Token导航 LogoToken导航

Agent Skill · 前端设计

webf-native-ui-dev(webf 原生 ui 开发)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

webf-native-ui-dev 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 8,040。

总安装 318周安装 13GitHub Stars 2,386下载 102核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:webf-native-ui-dev(webf 原生 ui 开发)
来源仓库:https://github.com/openwebf/webf
仓库路径:skills/webf-native-ui-dev
安装命令:
npx skills add https://github.com/openwebf/webf --skill webf-native-ui-dev
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/openwebf/webf --skill webf-native-ui-dev

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

✅ 本机 UI 库将 Flutter 小部件包装为可通过 Web 访问的自定义元素 ✅ 编写扩展 WebFWidgetElement 的 Dart 包装器 ✅ 为每个组件编写 TypeScript 定义 (.d.ts) ✅ 使用WebF CLI生成React/Vue组件 ✅ 在 Flutter 和 JavaScript 环境中进行测试 ✅ 发布到 pub.dev (Flutter) 和 npm (JavaScript) ✅ 遵循 webf_cupertino_ui 中的现有模式以供参考 每周安装量 13 存储库 openwebf/webf GitHub 之星 2.4K 第一次看到 2026 年 1 月 25 日 安全审计 Gen Agent Trust Hub 通行证 套接字通行证 斯尼克通行证

来源仓库内路径:skills/webf-native-ui-dev

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/openwebf/webf --skill webf-native-ui-dev;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

webf-native-ui-dev 怎么安装?

在终端执行 npx skills add https://github.com/openwebf/webf --skill webf-native-ui-dev。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

webf-native-ui-dev 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

webf-native-ui-dev 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

webf-native-ui-dev 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

webf-native-ui-dev 用的人多吗?

公开数据是累计安装 318 次,近一周安装 13 次,下载 102 次,GitHub 2,386 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

webf-native-ui-dev 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
webf-native-ui-dev

webf 原生 ui 开发 · 本页

3182,386需要联网MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

WebF Native UI Development

Want to create your own native UI library for WebF by wrapping Flutter widgets? This skill guides you through the complete process of building custom native UI libraries that make Flutter widgets accessible from JavaScript/TypeScript with React and Vue support.

What is Native UI Development?

Native UI development in WebF means:

  • Wrapping Flutter widgets as WebF custom elements
  • Bridging native Flutter UI to web technologies (HTML/JavaScript)
  • Creating reusable component libraries that work with React, Vue, and vanilla JavaScript
  • Publishing npm packages with type-safe TypeScript definitions

When to Create a Native UI Library

Use Cases:

  • ✅ You want to expose Flutter widgets to web developers
  • ✅ You need to wrap a Flutter package for WebF use
  • ✅ You're building a design system with native performance
  • ✅ You want to create platform-specific components (iOS, Android, etc.)
  • ✅ You need custom widgets beyond HTML/CSS capabilities

Don't Create a Native UI Library When:

  • ❌ HTML/CSS can achieve the same result (use standard web)
  • ❌ You just need to use existing UI libraries (see webf-native-ui skill)
  • ❌ You're building a one-off component (use WebF widget element directly)

Architecture Overview

A native UI library consists of three layers:

┌─────────────────────────────────────────┐
│  JavaScript/TypeScript (React/Vue)      │  ← Generated by CLI
│  @openwebf/my-component-lib             │
├─────────────────────────────────────────┤
│  TypeScript Definitions (.d.ts)         │  ← You write this
│  Component interfaces and events        │
├─────────────────────────────────────────┤
│  Dart (Flutter)                         │  ← You write this
│  Flutter widget wrappers                │
│  my_component_lib package                │
└─────────────────────────────────────────┘

Development Workflow

Overview

# 1. Create Flutter package with Dart wrappers
# 2. Write TypeScript definition files
# 3. Generate React/Vue components with WebF CLI
# 4. Test and publish

webf codegen my-ui-lib --flutter-package-src=./flutter_package

Step-by-Step Guide

Step 1: Create Flutter Package Structure

Create a standard Flutter package:

# Create Flutter package
flutter create --template=package my_component_lib

cd my_component_lib

Directory structure:

my_component_lib/
├── lib/
│   ├── my_component_lib.dart     # Main export file
│   └── src/
│       ├── button.dart           # Dart widget wrapper
│       ├── button.d.ts           # TypeScript definitions
│       ├── input.dart
│       └── input.d.ts
├── pubspec.yaml
└── README.md

