Provides core language-agnostic functionality for LiveView Native across platforms

Overview

LiveView Native Core

This repository contains an implementation of the LiveView Native core library, which is intended to handle all the details which are common across the various platforms on which LiveView Native is used.

Features

Currently, the features planned to be provided by the Core library consists of:

  1. Connection management for the LiveView socket
  2. Initializing a virtual DOM from the page received from the LiveView server, and associated parsing out of components, live views, and statics
  3. Receipt, decoding, and application of changes sent by the LiveView server to the virtual DOM managed by Core
  4. Management of callbacks/event handlers registered from the host language in response to virtual DOM changes

Host languages (e.g. Swift) can then bind to this library, and focus on the details of rendering the UI, rather than on how to interact with the LiveView server.

Status

This library is not quite ready for production use yet, as there are still some details of the API being finalized, and much testing remains to be done. We'll plan to announce the library more publically when it is ready for the community to build with.

License

Apache 2.0. See LICENSE.md.

You might also like...
Rust bindings to the minimalist, native, cross-platform UI toolkit `libui`
Rust bindings to the minimalist, native, cross-platform UI toolkit `libui`

Improved User Interface A cross-platform UI toolkit for Rust based on libui iui: ui-sys: iui is a simple (about 4 kLOC of Rust), small (about 800kb, i

OS-native file dialogs on Linux, OS X and Windows
OS-native file dialogs on Linux, OS X and Windows

nfd-rs nfd-rs is a Rust binding to the library nativefiledialog, that provides a convenient cross-platform interface to opening file dialogs on Linux,

Truly cross platform, truly native. multiple backend GUI for rust
Truly cross platform, truly native. multiple backend GUI for rust

WIP: Sauron-native a rust UI library that conquers all platforms ranging from desktop to mobile devices. An attempt to create a truly native, truly cr

A tiny, neat C library that portably invokes native file open and save dialogs.
A tiny, neat C library that portably invokes native file open and save dialogs.

Native File Dialog A tiny, neat C library that portably invokes native file open, folder select and save dialogs. Write dialog code once and have it p

Cross-platform native Rust menu library

A cross-platform Rust library for managing the native operating system menus.

Native Rust library for FastCGI

The FastCGI Rust implementation. Description gfcgi is a native Rust library for FastCGI. This library supports multithreaded socket listeners and HTTP

OS native dialogs for Windows, MacOS, and Linux

💾 nfd2 nfd2 is a Rust binding to the nativefiledialog library, that provides a convenient cross-platform interface to opening file dialogs on Windows

Winsafe-examples - Examples of native Windows applications written in Rust with WinSafe.
Winsafe-examples - Examples of native Windows applications written in Rust with WinSafe.

WinSafe examples This repo contains several examples of native Win32 applications written in Rust with WinSafe. All examples follow the same program s

Example for Rust Android Native Development
Example for Rust Android Native Development

Android console application example project based on rust & cargo-xdk

Comments
  • Assertion failure when merging document

    Assertion failure when merging document

    Stack trace:

    thread '<unnamed>' panicked at 'assertion failed: old_cursor.depth > new_cursor.depth', crates/core/src/diff/diff.rs:339:17
    stack backtrace:
       0: rust_begin_unwind
                 at ./rustc/0ca356586fed56002b10920fd21ddf6fb12de797/library/std/src/panicking.rs:556:5
       1: core::panicking::panic_fmt
                 at ./rustc/0ca356586fed56002b10920fd21ddf6fb12de797/library/core/src/panicking.rs:142:14
       2: core::panicking::panic
                 at ./rustc/0ca356586fed56002b10920fd21ddf6fb12de797/library/core/src/panicking.rs:48:5
       3: liveview_native_core::diff::diff::diff
                 at ./Users/shadowfacts/Work/liveview-native-core/crates/core/src/diff/diff.rs:339:17
       4: __liveview_native_core$Document$merge
                 at ./Users/shadowfacts/Work/liveview-native-core/crates/core/src/ffi/mod.rs:146:23
       5: $s18LiveViewNativeCore8DocumentC5merge4withyAC_tF
                 at ./Users/shadowfacts/Work/liveview-native-core-swift/Sources/LiveViewNativeCore/LiveViewNative.swift:88:12
       6: $s21PhoenixLiveViewNative0bC11CoordinatorC10handleDiff33_9E05CFBA1D5E03FCD0955515C76F9ED7LL7payload7baseURLySDySSypG_10Foundation0R0VtKF
                 at ./Users/shadowfacts/Work/liveview-client-swiftui/Sources/PhoenixLiveViewNative/LiveViewCoordinator.swift:302:24
       7: $s21PhoenixLiveViewNative0bC11CoordinatorC07connectbC033_9E05CFBA1D5E03FCD0955515C76F9ED7LL5tokenyAC22ConnectionAttemptTokenCyx_G_tYaKFy05SwiftA6Client7MessageCcfU1_yyYaYbScMYccfU_TY0_
                 at ./Users/shadowfacts/Work/liveview-client-swiftui/Sources/PhoenixLiveViewNative/LiveViewCoordinator.swift:425:27
       8: __ZN5swift34runJobInEstablishedExecutorContextEPNS_3JobE
       9: __ZL17swift_job_runImplPN5swift3JobENS_11ExecutorRefE
      10: __dispatch_main_queue_drain
      11: __dispatch_main_queue_callback_4CF
      12: ___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
      13: ___CFRunLoopRun
      14: _CFRunLoopRunSpecific
      15: _GSEventRunModal
      16: -[UIApplication _run]
      17: _UIApplicationMain
      18: _OUTLINED_FUNCTION_51
      19: _OUTLINED_FUNCTION_51
      20: _OUTLINED_FUNCTION_10
      21: $s10NarwinChat0aB3AppV5$mainyyFZ
                 at ./Users/shadowfacts/Work/narwin_chat/priv/clients/ios/narwin-chat/NarwinChat/NarwinChatApp.swift:10:1
      22: main
    

    Old DOM:

    <vstack nav-title="Cottonwood 4-5" roster-link="/room/16/roster">
        <messages-list>
            <vstack>
                <vstack id="102" alignment="leading" pad-leading="8" pad-trailing="8" pad-top="4" pad-bottom="4">
                    <zstack>
                        <hstack>
                            <text font="body" font-weight="bold">
                                Test Test
                            </text>
                            <spacer />
                        </hstack>
                        <hstack>
                            <spacer />
                            <local-time datetime="2022-10-26T17:13:08Z" />
                        </hstack>
                    </zstack>
                    <link-text frame-alignment="leading" fix-multiline-text="">
                        A
                    </link-text>
                </vstack>
            </vstack>
        </messages-list>
        <rectangle frame-height="1" fill-color="#cccccc" />
        <hstack pad-leading="8" pad-trailing="8">
            <phx-form id="post" phx-submit="send" submit-on-enter="">
                <hstack>
                    <textfield name="text" border-style="none" clear-button="while-editing" placeholder="Message" return-key-type="send" />
                    <phx-submit-button after-submit="clear">
                        <text>
                            Send
                        </text>
                    </phx-submit-button>
                </hstack>
            </phx-form>
        </hstack>
    </vstack>
    

    New DOM:

    <vstack nav-title="Cottonwood 4-5" roster-link="/room/16/roster">
        <messages-list>
            <vstack>
                <vstack id="102" alignment="leading" pad-leading="8" pad-trailing="8" pad-top="4" pad-bottom="4">
                    <zstack>
                        <hstack>
                            <text font="body" font-weight="bold">
                                Test Test
                            </text>
                            <spacer />
                        </hstack>
                        <hstack>
                            <spacer />
                            <local-time datetime="2022-10-26T17:13:08Z" />
                        </hstack>
                    </zstack>
                    <link-text frame-alignment="leading" fix-multiline-text="">
                        A
                    </link-text>
                </vstack>
                <vstack id="103" alignment="leading" pad-leading="8" pad-trailing="8" pad-top="4" pad-bottom="4">
                    <zstack>
                        <hstack>
                            <text font="body" font-weight="bold">
                                Test Test
                            </text>
                            <spacer />
                        </hstack>
                        <hstack>
                            <spacer />
                            <local-time datetime="2022-10-26T17:13:17Z" />
                        </hstack>
                    </zstack>
                    <link-text frame-alignment="leading" fix-multiline-text="">
                        B
                    </link-text>
                </vstack>
            </vstack>
        </messages-list>
        <rectangle frame-height="1" fill-color="#cccccc" />
        <hstack pad-leading="8" pad-trailing="8">
            <phx-form id="post" phx-submit="send" submit-on-enter="">
                <hstack>
                    <textfield name="text" border-style="none" clear-button="while-editing" placeholder="Message" return-key-type="send" />
                    <phx-submit-button after-submit="clear">
                        <text>
                            Send
                        </text>
                    </phx-submit-button>
                </hstack>
            </phx-form>
        </hstack>
    </vstack>
    
    bug area/diff 
    opened by shadowfacts 4
  • handle attr changes in simple case of 1 attr => 1 value

    handle attr changes in simple case of 1 attr => 1 value

    This PR adds support for changing an attributes' value -- in the common case, not the multiple-values case.

    (I needed this because I have a LiveView that changes attributes, and I saw that this was a 'todo').

    I marked it a draft because I see indications that LVNC aspires to handle multiple values for attributes -- an example used in the tests is web-inspired, like: <body class="a" class="b"></body>.

    In the case of LiveViewNative it feels like you could just say "people, let's not do that", if you really wanted ...

    opened by mrluc 1
  • Add a print_node helper and expose FFI

    Add a print_node helper and expose FFI

    Useful for debugging when you need to compare two nodes.

    Also re-adds the C headers that were removed in 9966a1851a487479a6d829dd212850869ac9872e, but in the new location.

    opened by shadowfacts 1
Releases(0.1.0-ca48f8c)
Owner
LiveView Native
Native platform implementations of the Phoenix LiveView protocol
LiveView Native
A tongue-in-cheek GUI that provides similar functionality to GNU cat

catboy a tongue-in-cheek GUI that provides similar functionality to GNU cat information: Attribute Value Development Status: Active Neglect Price: I h

toasterrepairman 2 Feb 9, 2022
An interactive JSON tree visualiser for egui, with search and highlight functionality.

egui_json_tree An interactive JSON tree visualiser for egui, with search and highlight functionality. Usage use egui::{Color32}; use egui_json_tree::{

null 13 Sep 1, 2023
Windows Native Undocumented API for Rust Language 🔥

Windows Native   The Windows-Native Rust library provides a convenient and safe way to access the native Windows undocumented APIs using the Rust prog

null 3 Aug 22, 2023
Rust bindings to Core Foundation and other low level libraries on Mac OS X and iOS

core-foundation-rs Compatibility Targets macOS 10.7 by default. To enable features added in macOS 10.8, set Cargo feature mac_os_10_8_features. To hav

Servo 685 Jan 2, 2023
Test bed for gtk-rs-core experiments

Rust GObject Experiments class macro #[gobject::class(final)] mod obj { #[derive(Default)] pub struct MyObj { #[property(get, set)]

Jason Francis 2 May 28, 2022
An Anime Game Launcher variant written on Rust, GTK4 and libadwaita, using Anime Game Core library

An Anime Game Launcher GTK The launcher variant written on Rust, GTK4 and libadwaita, using Anime Game Core library You could also try the main branch

An Anime Team 77 Jan 9, 2023
Honkers Launcher variant written on Rust, GTK4 and libadwaita, using Anime Game Core library

You could also try the main branch Development Folder Description ui Blueprint UI files ui/.dist UI files compiled by the blueprint src Rust source co

An Anime Team 9 Nov 2, 2022
autogen website (with Deno Core)

Kurit Static website generator ?? Warning WIP: It is still under development, so some of the features may not be developed. Project Structures graph T

null 11 Oct 16, 2023
A data-first Rust-native UI design toolkit.

Druid A data-first Rust-native UI toolkit. Druid is an experimental Rust-native UI toolkit. Its main goal is to offer a polished user experience. Ther

null 8.2k Dec 31, 2022
Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.

libui: a portable GUI library for C This README is being written. Status It has come to my attention that I have not been particularly clear about how

Pietro Gagliardi 10.4k Dec 31, 2022