@geekapps/silo-elements-nextjs 0.2.34 → 0.2.36

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.
@@ -1203,36 +1203,39 @@ function parseVideoChildren(children) {
1203
1203
  sources: [],
1204
1204
  subtitles: []
1205
1205
  };
1206
- function isType(child, fn) {
1207
- if (child.type === fn) return true;
1208
- return child.type?.displayName === fn.displayName && !!fn.displayName;
1206
+ function dn(child) {
1207
+ return child.type?.displayName ?? child.type?.name ?? "";
1209
1208
  }
1210
1209
  React.Children.forEach(children, (child) => {
1211
1210
  if (!React.isValidElement(child)) return;
1212
- if (isType(child, Sources)) {
1211
+ const name = dn(child);
1212
+ if (child.type === Sources || name === "SiloSources") {
1213
1213
  const element = child;
1214
1214
  React.Children.forEach(element.props.children, (sourceChild) => {
1215
1215
  if (!React.isValidElement(sourceChild)) return;
1216
- if (!isType(sourceChild, Source)) return;
1216
+ const sn = dn(sourceChild);
1217
+ if (sourceChild.type !== Source && sn !== "SiloSource") return;
1217
1218
  const sourceElement = sourceChild;
1218
1219
  parsed.sources.push(sourceElement.props);
1219
1220
  });
1220
1221
  }
1221
- if (isType(child, Subtitles)) {
1222
+ if (child.type === Subtitles || name === "SiloSubtitles") {
1222
1223
  const element = child;
1223
1224
  React.Children.forEach(element.props.children, (subtitleChild) => {
1224
1225
  if (!React.isValidElement(subtitleChild)) return;
1225
- if (!isType(subtitleChild, Subtitle)) return;
1226
+ const sn = dn(subtitleChild);
1227
+ if (subtitleChild.type !== Subtitle && sn !== "SiloSubtitle") return;
1226
1228
  const subtitleElement = subtitleChild;
1227
1229
  parsed.subtitles.push(subtitleElement.props);
1228
1230
  });
1229
1231
  }
1230
- if (isType(child, Storyboard)) {
1232
+ if (child.type === Storyboard || name === "SiloStoryboard") {
1231
1233
  const element = child;
1232
1234
  const frames = [];
1233
1235
  React.Children.forEach(element.props.children, (frameChild) => {
1234
1236
  if (!React.isValidElement(frameChild)) return;
1235
- if (!isType(frameChild, StoryboardFrame)) return;
1237
+ const fn2 = dn(frameChild);
1238
+ if (frameChild.type !== StoryboardFrame && fn2 !== "SiloStoryboardFrame") return;
1236
1239
  const frameElement = frameChild;
1237
1240
  frames.push(frameElement.props);
1238
1241
  });