remix 3.0.0-rc.4 → 3.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INDEX.md +6 -21
- package/dist/component/dev/refresh.d.ts +2 -0
- package/dist/component/dev/refresh.d.ts.map +1 -0
- package/dist/{ui → component}/dev/refresh.js +1 -1
- package/dist/component/jsx-dev-runtime.d.ts +2 -0
- package/dist/component/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/{ui → component}/jsx-dev-runtime.js +1 -1
- package/dist/component/jsx-runtime.d.ts +2 -0
- package/dist/component/jsx-runtime.d.ts.map +1 -0
- package/dist/{ui → component}/jsx-runtime.js +1 -1
- package/dist/component/server.d.ts +2 -0
- package/dist/component/server.d.ts.map +1 -0
- package/dist/{ui → component}/server.js +1 -1
- package/dist/component/test.d.ts +2 -0
- package/dist/component/test.d.ts.map +1 -0
- package/dist/{ui → component}/test.js +1 -1
- package/dist/component-hmr/assets.d.ts +2 -0
- package/dist/component-hmr/assets.d.ts.map +1 -0
- package/dist/{ui-hmr.js → component-hmr/assets.js} +1 -1
- package/dist/component-hmr/node.d.ts +3 -0
- package/dist/component-hmr/node.d.ts.map +1 -0
- package/dist/{ui-hmr → component-hmr}/node.js +1 -1
- package/dist/component-hmr/runtime/browser.d.ts +2 -0
- package/dist/component-hmr/runtime/browser.d.ts.map +1 -0
- package/dist/{ui-hmr → component-hmr}/runtime/browser.js +1 -1
- package/dist/component-hmr/runtime/server.d.ts +2 -0
- package/dist/component-hmr/runtime/server.d.ts.map +1 -0
- package/dist/{ui-hmr → component-hmr}/runtime/server.js +1 -1
- package/dist/component-hmr.d.ts +2 -0
- package/dist/component-hmr.d.ts.map +1 -0
- package/dist/{ui-hmr/assets.js → component-hmr.js} +1 -1
- package/dist/component.d.ts +2 -0
- package/dist/component.d.ts.map +1 -0
- package/dist/{ui/anchor.js → component.js} +1 -1
- package/guides/01-start-here.md +19 -19
- package/guides/02-routing-and-controllers.md +1 -1
- package/guides/03-request-handling.md +1 -1
- package/guides/04-rendering-ui.md +41 -307
- package/guides/05-interactivity.md +42 -37
- package/guides/06-streaming-ui-with-frames.md +28 -70
- package/guides/07-animation.md +41 -35
- package/guides/08-data-and-validation.md +423 -27
- package/guides/09-forms-and-mutations.md +250 -25
- package/guides/13-testing.md +10 -10
- package/guides/14-cli-and-tooling.md +1 -1
- package/package.json +65 -149
- package/src/assets/README.md +12 -12
- package/src/{ui → component}/README.md +31 -75
- package/src/{ui → component}/dev/refresh.ts +1 -1
- package/src/{ui → component}/jsx-dev-runtime.ts +1 -1
- package/src/{ui → component}/jsx-runtime.ts +1 -1
- package/src/{ui → component}/server/README.md +8 -8
- package/src/{ui → component}/server.ts +1 -1
- package/src/{ui → component}/test/README.md +6 -6
- package/src/{ui → component}/test.ts +1 -1
- package/src/{ui-hmr → component-hmr}/README.md +13 -13
- package/src/{ui-hmr → component-hmr}/assets.ts +1 -1
- package/src/{ui-hmr → component-hmr}/node.ts +1 -1
- package/src/{ui-hmr → component-hmr}/runtime/browser.ts +1 -1
- package/src/{ui-hmr → component-hmr}/runtime/server.ts +1 -1
- package/{dist/ui/accordion.js → src/component-hmr.ts} +1 -1
- package/{dist/ui/tabs.js → src/component.ts} +1 -1
- package/src/data-table/README.md +2 -1
- package/src/multiple-import-maps-polyfill/README.md +3 -3
- package/src/node-hmr/README.md +6 -6
- package/src/render-middleware/README.md +5 -5
- package/src/spa/README.md +4 -4
- package/src/test/README.md +4 -4
- package/dist/ui/accordion/primitives.d.ts +0 -2
- package/dist/ui/accordion/primitives.d.ts.map +0 -1
- package/dist/ui/accordion/primitives.js +0 -2
- package/dist/ui/accordion.d.ts +0 -2
- package/dist/ui/accordion.d.ts.map +0 -1
- package/dist/ui/anchor.d.ts +0 -2
- package/dist/ui/anchor.d.ts.map +0 -1
- package/dist/ui/animation.d.ts +0 -2
- package/dist/ui/animation.d.ts.map +0 -1
- package/dist/ui/animation.js +0 -2
- package/dist/ui/breadcrumbs.d.ts +0 -2
- package/dist/ui/breadcrumbs.d.ts.map +0 -1
- package/dist/ui/breadcrumbs.js +0 -2
- package/dist/ui/button.d.ts +0 -3
- package/dist/ui/button.d.ts.map +0 -1
- package/dist/ui/button.js +0 -3
- package/dist/ui/checkbox.d.ts +0 -3
- package/dist/ui/checkbox.d.ts.map +0 -1
- package/dist/ui/checkbox.js +0 -3
- package/dist/ui/combobox/primitives.d.ts +0 -2
- package/dist/ui/combobox/primitives.d.ts.map +0 -1
- package/dist/ui/combobox/primitives.js +0 -2
- package/dist/ui/combobox.d.ts +0 -2
- package/dist/ui/combobox.d.ts.map +0 -1
- package/dist/ui/combobox.js +0 -2
- package/dist/ui/dev/refresh.d.ts +0 -2
- package/dist/ui/dev/refresh.d.ts.map +0 -1
- package/dist/ui/input.d.ts +0 -3
- package/dist/ui/input.d.ts.map +0 -1
- package/dist/ui/input.js +0 -3
- package/dist/ui/jsx-dev-runtime.d.ts +0 -2
- package/dist/ui/jsx-dev-runtime.d.ts.map +0 -1
- package/dist/ui/jsx-runtime.d.ts +0 -2
- package/dist/ui/jsx-runtime.d.ts.map +0 -1
- package/dist/ui/listbox.d.ts +0 -2
- package/dist/ui/listbox.d.ts.map +0 -1
- package/dist/ui/listbox.js +0 -2
- package/dist/ui/menu/primitives.d.ts +0 -2
- package/dist/ui/menu/primitives.d.ts.map +0 -1
- package/dist/ui/menu/primitives.js +0 -2
- package/dist/ui/menu.d.ts +0 -2
- package/dist/ui/menu.d.ts.map +0 -1
- package/dist/ui/menu.js +0 -2
- package/dist/ui/popover.d.ts +0 -2
- package/dist/ui/popover.d.ts.map +0 -1
- package/dist/ui/popover.js +0 -2
- package/dist/ui/radio.d.ts +0 -3
- package/dist/ui/radio.d.ts.map +0 -1
- package/dist/ui/radio.js +0 -3
- package/dist/ui/select/primitives.d.ts +0 -2
- package/dist/ui/select/primitives.d.ts.map +0 -1
- package/dist/ui/select/primitives.js +0 -2
- package/dist/ui/select.d.ts +0 -2
- package/dist/ui/select.d.ts.map +0 -1
- package/dist/ui/select.js +0 -2
- package/dist/ui/server.d.ts +0 -2
- package/dist/ui/server.d.ts.map +0 -1
- package/dist/ui/tabs/primitives.d.ts +0 -2
- package/dist/ui/tabs/primitives.d.ts.map +0 -1
- package/dist/ui/tabs/primitives.js +0 -2
- package/dist/ui/tabs.d.ts +0 -2
- package/dist/ui/tabs.d.ts.map +0 -1
- package/dist/ui/test.d.ts +0 -2
- package/dist/ui/test.d.ts.map +0 -1
- package/dist/ui/toggle/primitives.d.ts +0 -2
- package/dist/ui/toggle/primitives.d.ts.map +0 -1
- package/dist/ui/toggle/primitives.js +0 -2
- package/dist/ui/toggle.d.ts +0 -3
- package/dist/ui/toggle.d.ts.map +0 -1
- package/dist/ui/toggle.js +0 -3
- package/dist/ui-hmr/assets.d.ts +0 -2
- package/dist/ui-hmr/assets.d.ts.map +0 -1
- package/dist/ui-hmr/node.d.ts +0 -3
- package/dist/ui-hmr/node.d.ts.map +0 -1
- package/dist/ui-hmr/runtime/browser.d.ts +0 -2
- package/dist/ui-hmr/runtime/browser.d.ts.map +0 -1
- package/dist/ui-hmr/runtime/server.d.ts +0 -2
- package/dist/ui-hmr/runtime/server.d.ts.map +0 -1
- package/dist/ui-hmr.d.ts +0 -2
- package/dist/ui-hmr.d.ts.map +0 -1
- package/dist/ui.d.ts +0 -2
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.js +0 -2
- package/src/ui/accordion/README.md +0 -202
- package/src/ui/accordion/primitives.ts +0 -2
- package/src/ui/accordion.ts +0 -2
- package/src/ui/anchor/README.md +0 -196
- package/src/ui/anchor.ts +0 -2
- package/src/ui/animation/README.md +0 -318
- package/src/ui/animation.ts +0 -2
- package/src/ui/breadcrumbs/README.md +0 -55
- package/src/ui/breadcrumbs.ts +0 -2
- package/src/ui/button/README.md +0 -44
- package/src/ui/button.ts +0 -3
- package/src/ui/checkbox/README.md +0 -59
- package/src/ui/checkbox.ts +0 -3
- package/src/ui/combobox/README.md +0 -194
- package/src/ui/combobox/primitives.ts +0 -2
- package/src/ui/combobox.ts +0 -2
- package/src/ui/input/README.md +0 -52
- package/src/ui/input.ts +0 -3
- package/src/ui/listbox/README.md +0 -83
- package/src/ui/listbox.ts +0 -2
- package/src/ui/menu/README.md +0 -161
- package/src/ui/menu/primitives.ts +0 -2
- package/src/ui/menu.ts +0 -2
- package/src/ui/popover/README.md +0 -103
- package/src/ui/popover.ts +0 -2
- package/src/ui/radio/README.md +0 -53
- package/src/ui/radio.ts +0 -3
- package/src/ui/select/README.md +0 -117
- package/src/ui/select/primitives.ts +0 -2
- package/src/ui/select.ts +0 -2
- package/src/ui/tabs/README.md +0 -141
- package/src/ui/tabs/primitives.ts +0 -2
- package/src/ui/tabs.ts +0 -2
- package/src/ui/toggle/README.md +0 -56
- package/src/ui/toggle/primitives.ts +0 -2
- package/src/ui/toggle.ts +0 -3
- package/src/ui-hmr.ts +0 -2
- package/src/ui.ts +0 -2
package/INDEX.md
CHANGED
|
@@ -12,7 +12,7 @@ Search this generated index by task, export name, or description. Use the guides
|
|
|
12
12
|
| [Rendering UI](guides/04-rendering-ui.md) | How to build pages from Remix components, props, context, document shells, styles, and first-party UI. |
|
|
13
13
|
| [Interactivity](guides/05-interactivity.md) | How server-rendered UI hydrates, handles events, connects components to application models, navigates, and cancels stale work. |
|
|
14
14
|
| [Streaming UI with Frames](guides/06-streaming-ui-with-frames.md) | How to stream and reload route-owned UI with Frame, fallbacks, and server and browser frame resolvers. |
|
|
15
|
-
| [Animation](guides/07-animation.md) | The CSS-first animation model and Remix
|
|
15
|
+
| [Animation](guides/07-animation.md) | The CSS-first animation model and Remix component helpers for motion that respects rendering state. |
|
|
16
16
|
| [Data and Validation](guides/08-data-and-validation.md) | How Remix validates inputs, defines relational data, queries databases, and runs SQL migrations. |
|
|
17
17
|
| [Forms and Mutations](guides/09-forms-and-mutations.md) | How native forms, action responses, validation failures, redirects, and enhanced mutations fit together. |
|
|
18
18
|
| [Auth, Sessions, and Security](guides/10-auth-sessions-security.md) | How Remix stores per-browser state, resolves identity, protects routes, and defends browser request boundaries. |
|
|
@@ -31,6 +31,10 @@ Exports covered by the same README are grouped together.
|
|
|
31
31
|
| `remix/assert` | Node assert-compatible utilities for any JavaScript environment | [README](src/assert/README.md) |
|
|
32
32
|
| `remix/assets`<br>`remix/assets/types/hmr` | Fetch-based server for compiling browser JS/TS and CSS assets on demand | [README](src/assets/README.md) |
|
|
33
33
|
| `remix/auth` | Browser login, OAuth, and OIDC helpers for Remix | [README](src/auth/README.md) |
|
|
34
|
+
| `remix/component`<br>`remix/component/dev/refresh`<br>`remix/component/jsx-dev-runtime`<br>`remix/component/jsx-runtime` | Component runtime with server rendering and browser hydration | [README](src/component/README.md) |
|
|
35
|
+
| `remix/component-hmr`<br>`remix/component-hmr/assets`<br>`remix/component-hmr/node`<br>`remix/component-hmr/runtime/browser`<br>`remix/component-hmr/runtime/server` | Hot module replacement runtime and transforms for Remix components | [README](src/component-hmr/README.md) |
|
|
36
|
+
| `remix/component/server` | Component runtime with server rendering and browser hydration | [README](src/component/server/README.md) |
|
|
37
|
+
| `remix/component/test` | Component runtime with server rendering and browser hydration | [README](src/component/test/README.md) |
|
|
34
38
|
| `remix/cookie` | A toolkit for working with cookies in JavaScript | [README](src/cookie/README.md) |
|
|
35
39
|
| `remix/data-schema`<br>`remix/data-schema/checks`<br>`remix/data-schema/coerce`<br>`remix/data-schema/form-data`<br>`remix/data-schema/lazy` | Tiny, standards-aligned schema validation | [README](src/data-schema/README.md) |
|
|
36
40
|
| `remix/data-table`<br>`remix/data-table/cli`<br>`remix/data-table/migrations`<br>`remix/data-table/migrations/node`<br>`remix/data-table/operators`<br>`remix/data-table/sql-helpers` | A typed, relational query toolkit for JavaScript | [README](src/data-table/README.md) |
|
|
@@ -54,7 +58,7 @@ Exports covered by the same README are grouped together.
|
|
|
54
58
|
| `remix/middleware/form-data` | Middleware for parsing FormData from request bodies | [README](src/form-data-middleware/README.md) |
|
|
55
59
|
| `remix/middleware/logger` | Middleware for logging HTTP requests and responses | [README](src/logger-middleware/README.md) |
|
|
56
60
|
| `remix/middleware/method-override` | Middleware for overriding HTTP request methods from form data | [README](src/method-override-middleware/README.md) |
|
|
57
|
-
| `remix/middleware/render` | Conventional Remix
|
|
61
|
+
| `remix/middleware/render` | Conventional Remix component and custom request-scoped render middleware | [README](src/render-middleware/README.md) |
|
|
58
62
|
| `remix/middleware/session` | Middleware for managing sessions with cookie-based storage | [README](src/session-middleware/README.md) |
|
|
59
63
|
| `remix/middleware/static` | Middleware for serving static files from the filesystem | [README](src/static-middleware/README.md) |
|
|
60
64
|
| `remix/mime` | Utilities for working with MIME types | [README](src/mime/README.md) |
|
|
@@ -73,22 +77,3 @@ Exports covered by the same README are grouped together.
|
|
|
73
77
|
| `remix/tar-parser` | A fast, efficient parser for tar streams in any JavaScript environment | [README](src/tar-parser/README.md) |
|
|
74
78
|
| `remix/terminal` | Terminal output utilities for JavaScript libraries and CLIs | [README](src/terminal/README.md) |
|
|
75
79
|
| `remix/test`<br>`remix/test/cli` | A test framework for JavaScript and TypeScript projects | [README](src/test/README.md) |
|
|
76
|
-
| `remix/ui`<br>`remix/ui/dev/refresh`<br>`remix/ui/jsx-dev-runtime`<br>`remix/ui/jsx-runtime` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/README.md) |
|
|
77
|
-
| `remix/ui-hmr`<br>`remix/ui-hmr/assets`<br>`remix/ui-hmr/node`<br>`remix/ui-hmr/runtime/browser`<br>`remix/ui-hmr/runtime/server` | Hot module replacement runtime and transforms for Remix UI components | [README](src/ui-hmr/README.md) |
|
|
78
|
-
| `remix/ui/accordion`<br>`remix/ui/accordion/primitives` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/accordion/README.md) |
|
|
79
|
-
| `remix/ui/anchor` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/anchor/README.md) |
|
|
80
|
-
| `remix/ui/animation` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/animation/README.md) |
|
|
81
|
-
| `remix/ui/breadcrumbs` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/breadcrumbs/README.md) |
|
|
82
|
-
| `remix/ui/button` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/button/README.md) |
|
|
83
|
-
| `remix/ui/checkbox` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/checkbox/README.md) |
|
|
84
|
-
| `remix/ui/combobox`<br>`remix/ui/combobox/primitives` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/combobox/README.md) |
|
|
85
|
-
| `remix/ui/input` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/input/README.md) |
|
|
86
|
-
| `remix/ui/listbox` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/listbox/README.md) |
|
|
87
|
-
| `remix/ui/menu`<br>`remix/ui/menu/primitives` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/menu/README.md) |
|
|
88
|
-
| `remix/ui/popover` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/popover/README.md) |
|
|
89
|
-
| `remix/ui/radio` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/radio/README.md) |
|
|
90
|
-
| `remix/ui/select`<br>`remix/ui/select/primitives` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/select/README.md) |
|
|
91
|
-
| `remix/ui/server` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/server/README.md) |
|
|
92
|
-
| `remix/ui/tabs`<br>`remix/ui/tabs/primitives` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/tabs/README.md) |
|
|
93
|
-
| `remix/ui/test` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/test/README.md) |
|
|
94
|
-
| `remix/ui/toggle`<br>`remix/ui/toggle/primitives` | UI runtime, headless primitives, and styled components for Remix | [README](src/ui/toggle/README.md) |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../../src/component/dev/refresh.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// IMPORTANT: This file is auto-generated, please do not edit manually.
|
|
2
|
-
export * from '@remix-run/
|
|
2
|
+
export * from '@remix-run/component/dev/refresh';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.ts","sourceRoot":"","sources":["../../src/component/jsx-dev-runtime.ts"],"names":[],"mappings":"AACA,cAAc,sCAAsC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// IMPORTANT: This file is auto-generated, please do not edit manually.
|
|
2
|
-
export * from '@remix-run/
|
|
2
|
+
export * from '@remix-run/component/jsx-dev-runtime';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../../src/component/jsx-runtime.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// IMPORTANT: This file is auto-generated, please do not edit manually.
|
|
2
|
-
export * from '@remix-run/
|
|
2
|
+
export * from '@remix-run/component/jsx-runtime';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/component/server.ts"],"names":[],"mappings":"AACA,cAAc,6BAA6B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// IMPORTANT: This file is auto-generated, please do not edit manually.
|
|
2
|
-
export * from '@remix-run/
|
|
2
|
+
export * from '@remix-run/component/server';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/component/test.ts"],"names":[],"mappings":"AACA,cAAc,2BAA2B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// IMPORTANT: This file is auto-generated, please do not edit manually.
|
|
2
|
-
export * from '@remix-run/
|
|
2
|
+
export * from '@remix-run/component/test';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/component-hmr/assets.ts"],"names":[],"mappings":"AACA,cAAc,iCAAiC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// IMPORTANT: This file is auto-generated, please do not edit manually.
|
|
2
|
-
export * from '@remix-run/
|
|
2
|
+
export * from '@remix-run/component-hmr/assets';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/component-hmr/node.ts"],"names":[],"mappings":"AACA,OAAO,+BAA+B,CAAA;AACtC,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/component-hmr/runtime/browser.ts"],"names":[],"mappings":"AACA,cAAc,0CAA0C,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// IMPORTANT: This file is auto-generated, please do not edit manually.
|
|
2
|
-
export * from '@remix-run/
|
|
2
|
+
export * from '@remix-run/component-hmr/runtime/browser';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/component-hmr/runtime/server.ts"],"names":[],"mappings":"AACA,cAAc,yCAAyC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// IMPORTANT: This file is auto-generated, please do not edit manually.
|
|
2
|
-
export * from '@remix-run/
|
|
2
|
+
export * from '@remix-run/component-hmr/runtime/server';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-hmr.d.ts","sourceRoot":"","sources":["../src/component-hmr.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// IMPORTANT: This file is auto-generated, please do not edit manually.
|
|
2
|
-
export * from '@remix-run/
|
|
2
|
+
export * from '@remix-run/component-hmr';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// IMPORTANT: This file is auto-generated, please do not edit manually.
|
|
2
|
-
export * from '@remix-run/
|
|
2
|
+
export * from '@remix-run/component';
|
package/guides/01-start-here.md
CHANGED
|
@@ -192,14 +192,14 @@ The [Routing and Controllers](/routing-and-controllers/) chapter covers route ma
|
|
|
192
192
|
|
|
193
193
|
Let's make this album page a little more interesting by returning HTML from a Remix component.
|
|
194
194
|
|
|
195
|
-
|
|
195
|
+
A component is a function that receives a `handle` and returns another function that renders JSX. The outer function is setup: it runs once when the component is created, so normal JavaScript variables declared there can hold local state. The returned function is render: it runs on the first render and every update afterward.
|
|
196
196
|
|
|
197
197
|
We'll come back to the component model later. If you want the full model now, check out the [Rendering UI](/rendering-ui/) chapter.
|
|
198
198
|
|
|
199
199
|
```tsx
|
|
200
200
|
function MyComponent(handle) {
|
|
201
201
|
// Setup phase: runs once when this component is created.
|
|
202
|
-
// The handle gives the component access to props and other Remix
|
|
202
|
+
// The handle gives the component access to props and other Remix component APIs.
|
|
203
203
|
|
|
204
204
|
return () => {
|
|
205
205
|
// Render phase: runs on the first render and every update afterward.
|
|
@@ -217,7 +217,7 @@ touch app/actions/albums/show-page.tsx
|
|
|
217
217
|
```
|
|
218
218
|
|
|
219
219
|
```tsx filename=app/actions/albums/show-page.tsx
|
|
220
|
-
import type { Handle } from "remix/
|
|
220
|
+
import type { Handle } from "remix/component";
|
|
221
221
|
|
|
222
222
|
import { Document } from "../document.tsx";
|
|
223
223
|
|
|
@@ -320,7 +320,7 @@ export default createController(routes.albums, {
|
|
|
320
320
|
Let's tweak our `AlbumPage` component to display the album data:
|
|
321
321
|
|
|
322
322
|
```tsx filename=app/actions/albums/show-page.tsx lines=[3,6,8,11,13-16]
|
|
323
|
-
import type { Handle } from "remix/
|
|
323
|
+
import type { Handle } from "remix/component";
|
|
324
324
|
|
|
325
325
|
import type { Album } from "./data.ts";
|
|
326
326
|
import { Document } from "../document.tsx";
|
|
@@ -348,8 +348,8 @@ Now the page displays the album title, artist, and year.
|
|
|
348
348
|
Center it and add a little spacing with the `css` function and `mix` prop. The [Rendering UI](/rendering-ui/) chapter covers this helper and prop in more detail.
|
|
349
349
|
|
|
350
350
|
```tsx filename=app/actions/albums/show-page.tsx lines=[2,14-18,20]
|
|
351
|
-
import type { Handle } from "remix/
|
|
352
|
-
import { css } from "remix/
|
|
351
|
+
import type { Handle } from "remix/component";
|
|
352
|
+
import { css } from "remix/component";
|
|
353
353
|
|
|
354
354
|
import type { Album } from "./data.ts";
|
|
355
355
|
import { Document } from "../document.tsx";
|
|
@@ -454,8 +454,8 @@ router.map(routes.albums.edit, albumsEditController);
|
|
|
454
454
|
Now we can create the form page. It's a very simple form that displays the existing data and submits a POST request to our edit action.
|
|
455
455
|
|
|
456
456
|
```tsx filename=app/actions/albums/edit/page.tsx
|
|
457
|
-
import { css } from "remix/
|
|
458
|
-
import type { Handle } from "remix/
|
|
457
|
+
import { css } from "remix/component";
|
|
458
|
+
import type { Handle } from "remix/component";
|
|
459
459
|
|
|
460
460
|
import { routes } from "../../../routes.ts";
|
|
461
461
|
import { Document } from "../../document.tsx";
|
|
@@ -606,7 +606,7 @@ export default createController(routes.albums.edit, {
|
|
|
606
606
|
});
|
|
607
607
|
```
|
|
608
608
|
|
|
609
|
-
The `action` route action validates the parsed Web `FormData`, returns an explicit response for invalid input or a missing album, and redirects back to the album page after a successful update. The [
|
|
609
|
+
The `action` route action validates the parsed Web `FormData`, returns an explicit response for invalid input or a missing album, and redirects back to the album page after a successful update. The [Forms and Mutations](/forms-and-mutations/) chapter shows how to render field-level validation errors back into a form.
|
|
610
610
|
|
|
611
611
|
Now we can update our album data and set it to the correct year.
|
|
612
612
|
|
|
@@ -629,13 +629,13 @@ mkdir -p app/actions/albums/edit/public
|
|
|
629
629
|
touch app/actions/albums/edit/public/album-edit-form.tsx
|
|
630
630
|
```
|
|
631
631
|
|
|
632
|
-
The colocated `public/` directory is the explicit browser-source boundary. The template's asset server allows source beneath `app/**/public/**`, so Remix can turn this component and its local dependencies into browser modules. Keep those local dependencies inside the same `public/` directory; `app/routes.ts` is allowed separately for type-safe links. The template also loads `app/actions/public/entry.ts`, which starts the Remix
|
|
632
|
+
The colocated `public/` directory is the explicit browser-source boundary. The template's asset server allows source beneath `app/**/public/**`, so Remix can turn this component and its local dependencies into browser modules. Keep those local dependencies inside the same `public/` directory; `app/routes.ts` is allowed separately for type-safe links. The template also loads `app/actions/public/entry.ts`, which starts the Remix component client runtime. The [Files and Assets](/files-and-assets/) chapter goes deeper into this bundlerless setup.
|
|
633
633
|
|
|
634
634
|
Now that we have a place for the form to live, let's pull it into its own component.
|
|
635
635
|
|
|
636
636
|
```tsx filename=app/actions/albums/edit/public/album-edit-form.tsx
|
|
637
|
-
import { css } from "remix/
|
|
638
|
-
import type { Handle } from "remix/
|
|
637
|
+
import { css } from "remix/component";
|
|
638
|
+
import type { Handle } from "remix/component";
|
|
639
639
|
|
|
640
640
|
import { routes } from "../../../../routes.ts";
|
|
641
641
|
|
|
@@ -685,8 +685,8 @@ export function AlbumEditForm(handle: Handle<{ album: Album }>) {
|
|
|
685
685
|
Let's update the edit page to render this new `AlbumEditForm` component:
|
|
686
686
|
|
|
687
687
|
```tsx filename=app/actions/albums/edit/page.tsx lines=[4,16]
|
|
688
|
-
import type { Handle } from "remix/
|
|
689
|
-
import { css } from "remix/
|
|
688
|
+
import type { Handle } from "remix/component";
|
|
689
|
+
import { css } from "remix/component";
|
|
690
690
|
|
|
691
691
|
import { AlbumEditForm } from "./public/album-edit-form.tsx";
|
|
692
692
|
import { Document } from "../../document.tsx";
|
|
@@ -713,8 +713,8 @@ Everything should look like it did before.
|
|
|
713
713
|
Next mark the form as a client entry. [`import.meta.url`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta) tells our asset server which source file should be turned into a browser-loadable module:
|
|
714
714
|
|
|
715
715
|
```tsx filename=app/actions/albums/edit/public/album-edit-form.tsx lines=[1,13-15,18]
|
|
716
|
-
import { clientEntry, css } from "remix/
|
|
717
|
-
import type { Handle } from "remix/
|
|
716
|
+
import { clientEntry, css } from "remix/component";
|
|
717
|
+
import type { Handle } from "remix/component";
|
|
718
718
|
|
|
719
719
|
import { routes } from "../../../../routes.ts";
|
|
720
720
|
|
|
@@ -752,11 +752,11 @@ export const AlbumEditForm = clientEntry(
|
|
|
752
752
|
);
|
|
753
753
|
```
|
|
754
754
|
|
|
755
|
-
When the form submits, we flip the `pending` variable from `false` to `true` and call `handle.update()`. `handle.update()` tells
|
|
755
|
+
When the form submits, we flip the `pending` variable from `false` to `true` and call `handle.update()`. `handle.update()` tells the component runtime to render this component again with the new local state. To listen for the submit, we add an event listener via the `on` helper and pass an array into the `mix` prop.
|
|
756
756
|
|
|
757
757
|
```tsx filename=app/actions/albums/edit/public/album-edit-form.tsx lines=[1,25,27-31,34-36]
|
|
758
|
-
import { clientEntry, css, on } from "remix/
|
|
759
|
-
import type { Handle } from "remix/
|
|
758
|
+
import { clientEntry, css, on } from "remix/component";
|
|
759
|
+
import type { Handle } from "remix/component";
|
|
760
760
|
|
|
761
761
|
import { routes } from "../../../../routes.ts";
|
|
762
762
|
|
|
@@ -245,7 +245,7 @@ import { routes } from "../../../routes.ts";
|
|
|
245
245
|
return redirect(routes.albums.show.href({ albumId: context.params.albumId }), 303);
|
|
246
246
|
```
|
|
247
247
|
|
|
248
|
-
For HTML outside the Remix
|
|
248
|
+
For HTML outside the Remix component render pipeline, the `html` template tag escapes interpolated values and `createHtmlResponse(...)` sets the HTML content type and adds a doctype:
|
|
249
249
|
|
|
250
250
|
```ts
|
|
251
251
|
import { html } from "remix/html-template";
|
|
@@ -254,7 +254,7 @@ The default app starts with static-file and render middleware. Add the others wh
|
|
|
254
254
|
| Middleware | Import | What it does | Placement |
|
|
255
255
|
| ------------------ | ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
256
256
|
| `formData()` | `remix/middleware/form-data` | Parses URL-encoded and multipart bodies once, then provides `context.formData`. Non-form requests receive empty `FormData`. | Before `methodOverride()`, CSRF form-field checks, or actions that read parsed form data. |
|
|
257
|
-
| `render()` | `remix/middleware/render` | Installs the standard Remix
|
|
257
|
+
| `render()` | `remix/middleware/render` | Installs the standard Remix component `context.render(...)` function. | After middleware that may answer without rendering. |
|
|
258
258
|
| `staticFiles()` | `remix/middleware/static` | Serves `GET` and `HEAD` requests from a directory, with conditional and range request support. | Early, before request enrichment that static files do not need. |
|
|
259
259
|
| `compression()` | `remix/middleware/compression` | Negotiates Brotli, gzip, or deflate for suitable downstream responses. | Before every response it should wrap, including `staticFiles()` when static text is compressed. |
|
|
260
260
|
| `logger()` | `remix/middleware/logger` | Logs the request and downstream response and provides `context.logger(...)`. | Usually first so early responses and `404`s are logged. |
|