Skip to content

Instantly share code, notes, and snippets.

View bcardarella's full-sized avatar
Out sailing

Brian Cardarella bcardarella

Out sailing
View GitHub Profile

PhoenixLiveViewWasm

Build the Wasm bundle with:

mix bundle_phoenix_live_view --phoenix v1.8.0-rc.3 --phoenix-live-view v1.1.0-rc.1

There is a Rust plugin that handles interfacing between JS and Elixir at priv/browser_plugin/src/lib.rs.

To define a function in Elixir that Wasm can call, use the defimport macro:

# Racing.org Platform - High-Level Requirements
## Project Objective
Build Racing.org as a free, comprehensive regatta management platform that introduces and promotes the OpenVPP rating system while providing modern, mobile-first regatta management tools that surpass existing commercial platforms in user experience and functionality.
---
## Core Business Requirements
@bcardarella
bcardarella / racing.md
Created July 3, 2025 01:07
racing.org plan

Racing.org Landing Page - Multi-Persona Information Hierarchy

Comprehensive Platform for the Global Sailing Community


Page Structure Overview

Primary Objective: Serve as the central hub for sailing that connects boat owners, race organizers, and crew while promoting fair racing through OpenVPP and free platform access.

Core User Personas:

@bcardarella
bcardarella / vml-winui3.md
Created June 24, 2025 16:34
VML - WinUI3

View Markup Language (VML) Specification - WinUI3

Version 1.0-alpha.1 (WinUI 3 / XAML)

1. Overview

View Markup Language (VML) is a markup language derived from SGML, designed to represent a XAML-based UI for unidirectional, server-driven rendering on the WinUI 3 platform. It is designed to be a subset of XAML concepts, making it highly idiomatic for Windows developers.

Specification Note 1.1: Scope The VML specification is concerned exclusively with the structure and rendering of UI elements. It is a unidirectional standard (server-to-client). Mechanisms for handling user interactions, events, and data binding ({Binding}, {x:Bind}) are explicitly outside the scope of this document.

@bcardarella
bcardarella / vml-jetpack.md
Created June 24, 2025 15:34
VML - Jetpack Compose

View Markup Language (VML) Specification - Jetpack Compose

Version 1.0-alpha.1

1. Overview

View Markup Language (VML) is a markup language derived from SGML, designed to represent composable UI frameworks for unidirectional, server-driven rendering. This specification defines the conversion from a server-side view model to VML for use with Jetpack Compose.

Specification Note 1.1: Scope The VML specification is concerned exclusively with the structure and rendering of composables. It is a unidirectional standard (server-to-client). Mechanisms for handling user interactions, actions, and client-to-server state changes are explicitly outside the scope of this document.

defmodule Task do
defp await_one(tasks, timeout \\ 5_000) when is_list(tasks) do
awaiting =
Map.new(tasks, fn %Task{ref: ref, owner: owner} = task ->
if owner != self() do
raise ArgumentError, invalid_owner_error(task)
end
{ref, true}
end)
import SwiftUI
import LiveViewNative
@LiveElement
struct WebView<Root: RootRegistry>: View {
var body: some View {
WebView(url: URL(string: "http://example.net")).ignoresSafeArea()
}
}
@bcardarella
bcardarella / vml-swiftui.md
Last active June 25, 2025 01:45
VML - SwiftUI

View Markup Language (VML) Specification - SwiftUI

Version 1.0-alpha.1

1. Overview

View Markup Language (VML) is a markup language derived from SGML, designed to represent composable UI frameworks for unidirectional, server-driven rendering. This specification defines the conversion from a server-side view model, such as SwiftUI, to VML.

Specification Note 1.1: Scope The VML specification is concerned exclusively with the structure and rendering of views. It is a unidirectional standard (server-to-client). Mechanisms for handling user interactions, actions, and client-to-server state changes are explicitly outside the scope of this document.

I'd like to vet two scenarios:

  • new Phoenix app
  • existing Phoenix app

Add these deps:

{:live_view_native, github: "liveview-native/live_view_native", branch: "main", override: true},
{:live_view_native_stylesheet, github: "liveview-native/live_view_native_stylesheet", branch: "main", override: true},

reproduce match?

Section

defmodule Foo do

  # stolen from:
  # https://github.com/elixir-lang/elixir/blob/v1.16.3/lib/elixir/lib/kernel.ex#L3401-L3412
  defmacro bar(pattern, expr) do