Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4fea3a8
WIP: Components
hudbuddy Oct 28, 2022
9c59e46
Add child methods to component context
hudbuddy Oct 30, 2022
eaf10bb
Fix childComponent updates
hudbuddy Oct 31, 2022
3d43249
Add local flag for sources
hudbuddy Oct 31, 2022
f0ef743
Clean up compositor interface
hudbuddy Oct 31, 2022
e5013f6
Add SourceList
hudbuddy Oct 31, 2022
e2dd2e1
Add child methods to wrapped TransformNode
hudbuddy Nov 1, 2022
8c4c1a8
Convert component children to single array
hudbuddy Nov 3, 2022
d9bfd11
Remove unused render param
hudbuddy Nov 3, 2022
5fcc0d9
Move background to Project component
hudbuddy Nov 4, 2022
4d846f0
Add banner to Project
hudbuddy Nov 4, 2022
7b4fa46
Add node keys for debugging
hudbuddy Nov 8, 2022
407cefc
Add a compositor-only demo entrypoint
hudbuddy Nov 10, 2022
11f4d3a
Update rendering logic
hudbuddy Nov 10, 2022
074cf3b
Update imports in example
hudbuddy Nov 10, 2022
7633cb9
Clean up renderer interactions
hudbuddy Nov 10, 2022
b260a03
Update html-layouts
hudbuddy Nov 14, 2022
a4de5d8
Fix renderer drag/drop outlines
hudbuddy Nov 14, 2022
93b773f
Clean up renderer
hudbuddy Nov 14, 2022
cd56190
Prevent deletion unless dropped off canvas
hudbuddy Nov 14, 2022
376dc1a
Clean up child element listeners
hudbuddy Nov 15, 2022
b99e34a
Update transition logic
hudbuddy Nov 15, 2022
d891601
Clean up virtual renderer logic
hudbuddy Nov 16, 2022
1a55f07
Fix layout node reinsertion logic
hudbuddy Nov 16, 2022
a1b4eef
Create virtual node index
hudbuddy Nov 16, 2022
cdfe922
Add transitions to layout props
hudbuddy Nov 16, 2022
ee0b537
Update missing headers
hudbuddy Nov 17, 2022
ce83dbc
Fix non-component virtual nodes
hudbuddy Nov 17, 2022
3f4e91b
Disregard position for nodes in removed slots
hudbuddy Nov 20, 2022
f113685
Add controls to compositor example
hudbuddy Nov 21, 2022
264a539
Add node JSON editor
hudbuddy Nov 21, 2022
2833bba
Update compositor view
hudbuddy Nov 21, 2022
8ba70a2
Add copy+paste to compositor
hudbuddy Nov 22, 2022
8f0b505
Fix project create
hudbuddy Nov 22, 2022
3cd35c0
Debounce render and event listeners
hudbuddy Nov 22, 2022
0678ef6
Update layout controls
hudbuddy Nov 22, 2022
8e3e00a
Update project getters
hudbuddy Nov 23, 2022
e78784f
Fix absolute positioning
hudbuddy Nov 20, 2022
f0083c3
Fix absolute layouts
hudbuddy Nov 26, 2022
7c67cd1
Remove componentChildren
hudbuddy Nov 28, 2022
2c437f0
WIP: Backup
hudbuddy Dec 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .babelrc
100644 → 100755
Empty file.
Empty file modified .github/workflows/check-license.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/deploy-docs.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/deploy-renderer.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/publish.yml
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ types
dist-ssr
db
log.txt
*.TODO
*.local
docs/
.npmrc
Expand Down
Empty file modified .npmignore
100644 → 100755
Empty file.
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tabWidth: 2
semi: false
singleQuote: true
trailingComma: all
jsxSelfClosing: false
7 changes: 0 additions & 7 deletions .prettierrc.json

This file was deleted.

