Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fable": {
"version": "5.0.0",
"version": "5.23.0",
"commands": [
"fable"
],
Expand All @@ -17,7 +17,7 @@
"rollForward": false
},
"fantomas": {
"version": "7.0.1",
"version": "8.1.0",
"commands": [
"fantomas"
],
Expand Down
31 changes: 24 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Release to NuGet

on:
push:
branches: [ main, 'major/**' ]
branches: [main, "major/**"]

jobs:

release-to-nuget:

permissions:
id-token: write # enable GitHub OIDC token issuance for this job
runs-on: ubuntu-latest

steps:
Expand All @@ -17,13 +17,30 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '8.0.x'
dotnet-version: "8.0.x"

- name: Setup Node.js and NPM
uses: actions/setup-node@v5
with:
node-version: '20'
cache: 'npm'
node-version: "20"
cache: "npm"

- name: Setup
run: dotnet run --project ./build/Build.fsproj setup

- name: Test .NET and NPM projects
run: dotnet run --project ./build/Build.fsproj test

- name: Build .NET and NPM projects
run: dotnet run --project ./build/Build.fsproj pack

# Get a short-lived NuGet API key
# https://learn.microsoft.com/en-gb/nuget/nuget-org/trusted-publishing#github-actions-setup
- name: NuGet login (OIDC → temp API key)
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.NUGET_USER }} # Recommended: use a secret like ${{ secrets.NUGET_USER }} for your nuget.org username (profile name), NOT your email address

- name: Release to NuGet
run: dotnet run --project ./build/Build.fsproj release-pipeline ${{ secrets.NUGET_API_KEY }}
run: dotnet run --project ./build/Build.fsproj release ${{steps.login.outputs.NUGET_API_KEY}}
50 changes: 50 additions & 0 deletions AGENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Feliz agent guide

## Purpose and scope

Feliz is an F# DSL and Fable binding for React. Its core package lets applications describe HTML, SVG, properties, styles, components, and React hooks in typed F# while Fable emits JavaScript. The repository also contains optional Feliz packages, Vitest bindings, tests, a playground, and the documentation site.

Use `docs/docs/` for the current Feliz 3 API. `docs/versioned_docs/version-2.9.0/` is a snapshot of the older API; do not copy its examples into current code without checking the migration guide at `docs/docs/api-docs/Upgrade.md`. The core project currently targets React 19 through its npm dependency requirements. Check the project's actual package versions before giving installation advice; some documentation snippets still show Feliz 2.9.0.

## Using Feliz in an application

- Add the `Feliz` NuGet package and install the matching JavaScript `react` and `react-dom` packages. A new application can start from `Feliz.Template`; an existing one can use Femto to install the .NET and npm dependencies together. See `docs/docs/api-docs/GettingStarted.mdx`.
- `open Feliz`. Build elements with `Html.*`, properties with `prop.*`, and typed inline CSS with `prop.style [ style.* ]`. For SVG, use the corresponding `Svg` API. See `docs/docs/api-docs/feliz/Html.mdx` and the examples in `docs/docs/feliz-docs/Examples/Feliz/`.
- An `Html.*` list is either a list of children or a list of properties. When passing properties, place children inside `prop.children [...]`; use `prop.text` for simple text. Do not mix bare children with properties in the same list.
- Use `[<ReactComponent>]` on a function that returns a React element, then call it normally from parent F# code. Its parameters become React props. `[<ReactComponent(true)>]` additionally makes it the module's default export; it is not required for ordinary components. See `docs/docs/api-docs/feliz/react-component.mdx` and `passing-props.mdx`.
- Keep state and effects inside components with `React.useState`, `React.useEffect`, and the other React hooks. Use `React.useStateWithUpdater` when the next state must be computed from the previous state. Clean up subscriptions or timers in effects. See `docs/docs/api-docs/react/hooks/`.
- F# `if`, `match`, `for`, and `List.map` work in element construction. Give dynamic siblings stable `prop.key` values; default Feliz element creation may not produce React's missing-key warning. `Html.none` renders nothing. See `conditional-rendering.mdx`, `rendering-lists.mdx`, and `Html.mdx` under `docs/docs/api-docs/feliz/`.
- Mount the app with `ReactDOM.createRoot` and `root.render`. See `docs/docs/api-docs/react-dom/client-apis/createRoot.mdx`.

```fsharp
open Feliz

[<ReactComponent>]
let Counter() =
let count, setCount = React.useState(0)
Html.div [
Html.button [
prop.onClick (fun _ -> setCount(count + 1))
prop.text "Increment"
]
Html.p [ prop.text (string count) ]
]
```