pubspec.yaml dependencies:

dependencies:
  flutter:
    sdk: flutter
  webf: ^0.24.0  # Latest WebF version

Step 2: Write Dart Widget Wrappers

Create a Dart class that wraps your Flutter widget:

Example: lib/src/button.dart

import 'package:flutter/widgets.dart';
import 'package:webf/webf.dart';
import 'button_bindings_generated.dart';  // Will be generated by CLI

/// Custom button component wrapping Flutter widgets
class MyCustomButton extends MyCustomButtonBindings {
  MyCustomButton(super.context);

  // Internal state
  String _variant = 'filled';
  bool _disabled = false;

  // Property getters/setters (implement interface from bindings)
  @override
  String get variant => _variant;

  @override
  set variant(String value) {
    _variant = value;
    // Trigger rebuild when property changes
    setState(() {});
  }

  @override
  bool get disabled => _disabled;

  @override
  set disabled(bool value) {
    _disabled = value;
    setState(() {});
  }

  @override
  WebFWidgetElementState createState() {
    return MyCustomButtonState(this);
  }
}

class MyCustomButtonState extends WebFWidgetElementState {
  MyCustomButtonState(super.widgetElement);

  @override
  MyCustomButton get widgetElement => super.widgetElement as MyCustomButton;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: widgetElement.disabled ? null : () {
        // Dispatch click event to JavaScript
        widgetElement.dispatchEvent(Event('click'));
      },
      child: Container(
        padding: EdgeInsets.all(12),
        decoration: BoxDecoration(
          color: _getBackgroundColor(),
          borderRadius: BorderRadius.circular(8),
        ),
        child: Text(
          // Get text from child nodes
          widgetElement.getTextContent() ?? 'Button',
          style: TextStyle(
            color: widgetElement.disabled ? Colors.grey : Colors.white,
          ),
        ),
      ),
    );
  }

  Color _getBackgroundColor() {
    if (widgetElement.disabled) return Colors.grey[400]!;
    switch (widgetElement.variant) {
      case 'filled':
        return Colors.blue;
      case 'outlined':
        return Colors.transparent;
      default:
        return Colors.blue;
    }
  }
}

Step 3: Write TypeScript Definitions

Create a .d.ts file alongside your Dart file:

Example: lib/src/button.d.ts

/**
 * Custom button component with multiple variants.
 */

/**
 * Properties for <my-custom-button>.
 */
interface MyCustomButtonProperties {
  /**
   * Button variant style.
   * Supported values: 'filled' | 'outlined' | 'text'
   * @default 'filled'
   */
  variant?: string;

  /**
   * Whether the button is disabled.
   * @default false
   */
  disabled?: boolean;
}

/**
 * Events for <my-custom-button>.
 */
interface MyCustomButtonEvents {
  /**
   * Fired when the button is clicked.
   */
  click: Event;
}

TypeScript Guidelines:

  • Interface names must end with Properties or Events
  • Use ? for optional properties (except booleans, which are always non-nullable in Dart)
  • Use CustomEvent<T> for events with data
  • Add JSDoc comments for documentation
  • See the TypeScript Definition Guide for more details

Step 4: Create Main Export File

lib/my_component_lib.dart:

library my_component_lib;

import 'package:webf/webf.dart';
import 'src/button.dart';

export 'src/button.dart';

/// Install all components in this library
void installMyComponentLib() {
  // Register custom elements
  WebFController.defineCustomElement(
    'my-custom-button',
    (context) => MyCustomButton(context),
  );

  // Add more components here
  // WebFController.defineCustomElement('my-custom-input', ...);
}

Step 5: Generate React/Vue Components

Use the WebF CLI to generate JavaScript/TypeScript components:

# Install WebF CLI globally (if not already installed)
npm install -g @openwebf/webf-cli

# Generate TypeScript bindings and React/Vue components
webf codegen my-ui-lib-react \
  --flutter-package-src=./my_component_lib \
  --framework=react

webf codegen my-ui-lib-vue \
  --flutter-package-src=./my_component_lib \
  --framework=vue

What the CLI does:

  1. ✅ Parses your .d.ts files
  2. ✅ Generates Dart binding classes (*_bindings_generated.dart)
  3. ✅ Creates React components with proper TypeScript types
  4. ✅ Creates Vue components with TypeScript support
  5. ✅ Copies .d.ts files to output directory
  6. ✅ Creates package.json with correct metadata
  7. ✅ Runs npm run build if a build script exists

