create-background-plugin.ts 562 B

1234567891011121314151617181920
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import { definePluginCreator } from '@flowgram.ai/core';
  6. import { BackgroundConfig, BackgroundLayer, BackgroundLayerOptions } from './background-layer';
  7. /**
  8. * 点位背景插件
  9. */
  10. export const createBackgroundPlugin = definePluginCreator<BackgroundLayerOptions>({
  11. onBind: (bindConfig, opts) => {
  12. bindConfig.bind(BackgroundConfig).toConstantValue(opts);
  13. },
  14. onInit: (ctx, opts) => {
  15. ctx.playground.registerLayer(BackgroundLayer, opts);
  16. },
  17. });