@skooldev/skool-stream-layout 1.0.0 → 1.0.2

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.cjs.js CHANGED
@@ -1,2 +1,92 @@
1
- /*! For license information please see index.cjs.js.LICENSE.txt */
2
- (()=>{"use strict";var e={56:(e,t,r)=>{e.exports=function(e){var t=r.nc;t&&e.setAttribute("nonce",t)}},72:e=>{var t=[];function r(e){for(var r=-1,o=0;o<t.length;o++)if(t[o].identifier===e){r=o;break}return r}function o(e,o){for(var i={},n=[],s=0;s<e.length;s++){var c=e[s],l=o.base?c[0]+o.base:c[0],d=i[l]||0,p="".concat(l," ").concat(d);i[l]=d+1;var u=r(p),v={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==u)t[u].references++,t[u].updater(v);else{var f=a(v,o);o.byIndex=s,t.splice(s,0,{identifier:p,updater:f,references:1})}n.push(p)}return n}function a(e,t){var r=t.domAPI(t);return r.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;r.update(e=t)}else r.remove()}}e.exports=function(e,a){var i=o(e=e||[],a=a||{});return function(e){e=e||[];for(var n=0;n<i.length;n++){var s=r(i[n]);t[s].references--}for(var c=o(e,a),l=0;l<i.length;l++){var d=r(i[l]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}i=c}}},100:(e,t,r)=>{r.d(t,{A:()=>s});var o=r(601),a=r.n(o),i=r(314),n=r.n(i)()(a());n.push([e.id,'.skool-stream-layout{background-color:#131314;color:#fff}.skool-stream-layout .str-video__paginated-grid-layout{padding-top:16px}.skool-stream-layout .str-video__paginated-grid-layout .str-video__paginated-grid-layout__group{padding-inline:16px 0}.skool-stream-layout .str-chat__channel .str-chat__container{flex-direction:column}.skool-stream-layout .str-video__speaker-layout .str-video__speaker-layout__participants-bar-wrapper .str-video__speaker-layout__participants-bar .str-video__speaker-layout__participant-tile{min-width:215px}.skool-stream-layout .str-video__participant-view--speaking{outline:2px solid #f1d07c}.skool-stream-layout .str-video__video-placeholder .str-video__video-placeholder__avatar{width:auto;height:88px;max-height:40%;aspect-ratio:1}.skool-stream-layout .str-video__video-placeholder{background:#343537}.skool-stream-layout .str-video__paginated-grid-layout__wrapper .str-video__video{aspect-ratio:4/3}.skool-stream-layout .str-video__paginated-grid-layout__wrapper .str-video__participant-view--no-video .str-video__video-placeholder{aspect-ratio:4/3;position:unset !important}.skool-stream-layout .str-video__paginated-grid-layout__wrapper .str-video__participant-view{aspect-ratio:unset}.skool-stream-layout .str-video__video.str-video__video--screen-share{object-fit:contain}.participant-label{font-family:"Roboto","Helvetica","Arial",sans-serif;font-weight:normal;font-style:normal;font-size:14;line-height:1.5;position:absolute;bottom:8px;left:8px;display:flex;align-items:center;gap:4px;border-radius:8px;background:rgba(19,19,20,.66);padding:4px 8px;color:#fff}.mute-icon{width:1rem;height:1rem;mask-size:1rem;-webkit-mask-size:1rem;background-color:var(--str-video__text-color1);mask-image:var(--str-video__icon--mic-off);-webkit-mask-image:var(--str-video__icon--mic-off)}.pin-icon{width:1rem;height:1rem;mask-size:1rem;-webkit-mask-size:1rem;background-color:var(--str-video__text-color1);mask-image:var(--str-video__icon--pin);-webkit-mask-image:var(--str-video__icon--pin)}',""]);const s=n},113:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},314:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var r="",o=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),o&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),o&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r}).join("")},t.i=function(e,r,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var n={};if(o)for(var s=0;s<this.length;s++){var c=this[s][0];null!=c&&(n[c]=!0)}for(var l=0;l<e.length;l++){var d=[].concat(e[l]);o&&n[d[0]]||(void 0!==i&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=i),r&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=r):d[2]=r),a&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=a):d[4]="".concat(a)),t.push(d))}},t}},540:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},601:e=>{e.exports=function(e){return e[1]}},659:e=>{var t={};e.exports=function(e,r){var o=function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(r)}},698:(e,t)=>{var r=Symbol.for("react.transitional.element");function o(e,t,o){var a=null;if(void 0!==o&&(a=""+o),void 0!==t.key&&(a=""+t.key),"key"in t)for(var i in o={},t)"key"!==i&&(o[i]=t[i]);else o=t;return t=o.ref,{$$typeof:r,type:e,key:a,ref:void 0!==t?t:null,props:o}}Symbol.for("react.fragment"),t.jsx=o,t.jsxs=o},825:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(r){!function(e,t,r){var o="";r.supports&&(o+="@supports (".concat(r.supports,") {")),r.media&&(o+="@media ".concat(r.media," {"));var a=void 0!==r.layer;a&&(o+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),o+=r.css,a&&(o+="}"),r.media&&(o+="}"),r.supports&&(o+="}");var i=r.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,r)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},848:(e,t,r)=>{e.exports=r(698)}},t={};function r(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nc=void 0;var o={};r.r(o),r.d(o,{SkoolStreamLayout:()=>b});var a=r(848);const i=require("react"),n=require("@stream-io/video-react-sdk");var s=r(72),c=r.n(s),l=r(825),d=r.n(l),p=r(659),u=r.n(p),v=r(56),f=r.n(v),m=r(540),_=r.n(m),y=r(113),h=r.n(y),g=r(100),k={};k.styleTagTransform=h(),k.setAttributes=f(),k.insert=u().bind(null,"head"),k.domAPI=d(),k.insertStyleElement=_(),c()(g.A,k),g.A&&g.A.locals&&g.A.locals;const x=()=>{const e=null===n.useParticipantViewContext||void 0===n.useParticipantViewContext?void 0:(0,n.useParticipantViewContext)(),{participant:t}=e,r=(0,i.useMemo)(()=>{var e;return!!(null===(e=t.pausedTracks)||void 0===e?void 0:e.includes(n.SfuModels.TrackType.VIDEO))},[t]);return(0,a.jsxs)("div",{className:"participant-label",children:[(0,a.jsx)("span",{children:t.name}),!(0,n.hasAudio)(t)&&(0,a.jsx)("span",{className:"mute-icon"}),(0,n.isPinned)(t)&&(0,a.jsx)("span",{className:"pin-icon"}),r&&(0,a.jsx)(n.Icon,{icon:"low-bandwidth"})]})},b=(0,i.memo)(()=>{const e=(0,n.useCall)(),{useParticipants:t,useHasOngoingScreenShare:r}=(0,n.useCallStateHooks)(),o=t(),s=r(),c="livestream"===(null==e?void 0:e.type),l=(0,i.useMemo)(()=>!!o.find(e=>(0,n.isPinned)(e)),[o]),d=(0,i.useMemo)(()=>{const e=c?{$or:[{hasVideo:!0},{hasScreenShare:!0}]}:void 0;return s||o.length>2&&l?(0,a.jsx)(n.SpeakerLayout,{ParticipantViewUIBar:x,ParticipantViewUISpotlight:x,filterParticipants:e}):(0,a.jsx)(n.PaginatedGridLayout,{groupSize:12,ParticipantViewUI:x,filterParticipants:e})},[s,o,l,c]);return(0,a.jsx)("div",{className:"skool-stream-layout",children:d})});module.exports=o})();
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ // The require scope
4
+ /******/ var __webpack_require__ = {};
5
+ /******/
6
+ /************************************************************************/
7
+ /******/ /* webpack/runtime/define property getters */
8
+ /******/ (() => {
9
+ /******/ // define getter functions for harmony exports
10
+ /******/ __webpack_require__.d = (exports, definition) => {
11
+ /******/ for(var key in definition) {
12
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
13
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
14
+ /******/ }
15
+ /******/ }
16
+ /******/ };
17
+ /******/ })();
18
+ /******/
19
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
20
+ /******/ (() => {
21
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
22
+ /******/ })();
23
+ /******/
24
+ /******/ /* webpack/runtime/make namespace object */
25
+ /******/ (() => {
26
+ /******/ // define __esModule on exports
27
+ /******/ __webpack_require__.r = (exports) => {
28
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
29
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
30
+ /******/ }
31
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
32
+ /******/ };
33
+ /******/ })();
34
+ /******/
35
+ /************************************************************************/
36
+ var __webpack_exports__ = {};
37
+ // ESM COMPAT FLAG
38
+ __webpack_require__.r(__webpack_exports__);
39
+
40
+ // EXPORTS
41
+ __webpack_require__.d(__webpack_exports__, {
42
+ SkoolStreamLayout: () => (/* binding */ SkoolStreamLayout)
43
+ });
44
+
45
+ ;// external "react/jsx-runtime"
46
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
47
+ ;// external "react"
48
+ const external_react_namespaceObject = require("react");
49
+ ;// external "@stream-io/video-react-sdk"
50
+ const video_react_sdk_namespaceObject = require("@stream-io/video-react-sdk");
51
+ ;// ./src/index.tsx
52
+
53
+
54
+
55
+ let numParticipantsInView = 0;
56
+ const CustomParticipantViewUI = () => {
57
+ const context = (0,video_react_sdk_namespaceObject.useParticipantViewContext)();
58
+ const { participant } = context;
59
+ (0,external_react_namespaceObject.useLayoutEffect)(() => {
60
+ numParticipantsInView++;
61
+ return () => {
62
+ numParticipantsInView--;
63
+ };
64
+ }, []);
65
+ const hasPausedVideo = (0,external_react_namespaceObject.useMemo)(() => { var _a; return !!((_a = participant.pausedTracks) === null || _a === void 0 ? void 0 : _a.includes(video_react_sdk_namespaceObject.SfuModels.TrackType.VIDEO)); }, [participant]);
66
+ return ((0,jsx_runtime_namespaceObject.jsxs)("div", { className: "participant-label", children: [(0,jsx_runtime_namespaceObject.jsx)("span", { children: participant.name }), !(0,video_react_sdk_namespaceObject.hasAudio)(participant) && (0,jsx_runtime_namespaceObject.jsx)("span", { className: "mute-icon" }), (0,video_react_sdk_namespaceObject.isPinned)(participant) && (0,jsx_runtime_namespaceObject.jsx)("span", { className: "pin-icon" }), hasPausedVideo && (0,jsx_runtime_namespaceObject.jsx)(video_react_sdk_namespaceObject.Icon, { icon: "low-bandwidth" })] }));
67
+ };
68
+ const SkoolStreamLayoutComponent = () => {
69
+ const call = (0,video_react_sdk_namespaceObject.useCall)();
70
+ const { useParticipants, useHasOngoingScreenShare } = (0,video_react_sdk_namespaceObject.useCallStateHooks)();
71
+ const participants = useParticipants();
72
+ const hasOngoingScreenshare = useHasOngoingScreenShare();
73
+ const isWebinar = (call === null || call === void 0 ? void 0 : call.type) === "livestream";
74
+ const hasPinnedParticipant = (0,external_react_namespaceObject.useMemo)(() => !!participants.find((participant) => (0,video_react_sdk_namespaceObject.isPinned)(participant)), [participants]);
75
+ const mainLayout = (0,external_react_namespaceObject.useMemo)(() => {
76
+ const participantsFilter = isWebinar
77
+ ? {
78
+ $or: [{ hasVideo: true }, { hasScreenShare: true }],
79
+ }
80
+ : undefined;
81
+ if (hasOngoingScreenshare || (participants.length > 2 && hasPinnedParticipant)) {
82
+ return ((0,jsx_runtime_namespaceObject.jsx)(video_react_sdk_namespaceObject.SpeakerLayout, { ParticipantViewUIBar: CustomParticipantViewUI, ParticipantViewUISpotlight: CustomParticipantViewUI, filterParticipants: participantsFilter }));
83
+ }
84
+ return ((0,jsx_runtime_namespaceObject.jsx)(video_react_sdk_namespaceObject.PaginatedGridLayout, { groupSize: 12, ParticipantViewUI: CustomParticipantViewUI, filterParticipants: participantsFilter }));
85
+ }, [hasOngoingScreenshare, participants, hasPinnedParticipant, isWebinar]);
86
+ return ((0,jsx_runtime_namespaceObject.jsx)("div", { "data-participants": numParticipantsInView, className: "skool-stream-layout", children: mainLayout }));
87
+ };
88
+ const SkoolStreamLayout = (0,external_react_namespaceObject.memo)(SkoolStreamLayoutComponent);
89
+
90
+ module.exports = __webpack_exports__;
91
+ /******/ })()
92
+ ;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  import React from "react";
2
- import "./styles.scss";
3
2
  export declare const SkoolStreamLayout: React.MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@skooldev/skool-stream-layout",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Skool Stream Layout",
