0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-29 01:32:12 +01:00
Commit Graph

21 Commits

Author SHA1 Message Date
Taku Amano
0ed91a7ad1
fix(jsx): fix context provider with async component (#2124)
* test(jsx): add test for Context with Suspense

* fix(jsx): fix context provider with async component

* chore: denoify
2024-01-31 23:26:04 +09:00
Taku Amano
2d8d59f1e8
fix(jsx): fix jsx-runtime for falsy children (#1910) 2024-01-08 04:37:04 +09:00
Yusuke Wada
74287a82cc
feat: introduce css Helper (#1850)
* feat: introduce CSS Helper

* shorten

* feat(css): Implement css helper with callback (#1858)

* feat(css): Implement css helper with callback

* feat(css): add keyframes and pseudo selectors support

* fix(css): Specify missing "context" argument in resolveCallback()

* feat(css): use WeakMap instead of Map, to avoid memory leak

* feat(css): improve CSS helper

* fix(css): fix formatting and types in css helper

* chore: denoify

* docs(css): add experimental flag to css helper

* feat(css): Enable to embed sub `css`.

* fix(css): propagate selector to parent class

* feat(css): Use Record again for usedClassNameData

* feat(css): escape only close tag "</...>", not all slashes. we can use url() without escaping.

* fix(css): embedded `css` must have ";"

* Fix format.

* feat(css): add cx() helper

`cx()` is a helper function to combine multiple css classes.
This function is compatible with `cx()` in @emotion/css.

* feat(css): ignore boolean, null, and undefined values as same as jsx

* chore: denoify

* feat(css): enable to use cx() with external class name

* refactor(css): use symbols for keys

* chore: denoify

---------

Co-authored-by: Taku Amano <taku@taaas.jp>
2024-01-02 22:47:42 +09:00
Yusuke Wada
5f42d3cca4
feat(jsx): mark ErrorBoundary as experimental (#1771)
* feat(jsx): mark `ErrorBoundary` as `experimental`

* denoify
2023-12-04 05:56:25 +09:00
Yusuke Wada
19641d07c1 Merge branch 'main' into next 2023-11-28 18:00:14 +09:00
Taku Amano
c3275eebf0
fix(jsx): Write the raw value if the value is a HtmlEscaped string (#1739)
* fix(jsx): Write the raw value if the value is a HtmlEscaped string

* chore: denoify
2023-11-27 17:19:35 +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
fa1abf637b
fix(jsx/streaming): Fixed a problem when multiple children are added directly under Suspense. (#1665)
* fix(jsx/streaming): Fixed a problem when multiple children are added directly under Suspense.

* refactor: Use `raw()` helper as constructor of `HtmlEscapedString`.

* chore: denoify.
2023-11-09 14:37:47 +09:00
Taku Amano
ebd43b91ff
feat(jsx-renderer): Support "stream" option in jsxRenderer. (#1662)
* fix(jsx/streaming): Fix await order again.

* feat(jsx): Support async component in useContext().

* fix(html): fix async component bug in html helper.

* feat(jsx-renderer): Support "stream" option in jsxRenderer.

* chore: denoify

* fix(jsx-renderer): Add "eslint-disable @typescript-eslint/no-explicit-any".
2023-11-09 05:03:54 +09:00
Taku Amano
691d02450e
perf(jsx/streaming): In multiple Suspense, go ahead in the order of resolved. (#1663)
* perf(jsx/streaming): In multiple Suspense, go ahead in the order of resolved.

* chore: denoify
2023-11-09 04:13:50 +09:00
Taku Amano
7fd9cba89d
feat(jsx/streaming): Support nested Suspense. (#1660) 2023-11-08 23:49:42 +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
Taku Amano
a98661b419
fix(jsx/streaming): Fixed a bug that caused async components to be evaluated multiple times inside Suspense. (#1656)
* fix(jsx/streaming): Fixed a bug that caused async components to be evaluated multiple times inside Suspense.

* test(jsx/streaming): The problem of catching the global unhandledRejection and causing an error has been fixed in the vitest.

* chore: denoify
2023-11-08 20:52:29 +09:00
Taku Amano
fedeb3d696
feat: Introduce streaming API with Suspense and use. (#1630)
* feat(jsx): Support async component.

* chore: denoify

* feat: Support nested async components.

* chore: denoify

* Remove unintended file from commit.

* test(jsx): Add test for html tagged template strings.

* feat: Introduce streaming API with `Suspense` and `use`.

* chore: denoify

* "use" receives only Promise.

* feat: Support multiple calls and nested calls to "use".

* refactor: tweaks replacement script.

* test: Add test for replacement result of streaming

* chore: denoify

* test: Add test "Complex fallback content"

* refactor: Add "typescript-eslint/no-explicit-any".

* Use jsdom instead of happy-dom due to ci failure.

* test: update test data for suspense.

* refactor: Remove excessive exports

* refactor: Changed initialization of `useContexts[]` to clarify intent.

* perf: improve `renderToReadableStream()` performance.

* chore: denoify

* pref: Shortened the output JS a bit.

* pref: Delete unneeded condition

* docs(jsx/streaming): Add `@experimental` flag to streaming API.

* fix(jsx/streadming): fix loop when using fullfilled Promise with null or undefined.

* fix(jsx/streaming): Catch unhandledRejection to avoid streaming not being closed.

* chore(jsx/streaming): Add entries for jsx/streaming to package.json.

* chore: denoify

* feat(jsx/streaming): Support the Async Component inside Suspense.

* chore: denoify

* feat(jsx/streaming): remove implementation of `use()`.
2023-11-07 07:09:04 +09:00
Yusuke Wada
b3e465a103
feat: types for JSX elements (#1614)
* feat: types for JSX elements

* make it minimal

* add children

* denoify

* fixed some attributes

* denoify

* `dateTime` to `datetime`

* remove `onxxx`

* feat: Declare in the Hono namespace so that it can be overridden by the user. (#1616)

* feat: Declare in the Hono namespace so that it can be overridden by the user.

* feat: Use interface instead of type to enable overwriting

```ts
declare global {
  namespace JSX {
    interface IntrinsicElements {
      'my-custom-element': Hono.HTMLAttributes & {
        'x-event'?: 'click' | 'scroll';
      }
    }
  }
}
```

---------

Co-authored-by: Yusuke Wada <yusuke@kamawada.com>

* remove `onxxx`

* denoify

---------

Co-authored-by: Taku Amano <taku@taaas.jp>
2023-10-27 06:21:33 +09:00
Connor White
715b4841ea
fix: Don't kebab case style property values (#1562)
* fix: don't kebab case style property values

* add a test and format

* denoify and `denoify-ignore`

---------

Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
2023-10-22 00:13:09 +09:00
Taku Amano
b05ed376b2
feat(jsx): Introduce Context API and jsx-renderer middleware (#1496)
Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
2023-10-05 16:57:33 +09:00
Yusuke Wada
6a9590d69c
fix(jsx): render a child or odd children with Fragment correctly (#1541)
* fix(jsx): render a child or odd children with `Fragment` correctly

* denoify
2023-10-05 00:18:18 +09:00
Yusuke Wada
27d26204af
feat(jsx): export FC (#1420)
* feat(jsx): export `FC`

* denoify
2023-09-09 17:12:21 +09:00
Yusuke Wada
3351e9db96
fix(jsx): enable Fragment (#1412)
* fix(jsx): enable `Fragment`

* denoify
2023-09-05 18:14:32 +09:00
Yusuke Wada
e07019125d
feat: introduce "Helpers" (#1353)
* mv jsx

* introduce helper

* denoify & add src/helper.ts for Deno

* remove `c` not used

* remove `c` in lagon test

* remove `src/adapter.ts` not used
2023-08-21 15:22:37 +09:00