0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-25 13:19:30 +01:00
Commit Graph

11 Commits

Author SHA1 Message Date
Taku Amano
fbed2df668
fix(jsx): allow null, undefined, and boolean to be returned from function component (#3241)
* fix(jsx): allow `null`, `undefined`, and `boolean` to be returned from function component

* fix(jsx): allow `null` to be returned from `FC` type

* test: add test for empty fragment in `"jsx": "precompile"`

Empty Fragment is converted to null in `"jsx": "precompile"`, so add a test for that pattern
2024-08-08 22:14:35 +09:00
Taku Amano
4201a29490 feat(jsx/dom): Compatible implementation of new features in React 19 (document metadata, "form" element and related hooks, and new behavior of hooks) (#2960)
* feat(jsx/dom): Introduce document metadata integration for compatibility with React 19

* test(jsx/dom): add test for "ref as a prop"

* refactor: tweaks element selector

* feat(jsx/dom): implement " Cleanup functions for refs" for compatibility with React 19

* feat(jsx/dom): implement `useDeferredValue()`

* refactor(jsx): insert metadata into head synchronously

* feat(jsx/dom): introduce form and related hooks

* feat(jsx): sort by precedence in documentMetadataTag

* feat(jsx): enable to specify action attribute as function

* fixup! feat(jsx): enable to specify action attribute as function

* refactor: refactor file layout

* feat(jsx): de-dupe tags

* feat(jsx): accept crossOrigin as crossorigin

* feat(jsx/dom): inprement blocking and precedence feature for jsx/dom

* feat(jsx): export new hooks

* fix(jsx/dom): fix some bugs in jsx/dom/hooks

* fix(jsx/dom): fix useOptimistic hook

* fix(jsx/dom): fix signature of useActionState

* fix(jsx): fix type declaration for HtmlEscapedCallback

* refactor(jsx): improve importing of intrinsic element components

* feat(jsx): support permalink for useActionState

* fix(jsx): fix composeRef cleanup in intrinsic element components

* fix(jsx): remove blocking attribute from DOM node

* fix(jsx/dom): preserve HTMLElement for meta data if it will be unmounted

* fix(jsx/dom): fix de-dupe logic in `documentMetadataTag`

* fix(jsx/dom): fix precedence logic in `documentMetadataTag`

* feat(jsx): add React 19 compatibility attributes

* fix(jsx): Handle NodeListOf<HTMLElement> as an iterable

* test: tweaks test data

* fix(jsx/dom): fix precedence logic in `documentMetadataTag`

* fix(jsx/dom): fix meta data tag insertion behavior

* fix(jsx/dom): set next node recursively for all previous nodes

* refactor(jsx/dom): use better variable names and types in form component

* fix(jsx/dom): fix meta data tag insertion behavior

* fix(jsx): improve document meta tag behavior in jsx

* test(jsx/dom): add tests for intrinsic-element/components

* fix(jsx/dom): fix `use()` hook wrong behavior

* test(jsx/dom): add tests for hooks

* test(jsx): add tests new hooks for form

* fix(jsx): update current state synchronously if no actions are provided

* test(jsx): add tests for new hooks for form handling

* docs(jsx): add documentation for hooks

* test(jsx): Update test

* refactor(jsx/hooks): remove unused constant

* feat(jsx): improve compatibility with React 19 (precedence / special behavior)

* feat(jsx/dom): improve compatibility with title element mount/unmount behavior

* feat(jsx): support async function for useTransition

* fix(jsx/dom): method is always 'post' when data is present

* feat(jsx): support formAction for input and button elements

* feat(jsx/dom): support suspense with child counter

* feat(jsx/dom): enable to handle async error in useTransition
2024-06-27 10:37:57 +09:00
Yusuke Wada
cc4b2b3c7f
chore(lint): update eslint rules (#2790)
* chore(lint): update eslint rules

* fix formats
2024-05-26 05:17:45 +09:00
ryu
82cfd466f2
chore(deno): change path including deno_dist (#2788) 2024-05-26 04:41:48 +09:00
Yusuke Wada
1b2a4c0800
feat(jsr): support JSR (#2662)
* feat(jsr): reduce slow types (#2369)

* feat(jsr): reduce slow types

* fix: use allow function

* chore: format code

* chore: denoify

* add `deno.json`

* add `jsr-dry-run` command for CI

* don't put `JSX` on `global`

* fix test settings for deno

* don't use `dynamicClass`

* don't declare `ExecutionContext` in `global`

* goodbye denoify

* exports `./middleware`

* exports `./helper`

* exports each helper and middleware

* remove the `awslambda` implementation which is not enough

* feat(jsr): remove helper.ts and middleware.ts (#2667)

* feat(jsr): remove helper.ts and middleware.ts

* fix: fix test

* dont' use `SuperClass`

Co-authored-by: Taku Amano <taku@taaas.jp>

* feat(jsr): delete `mod.ts` (#2669)

* rename `deno.json` to `jsr.json`

* lint

* remove slow type in lambda adapter

* fixed runtime test for deno

* export all utils

* add a GitHub action to publish the package to JSR

* fixed declaring `ContextVariableMap`

* fixed the type error

* include `jsr.json` in `jsr.json`

* update `jsr.json`

---------

Co-authored-by: Shotaro Nakamura <79000684+nakasyou@users.noreply.github.com>
Co-authored-by: Taku Amano <taku@taaas.jp>
2024-05-24 17:47:28 +09:00
Taku Amano
b4912f32b6
fix(deno/jsx-precompile): use html() tag function if value is a promise (#2283) 2024-02-28 17:13:45 +09:00
Taku Amano
473a6f0999
refactor: jsx streaming (#2216)
* refactor(jsx): tweaks loop in order to avoid error for blank content

* feat(jsx): add data-hono-target attribute to streaming content

* chore: denoify

* test: fix runtime_tests/deno-jsx/jsx.test.tsx
2024-02-16 09:04:22 +09:00
Yusuke Wada
a183fe403e
chore: enables lint and format for .tsx (#1994)
* chore: enables lint and format for `.tsx`

* ignore
2024-01-16 18:38:26 +09:00
Taku Amano
62f11a2817
feat(jsx/dom): rewrite renderer to use virtual tree (#1981)
* feat(jsx/dom): rewrite renderer to use virtual tree

* test(deno): add runtime_tests/deno/deno.json in order to allow `document`, `Element`, etc.

* refactor(jsx/dom): Removed redundant `map()` calls

* refactor(jsx/dom): tweaks getNextChildren for reduce code size

* refactor(jsx/dom): optimize findInsertBefore

* refactor(jsx/dom): optimize `build()`

* refactor(jsx/dom): reuse oldChild even in text nodes.

* feat(jsx/dom): handle promise rejection in use()

* feat(jsx): The result of using Suspense and use() is now the same as React's renderToReadableStream().

* chore: denoify

* test(deno): "dom.iterable" is required for 'Headers.entries()'
2024-01-16 11:32:44 +09:00
Taku Amano
cd6c488b76
feat(jsx): Introduce ErrorBoundary component (#1714)
* feat(jsx/streaming): Support Suspense in non-streaming mode.

* feat(jsx): Introduce ErrorBoundary component.

* chore: denoify

* feat: Support ErrorBoundary[fallbackRender].

* chore: denoify

* Rename utils.ts to components.ts

* refactor: export the ErrorBoundary component from the top level.

* fix: tweaks `resolveStream` to work with nested components

* refactor: Import `childrenToString` from `components.ts`

* fix: return immediately if the element is not found

* test: add test for jsx/components

* fix: run `npm run format:fix`

* chore: denoify
2023-11-21 18:05:05 +09:00
Taku Amano
652ef7c867
feat(jsx): Define jsxTemplate/jsxAttr/jsxEscape for "@jsx precompile" of Deno 1.38 (#1651)
* fix(jsx/streaming): Fix for renderToReadableStream(promise: Promise<HtmlEscapedString>).

* feat(jsx): Define jsxTemplate/jsxAttr/jsxEscape for "@jsx precompile" of Deno 1.38

* chore: denoify

* fix(jsx/streaming): some times jsxDEV is called with null props.

* test(deno-jsx): Add runtime tests for JSX by Deno.

* test: Refactor import map.

* test: Added @jsxImportSource to avoid type warnings
2023-11-08 21:07:35 +09:00