5
5
  "main": "dist/index.cjs.js",
6
- "module": "dist/index.esm.js",
7
6
  "types": "dist/index.d.ts",
8
7
  "files": [
9
8
  "dist"
10
9
  ],
11
10
  "scripts": {
12
11
  "build": "webpack --mode production",
12
+ "prepack": "webpack --mode production",
13
13
  "prepublishOnly": "npm run build"
14
14
  },
15
15
  "peerDependencies": {
16
+ "@stream-io/video-react-sdk": "^1.25.0",
16
17
  "react": "^17 || ^18 || ^19",
17
18
  "react-dom": "^17 || ^18 || ^19"
18
19
  },
@@ -33,7 +34,6 @@
33
34
  "react-dom": "19.1.0",
34
35
  "sass": "^1.80.0",
35
36
  "sass-loader": "^13.3.2",
36
- "style-loader": "^3.3.4",
37
37
  "ts-loader": "^9.5.1",
38
38
  "typescript": "^5.6.3",
39
39
  "webpack": "^5.95.0",
@@ -43,8 +43,5 @@
43
43
  "type": "git",
44
44
  "url": "https://github.com/skooldev/skool-stream-layout"
45
45
  },
46
- "publishConfig": {
47
- "access": "restricted"
48
- },
49
46
  "author": "Skool Dev Team"
50
47
  }
@@ -1,9 +0,0 @@
1
- /**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */