Skip to content

Commit

Permalink
Merge branch 'main' into feat/bf_support
Browse files Browse the repository at this point in the history
  • Loading branch information
andycall authored Jan 3, 2024
2 parents 7648b6a + cf4d31c commit 84f5531
Show file tree
Hide file tree
Showing 544 changed files with 20,955 additions and 4,369 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# These are supported funding model platforms
github: [openwebf]
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ body:
label: Affected version
description: Please specify which version of webf you are using.
placeholder: 0.12.0 or main
- type: input
validations:
required: true
attributes:
label: Flutter versions
description: Please specify which version of flutter you are using.
placeholder: 3.13.5

- type: checkboxes
validations:
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy website content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main", "feat/website"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- uses: actions/setup-node@v2
with:
node-version: "18.12.1"
- name: Build the Docs
run: |
cd website
npm i
npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: './website/build'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
2 changes: 1 addition & 1 deletion .github/workflows/example_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
env:
nodeVersion: "16"
cmakeVersion: "3.26.3"
flutterVersion: "3.10.5"
flutterVersion: "3.13.5"

jobs:
build_windows-app_in_windows:
Expand Down
23 changes: 10 additions & 13 deletions .github/workflows/integration_test_flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [workflow_dispatch, pull_request]
env:
nodeVersion: "16"
cmakeVersion: "3.22.x"
flutter310: "3.10.5"
flutter310: "3.13.5"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
- run: ENABLE_ASAN=true npm run build:bridge:linux
- run: node scripts/run_bridge_unit_test.js

webf_unit_test_310:
webf_unit_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -72,7 +72,7 @@ jobs:
- run: flutter doctor -v
- run: cd webf && flutter test

integration_test_f310:
integration_test:
runs-on: self-hosted
needs: [ setup, build_bridge ]
strategy:
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
- name: Check on failures
if: steps.test.outcome != 'success'
run: exit 1
plugin_test:
multiple_page_test:
runs-on: self-hosted
needs: [ build_bridge ]
steps:
Expand All @@ -127,18 +127,15 @@ jobs:
flutter-version: ${{ env.flutter310 }}
- run: flutter config --enable-macos-desktop
- run: flutter doctor -v
- name: Run Plugin Test
run: cd integration_tests && npm run plugin_test
- name: Run MultiplePageTest Test
run: cd integration_tests && npm run multiple_page_test
id: test
continue-on-error: true
- uses: actions/upload-artifact@v2
with:
name: plugin_snapshots
path: integration_tests/snapshots/plugins
- name: Check on failures
if: steps.test.outcome != 'success'
run: exit 1
multiple_page_test:

memory_leak_test:
runs-on: self-hosted
needs: [ build_bridge ]
steps:
Expand All @@ -157,8 +154,8 @@ jobs:
flutter-version: ${{ env.flutter310 }}
- run: flutter config --enable-macos-desktop
- run: flutter doctor -v
- name: Run MultiplePageTest Test
run: cd integration_tests && npm run multiple_page_test
- name: Run MemoryLeak Test
run: cd integration_tests && npm run memory_leak_integration
id: test
continue-on-error: true
- name: Check on failures
Expand Down
47 changes: 33 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,52 @@
# [WebF](https://openwebf.com/) [![pub package](https://img.shields.io/pub/v/webf.svg)](https://pub.dev/packages/webf)

WebF (Web on Flutter) is a W3C standards-compliant web rendering engine based on Flutter, allowing web applications to run natively on Flutter.
WebF presents a high-performance, cutting-edge web rendering engine built on top of Flutter, empowering web applications to operate natively within the Flutter ecosystem.