Empty file modified LICENSE.txt
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified build/LICENSE.header-formatted.txt
100644 → 100755
Empty file.
Empty file modified build/LICENSE.header.txt
100644 → 100755
Empty file.
Empty file modified build/hosted-renderer/README.md
100644 → 100755
Empty file.
Empty file modified build/hosted-renderer/directory-to-kv.js
100644 → 100755
Empty file.
Empty file modified build/hosted-renderer/package-lock.json
100644 → 100755
Empty file.
Empty file modified build/hosted-renderer/package.json
100644 → 100755
Empty file.
Empty file modified build/hosted-renderer/src/index.ts
100644 → 100755
Empty file.
Empty file modified build/hosted-renderer/tsconfig.json
100644 → 100755
Empty file.
Empty file modified build/hosted-renderer/wrangler.toml
100644 → 100755
Empty file.
Empty file modified build/license-header.json
100644 → 100755
Empty file.
Empty file modified config.ts
100644 → 100755
Empty file.
Empty file modified docs.css
100644 → 100755
Empty file.
Empty file modified examples/studio-kit-demo/.babelrc
100644 → 100755
Empty file.
Empty file modified examples/studio-kit-demo/.gitignore
100644 → 100755
Empty file.
Empty file modified examples/studio-kit-demo/.prettierrc.json
100644 → 100755
Empty file.
Empty file modified examples/studio-kit-demo/Font.ttf
100644 → 100755
Empty file.
Empty file modified examples/studio-kit-demo/README.md
100644 → 100755
Empty file.
19 changes: 19 additions & 0 deletions examples/studio-kit-demo/compositor/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
---------------------------------------------------------------------------------------------
Copyright (c) Infiniscene, Inc. All rights reserved.
Licensed under the MIT License. See License.txt in the project root for license information.
---------------------------------------------------------------------------------------------
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/ico" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Studio Kit Demo - Compositor</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/compositor/Compositor.tsx"></script>
</body>
</html>
3 changes: 3 additions & 0 deletions examples/studio-kit-demo/config.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type Config = {
env: 'stage' | 'prod'
logLevel: 'Debug' | 'Info' | 'Warn' | 'Error'
recaptchaKey: string
[prop: string]: any
}

const LOCAL_ENV: Config['env'] = 'stage'
Expand All @@ -14,4 +15,6 @@ export default {
env: location.hostname === 'live.api.stream' ? 'prod' : LOCAL_ENV,
logLevel: 'Debug',
recaptchaKey: '6Lc0HIUfAAAAAIdsyq7vB_3c3skiVvltzdUTCUSx',
liveblocksKey:
'pk_dev_yf1qXf_yTDHhEcKr1sdtPnOHYGJeEhgL4x8LwaC1bPQeMC2cazP5RYFUJq7sRcTe',
} as Config
Empty file modified examples/studio-kit-demo/favicon.ico
100644 → 100755
Empty file.
Empty file modified examples/studio-kit-demo/guest/index.html
100644 → 100755
Empty file.
Empty file modified examples/studio-kit-demo/index.html
100644 → 100755
Empty file.
Empty file modified examples/studio-kit-demo/logo.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion examples/studio-kit-demo/package.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,26 @@
},
"dependencies": {
"@api.stream/studio-kit": "file:../../",
"@liveblocks/client": "^0.19.1",
"@liveblocks/react": "^0.19.0",
"axios": "^0.26.1",
"install": "^0.13.0",
"jsoneditor": "^9.9.2",
"jsoneditor-react": "^3.1.2",
"nanoid": "^3.3.3",
"npm": "^9.1.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-google-recaptcha": "^2.1.0"
"react-google-recaptcha": "^2.1.0",
"react-json-editor-ajrm": "^2.5.13"
},
"devDependencies": {
"@rollup/plugin-babel": "^5.3.0",
"@types/node": "^16.11.7",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-google-recaptcha": "^2.1.5",
"@types/react-json-editor-ajrm": "^2.5.3",
"@vitejs/plugin-react": "1.0.8",
"babel-plugin-wildcard": "^7.0.0",
"csstype": "^3.0.8",
Expand Down
Empty file modified examples/studio-kit-demo/public/bg.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions examples/studio-kit-demo/src/components/MultiScene.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/* ---------------------------------------------------------------------------------------------
* Copyright (c) Infiniscene, Inc. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* -------------------------------------------------------------------------------------------- */
import React, { useEffect, useRef, useState } from 'react'
import { Components, Sources, SDK, Compositor } from '@api.stream/studio-kit'
import { Column, Flex, Row } from '../ui/Box'
import { Component } from '.'
import { ScenelessProps } from './Sceneless'
import { SourceList } from '../shared/sources'

export type MultiSceneInterface = Components.MultiScene.Interface

export const SceneList = ({
component,
}: {
component: MultiSceneInterface
}) => {
const activeScene = component.getChild(component.props.activeSceneId)

return (
<Column>
<Row>
{component.children.map((x) => (
<Flex
key={x.id}
width={50}
height={50}
style={{
cursor: 'pointer',
background:
component.props.activeSceneId === x.id
? 'rgba(255,255,255,0.5)'
: 'rgba(255,255,255,0.1)',
}}
onClick={(e) => {
component.execute.setActiveScene(x.id)
}}
/>
))}
<button onClick={(e) => component.addChildComponent('Sceneless', {})}>
Add scene
</button>
</Row>
<Row>
{activeScene && (
<Column>
<div>Scene ID: {activeScene.id}</div>
<Component component={activeScene} />
</Column>
)}
</Row>
</Column>
)
}

export const MultiSceneComponent = ({
component,
}: {
component: MultiSceneInterface
}) => {
return (
<Column>
<SceneList component={component} />
</Column>
)
}
58 changes: 58 additions & 0 deletions examples/studio-kit-demo/src/components/Sceneless.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/* ---------------------------------------------------------------------------------------------
* Copyright (c) Infiniscene, Inc. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* -------------------------------------------------------------------------------------------- */
import React, { useEffect, useRef, useState } from 'react'
import { Components, Sources } from '@api.stream/studio-kit'
import { Column, Flex } from '../ui/Box'
import { BackgroundSelect, BannerSelect, SourceList } from '../shared/sources'
import { Layout } from '../shared/props'

export type ScenelessInterface = Components.Sceneless.Interface
export type ScenelessProps = Components.Sceneless.Props

const overlays = [
{
id: '123',
url: 'https://www.pngmart.com/files/12/Twitch-Stream-Overlay-PNG-Transparent-Picture.png',
},
{
id: '124',
url: 'https://www.pngmart.com/files/12/Stream-Overlay-Transparent-PNG.png',
},
]

const logos = [
{
id: '128',
url: 'https://www.pngmart.com/files/12/Twitch-Stream-Overlay-PNG-Transparent-Picture.png',
},
{
id: '129',
url: 'https://www.pngmart.com/files/12/Stream-Overlay-Transparent-PNG.png',
},
]

export const ScenelessComponent = ({
component,
}: {
component: ScenelessInterface
}) => {
return (
<Column>
<SourceList component={component} sourceType="RoomParticipant" />
<Column>
<label>Layout</label>
<Flex padding={8} style={{ background: 'rgba(0, 0, 0, 0.2)' }}>
<Layout component={component} />
</Flex>
</Column>
<Column>
<label>Background</label>
<Flex padding={8} style={{ background: 'rgba(0, 0, 0, 0.2)' }}>
<BackgroundSelect component={component} />
</Flex>
</Column>
</Column>
)
}
42 changes: 42 additions & 0 deletions examples/studio-kit-demo/src/components/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* ---------------------------------------------------------------------------------------------
* Copyright (c) Infiniscene, Inc. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* -------------------------------------------------------------------------------------------- */
import { Compositor, SDK } from '@api.stream/studio-kit'
import { useEffect, useState } from 'react'
import { useRenderRef, useUpdate } from '../shared/hooks'
import { MultiSceneComponent } from './MultiScene'
import { ScenelessComponent } from './Sceneless'

const components = {
Sceneless: ScenelessComponent,
MultiScene: MultiSceneComponent,
}

export const Component = ({
component,
}: {
component: Compositor.Component.NodeInterface
}) => {
const [updatedComponent, setComponent] =
useState<Compositor.Component.NodeInterface>(component)

useEffect(() => {
if (!component?.id) return
return component.project.useComponent(component.id, setComponent)
}, [component?.id])

if (!component) return null

// @ts-ignore
const Component = components[component.type]
if (!Component) return null

return <Component component={updatedComponent} />
}

export const Renderer = ({ scene }: { scene: Compositor.Project }) => {
const renderContainer = useRenderRef(scene)

return <div ref={renderContainer} style={{ width: 840, height: 500 }}></div>
}
Loading