ns-octane 是一个使用 Octane 编译时框架的 NativeScript 应用,无需虚拟 DOM 或 DOM shim,通过提前编译和通用宿主驱动渲染视图。

Stars

12

7 天增长

暂无数据

Fork 数

1

开放 Issue

0

开源协议

Apache-2.0

最近更新

2026-07-28

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它展示了通过消除虚拟 DOM 和运行时响应式来渲染 NativeScript 的新方法,使用静态计划+插槽表模型,并包含高级 iOS 功能,如 SwiftUI 集成和自定义 Metal 着色器。

适合谁使用

  • 寻求替代渲染架构的 NativeScript 开发者
  • 对编译时框架感兴趣的 Web 开发者
  • 探索无虚拟 DOM 方法的移动应用开发者
  • 希望将 SwiftUI/Metal 效果集成到 NativeScript 的开发者

典型使用场景

  • 构建高性能、低运行时开销的 NativeScript 应用
  • 尝试提前编译的组件框架
  • 在 NativeScript 应用中集成自定义 SwiftUI 视图和 Metal 着色器
  • 学习非 DOM 环境的通用宿主驱动模式

项目优势

  • 提前编译消除了虚拟 DOM 和运行时差异
  • 通过小型驱动和内部模块与 @nativescript/core 干净集成
  • 使用 Tailwind v4 样式无需配置文件
  • 展示 SwiftUI 和 NativeScript 之间通过着色器统一和事件的双向状态流

使用前须知

  • iOS 着色器功能需要 iOS 17+,且 Android 不可用
  • 标签名必须小写,驼峰命名会导致类型错误
  • 热重载被禁用(--no-hmr),可能降低开发迭代速度
  • 依赖 Octane 框架,其生态系统比 React 或 Vue 小

README 快速开始

ns-octane

A NativeScript app rendered by Octane. No React, no virtual DOM, no DOM shim.

Octane compiles components ahead of time. For a renderer-owned .tsx it emits a static plan plus a slot table rather than a tree of elements:

universalPlan("nativescript", {
  kind: "host", type: "gridlayout", props: { rows: "*,auto,auto,auto,*" },
  children: [{ kind: "host", type: "label", bindings: [["row", 0]], … }]
})

At runtime that plan turns into a batch of create / update / insert / event / destroy commands. Applying those commands to @nativescript/core views is the entire port.

How it is wired

Octane ships octane/universal/native, a host-neutral runtime with no dependency on its DOM half — built for JS environments without DOM globals, which is exactly NativeScript. The integration is four small modules in src/octane/, following the shape @octanejs/three uses for its non-DOM renderer:

FileRole
config.tsSerializable renderer metadata, read by vite.config.ts
renderer.tsCompiler-facing ABI — re-exports the universal runtime
driver.tsUniversalHostDriver: host commands → NativeScript views
intrinsics.tsJSX element types, derived from the core view classes
elements.tsTag name → view constructor, plus event-name aliasing

@octanejs/vite-plugin runs alongside @nativescript/vite, with the renderer scoped to src/**/*.tsx by rule. Everything else stays untouched.

Three details worth knowing before editing:

  • Tag names are lowercase, , ``. They match the driver's registry keys. Unknown or camelCase names are a type error, not a blank screen.
  • Props are view properties, not attributes. The driver assigns them onto the instance, so anything on the @nativescript/core class works and is typed as such.
  • Text is a host node. Octane lowers Hi to a #text child; the driver keeps those viewless and folds them into the parent's text, since NativeScript has no text nodes.

Styling

Tailwind v4 through @nativescript/tailwind, which auto-registers its PostCSS chain — no postcss.config.js or tailwind.config.js. app.css imports theme and utiliti

项目描述

Octane with NativeScript

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

makecindy
精选
makecindy GitHub avatar

cindy

Cindy is an open-source AI agent that runs locally on your machine, integrates multiple AI harnesses and models, and provides memory, skills, and automation to perform real work in your projects and apps.

AI 与机器学习大语言模型
958
uzairansaruzi
精选
uzairansaruzi GitHub avatar

hermex

Hermex is a native SwiftUI iPhone app that lets you control a self-hosted Hermes AI agent directly from your phone, with no subscriptions, tracking, or third-party relay.

AI 与机器学习大语言模型
941
nsdkinx
精选
nsdkinx GitHub avatar

twell

Twell is a tiny, embeddable, zero-allocation physics engine for interruptible, Apple-style UI animations, available as a single-header C library with Python bindings.

移动开发设计与创意
17