- **W3C Standards Compliant:** WebF uses HTML/CSS and JavaScript to render content on Flutter, achieving 100% consistency with browser rendering.
- **Front-End Framework Supports:** As WebF is W3C standards compliant, it can be used with many front-end frameworks, such as [React](https://reactjs.org/), [Vue](https://vuejs.org/).
- **Expand your Web App with Flutter:** WebF is fully customizable. You can define a customized HTML element with Flutter Widgets and use it in your application or add a JavaScript API for any Dart library from <pub.dev> registry.
- **Web Development Experience:** WebF supports inspecting DOM structure, CSS styles and debugging JavaScript with Chrome DevTools, providing a browser-like web development experience.
- **Write Once, Run Anywhere:** With the power of WebF, You can write your web application and run it on any device that Flutter supports. Additionally, you can still run your apps in Node.js and web browsers with the same codebase.
- **Adherence to W3C Standards:** By leveraging HTML/CSS and JavaScript, WebF renders content on Flutter, ensuring impeccable alignment with standard browser rendering.

## Check if a Web API or CSS is available in WebF
- **Compatible with Leading Front-End Frameworks:** Given its compliance with W3C standards, WebF seamlessly integrates with popular front-end frameworks, including [React](https://reactjs.org/) and [Vue](https://vuejs.org/).

Check [this yaml](https://github.com/openwebf/webf-available-apis/blob/main/data.yaml)
- **Amplify Your Web Applications with Flutter:** WebF's adaptability shines through its customization capabilities. Craft bespoke HTML elements using Flutter Widgets or enhance your application by integrating a JavaScript API sourced from any Dart library on the `pub.dev` registry.

- **Authentic Web Development Environment:** Experience a traditional web development setting with WebF. It facilitates DOM structure inspection, CSS style evaluations, and JavaScript debugging via Chrome DevTools.

## The Relationship between WebF and Kraken
- **Craft Once, Deploy Everywhere:** Harness the versatility of WebF to design your web application and launch it across any Flutter-compatible device. What's more, maintain the flexibility to execute your apps within Node.js or web browsers, all from a unified codebase.

The WebF project is a community support version of [Alibaba's Kraken Project](https://github.com/openkraken/kraken). On May 10, 2022, The Kraken Dev Team was dismissed and the project itself are discontinued.
## Join Our Mission

The core developer and architector: [andycall](https://github.com/andycall), who is from the original Kraken Team. Leave the Alibaba Group and launch this project, to keep following the original ambition of the Kraken project.
We envision providing web developers with an innovative web rendering engine, surpassing WebView in performance and adaptability across both mobile and desktop platforms.

For more details(zh_CN): https://www.zhihu.com/question/534811524/answer/2595510449
WebF's journey is ambitious and enduring. We believe in the strength of collective effort. If you share our dream of a superior alternative to WebView for the future, your expertise could be invaluable to us.

Further, financial contributions can pave the way for erstwhile members of the Kraken team to rejoin our mission, bolstering our developmental pace and potential.

If you or your team are interested in supporting us, please contact @andycall on our Discord channel.

## Join the community (Beta)

[![Discord Shield](https://discordapp.com/api/guilds/1008119434688344134/widget.png?style=banner1)](https://discord.gg/DvUBtXZ5rK)

## Version requirement
## The update and maintenance policy for WebF versions

Each version of WebF will be maintained for the lifespan of three minor WebF releases. For instance, WebF 0.15.0 was released to be compatible with Flutter 3.10.x. Its support will conclude once WebF 0.18.0 is introduced. Any updates applied to versions 0.16.x and 0.17.x will be cherry-picked for the subsequent update of 0.15.x.

This ensures that users can reliably receive updates for three minor WebF versions without the necessity to upgrade the Flutter version in their app.

| WebF | Flutter |
| -------------------- | ------- |
| `>= 0.12.0 < 0.14.0` | `3.0.5` |
| `>= 0.14.0 < 0.15.0` | `3.3.10` and `3.7.3` |
| `>= 0.15.0` | `3.10.x` |
| `>= 0.15.0 < 0.16.0` | `3.10.x` |
| `>= 0.16.0 < 0.17.0` | `3.13.x` |
| `>= 0.17.0 < 0.18.0` | `3.16.x` |


<img width="817" alt="image" src="https://github.com/openwebf/webf/assets/4409743/2d5cf5a1-e670-424b-8766-324f475bbc0a">

Below is the relationship between the various Flutter and WebF versions:

<img width="627" alt="image" src="https://github.com/openwebf/webf/assets/4409743/8cace8da-ac97-4908-b970-6b52450cb4cc">


## How to use

Expand Down Expand Up @@ -115,6 +130,10 @@ With WebF, Web Apps and Flutter Apps share the same rendering context. It means

<img src="https://user-images.githubusercontent.com/4409743/186230941-83b0aa1c-59d1-4d8d-be10-958a3ae64114.jpg" width="800" style="display: block; margin: 0 auto;" />

## Contributors

<a href="https://github.com/openwebf/webf/graphs/contributors"><img src="https://opencollective.com/webf/contributors.svg?width=890&button=false" /></a>

## 👏 Contributing [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/openwebf/webf/pulls)

By contributing to WebF, you agree that your contributions will be licensed under its Apache-2.0 License.
Expand Down
31 changes: 30 additions & 1 deletion bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ else ()
add_definitions(-DENABLE_PROFILE=0)
endif ()

if (${ENABLE_LOG})
add_definitions(-DENABLE_LOG=1)
else()
add_definitions(-DENABLE_LOG=0)
endif()

if(NOT MSVC)
if (${CMAKE_BUILD_TYPE} STREQUAL "Release" OR ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
include(CheckIPOSupported)
Expand Down Expand Up @@ -91,17 +97,19 @@ if (DEFINED PLATFORM)
endif()

list(APPEND BRIDGE_SOURCE
webf_bridge.cc
foundation/logging.cc
foundation/native_string.cc
foundation/ui_task_queue.cc
foundation/shared_ui_command.cc
foundation/inspector_task_queue.cc
foundation/task_queue.cc
foundation/string_view.cc
foundation/native_value.cc
foundation/native_type.cc
foundation/ui_command_buffer.cc
polyfill/dist/polyfill.cc
multiple_threading/dispatcher.cc
multiple_threading/looper.cc
${CMAKE_CURRENT_LIST_DIR}/third_party/dart/include/dart_api_dl.c
)

Expand Down Expand Up @@ -189,6 +197,11 @@ if ($ENV{WEBF_JS_ENGINE} MATCHES "quickjs")
third_party/quickjs/src/core/builtins/js-symbol.c
third_party/quickjs/src/core/builtins/js-typed-array.c
)

if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
add_definitions(-DDDEBUG)
endif ()

if(${STATIC_QUICKJS})
add_library(quickjs STATIC ${QUICK_JS_SOURCE})
else()
Expand Down Expand Up @@ -247,7 +260,10 @@ if ($ENV{WEBF_JS_ENGINE} MATCHES "quickjs")
bindings/qjs/rejected_promises.cc
bindings/qjs/union_base.cc
# Core sources
webf_bridge.cc
core/api/api.cc
core/executing_context.cc
core/script_forbidden_scope.cc
core/script_state.cc
core/page.cc
core/dart_methods.cc
Expand Down Expand Up @@ -287,6 +303,7 @@ if ($ENV{WEBF_JS_ENGINE} MATCHES "quickjs")
core/binding_object.cc
core/dom/node.cc
core/dom/node_list.cc
core/dom/static_node_list.cc
core/dom/node_traversal.cc
core/dom/live_node_list_base.cc
core/dom/character_data.cc
Expand All @@ -305,6 +322,11 @@ if ($ENV{WEBF_JS_ENGINE} MATCHES "quickjs")
core/dom/document_fragment.cc
core/dom/child_node_list.cc
core/dom/empty_node_list.cc
core/dom/mutation_observer.cc
core/dom/mutation_observer_registration.cc
core/dom/mutation_observer_interest_group.cc
core/dom/mutation_record.cc
core/dom/child_list_mutation_scope.cc
core/dom/container_node.cc
core/html/custom/widget_element.cc
core/events/error_event.cc
Expand Down Expand Up @@ -366,6 +388,7 @@ if ($ENV{WEBF_JS_ENGINE} MATCHES "quickjs")
core/svg/svg_circle_element.cc
core/svg/svg_ellipse_element.cc
core/svg/svg_style_element.cc
core/svg/svg_line_element.cc

# Legacy implements, should remove them in the future.
core/dom/legacy/element_attributes.cc
Expand Down Expand Up @@ -406,6 +429,10 @@ if ($ENV{WEBF_JS_ENGINE} MATCHES "quickjs")
out/qjs_touch.cc
out/qjs_touch_init.cc
out/qjs_touch_list.cc
out/qjs_mutation_record.cc
out/qjs_mutation_observer.cc
out/qjs_mutation_observer_init.cc
out/qjs_mutation_observer_registration.cc
out/qjs_touch_event.cc
out/qjs_touch_event_init.cc
out/qjs_pointer_event.cc
Expand Down Expand Up @@ -443,6 +470,7 @@ if ($ENV{WEBF_JS_ENGINE} MATCHES "quickjs")
out/qjs_node_list.cc
out/event_type_names.cc
out/built_in_string.cc
out/mutation_record_types.cc
out/binding_call_methods.cc
out/qjs_scroll_options.cc
out/qjs_scroll_to_options.cc
Expand Down Expand Up @@ -515,6 +543,7 @@ if ($ENV{WEBF_JS_ENGINE} MATCHES "quickjs")
out/qjs_svg_circle_element.cc
out/qjs_svg_ellipse_element.cc
out/qjs_svg_style_element.cc
out/qjs_svg_line_element.cc
)


Expand Down
8 changes: 8 additions & 0 deletions bridge/bindings/qjs/binding_initializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
#include "qjs_message_event.h"
#include "qjs_module_manager.h"
#include "qjs_mouse_event.h"
#include "qjs_mutation_observer.h"
#include "qjs_mutation_observer_registration.h"
#include "qjs_mutation_record.h"
#include "qjs_node.h"
#include "qjs_node_list.h"
#include "qjs_performance.h"
Expand All @@ -77,6 +80,7 @@
#include "qjs_svg_g_element.h"
#include "qjs_svg_geometry_element.h"
#include "qjs_svg_graphics_element.h"
#include "qjs_svg_line_element.h"
#include "qjs_svg_path_element.h"
#include "qjs_svg_rect_element.h"
#include "qjs_svg_style_element.h"
Expand Down Expand Up @@ -165,6 +169,9 @@ void InstallBindings(ExecutingContext* context) {
QJSTouch::Install(context);
QJSTouchList::Install(context);
QJSDOMStringMap::Install(context);
QJSMutationObserver::Install(context);
QJSMutationRecord::Install(context);
QJSMutationObserverRegistration::Install(context);
QJSDOMTokenList::Install(context);
QJSPerformance::Install(context);
QJSPerformanceEntry::Install(context);
Expand All @@ -187,6 +194,7 @@ void InstallBindings(ExecutingContext* context) {
QJSSVGCircleElement::Install(context);
QJSSVGEllipseElement::Install(context);
QJSSVGStyleElement::Install(context);
QJSSVGLineElement::Install(context);

// Legacy bindings, not standard.
QJSElementAttributes::Install(context);
Expand Down
Loading

0 comments on commit 84f5531

Please sign in to comment.