@curiouslearning/gdl-player-core 1.1.0 → 1.2.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { Player } from './components/Player';
2
2
  export type { PlayerProps } from './components/Player';
3
+ export type { PlayerSource } from './lib/utils';
3
4
  export type { PlayerAnalytics } from './types/analytics';
4
5
  export type { FontDefinition } from './types/font';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./utils-Dm7P4Nnv.js";
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./utils-D1e5mIt_.js";
2
2
  //#region node_modules/swiper/shared/ssr-window.esm.mjs
3
3
  var c = /* @__PURE__ */ t(o(), 1);
4
4
  function l(e) {
@@ -5756,7 +5756,7 @@ var Jc = {
5756
5756
  style: tl,
5757
5757
  children: t
5758
5758
  });
5759
- }, rl = c.lazy(() => import("./dolottie-D6pmgIXi.js")), il = c.lazy(() => import("./Image-Bwx-qXJQ.js")), al = ({ item: t, screenScale: n, onMediaClick: r, ref: i }) => {
5759
+ }, rl = c.lazy(() => import("./dolottie-DSkJyF_U.js")), il = c.lazy(() => import("./Image-Dh6rF8NX.js")), al = ({ item: t, screenScale: n, onMediaClick: r, ref: i }) => {
5760
5760
  let { effect: a, mediaType: o } = t, [s, l] = (0, c.useState)(!1), [u, d] = (0, c.useState)(null), { bookId: f } = e(), p = (0, c.useCallback)(() => {
5761
5761
  u && !s && (l(!0), u.setFrame(0), u.play());
5762
5762
  }, [
@@ -6016,14 +6016,17 @@ var cl = c.memo(sl), ll = {
6016
6016
  "aria-hidden": "true",
6017
6017
  children: [p && /* @__PURE__ */ (0, I.jsx)(kn, { background: p }), P]
6018
6018
  });
6019
- }, fl = 1280, pl = 600, ml = fl / pl, hl = ({ id: e, analytics: t, fonts: i = [] }) => {
6020
- let [a, o] = (0, c.useState)(null), [s, l] = (0, c.useState)(null), [u, d] = (0, c.useState)(null), [f, p] = (0, c.useState)(null), m = cn(i, a?.language), h = ln(m), g = m[0]?.family || "Quicksand", _ = a?.illustration && a.illustration.path || a?.coverText && a.coverText !== "", v = a?.credits && a.credits?.text || a?.credits?.logos && a.credits?.logos.length > 0, [y, b] = (0, c.useState)({
6019
+ }, fl = 1280, pl = 600, ml = fl / pl, hl = ({ id: e, analytics: t, fonts: i = [], bookSource: a = {
6020
+ type: "static",
6021
+ staticFolder: "GDLBookContent"
6022
+ } }) => {
6023
+ let [o, s] = (0, c.useState)(null), [l, u] = (0, c.useState)(null), [d, f] = (0, c.useState)(null), [p, m] = (0, c.useState)(null), h = cn(i, o?.language), g = ln(h), _ = h[0]?.family || "Quicksand", v = o?.illustration && o.illustration.path || o?.coverText && o.coverText !== "", y = o?.credits && o.credits?.text || o?.credits?.logos && o.credits?.logos.length > 0, [b, x] = (0, c.useState)({
6021
6024
  width: 0,
6022
6025
  height: 0
6023
- }), { width: x, height: S } = y, C = a?.config.textDirection || "LTR", w = "production", T = "GDLBookContent";
6026
+ }), { width: S, height: C } = b, w = o?.config.textDirection || "LTR";
6024
6027
  (0, c.useEffect)(() => {
6025
6028
  let e = () => {
6026
- b({
6029
+ x({
6027
6030
  width: window.innerWidth,
6028
6031
  height: window.innerHeight
6029
6032
  });
@@ -6032,44 +6035,40 @@ var cl = c.memo(sl), ll = {
6032
6035
  window.removeEventListener("resize", e);
6033
6036
  };
6034
6037
  }, []);
6035
- let E = 100, D = {
6038
+ let T = 100, E = {
6036
6039
  width: fl,
6037
6040
  height: pl
6038
6041
  };
6039
- return (x < fl || S < pl) && (pl / S > fl / x ? (D = {
6040
- height: S,
6041
- width: S * ml
6042
- }, E = S / pl * 100) : (D = {
6043
- width: x,
6044
- height: x / ml
6045
- }, E = x / fl * 100)), (0, c.useEffect)(() => {
6046
- !a && e && (async (e) => {
6047
- let n = `/${T}/${e}/content.json`;
6042
+ return (S < fl || C < pl) && (pl / C > fl / S ? (E = {
6043
+ height: C,
6044
+ width: C * ml
6045
+ }, T = C / pl * 100) : (E = {
6046
+ width: S,
6047
+ height: S / ml
6048
+ }, T = S / fl * 100)), (0, c.useEffect)(() => {
6049
+ !o && e && (async (e) => {
6050
+ let n = a.type === "api" ? `${a.apiHost}/api/book?slug=${e}` : `/${a.staticFolder}/${e}/content.json`;
6048
6051
  try {
6049
6052
  let r = await fetch(n, { cache: "no-store" });
6050
6053
  if (!r.ok) throw Error(`Error fetching data for (${e}): ${r.status}`);
6051
6054
  let i = await r.json();
6052
- o(i), l(null), navigator.onLine && t?.onBookOpened && t.onBookOpened(i._id, i.title);
6055
+ s(i), u(null), navigator.onLine && t?.onBookOpened && t.onBookOpened(i._id, i.title);
6053
6056
  } catch (t) {
6054
- console.error(t), o(null), l(`Error fetching data for (${e}): ${t instanceof Error ? t.message : "Unknown error"}`);
6057
+ console.error(t), s(null), u(`Error fetching data for (${e}): ${t instanceof Error ? t.message : "Unknown error"}`);
6055
6058
  }
6056
6059
  })(e);
6057
- }, [e]), s ? /* @__PURE__ */ (0, I.jsxs)("p", {
6060
+ }, [e]), l ? /* @__PURE__ */ (0, I.jsxs)("p", {
6058
6061
  role: "alert",
6059
6062
  className: "player",
6060
- children: ["Error: ", s]
6061
- }) : !a || !e ? /* @__PURE__ */ (0, I.jsx)("p", {
6063
+ children: ["Error: ", l]
6064
+ }) : !o || !e ? /* @__PURE__ */ (0, I.jsx)("p", {
6062
6065
  role: "status",
6063
6066
  className: "player",
6064
6067
  children: "Loading..."
6065
- }) : /* @__PURE__ */ (0, I.jsxs)(I.Fragment, { children: [/* @__PURE__ */ (0, I.jsx)("style", { children: `:root, :host, .player { --player-font-family: '${sn(g)}'; }${h}${on}` }), /* @__PURE__ */ (0, I.jsx)(n, {
6066
- bookId: a._id,
6067
- slug: a.slug,
6068
- assetConfig: {
6069
- mode: w,
6070
- staticFolder: T,
6071
- assetsHost: ""
6072
- },
6068
+ }) : /* @__PURE__ */ (0, I.jsxs)(I.Fragment, { children: [/* @__PURE__ */ (0, I.jsx)("style", { children: `:root, :host, .player { --player-font-family: '${sn(_)}'; }${g}${on}` }), /* @__PURE__ */ (0, I.jsx)(n, {
6069
+ bookId: o._id,
6070
+ slug: o.slug,
6071
+ assetConfig: a,
6073
6072
  analytics: t,
6074
6073
  children: /* @__PURE__ */ (0, I.jsx)("div", {
6075
6074
  className: "player",
@@ -6077,92 +6076,88 @@ var cl = c.memo(sl), ll = {
6077
6076
  className: "view-box",
6078
6077
  children: /* @__PURE__ */ (0, I.jsxs)(en, {
6079
6078
  onSlideChange: (e) => {
6080
- d(e.activeIndex), a && (t?.onPageTurned && t.onPageTurned(a._id, e.activeIndex), e.isEnd && t?.onBookCompleted && t.onBookCompleted(a._id, a.title));
6079
+ f(e.activeIndex), o && (t?.onPageTurned && t.onPageTurned(o._id, e.activeIndex), e.isEnd && t?.onBookCompleted && t.onBookCompleted(o._id, o.title));
6081
6080
  },
6082
6081
  className: "mySwiper swiper-container",
6083
6082
  speed: 1200,
6084
- dir: C.toLowerCase() ?? "ltr",
6083
+ dir: w.toLowerCase() ?? "ltr",
6085
6084
  modules: [an],
6086
6085
  pagination: {
6087
6086
  clickable: !1,
6088
6087
  type: "progressbar"
6089
6088
  },
6090
6089
  onSwiper: (e) => {
6091
- p(e);
6090
+ m(e);
6092
6091
  },
6093
- style: { ...D },
6092
+ style: { ...E },
6094
6093
  a11y: {
6095
6094
  enabled: !0,
6096
6095
  prevSlideMessage: "Previous page",
6097
6096
  nextSlideMessage: "Next page"
6098
6097
  },
6099
6098
  children: [
6100
- _ && /* @__PURE__ */ (0, I.jsx)(tn, {
6099
+ v && /* @__PURE__ */ (0, I.jsx)(tn, {
6101
6100
  "data-hash": "cover",
6102
6101
  children: ({ isActive: e }) => /* @__PURE__ */ (0, I.jsxs)("div", {
6103
6102
  className: "cover-page",
6104
6103
  inert: e ? void 0 : !0,
6105
6104
  children: [/* @__PURE__ */ (0, I.jsx)("div", {
6106
6105
  className: "cover-illustration",
6107
- children: a.illustration?.path && /* @__PURE__ */ (0, I.jsx)("img", {
6106
+ children: o.illustration?.path && /* @__PURE__ */ (0, I.jsx)("img", {
6108
6107
  src: r({
6109
- bookId: a._id,
6110
- slug: a.slug,
6111
- assetConfig: {
6112
- mode: w,
6113
- staticFolder: T,
6114
- assetsHost: ""
6115
- }
6116
- }, a.illustration),
6117
- alt: a.title
6108
+ bookId: o._id,
6109
+ slug: o.slug,
6110
+ assetConfig: a
6111
+ }, o.illustration),
6112
+ alt: o.title
6118
6113
  })
6119
6114
  }), /* @__PURE__ */ (0, I.jsxs)("div", {
6120
6115
  className: "cover-text",
6121
- dir: C.toLowerCase() || "ltr",
6122
- children: [/* @__PURE__ */ (0, I.jsx)("h1", { children: a.title }), a.coverText && /* @__PURE__ */ (0, I.jsx)("small", { children: a.coverText })]
6116
+ dir: w.toLowerCase() || "ltr",
6117
+ children: [/* @__PURE__ */ (0, I.jsx)("h1", { children: o.title }), o.coverText && /* @__PURE__ */ (0, I.jsx)("small", { children: o.coverText })]
6123
6118
  })]
6124
6119
  })
6125
6120
  }),
6126
- a.body.map((e) => /* @__PURE__ */ (0, I.jsx)(tn, {
6121
+ o.body.map((e) => /* @__PURE__ */ (0, I.jsx)(tn, {
6127
6122
  className: "overflow-hidden",
6128
6123
  "data-hash": e._id,
6129
6124
  children: ({ isActive: t }) => /* @__PURE__ */ (0, I.jsx)(dl, {
6130
- screenScale: E,
6125
+ screenScale: T,
6131
6126
  page: e,
6132
6127
  isActive: t,
6133
- textDirection: C
6128
+ textDirection: w
6134
6129
  })
6135
6130
  }, e._id)),
6136
- v && /* @__PURE__ */ (0, I.jsx)(tn, {
6131
+ y && /* @__PURE__ */ (0, I.jsx)(tn, {
6137
6132
  "data-hash": "credits",
6138
6133
  children: ({ isActive: e }) => /* @__PURE__ */ (0, I.jsxs)("div", {
6139
6134
  className: "credits-page",
6140
6135
  inert: e ? void 0 : !0,
6141
6136
  children: [/* @__PURE__ */ (0, I.jsx)("div", {
6142
6137
  className: "credits-page-inner",
6143
- children: a.credits?.logos.map((e) => /* @__PURE__ */ (0, I.jsx)("div", {
6138
+ children: o.credits?.logos.map((e) => /* @__PURE__ */ (0, I.jsx)("div", {
6144
6139
  className: "logo-item",
6145
6140
  children: /* @__PURE__ */ (0, I.jsx)("img", {
6146
- src: `/${T}/${a.slug}/assets/${e}.jpg`,
6141
+ src: a.type === "api" ? `${a.assetsHost}/logos/${e}.jpg` : `/${a.staticFolder}/${o.slug}/assets/${e}.jpg`,
6147
6142
  alt: e
6148
6143
  })
6149
6144
  }, e))
6150
6145
  }), /* @__PURE__ */ (0, I.jsxs)("div", {
6151
6146
  className: "credits-page-bottom",
6152
- dir: C.toLowerCase() || "ltr",
6147
+ dir: w.toLowerCase() || "ltr",
6153
6148
  children: [/* @__PURE__ */ (0, I.jsxs)("h1", { children: [
6154
6149
  "\"",
6155
- a.title,
6150
+ o.title,
6156
6151
  "\" credits"
6157
- ] }), a.credits?.text && /* @__PURE__ */ (0, I.jsx)("small", { children: a.credits.text })]
6152
+ ] }), o.credits?.text && /* @__PURE__ */ (0, I.jsx)("small", { children: o.credits.text })]
6158
6153
  })]
6159
6154
  })
6160
6155
  }),
6161
- f && f.slides.length > 1 && /* @__PURE__ */ (0, I.jsx)(En, {
6162
- isFirst: f.isBeginning === !0,
6163
- isLast: f.isEnd === !0,
6164
- activeIndex: u,
6165
- textDirection: C
6156
+ p && p.slides.length > 1 && /* @__PURE__ */ (0, I.jsx)(En, {
6157
+ isFirst: p.isBeginning === !0,
6158
+ isLast: p.isEnd === !0,
6159
+ activeIndex: d,
6160
+ textDirection: w
6166
6161
  })
6167
6162
  ]
6168
6163
  })
@@ -1,9 +1,19 @@
1
1
  import type { BookContextType } from '../types/context';
2
- export type AssetConfig = {
3
- mode: 'development' | 'production';
4
- staticFolder: string;
2
+ /**
3
+ * Describes where the player should load book data and assets from. This is a
4
+ * runtime choice made by the consumer, not the library's build mode:
5
+ * - `api`: load from a backend/DB (library dev server, book builder).
6
+ * - `static`: load from a static folder (production player web component).
7
+ */
8
+ export type PlayerSource = {
9
+ type: 'api';
10
+ apiHost: string;
5
11
  assetsHost: string;
12
+ } | {
13
+ type: 'static';
14
+ staticFolder: string;
6
15
  };
16
+ export type AssetConfig = PlayerSource;
7
17
  export declare const getContextAssetPath: (context: BookContextType, asset: any, config?: AssetConfig) => string;
8
18
  export declare const getContextAudioPath: (context: BookContextType, audio: any) => string;
9
19
  export declare const delay: (ms: number) => Promise<void>;
@@ -1090,9 +1090,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1090
1090
  bookId: "",
1091
1091
  slug: "",
1092
1092
  assetConfig: {
1093
- mode: "development",
1094
- staticFolder: "",
1095
- assetsHost: ""
1093
+ type: "static",
1094
+ staticFolder: ""
1096
1095
  },
1097
1096
  analytics: void 0
1098
1097
  }), v = ({ bookId: e, slug: t, assetConfig: n, analytics: r, children: i }) => /* @__PURE__ */ (0, g.jsx)(_.Provider, {
@@ -1105,10 +1104,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1105
1104
  children: i
1106
1105
  }), y = () => (0, h.useContext)(_), b = (e, t, n) => {
1107
1106
  let r = n ?? e.assetConfig, i = (t?.path ?? t?.url ?? "").split("/").pop() || t?.filename || t?.name || "";
1108
- return r.mode === "development" ? `${r.assetsHost}${t?.path ?? t?.url ?? ""}` : `/${r.staticFolder}/${encodeURIComponent(e.slug)}/assets/${i}`;
1107
+ return r.type === "api" ? `${r.assetsHost}${t?.path ?? t?.url ?? ""}` : `/${r.staticFolder}/${encodeURIComponent(e.slug)}/assets/${i}`;
1109
1108
  }, x = (e, t) => {
1110
- let n = t?.path ?? t?.mp3 ?? "", r = n.split("/").pop() || t?.filename || t?.name || "";
1111
- return e.assetConfig.mode === "development" ? `${e.assetConfig.assetsHost}${n}` : `/${e.assetConfig.staticFolder}/${encodeURIComponent(e.slug)}/audio/${r}`;
1109
+ let n = e.assetConfig, r = t?.path ?? t?.mp3 ?? "", i = r.split("/").pop() || t?.filename || t?.name || "";
1110
+ return n.type === "api" ? `${n.assetsHost}${r}` : `/${n.staticFolder}/${encodeURIComponent(e.slug)}/audio/${i}`;
1112
1111
  }, S = (e) => new Promise((t) => {
1113
1112
  setTimeout(t, e);
1114
1113
  });
@@ -15,4 +15,4 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
15
15
  <%s {...props} />
16
16
  React keys must be passed directly to JSX without using spread:
17
17
  let props = %s;
18
- <%s key={someKey} {...props} />`,o,f,m,f),R[f+o]=!0)}if(f=null,i!==void 0&&(r(i),f=``+i),s(n)&&(r(n.key),f=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return f&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,f,i,a(),l,d)}function p(e){m(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===D&&(e._payload.status===`fulfilled`?m(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function m(e){return typeof e==`object`&&!!e&&e.$$typeof===g}var h=d(),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.client.reference`),A=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=Object.prototype.hasOwnProperty,M=Array.isArray,N=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(e){return e()}};var P,F={},I=h.react_stack_bottom_frame.bind(h,o)(),L=N(i(o)),R={};e.Fragment=v,e.jsx=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;return f(e,t,n,!1,r?Error(`react-stack-top-frame`):I,r?N(i(e)):L)},e.jsxs=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;return f(e,t,n,!0,r?Error(`react-stack-top-frame`):I,r?N(i(e)):L)}})()})),m=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=f():t.exports=p()})),h=c(d(),1),g=m(),_=h.createContext({bookId:``,slug:``,assetConfig:{mode:`development`,staticFolder:``,assetsHost:``},analytics:void 0}),v=({bookId:e,slug:t,assetConfig:n,analytics:r,children:i})=>(0,g.jsx)(_.Provider,{value:{bookId:e,slug:t,assetConfig:n,analytics:r},children:i}),y=()=>(0,h.useContext)(_),b=(e,t,n)=>{let r=n??e.assetConfig,i=(t?.path??t?.url??``).split(`/`).pop()||t?.filename||t?.name||``;return r.mode===`development`?`${r.assetsHost}${t?.path??t?.url??``}`:`/${r.staticFolder}/${encodeURIComponent(e.slug)}/assets/${i}`},x=(e,t)=>{let n=t?.path??t?.mp3??``,r=n.split(`/`).pop()||t?.filename||t?.name||``;return e.assetConfig.mode===`development`?`${e.assetConfig.assetsHost}${n}`:`/${e.assetConfig.staticFolder}/${encodeURIComponent(e.slug)}/audio/${r}`},S=e=>new Promise(t=>{setTimeout(t,e)});Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return S}});
18
+ <%s key={someKey} {...props} />`,o,f,m,f),R[f+o]=!0)}if(f=null,i!==void 0&&(r(i),f=``+i),s(n)&&(r(n.key),f=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return f&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,f,i,a(),l,d)}function p(e){m(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===D&&(e._payload.status===`fulfilled`?m(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function m(e){return typeof e==`object`&&!!e&&e.$$typeof===g}var h=d(),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.client.reference`),A=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=Object.prototype.hasOwnProperty,M=Array.isArray,N=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(e){return e()}};var P,F={},I=h.react_stack_bottom_frame.bind(h,o)(),L=N(i(o)),R={};e.Fragment=v,e.jsx=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;return f(e,t,n,!1,r?Error(`react-stack-top-frame`):I,r?N(i(e)):L)},e.jsxs=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;return f(e,t,n,!0,r?Error(`react-stack-top-frame`):I,r?N(i(e)):L)}})()})),m=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=f():t.exports=p()})),h=c(d(),1),g=m(),_=h.createContext({bookId:``,slug:``,assetConfig:{type:`static`,staticFolder:``},analytics:void 0}),v=({bookId:e,slug:t,assetConfig:n,analytics:r,children:i})=>(0,g.jsx)(_.Provider,{value:{bookId:e,slug:t,assetConfig:n,analytics:r},children:i}),y=()=>(0,h.useContext)(_),b=(e,t,n)=>{let r=n??e.assetConfig,i=(t?.path??t?.url??``).split(`/`).pop()||t?.filename||t?.name||``;return r.type===`api`?`${r.assetsHost}${t?.path??t?.url??``}`:`/${r.staticFolder}/${encodeURIComponent(e.slug)}/assets/${i}`},x=(e,t)=>{let n=e.assetConfig,r=t?.path??t?.mp3??``,i=r.split(`/`).pop()||t?.filename||t?.name||``;return n.type===`api`?`${n.assetsHost}${r}`:`/${n.staticFolder}/${encodeURIComponent(e.slug)}/audio/${i}`},S=e=>new Promise(t=>{setTimeout(t,e)});Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return S}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curiouslearning/gdl-player-core",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Package containing the core player components for the GDL interactive books",
5
5
  "homepage": "https://github.com/curiouslearning/gdl-player-core#readme",
6
6
  "bugs": {
@@ -35,12 +35,17 @@
35
35
  "typecheck": "tsc --noEmit",
36
36
  "ci:verify": "npm run typecheck && npm run build",
37
37
  "prepublishOnly": "npm run build",
38
- "test": "npm run typecheck"
38
+ "test": "npm run typecheck",
39
+ "dev": "vite --config vite.dev.config.ts"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@types/node": "^25.9.2",
42
43
  "@types/react": "^19.2.17",
44
+ "@types/react-dom": "^19.2.3",
45
+ "react": "^19.0.0",
46
+ "react-dom": "^19.0.0",
43
47
  "sass-embedded": "^1.100.0",
48
+ "swiper": "^12.0.0",
44
49
  "typescript": "^6.0.3",
45
50
  "vite": "^8.0.16"
46
51
  },