@geekapps/silo-elements-nextjs 0.2.33 → 0.2.34

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.js CHANGED
@@ -1212,21 +1212,27 @@ var PLAYBACK_SPEEDS = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 2];
1212
1212
  function Sources(_props) {
1213
1213
  return null;
1214
1214
  }
1215
+ Sources.displayName = "SiloSources";
1215
1216
  function Source(_props) {
1216
1217
  return null;
1217
1218
  }
1219
+ Source.displayName = "SiloSource";
1218
1220
  function Subtitles(_props) {
1219
1221
  return null;
1220
1222
  }
1223
+ Subtitles.displayName = "SiloSubtitles";
1221
1224
  function Subtitle(_props) {
1222
1225
  return null;
1223
1226
  }
1227
+ Subtitle.displayName = "SiloSubtitle";
1224
1228
  function Storyboard(_props) {
1225
1229
  return null;
1226
1230
  }
1231
+ Storyboard.displayName = "SiloStoryboard";
1227
1232
  function StoryboardFrame(_props) {
1228
1233
  return null;
1229
1234
  }
1235
+ StoryboardFrame.displayName = "SiloStoryboardFrame";
1230
1236
  function Video({
1231
1237
  title,
1232
1238
  description,
@@ -2397,32 +2403,36 @@ function parseVideoChildren(children) {
2397
2403
  sources: [],
2398
2404
  subtitles: []
2399
2405
  };
2406
+ function isType(child, fn) {
2407
+ if (child.type === fn) return true;
2408
+ return child.type?.displayName === fn.displayName && !!fn.displayName;
2409
+ }
2400
2410
  React.Children.forEach(children, (child) => {
2401
2411
  if (!React.isValidElement(child)) return;
2402
- if (child.type === Sources) {
2412
+ if (isType(child, Sources)) {
2403
2413
  const element = child;
2404
2414
  React.Children.forEach(element.props.children, (sourceChild) => {
2405
2415
  if (!React.isValidElement(sourceChild)) return;
2406
- if (sourceChild.type !== Source) return;
2416
+ if (!isType(sourceChild, Source)) return;
2407
2417
  const sourceElement = sourceChild;
2408
2418
  parsed.sources.push(sourceElement.props);
2409
2419
  });
2410
2420
  }
2411
- if (child.type === Subtitles) {
2421
+ if (isType(child, Subtitles)) {
2412
2422
  const element = child;
2413
2423
  React.Children.forEach(element.props.children, (subtitleChild) => {
2414
2424
  if (!React.isValidElement(subtitleChild)) return;
2415
- if (subtitleChild.type !== Subtitle) return;
2425
+ if (!isType(subtitleChild, Subtitle)) return;
2416
2426
  const subtitleElement = subtitleChild;
2417
2427
  parsed.subtitles.push(subtitleElement.props);
2418
2428
  });
2419
2429
  }
2420
- if (child.type === Storyboard) {
2430
+ if (isType(child, Storyboard)) {
2421
2431
  const element = child;
2422
2432
  const frames = [];
2423
2433
  React.Children.forEach(element.props.children, (frameChild) => {
2424
2434
  if (!React.isValidElement(frameChild)) return;
2425
- if (frameChild.type !== StoryboardFrame) return;
2435
+ if (!isType(frameChild, StoryboardFrame)) return;
2426
2436
  const frameElement = frameChild;
2427
2437
  frames.push(frameElement.props);
2428
2438
  });