For optional integrations, use their own package and documentation: `Feliz.UseElmish` for an Elmish model inside a component, `Feliz.Recharts` and `Feliz.PigeonMaps` for visualizations, and the other packages catalogued in `docs/docs/ecosystem/`. The `Feliz.JSX` module is an alternative output path; it requires `.jsx` Fable output and has documented limitations, so consult `docs/docs/api-docs/guides/output-jsx.mdx` before using it. For JavaScript library interop, start with `docs/docs/api-docs/guides/writing-bindings.mdx`.

## Repository map

- `src/Feliz/`: core public API. `Html.fs`, `Svg.fs`, `Properties.fs`, `Styles.fs`, and `React/` implement the DSL and React bindings. `Feliz.fsproj` defines F# compilation order and references `src/Feliz.CompilerPlugins/`, which implements component-related transforms.
- `src/Feliz.*` and `src/Vitest*`: companion libraries and test bindings. Each package has its own project file and usually a `CHANGELOG.md`.
- `tests/`: F# and npm/Vitest test projects. `tests/README.md` describes the test layout.
- `docs/docs/api-docs/`: current guides and API reference. `docs/docs/feliz-docs/Examples/`: F# examples compiled into live Docusaurus examples by `docs/docs/feliz-docs/Feliz.Docs.fsproj`. `docs/versioned_docs/`: historical docs.
- `playground/`: small application for trying changes. `build/Build.fsproj` and `build/Program.fs`: setup, test, pack, and release commands.

## Working in this repository

- Follow the relevant current guide and its compiled example before changing an API. Keep `src`, matching tests, live examples, and API documentation in sync. Respect `.fsproj` compile ordering when adding F# files.
- Use the shared root `package.json` npm workspaces and `Directory.Packages.props` for dependencies; the repo pins its .NET SDK in `global.json` and local Fable tools in `.config/dotnet-tools.json`.
- Run `dotnet run --project ./build/Build.fsproj setup` for initial setup. Run `dotnet run --project ./build/Build.fsproj test` for the test suite, or append a test folder name to target one project (for example, `test Feliz`).
- For documentation work, run `npm run start` from `docs/` to compile the F# examples and start Docusaurus; run `npm run build` there to verify a production docs build.
- Follow `CONTRIBUTING.md` for formatting, tests, and changelog entries. Avoid editing generated output or dependency directories such as `node_modules/`, `obj/`, `bin/`, and `docs/.docusaurus/` by hand.
141 changes: 0 additions & 141 deletions Feliz.Pack.sln

This file was deleted.

24 changes: 24 additions & 0 deletions Feliz.Pack.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Solution>
<Folder Name="/tests/">
<Project Path="tests/Feliz.CompilerPlugin/Feliz.CompilerPlugins.Tests.fsproj" />
</Folder>
<Project Path="src/Feliz.CompilerPlugins/Feliz.CompilerPlugins.fsproj" />
<Project Path="src/Feliz.Delay/Feliz.Delay.fsproj" />
<Project Path="src/Feliz.Kawaii/Feliz.Kawaii.fsproj" />
<Project Path="src/Feliz.Listeners/Feliz.Listeners.fsproj" />
<Project Path="src/Feliz.Markdown/Feliz.Markdown.fsproj" />
<Project Path="src/Feliz.PigeonMaps/Feliz.PigeonMaps.fsproj" />
<Project Path="src/Feliz.Popover/Feliz.Popover.fsproj" />
<Project Path="src/Feliz.Recharts/Feliz.Recharts.fsproj" />
<Project Path="src/Feliz.RoughViz/Feliz.RoughViz.fsproj" />
<Project Path="src/Feliz.SelectSearch/Feliz.SelectSearch.fsproj" />
<Project Path="src/Feliz.Template/Feliz.Template.fsproj" />
<Project Path="src/Feliz.UseDeferred/Feliz.UseDeferred.fsproj" />
<Project Path="src/Feliz.UseElmish/Feliz.UseElmish.fsproj" />
<Project Path="src/Feliz.UseMediaQuery/Feliz.UseMediaQuery.fsproj" />
<Project Path="src/Feliz/Feliz.fsproj" />
<Project Path="src/Vitest.JestDom/Vitest.JestDom.fsproj" />
<Project Path="src/Vitest.ReactTestingLibrary/Vitest.ReactTestingLibrary.fsproj" />
<Project Path="src/Vitest.UserEvent/Vitest.UserEvent.fsproj" />
<Project Path="src/Vitest/Vitest.fsproj" />
</Solution>
Loading
Loading