Generated output structure:

my-ui-lib-react/
├── src/
│   ├── MyCustomButton.tsx        # React component
│   └── index.ts                  # Main export
├── dist/                         # Built files (after npm run build)
├── package.json
├── tsconfig.json
└── README.md

Step 6: Test Your Components

Test in Flutter App

In your Flutter app's main.dart:

import 'package:my_component_lib/my_component_lib.dart';

void main() {
  WebFControllerManager.instance.initialize(WebFControllerManagerConfig(
    maxAliveInstances: 2,
    maxAttachedInstances: 1,
  ));

  // Install your component library
  installMyComponentLib();

  runApp(MyApp());
}
Test in JavaScript/TypeScript

React example:

import { MyCustomButton } from '@openwebf/my-ui-lib-react';

function App() {
  return (
    <div>
      <MyCustomButton
        variant="filled"
        onClick={() => console.log('Clicked!')}
      >
        Click Me
      </MyCustomButton>
    </div>
  );
}

Vue example:

<template>
  <div>
    <MyCustomButton
      variant="filled"
      @click="handleClick"
    >
      Click Me
    </MyCustomButton>
  </div>
</template>

<script setup>
import { MyCustomButton } from '@openwebf/my-ui-lib-vue';

const handleClick = () => {
  console.log('Clicked!');
};
</script>

Step 7: Publish Your Library

Publish Flutter Package
# In Flutter package directory
flutter pub publish

# Or for private packages
flutter pub publish --server=https://your-private-registry.com
Publish npm Packages
# Automatic publishing with CLI
webf codegen my-ui-lib-react \
  --flutter-package-src=./my_component_lib \
  --framework=react \
  --publish-to-npm

# Or manual publishing
cd my-ui-lib-react
npm publish

For custom npm registry:

webf codegen my-ui-lib-react \
  --flutter-package-src=./my_component_lib \
  --framework=react \
  --publish-to-npm \
  --npm-registry=https://registry.your-company.com/

Advanced Patterns

1. Handling Complex Properties

TypeScript:

interface MyComplexWidgetProperties {
  // JSON string properties for complex data
  items?: string;  // Will be JSON.parse() in Dart

  // Enum-like values
  alignment?: 'left' | 'center' | 'right';

  // Numeric properties
  maxLength?: number;
  opacity?: number;
}

Dart:

@override
set items(String? value) {
  if (value != null) {
    try {
      final List<dynamic> parsed = jsonDecode(value);
      _items = parsed.cast<Map<String, dynamic>>();
      setState(() {});
    } catch (e) {
      print('Error parsing items: $e');
    }
  }
}

2. Dispatching Custom Events with Data

Dart:

void _handleValueChange(String newValue) {
  // Dispatch CustomEvent with data
  widgetElement.dispatchEvent(CustomEvent(
    'change',
    detail: {'value': newValue},
  ));
}

TypeScript:

interface MyInputEvents {
  change: CustomEvent<{value: string}>;
}

3. Calling Methods from JavaScript

TypeScript:

interface MyInputProperties {
  // Regular properties
  value?: string;

  // Methods
  focus(): void;
  clear(): void;
}

Dart:

class MyInput extends MyInputBindings {
  final FocusNode _focusNode = FocusNode();

  @override
  void focus() {
    _focusNode.requestFocus();
  }

  @override
  void clear() {
    // Clear the input
    value = '';
    // Dispatch event
    dispatchEvent(Event('input'));
  }
}

4. Reading CSS Styles

Dart:

@override
Widget build(BuildContext context) {
  // Read CSS properties
  final renderStyle = widgetElement.renderStyle;
  final backgroundColor = renderStyle.backgroundColor?.value;
  final borderRadius = renderStyle.borderRadius;

  return Container(
    decoration: BoxDecoration(
      color: backgroundColor ?? Colors.blue,
      borderRadius: BorderRadius.circular(
        borderRadius?.topLeft?.x ?? 8.0
      ),
    ),
    child: buildChild(),
  );
}

5. Handling Child Elements

Dart:

@override
Widget build(BuildContext context) {
  // Get text content from child nodes
  final text = widgetElement.getTextContent() ?? '';

  // Build child widgets
  final children = widgetElement.children.map((child) {
    return child.renderObject?.widget ?? SizedBox();
  }).toList();

  return Column(
    children: children,
  );
}

Common Patterns and Best Practices

1. Property Validation

