mirror of
https://github.com/Effect-TS/effect.git
synced 2026-12-06 03:59:09 +08:00
Move the HTML modules into effect as effect/ui/html
Fold @effect/ui-html into the effect package. The modules now live in packages/effect/src/ui/html and are exported as effect/ui/html, effect/ui/html/testing and effect/ui/html/<Module>, with ./ui/html/internal/* hidden. Neither the effect/ui barrel, effect/ui/testing nor the root index re-exports them, so only code that imports effect/ui/html needs the DOM lib. An oxlint no-restricted-imports override stops anything else in packages/effect/src from importing ui/html, and check-dist-types now type-checks effect/ui and effect/ui/testing without the DOM lib and with skipLibCheck: false. Tests and type tests move to packages/effect/test/ui/html (run under happy-dom) and packages/effect/typetest/ui/html. The standalone package, its workspace, tsconfig, vitest and lockfile entries, and its changeset entry are removed; the release note is folded into the effect changeset. The scheduler's internal exports are marked @internal, so docgen reports no errors under src/ui.
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
---
|
||||
"effect": patch
|
||||
"@effect/ui-html": patch
|
||||
---
|
||||
|
||||
Add `effect/ui`, a Layer-composed frontend framework for Effect, and `@effect/ui-html`, its HTML package.
|
||||
Add `effect/ui`, a Layer-composed frontend framework for Effect, and `effect/ui/html`, which runs it in the DOM and on the server.
|
||||
|
||||
The host-agnostic core holds `Component`, `Command`, `Subscription`, `Feature` and `View`, plus `Renderer` to mount a component tree on any host and `MessageLog` to record what it does. `effect/ui/testing` adds `Story` for one-instance tests, `TestHost` and `Query` for runtime tests, and `Story.fromLog` to replay a logged session. `Route` defines a typed route table that parses and prints URLs, `Router` holds the current route with navigation and blocking Commands (`Router.push(AppRoute, route)` takes only routes of the table, `Router.memory` is for tests and `Router.static` for the server), and restores a page's Model on back and forward, skipping the `Command.Service`s declared `server: true`, and a component's `head` option sets the document title, meta, links, JSON-LD and `<html>` / `<body>` attributes. The modules are experimental.
|
||||
|
||||
`@effect/ui-html` runs the same components in a real DOM. `Html` is the element vocabulary (typed events with plain payloads, controlled `value` / `checked` / `selected` / `open`, refs typed by tag, and the `focus`, `blur`, `scrollIntoView` and `measure` ref Commands), `BrowserHost.mount` mounts an HTML root into an element with delegated events and keeps the document head in sync, `BrowserRouter` routes through `window.history` with link interception, scroll restoration and route-change announcements, `HtmlQuery` in `@effect/ui-html/testing` finds elements by ARIA role and accessible name.
|
||||
`effect/ui/html` runs the same components in a real DOM. It is the only part of `effect/ui` whose types need the `DOM` lib, and nothing else in `effect` re-exports it. `Html` is the element vocabulary (typed events with plain payloads, controlled `value` / `checked` / `selected` / `open`, refs typed by tag, and the `focus`, `blur`, `scrollIntoView` and `measure` ref Commands), `BrowserHost.mount` mounts an HTML root into an element with delegated events and keeps the document head in sync, `BrowserRouter` routes through `window.history` with link interception, scroll restoration and route-change announcements, `HtmlQuery` in `effect/ui/html/testing` finds elements by ARIA role and accessible name.
|
||||
|
||||
Server rendering: `HtmlServer.renderToHtml` renders a tree to HTML within a `budget`, running only `init`'s `server: true` Commands, and returns the markup, the state the client adopts, the root's Model and the head as escaped strings. `BrowserHost.mount(App, props, container, { state })` hydrates it, adopting the server's nodes and Models, and `root.adopted` completes when no slot is still waiting for its Layer. `Component.provide(..., { server: false })` keeps a Layer off the server, and `ssr` in `@effect/ui-html/testing` renders, hydrates and checks the two agree.
|
||||
Server rendering: `HtmlServer.renderToHtml` renders a tree to HTML within a `budget`, running only `init`'s `server: true` Commands, and returns the markup, the state the client adopts, the root's Model and the head as escaped strings. `BrowserHost.mount(App, props, container, { state })` hydrates it, adopting the server's nodes and Models, and `root.adopted` completes when no slot is still waiting for its Layer. `Component.provide(..., { server: false })` keeps a Layer off the server, and `ssr` in `effect/ui/html/testing` renders, hydrates and checks the two agree.
|
||||
|
||||
```ts
|
||||
import { Schema } from "effect"
|
||||
|
||||
@@ -38,5 +38,21 @@
|
||||
"rules": {
|
||||
"eslint/no-control-regex": "off"
|
||||
}
|
||||
}, {
|
||||
// Only effect/ui/html may use DOM types, so nothing else in effect imports it.
|
||||
"files": ["packages/effect/src/**"],
|
||||
"rules": {
|
||||
"eslint/no-restricted-imports": ["error", {
|
||||
"patterns": [{
|
||||
"regex": "(^|/)ui/html(/|$)|^\\.{1,2}/(\\.\\./)*html(/|$)",
|
||||
"message": "Only effect/ui/html may use DOM types; nothing else in effect may import it."
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"files": ["packages/effect/src/ui/html/**"],
|
||||
"rules": {
|
||||
"eslint/no-restricted-imports": "off"
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
"packages/*/benchmark/",
|
||||
"packages/ai",
|
||||
"packages/atom",
|
||||
"packages/effect/src/ui/html/",
|
||||
"packages/effect/test/cluster/",
|
||||
"packages/effect/test/ui/html/",
|
||||
"packages/opentelemetry/",
|
||||
"packages/platform/browser/",
|
||||
"packages/platform/bun/",
|
||||
@@ -31,7 +33,6 @@
|
||||
"packages/platform/node/",
|
||||
"packages/platform/node-shared/",
|
||||
"packages/tools/",
|
||||
"packages/ui/",
|
||||
"packages/sql"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
"./workers": "./src/workers/index.ts",
|
||||
"./ui": "./src/ui/index.ts",
|
||||
"./ui/testing": "./src/ui/testing/index.ts",
|
||||
"./ui/html": "./src/ui/html/index.ts",
|
||||
"./ui/html/testing": "./src/ui/html/testing/index.ts",
|
||||
"./*": "./src/*.ts",
|
||||
"./ai/internal/*": null,
|
||||
"./cli/internal/*": null,
|
||||
@@ -74,6 +76,7 @@
|
||||
"./rpc/internal/*": null,
|
||||
"./workflow/internal/*": null,
|
||||
"./ui/internal/*": null,
|
||||
"./ui/html/internal/*": null,
|
||||
"./internal/*": null,
|
||||
"./index": null,
|
||||
"./*/index": null
|
||||
@@ -121,6 +124,8 @@
|
||||
"./workers": "./dist/workers/index.js",
|
||||
"./ui": "./dist/ui/index.js",
|
||||
"./ui/testing": "./dist/ui/testing/index.js",
|
||||
"./ui/html": "./dist/ui/html/index.js",
|
||||
"./ui/html/testing": "./dist/ui/html/testing/index.js",
|
||||
"./*": "./dist/*.js",
|
||||
"./internal/*": null,
|
||||
"./cli/internal/*": null,
|
||||
@@ -138,6 +143,7 @@
|
||||
"./rpc/internal/*": null,
|
||||
"./workflow/internal/*": null,
|
||||
"./ui/internal/*": null,
|
||||
"./ui/html/internal/*": null,
|
||||
"./index": null,
|
||||
"./*/index": null
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* `Router` is a host service. Its Layers are `Router.memory` (tests and
|
||||
* `TestHost`), `Router.static` (server rendering) and, in
|
||||
* `@effect/ui-html`, `BrowserRouter.layer` and `BrowserRouter.layerHash`.
|
||||
* `effect/ui/html`, `BrowserRouter.layer` and `BrowserRouter.layerHash`.
|
||||
* Each provides the `Router` service and the navigation Commands, `Push`,
|
||||
* `Replace`, `Back`, `Forward`, `Load`, `Block` and `Unblock`. A component
|
||||
* that navigates has them in its requirements, so a missing Router is a
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* **Example** (Mounting an app)
|
||||
*
|
||||
* ```ts
|
||||
* import { BrowserHost, Html } from "@effect/ui-html"
|
||||
* import { BrowserHost, Html } from "effect/ui/html"
|
||||
* import { Effect, Schema } from "effect"
|
||||
* import { Component } from "effect/ui"
|
||||
*
|
||||
@@ -42,14 +42,14 @@
|
||||
* @stability experimental
|
||||
* @since 4.1.3
|
||||
*/
|
||||
import * as Context from "effect/Context"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Layer from "effect/Layer"
|
||||
import type * as AsyncResult from "effect/reactivity/AsyncResult"
|
||||
import type * as Scope from "effect/Scope"
|
||||
import type * as Component from "effect/ui/Component"
|
||||
import * as Renderer from "effect/ui/Renderer"
|
||||
import type * as View from "effect/ui/View"
|
||||
import * as Context from "../../Context.ts"
|
||||
import * as Effect from "../../Effect.ts"
|
||||
import * as Layer from "../../Layer.ts"
|
||||
import type * as AsyncResult from "../../reactivity/AsyncResult.ts"
|
||||
import type * as Scope from "../../Scope.ts"
|
||||
import type * as Component from "../Component.ts"
|
||||
import * as Renderer from "../Renderer.ts"
|
||||
import type * as View from "../View.ts"
|
||||
import * as Html from "./Html.ts"
|
||||
import * as headSync from "./internal/head.ts"
|
||||
import * as markers from "./internal/markers.ts"
|
||||
+7
-7
@@ -22,7 +22,7 @@
|
||||
* **Example** (A two-page app)
|
||||
*
|
||||
* ```ts
|
||||
* import { BrowserHost, BrowserRouter, Html } from "@effect/ui-html"
|
||||
* import { BrowserHost, BrowserRouter, Html } from "effect/ui/html"
|
||||
* import { Effect, Layer, Option, Schema } from "effect"
|
||||
* import { Component, Route, Router } from "effect/ui"
|
||||
*
|
||||
@@ -64,12 +64,12 @@
|
||||
* @stability experimental
|
||||
* @since 4.1.3
|
||||
*/
|
||||
import * as Context from "effect/Context"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as Option from "effect/Option"
|
||||
import type * as Route from "effect/ui/Route"
|
||||
import * as Router from "effect/ui/Router"
|
||||
import * as Context from "../../Context.ts"
|
||||
import * as Effect from "../../Effect.ts"
|
||||
import * as Layer from "../../Layer.ts"
|
||||
import * as Option from "../../Option.ts"
|
||||
import type * as Route from "../Route.ts"
|
||||
import * as Router from "../Router.ts"
|
||||
import * as submit from "./internal/submit.ts"
|
||||
|
||||
/**
|
||||
@@ -16,7 +16,7 @@
|
||||
* **Example** (Registering the vocabulary for the app)
|
||||
*
|
||||
* ```ts
|
||||
* import { Html } from "@effect/ui-html"
|
||||
* import { Html } from "effect/ui/html"
|
||||
* import { View } from "effect/ui"
|
||||
*
|
||||
* declare module "effect/ui/View" {
|
||||
@@ -31,7 +31,7 @@
|
||||
* **Example** (A controlled text field)
|
||||
*
|
||||
* ```ts import.meta.vitest
|
||||
* import { Html } from "@effect/ui-html"
|
||||
* import { Html } from "effect/ui/html"
|
||||
* import { Schema } from "effect"
|
||||
* import { Component } from "effect/ui"
|
||||
*
|
||||
@@ -58,12 +58,12 @@
|
||||
* @stability experimental
|
||||
* @since 4.1.3
|
||||
*/
|
||||
import * as Context from "effect/Context"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Option from "effect/Option"
|
||||
import * as Command from "effect/ui/Command"
|
||||
import * as Renderer from "effect/ui/Renderer"
|
||||
import * as View from "effect/ui/View"
|
||||
import * as Context from "../../Context.ts"
|
||||
import * as Effect from "../../Effect.ts"
|
||||
import * as Option from "../../Option.ts"
|
||||
import * as Command from "../Command.ts"
|
||||
import * as Renderer from "../Renderer.ts"
|
||||
import * as View from "../View.ts"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// host
|
||||
@@ -89,9 +89,9 @@ export class Host extends Context.Service<Host, {
|
||||
readonly blur: (element: globalThis.Element) => void
|
||||
readonly scrollIntoView: (element: globalThis.Element, options: ScrollOptions) => void
|
||||
readonly measure: (element: globalThis.Element) => Rect
|
||||
}>()("@effect/ui-html/Html/Host") {}
|
||||
}>()("effect/ui/html/Html/Host") {}
|
||||
|
||||
declare module "effect/ui/Command" {
|
||||
declare module "../Command.ts" {
|
||||
interface FrameworkServices {
|
||||
readonly HtmlHost: Host
|
||||
}
|
||||
@@ -772,7 +772,7 @@ export const Measure: Command.Factory<[ref: Renderer.Ref<any>], Option.Option<Re
|
||||
* **Example** (Focusing the new-todo field after adding)
|
||||
*
|
||||
* ```ts
|
||||
* import { Html } from "@effect/ui-html"
|
||||
* import { Html } from "effect/ui/html"
|
||||
* import { Schema } from "effect"
|
||||
*
|
||||
* const Message = Schema.TaggedUnion({ Add: {}, Focused: {} })
|
||||
@@ -21,7 +21,7 @@
|
||||
* **Example** (Rendering a page)
|
||||
*
|
||||
* ```ts
|
||||
* import { HtmlServer } from "@effect/ui-html"
|
||||
* import { HtmlServer } from "effect/ui/html"
|
||||
* import { Effect, Schema } from "effect"
|
||||
* import { Component, Head } from "effect/ui"
|
||||
*
|
||||
@@ -54,12 +54,12 @@
|
||||
* @stability experimental
|
||||
* @since 4.1.3
|
||||
*/
|
||||
import type * as Context from "effect/Context"
|
||||
import type * as Duration from "effect/Duration"
|
||||
import * as Effect from "effect/Effect"
|
||||
import type * as Component from "effect/ui/Component"
|
||||
import * as Renderer from "effect/ui/Renderer"
|
||||
import type * as View from "effect/ui/View"
|
||||
import type * as Context from "../../Context.ts"
|
||||
import type * as Duration from "../../Duration.ts"
|
||||
import * as Effect from "../../Effect.ts"
|
||||
import type * as Component from "../Component.ts"
|
||||
import * as Renderer from "../Renderer.ts"
|
||||
import type * as View from "../View.ts"
|
||||
import type * as BrowserHost from "./BrowserHost.ts"
|
||||
import * as Html from "./Html.ts"
|
||||
import * as server from "./internal/server.ts"
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
* The browser host's head sync: it diffs each merged `Head.Head` against the
|
||||
* document, owning only marked tags plus `<title>` and `lang` / `dir`.
|
||||
*/
|
||||
import * as Head from "effect/ui/Head"
|
||||
import * as Head from "../../Head.ts"
|
||||
|
||||
type Warn = (message: string) => void
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
* Server HTML: the tree, the head tags and the `<html>` / `<body>` attributes
|
||||
* as escaped strings.
|
||||
*/
|
||||
import * as Head from "effect/ui/Head"
|
||||
import type * as Renderer from "effect/ui/Renderer"
|
||||
import * as Head from "../../Head.ts"
|
||||
import type * as Renderer from "../../Renderer.ts"
|
||||
import * as markers from "./markers.ts"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
+2
-2
@@ -17,7 +17,7 @@
|
||||
* **Example** (Finding a button by its name)
|
||||
*
|
||||
* ```ts import.meta.vitest
|
||||
* import { HtmlQuery } from "@effect/ui-html/testing"
|
||||
* import { HtmlQuery } from "effect/ui/html/testing"
|
||||
*
|
||||
* const tree = {
|
||||
* tag: "form",
|
||||
@@ -35,7 +35,7 @@
|
||||
* @stability experimental
|
||||
* @since 4.1.3
|
||||
*/
|
||||
import type * as Query from "effect/ui/testing/Query"
|
||||
import type * as Query from "../../testing/Query.ts"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// trees
|
||||
@@ -17,7 +17,7 @@
|
||||
* **Example** (Checking a page hydrates)
|
||||
*
|
||||
* ```ts
|
||||
* import { ssr } from "@effect/ui-html/testing"
|
||||
* import { ssr } from "effect/ui/html/testing"
|
||||
* import { Effect, Schema } from "effect"
|
||||
* import { Component, Head } from "effect/ui"
|
||||
*
|
||||
@@ -40,17 +40,17 @@
|
||||
* @stability experimental
|
||||
* @since 4.1.3
|
||||
*/
|
||||
import * as Context from "effect/Context"
|
||||
import * as Data from "effect/Data"
|
||||
import type * as Duration from "effect/Duration"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Schema from "effect/Schema"
|
||||
import type * as Scope from "effect/Scope"
|
||||
import type * as Component from "effect/ui/Component"
|
||||
import * as Head from "effect/ui/Head"
|
||||
import * as MessageLog from "effect/ui/MessageLog"
|
||||
import * as Renderer from "effect/ui/Renderer"
|
||||
import type * as View from "effect/ui/View"
|
||||
import * as Context from "../../../Context.ts"
|
||||
import * as Data from "../../../Data.ts"
|
||||
import type * as Duration from "../../../Duration.ts"
|
||||
import * as Effect from "../../../Effect.ts"
|
||||
import * as Schema from "../../../Schema.ts"
|
||||
import type * as Scope from "../../../Scope.ts"
|
||||
import type * as Component from "../../Component.ts"
|
||||
import * as Head from "../../Head.ts"
|
||||
import * as MessageLog from "../../MessageLog.ts"
|
||||
import * as Renderer from "../../Renderer.ts"
|
||||
import type * as View from "../../View.ts"
|
||||
import * as BrowserHost from "../BrowserHost.ts"
|
||||
import * as Html from "../Html.ts"
|
||||
import * as markers from "../internal/markers.ts"
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Test helpers for `@effect/ui-html`: `HtmlQuery`, and `ssr`, which renders
|
||||
* Test helpers for `effect/ui/html`: `HtmlQuery`, and `ssr`, which renders
|
||||
* on the server, hydrates and checks the two agree.
|
||||
*
|
||||
* @stability experimental
|
||||
@@ -7,7 +7,11 @@
|
||||
*/
|
||||
import type * as Command from "../Command.ts"
|
||||
|
||||
/** A run the scheduler knows about: a Command that is running or waiting to run. */
|
||||
/**
|
||||
* A run the scheduler knows about: a Command that is running or waiting to run.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export interface Entry<A> {
|
||||
readonly name: string
|
||||
readonly key: string | undefined
|
||||
@@ -16,7 +20,11 @@ export interface Entry<A> {
|
||||
readonly value: A
|
||||
}
|
||||
|
||||
/** What to do with an issued Command, and which in-flight entries it interrupts. */
|
||||
/**
|
||||
* What to do with an issued Command, and which in-flight entries it interrupts.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export interface Decision<A> {
|
||||
readonly action: "start" | "queue" | "drop" | "none"
|
||||
readonly interrupt: ReadonlyArray<Entry<A>>
|
||||
@@ -34,6 +42,8 @@ const sameGroup = <A>(entry: Entry<A>, name: string, key: string | undefined): b
|
||||
* running run. `queue` waits while the group has a running run. An `Interrupt`
|
||||
* starts nothing and interrupts every run with its name, or only those with
|
||||
* its key when it has one.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export const schedule = <A>(
|
||||
inFlight: ReadonlyArray<Entry<A>>,
|
||||
@@ -63,6 +73,8 @@ export const schedule = <A>(
|
||||
/**
|
||||
* Decides which queued run starts when a running one ends: the oldest queued
|
||||
* run of the same group, if `remaining` no longer has a running one.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export const next = <A>(remaining: ReadonlyArray<Entry<A>>, ended: Entry<A>): Entry<A> | undefined => {
|
||||
const group = remaining.filter((entry) => sameGroup(entry, ended.name, ended.key))
|
||||
|
||||
+3
-2
@@ -1,8 +1,9 @@
|
||||
import { BrowserHost, Html } from "@effect/ui-html"
|
||||
import { HtmlQuery } from "@effect/ui-html/testing"
|
||||
// @vitest-environment happy-dom
|
||||
import { expect, it } from "@effect/vitest"
|
||||
import { Effect, Exit, Option, Schema, Scope } from "effect"
|
||||
import { Component, View } from "effect/ui"
|
||||
import { BrowserHost, Html } from "effect/ui/html"
|
||||
import { HtmlQuery } from "effect/ui/html/testing"
|
||||
import { describe } from "vitest"
|
||||
import { maxTitle, TodoApp } from "./fixtures/todos.ts"
|
||||
|
||||
+3
-2
@@ -1,9 +1,10 @@
|
||||
import { BrowserHost, BrowserRouter } from "@effect/ui-html"
|
||||
import { HtmlQuery } from "@effect/ui-html/testing"
|
||||
// @vitest-environment happy-dom
|
||||
import { expect, it } from "@effect/vitest"
|
||||
import { Context, Effect, Exit, Layer, Option, Scope } from "effect"
|
||||
import { TestClock } from "effect/testing"
|
||||
import { Router } from "effect/ui"
|
||||
import { BrowserHost, BrowserRouter } from "effect/ui/html"
|
||||
import { HtmlQuery } from "effect/ui/html/testing"
|
||||
import { describe } from "vitest"
|
||||
import { App, AppRoute, People } from "./fixtures/routed.ts"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { BrowserHost } from "@effect/ui-html"
|
||||
// @vitest-environment happy-dom
|
||||
import { Head } from "effect/ui"
|
||||
import { BrowserHost } from "effect/ui/html"
|
||||
import { afterEach, describe, expect, it } from "vitest"
|
||||
|
||||
const head = (...entries: ReadonlyArray<Head.Entry>) => Head.merge({ entries, children: [] })
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
import { HtmlQuery } from "@effect/ui-html/testing"
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, expect, it } from "@effect/vitest"
|
||||
import { Effect } from "effect"
|
||||
import { HtmlQuery } from "effect/ui/html/testing"
|
||||
import { Query, Story, TestHost } from "effect/ui/testing"
|
||||
import { TodoApp, TodoAppMessage } from "./fixtures/todos.ts"
|
||||
|
||||
+3
-2
@@ -1,8 +1,9 @@
|
||||
import { BrowserHost, Html, HtmlServer } from "@effect/ui-html"
|
||||
import { ssr } from "@effect/ui-html/testing"
|
||||
// @vitest-environment happy-dom
|
||||
import { expect, it } from "@effect/vitest"
|
||||
import { Context, Effect, Fiber, Layer, Option, Schema } from "effect"
|
||||
import { Command, Component, Feature, Head, Router } from "effect/ui"
|
||||
import { BrowserHost, Html, HtmlServer } from "effect/ui/html"
|
||||
import { ssr } from "effect/ui/html/testing"
|
||||
import { describe } from "vitest"
|
||||
import { App, AppRoute, People } from "./fixtures/routed.ts"
|
||||
|
||||
+1
-1
@@ -3,9 +3,9 @@
|
||||
* page that loads its bio on entry with a server Command, a search route
|
||||
* and a slow page whose provided Layer takes a second to build.
|
||||
*/
|
||||
import { Html } from "@effect/ui-html"
|
||||
import { Context, Effect, Layer, Schema } from "effect"
|
||||
import { Command, Component, Head, Route, Router } from "effect/ui"
|
||||
import { Html } from "effect/ui/html"
|
||||
|
||||
export const AppRoute = Route.union({
|
||||
Home: Route.make("/"),
|
||||
+1
-1
@@ -3,9 +3,9 @@
|
||||
* characters, a keyed list of rows with a controlled checkbox each, and a
|
||||
* button that clears the done ones.
|
||||
*/
|
||||
import { Html } from "@effect/ui-html"
|
||||
import { Schema } from "effect"
|
||||
import { Component } from "effect/ui"
|
||||
import { Html } from "effect/ui/html"
|
||||
|
||||
export const maxTitle = 20
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { BrowserHost, Html } from "@effect/ui-html"
|
||||
import { HtmlQuery } from "@effect/ui-html/testing"
|
||||
import { Effect, Schema, type Scope } from "effect"
|
||||
import { Component, Renderer, type View } from "effect/ui"
|
||||
import { BrowserHost, Html } from "effect/ui/html"
|
||||
import { HtmlQuery } from "effect/ui/html/testing"
|
||||
import type { Query } from "effect/ui/testing"
|
||||
import { describe, expect, it } from "tstyche"
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Effectful Technologies Inc
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,25 +0,0 @@
|
||||
# @effect/ui-html
|
||||
|
||||
The HTML vocabulary, browser host, browser router and server renderer for `effect/ui`, the Layer-composed frontend framework in the `effect` package.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install effect @effect/ui-html
|
||||
```
|
||||
|
||||
## Links
|
||||
|
||||
- [Website](https://effect.website): documentation, guides, and news.
|
||||
- [Reference](https://effect.website/docs/v4/api/ui-html): API documentation for this package.
|
||||
- [Discord](https://discord.gg/effect-ts): ask questions, share what you're building, and talk to the core team.
|
||||
- [Community](https://effect.website/community-hub): meetups and events, or bring Effect to your own.
|
||||
- [Issues](https://github.com/Effect-TS/effect/issues): bug reports and feature requests.
|
||||
|
||||
## Let's talk
|
||||
|
||||
Whether your team is considering Effect, rolling it out, or already running it in production, we'd love to hear from you: what you're building, what works, and what you need from Effect next.
|
||||
|
||||
- **Talk to the maintainers.** Introduce your team on [Discord](https://discord.gg/effect-ts) or email [contact@effectful.co](mailto:contact@effectful.co). We're happy to connect privately on Slack or Discord for feedback and help with adoption.
|
||||
- **Production support.** We're exploring how to better support teams running Effect in production. If your organization has specific support needs, let's discuss them.
|
||||
- **Adoption help.** Our [adoption partners](https://effect.website/adoption-partners) offer implementation, consulting, team extension, training, and commercial support.
|
||||
@@ -1,75 +0,0 @@
|
||||
{
|
||||
"name": "@effect/ui-html",
|
||||
"type": "module",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT",
|
||||
"description": "HTML vocabulary, browser host and server renderer for effect/ui",
|
||||
"homepage": "https://effect.website",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Effect-TS/effect.git",
|
||||
"directory": "packages/ui/html"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Effect-TS/effect/issues"
|
||||
},
|
||||
"tags": [
|
||||
"typescript",
|
||||
"ui",
|
||||
"html",
|
||||
"browser",
|
||||
"functional-programming"
|
||||
],
|
||||
"keywords": [
|
||||
"typescript",
|
||||
"ui",
|
||||
"html",
|
||||
"browser",
|
||||
"functional-programming"
|
||||
],
|
||||
"sideEffects": [],
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": "./src/index.ts",
|
||||
"./testing": "./src/testing/index.ts",
|
||||
"./*": "./src/*.ts",
|
||||
"./internal/*": null,
|
||||
"./index": null,
|
||||
"./*/index": null
|
||||
},
|
||||
"files": [
|
||||
"src/**/*.ts",
|
||||
"dist/**/*.js",
|
||||
"dist/**/*.js.map",
|
||||
"dist/**/*.d.ts",
|
||||
"dist/**/*.d.ts.map",
|
||||
"AGENTS.md",
|
||||
"CLAUDE.md",
|
||||
"ai-docs/**/*"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true,
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": "./dist/index.js",
|
||||
"./testing": "./dist/testing/index.js",
|
||||
"./*": "./dist/*.js",
|
||||
"./internal/*": null,
|
||||
"./index": null,
|
||||
"./*/index": null
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"codegen": "effect-utils codegen",
|
||||
"build": "tsc -b tsconfig.json && pnpm babel",
|
||||
"babel": "babel dist --plugins annotate-pure-calls --out-dir dist --source-maps",
|
||||
"check": "tsc -b tsconfig.json"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"effect": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"effect": "workspace:^"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "../../../tsconfig.base.json",
|
||||
"include": ["src"],
|
||||
"references": [
|
||||
{ "path": "../../effect" }
|
||||
]
|
||||
}
|
||||
Generated
-6
@@ -1067,12 +1067,6 @@ importers:
|
||||
specifier: ^26.6.6
|
||||
version: 26.6.6
|
||||
|
||||
packages/ui/html:
|
||||
devDependencies:
|
||||
effect:
|
||||
specifier: workspace:^
|
||||
version: link:../../effect
|
||||
|
||||
packages/vitest:
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
|
||||
@@ -8,7 +8,6 @@ packages:
|
||||
- packages/platform/*
|
||||
- packages/sql/*
|
||||
- packages/tools/*
|
||||
- packages/ui/*
|
||||
- examples/*
|
||||
|
||||
verifyDepsBeforeRun: error
|
||||
|
||||
@@ -48,10 +48,11 @@ try {
|
||||
Fs.writeFileSync(Path.join(dir, "tsconfig.json"), JSON.stringify(config))
|
||||
execFileSync("pnpm", ["exec", "tsc", "-p", Path.join(dir, "tsconfig.json")], { cwd: root, stdio: "inherit" })
|
||||
|
||||
// Core, crypto and JOSE imports must work without DOM types (see Effect-TS/effect#10115).
|
||||
// Core, crypto, JOSE and UI imports must work without DOM types (see Effect-TS/effect#10115).
|
||||
// Only `effect/ui/html` may need the DOM lib.
|
||||
Fs.writeFileSync(
|
||||
Path.join(dir, "index.ts"),
|
||||
["effect", "effect/Effect", "effect/Schema", "effect/crypto/KeyFormat", "effect/jose"]
|
||||
["effect", "effect/Effect", "effect/Schema", "effect/crypto/KeyFormat", "effect/jose", "effect/ui", "effect/ui/testing"]
|
||||
.map((entry, i) => `import * as _${i} from "${entry}"\nexport { _${i} }\n`).join("")
|
||||
)
|
||||
config.compilerOptions.lib = ["ES2024"]
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as glob from "glob"
|
||||
import madge from "madge"
|
||||
|
||||
madge(
|
||||
glob.globSync(["packages/*/src/**/*.ts", "packages/ai/*/src/**/*.ts", "packages/platform/*/src/**/*.ts", "packages/ui/*/src/**/*.ts"], {
|
||||
glob.globSync(["packages/*/src/**/*.ts", "packages/ai/*/src/**/*.ts", "packages/platform/*/src/**/*.ts"], {
|
||||
ignore: [
|
||||
"packages/sql-sqlite-bun/**",
|
||||
"packages/experimental/src/EventLogServer/Cloudflare.ts"
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import * as Glob from "glob"
|
||||
import * as Fs from "node:fs"
|
||||
|
||||
const dirs = [".", ...Glob.sync("packages/*/"), ...Glob.sync("packages/sql/*/"), ...Glob.sync("packages/tools/*/"), ...Glob.sync("packages/ai/*/"), ...Glob.sync("packages/atom/*/"), ...Glob.sync("packages/platform/*/"), ...Glob.sync("packages/ui/*/")]
|
||||
const dirs = [".", ...Glob.sync("packages/*/"), ...Glob.sync("packages/sql/*/"), ...Glob.sync("packages/tools/*/"), ...Glob.sync("packages/ai/*/"), ...Glob.sync("packages/atom/*/"), ...Glob.sync("packages/platform/*/")]
|
||||
dirs.forEach((pkg) => {
|
||||
const files = [".tsbuildinfo", "tsconfig.tsbuildinfo", "tsconfig.fixtures.tsbuildinfo", "tsconfig.src.tsbuildinfo", "docs", "build", "dist", "coverage"]
|
||||
if (pkg !== ".") {
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
{ "path": "packages/tools/npm-promote" },
|
||||
{ "path": "packages/tools/oxc" },
|
||||
{ "path": "packages/tools/utils" },
|
||||
{ "path": "packages/ui/html" },
|
||||
{ "path": "packages/vitest" }
|
||||
]
|
||||
}
|
||||
|
||||
+2
-3
@@ -41,6 +41,8 @@
|
||||
"effect/schema": ["./packages/effect/src/schema/index.ts"],
|
||||
"effect/ui": ["./packages/effect/src/ui/index.ts"],
|
||||
"effect/ui/testing": ["./packages/effect/src/ui/testing/index.ts"],
|
||||
"effect/ui/html": ["./packages/effect/src/ui/html/index.ts"],
|
||||
"effect/ui/html/testing": ["./packages/effect/src/ui/html/testing/index.ts"],
|
||||
"effect/*": ["./packages/effect/src/*.ts"],
|
||||
"@effect/ai-amazon-bedrock": ["./packages/ai/amazon-bedrock/src/index.ts"],
|
||||
"@effect/ai-amazon-bedrock/*": ["./packages/ai/amazon-bedrock/src/*.ts"],
|
||||
@@ -116,9 +118,6 @@
|
||||
"@effect/oxc/*": ["./packages/tools/oxc/src/*.ts"],
|
||||
"@effect/tools-utils": ["./packages/tools/utils/src/index.ts"],
|
||||
"@effect/tools-utils/*": ["./packages/tools/utils/src/*.ts"],
|
||||
"@effect/ui-html": ["./packages/ui/html/src/index.ts"],
|
||||
"@effect/ui-html/testing": ["./packages/ui/html/src/testing/index.ts"],
|
||||
"@effect/ui-html/*": ["./packages/ui/html/src/*.ts"],
|
||||
"@effect/vitest": ["./packages/vitest/src/index.ts"],
|
||||
"@effect/vitest/*": ["./packages/vitest/src/*.ts"],
|
||||
// TODO: This is a special alias used by some tests. We should try to get rid of it.
|
||||
|
||||
@@ -198,11 +198,6 @@ export default defineConfig({
|
||||
]
|
||||
),
|
||||
...project("@effect/platform-node-shared", "packages/platform/node-shared", isNode),
|
||||
...project("@effect/ui-html", "packages/ui/html", true, {
|
||||
test: {
|
||||
environment: "happy-dom"
|
||||
}
|
||||
}),
|
||||
...project("@effect/vitest", "packages/vitest"),
|
||||
...project("@effect/sql-clickhouse", "packages/sql/clickhouse"),
|
||||
...project("@effect/sql-d1", "packages/sql/d1", !isDeno),
|
||||
|
||||
Reference in New Issue
Block a user