mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-02 19:42:51 +08:00
feat(skin): preserve screen share user gesture
This commit is contained in:
1 parent
e20219b010
commit
b0b4a02a21
14 files changed
+209
-19
No files matched your search
@@ -11,6 +11,7 @@ import {
|
||||
type SkinPluginDocument,
|
||||
type SkinPluginHostWidget,
|
||||
type SkinPluginNode,
|
||||
type SkinPluginPermission,
|
||||
} from "../../../src/shared/skin-plugin.js";
|
||||
import { parseSkinExtensionUiOutput } from "../../../src/shared/skin-extension-ui.js";
|
||||
import { parseSkinExtensionUiInput } from "../../../src/shared/skin-extension-ui-input.js";
|
||||
@@ -35,6 +36,7 @@ export default defineComponent({
|
||||
document: { type: Object as PropType<SkinPluginDocument>, required: true },
|
||||
extensionOutput: { type: String as PropType<string | null>, default: null },
|
||||
extensionMode: { type: String as PropType<SkinPluginComponentMode | undefined>, default: undefined },
|
||||
extensionPermissions: { type: Array as PropType<readonly SkinPluginPermission[]>, default: () => [] },
|
||||
componentNamespace: { type: String, default: "" },
|
||||
manageSurfaceRecovery: { type: Boolean, default: true },
|
||||
page: { type: String as PropType<"home" | "voice" | "demo">, required: true },
|
||||
@@ -57,11 +59,21 @@ export default defineComponent({
|
||||
const objectUrls = new Map<string, string>();
|
||||
const validatedDocument = computed(() => {
|
||||
let document: SkinPluginDocument;
|
||||
try { document = parseSkinPluginDocument(props.document); }
|
||||
const emptyRuntimeBase = Boolean(props.extensionOutput)
|
||||
&& props.document.schemaVersion === 3
|
||||
&& Array.isArray(props.document.components)
|
||||
&& props.document.components.length === 0;
|
||||
try {
|
||||
// Runtime plugins use an empty v3 base document so their validated generated output
|
||||
// can flow through the same approval, layout, and rendering path as packaged components.
|
||||
document = emptyRuntimeBase
|
||||
? { schemaVersion: 3, components: [] }
|
||||
: parseSkinPluginDocument(props.document);
|
||||
}
|
||||
catch { return { schemaVersion: 2 as const, components: [] }; }
|
||||
if (!props.extensionOutput || document.schemaVersion !== 3) return document;
|
||||
try {
|
||||
const parsedExtensionDocument = parseSkinExtensionUiOutput(props.extensionOutput);
|
||||
const parsedExtensionDocument = parseSkinExtensionUiOutput(props.extensionOutput, { permissions: props.extensionPermissions });
|
||||
const extensionDocument = props.extensionMode
|
||||
? { ...parsedExtensionDocument, components: parsedExtensionDocument.components.map((component) => ({ ...component, mode: props.extensionMode })) }
|
||||
: parsedExtensionDocument;
|
||||
@@ -192,6 +204,7 @@ export default defineComponent({
|
||||
|
||||
function layoutPart(component: SkinPluginComponent, node: SkinPluginNode, nodePath: string): string {
|
||||
const interactive = ["a", "button", "input", "select", "summary", "textarea"].includes(node.tag ?? "")
|
||||
|| node.widget === "voice.screen-share-start"
|
||||
|| node.attributes?.role === "button"
|
||||
|| ["click", "dblclick", "contextmenu", "keydown", "keyup", "pointerdown", "pointerup", "drop"]
|
||||
.some((eventName) => Boolean(node.events?.[eventName as keyof typeof node.events]));
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { SkinExtensionSessionStatus } from "../../../src/shared/skin-extens
|
||||
import { computeSkinRuntimePluginDigest, createSkinRuntimePluginApproval, isSkinRuntimePluginApproved, type SkinRuntimePluginApproval } from "../../../src/shared/skin-runtime-plugin-approval.js";
|
||||
import type { SkinRuntimePlugin, SkinRuntimePluginDocument, SkinRuntimePluginPage } from "../../../src/shared/skin-runtime-plugins.js";
|
||||
import { parseSkinExtensionUiInput, type SkinExtensionUiInput } from "../../../src/shared/skin-extension-ui-input.js";
|
||||
import { SKIN_PLUGIN_ACTION_PERMISSIONS, skinPluginActionPermission, type SkinPluginAction, type SkinPluginDocument } from "../../../src/shared/skin-plugin.js";
|
||||
import { SKIN_PLUGIN_ACTION_PERMISSIONS, skinPluginActionPermission, type SkinPluginAction, type SkinPluginDocument, type SkinPluginHostWidget } from "../../../src/shared/skin-plugin.js";
|
||||
import { SKIN_RUNTIME_PLUGIN_DATA_PERMISSIONS } from "../../../src/shared/skin-runtime-plugin-context.js";
|
||||
import SkinPluginOutlet from "./SkinPluginOutlet.js";
|
||||
import { approveSkinRuntimePlugin, getSkinRuntimePluginApproval, revokeSkinRuntimePluginApprovals } from "../services/skin-runtime-plugin-approval.js";
|
||||
@@ -91,6 +91,7 @@ export default defineComponent({
|
||||
page: { type: String as PropType<SkinRuntimePluginPage>, required: true },
|
||||
context: { type: Object as PropType<Record<string, unknown>>, default: () => ({}) },
|
||||
actions: { type: Object as PropType<Partial<Record<SkinPluginAction, HostActionHandler>>>, default: () => ({}) },
|
||||
widgets: { type: Object as PropType<Partial<Record<SkinPluginHostWidget, () => VNodeChild>>>, default: () => ({}) },
|
||||
readSessionStatus: { type: Function as PropType<(signal: AbortSignal) => SkinExtensionSessionStatus | Promise<SkinExtensionSessionStatus>>, required: true },
|
||||
},
|
||||
emits: {
|
||||
@@ -351,6 +352,8 @@ export default defineComponent({
|
||||
data: {},
|
||||
assets: pluginAssets,
|
||||
actions: {},
|
||||
extensionPermissions: plugin.permissions,
|
||||
widgets: props.widgets,
|
||||
onExtensionEvent: (event: unknown) => dispatch(plugin.id, event),
|
||||
onSurfaceChange: (active: boolean) => surfaceChanged(plugin.id, active),
|
||||
onRestoreSkin: () => emit("restore-skin"),
|
||||
|
||||
Reference in new issue
Block a user