@override
set variant(String value) {
  const validVariants = ['filled', 'outlined', 'text'];
  if (validVariants.contains(value)) {
    _variant = value;
  } else {
    print('Warning: Invalid variant "$value"');
    _variant = 'filled';
  }
  setState(() {});
}

2. Debouncing Frequent Updates

Timer? _debounceTimer;

@override
set searchQuery(String value) {
  _searchQuery = value;

  // Debounce search
  _debounceTimer?.cancel();
  _debounceTimer = Timer(Duration(milliseconds: 300), () {
    _performSearch();
  });
}

3. Lifecycle Management

@override
void didMount() {
  super.didMount();
  // Called when element is inserted into DOM
  _initializeWidget();
}

@override
void dispose() {
  // Clean up resources
  _debounceTimer?.cancel();
  _focusNode.dispose();
  super.dispose();
}

4. Error Handling

@override
set jsonData(String? value) {
  if (value == null || value.isEmpty) {
    _data = null;
    return;
  }

  try {
    _data = jsonDecode(value);
    setState(() {});
  } catch (e) {
    print('Error parsing JSON: $e');
    // Dispatch error event
    dispatchEvent(CustomEvent('error', detail: {'message': e.toString()}));
  }
}

CLI Command Reference

Basic Generation

# Generate React components
webf codegen output-dir --flutter-package-src=./my_package --framework=react

# Generate Vue components
webf codegen output-dir --flutter-package-src=./my_package --framework=vue

# Specify package name
webf codegen output-dir \
  --flutter-package-src=./my_package \
  --framework=react \
  --package-name=@mycompany/my-ui-lib

Auto-Publishing

# Publish to npm after generation
webf codegen output-dir \
  --flutter-package-src=./my_package \
  --framework=react \
  --publish-to-npm

# Publish to custom registry
webf codegen output-dir \
  --flutter-package-src=./my_package \
  --framework=react \
  --publish-to-npm \
  --npm-registry=https://registry.company.com/

Project Auto-Creation

The CLI auto-creates projects if files are missing:

  • If package.json, tsconfig.json, or global.d.ts are missing, it creates a new project
  • If framework is not specified, it prompts interactively
  • Uses existing configuration if project already exists

Troubleshooting

Issue: Bindings file not found

Error: Error: Could not find 'button_bindings_generated.dart'

Solution:

  1. Make sure you've run the CLI code generation
  2. Check that .d.ts files are in the same directory as .dart files
  3. Verify interface naming (must end with Properties or Events)

Issue: Properties not updating in UI

Cause: Not calling setState() after property changes

Solution:

@override
set myProperty(String value) {
  _myProperty = value;
  setState(() {});  // ← Don't forget this!
}

Issue: Events not firing in JavaScript

Cause: Event name mismatch or not dispatching events

Solution:

// Make sure event names match your TypeScript definitions
widgetElement.dispatchEvent(Event('click'));  // matches 'click' in TypeScript

Issue: TypeScript types not working

Cause: Generated types not exported properly

Solution: Check that generated package.json exports types:

{
  "types": "./dist/index.d.ts",
  "exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.js"
    }
  }
}

Complete Example: Text Input Component

See Complete Example for a full implementation of a text input component with:

  • Flutter TextFormField wrapper
  • TypeScript definitions
  • Event handling
  • Validation
  • Methods (focus, blur, clear)
  • CSS integration

Resources

Next Steps

After creating your native UI library:

  1. Test thoroughly on all target platforms (iOS, Android, desktop)
  2. Write documentation for each component (see existing .md files in webf_cupertino_ui)
  3. Create example apps demonstrating usage
  4. Publish to pub.dev (Flutter) and npm (JavaScript)
  5. Maintain compatibility with WebF version updates

Summary

  • ✅ Native UI libraries wrap Flutter widgets as web-accessible custom elements
  • ✅ Write Dart wrappers extending WebFWidgetElement
  • ✅ Write TypeScript definitions (.d.ts) for each component
  • ✅ Use WebF CLI to generate React/Vue components
  • ✅ Test in both Flutter and JavaScript environments
  • ✅ Publish to pub.dev (Flutter) and npm (JavaScript)
  • ✅ Follow existing patterns from webf_cupertino_ui for reference

平台分布

windsurf

26.84%
按下载量换算27

OpenCode

26.36%
按下载量换算27

Codex

17.3%
按下载量换算18

Claude Code

13.74%
按下载量换算14

Antigravity

9.09%
按下载量换算9

Gemini CLI

4%
按下载量换算4

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills