From 65d8f8b531fc1cf25b9e0880c5581bd4ba720a1d Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sat, 30 Mar 2024 15:57:09 -0400 Subject: [PATCH] wip --- .../src/app/style-select.element.scss | 53 ++++++++++++++++ .../src/app/style-select.element.ts | 63 +++++++++++++++++++ .../src/app/temp-video-preview.element.ts | 7 ++- 3 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 studio-frontend/src/app/style-select.element.scss create mode 100644 studio-frontend/src/app/style-select.element.ts diff --git a/studio-frontend/src/app/style-select.element.scss b/studio-frontend/src/app/style-select.element.scss new file mode 100644 index 0000000..ecc942b --- /dev/null +++ b/studio-frontend/src/app/style-select.element.scss @@ -0,0 +1,53 @@ +@use "sass:math"; + +:host { + // background: red; + display: flex; + gap: 0.6rem; + box-sizing: border-box; +} + +*, *::before, *::after { + box-sizing: border-box; +} + +.bubble { + position: relative; + flex: 0 0 auto; + display: flex; + align-items: flex-end; + width: 80px; + height: 80px; + padding: 0.5rem; + border-radius: 0.5rem; + background: { + size: cover; + position: center center; + } + + outline: #FFF2 solid 2px; + color: rgba(#fff, 0.75); + transition: { + property: background-color, outline-color; + duration: 200ms; + timing-function: ease; + } + white-space: nowrap; + + cursor: pointer; + + .gradient { + position: absolute; + inset: 0; + background: linear-gradient(to top, #000B, #0000); + border-radius: 0.5rem; + } + + .label { + position: relative; + font: { + size: math.div(12, 16) * 1rem; + weight: 500; + } + } +} diff --git a/studio-frontend/src/app/style-select.element.ts b/studio-frontend/src/app/style-select.element.ts new file mode 100644 index 0000000..297d8cb --- /dev/null +++ b/studio-frontend/src/app/style-select.element.ts @@ -0,0 +1,63 @@ +import { FormFieldBaseElement } from "@storyteller/studio-ui/forms/form-field-base"; +import { PropertyValues, html, unsafeCSS } from "lit"; +import { customElement, property } from "lit/decorators.js"; +import { classMap } from "lit/directives/class-map.js"; +import { styleMap } from "lit/directives/style-map.js"; + +import { type StyleOption, type VstStyle } from "./inspector-tabs/style-tab"; + +import styles from "./style-select.element.scss?inline"; + +@customElement("sts-style-select") +export class StyleSelect extends FormFieldBaseElement { + static override styles = unsafeCSS(styles); + + @property({ reflect: true }) + override role = "listbox" + + @property({ attribute: false }) + options: readonly StyleOption[] = []; + + @property() value?: VstStyle; + + protected override update(changes: PropertyValues): void { + if (changes.has("value")) + this.internals.setFormValue(this.value ?? ""); + + super.update(changes); + } + + protected override render = () => html` +
+
+
+ + ${ "Foo" } + +
+ +
+ ` +} diff --git a/studio-frontend/src/app/temp-video-preview.element.ts b/studio-frontend/src/app/temp-video-preview.element.ts index ee009e6..e914d7d 100644 --- a/studio-frontend/src/app/temp-video-preview.element.ts +++ b/studio-frontend/src/app/temp-video-preview.element.ts @@ -10,7 +10,6 @@ import { bind, on } from "@storyteller/framework"; import { VideoStylePreview } from "./api/VideoStylePreview"; -import "./bubble-select.element"; import "./style-select.element"; import styles from "./temp-video-preview.element.scss?inline"; @@ -204,11 +203,13 @@ export class TempVideoPreview extends LitElement { > Select Base Style - + > +