@remix-run/ui 0.4.0 → 0.6.0
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/README.md +74 -1
- package/dist/accordion/index.js +2 -2
- package/dist/accordion/primitives.d.ts +1 -1
- package/dist/accordion/primitives.js.map +1 -1
- package/dist/anchor/index.js.map +1 -1
- package/dist/animation/animate-layout-mixin.js +1 -1
- package/dist/animation/animate-layout-mixin.js.map +1 -1
- package/dist/animation/animate-mixins.js +2 -2
- package/dist/animation/animate-mixins.js.map +1 -1
- package/dist/animation/demos/color-interpolation.js +1 -1
- package/dist/animation/demos/color-interpolation.js.map +1 -1
- package/dist/animation/demos/drag-release.d.ts +1 -1
- package/dist/animation/demos/hold-to-confirm.d.ts +3 -3
- package/dist/animation/demos/material-ripple.js +1 -3
- package/dist/animation/demos/material-ripple.js.map +1 -1
- package/dist/animation/index.js +4 -4
- package/dist/animation/spring.js.map +1 -1
- package/dist/breadcrumbs/index.js +2 -2
- package/dist/button/index.js +25 -25
- package/dist/button/index.js.map +1 -1
- package/dist/checkbox/index.js +11 -9
- package/dist/checkbox/index.js.map +1 -1
- package/dist/combobox/index.js +4 -4
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/primitives.d.ts +1 -1
- package/dist/combobox/primitives.js +5 -5
- package/dist/combobox/primitives.js.map +1 -1
- package/dist/dev/refresh.d.ts +1 -0
- package/dist/dev/refresh.js +2 -0
- package/dist/dev/refresh.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -14
- package/dist/input/index.js +9 -9
- package/dist/input/index.js.map +1 -1
- package/dist/jsx-runtime.js +2 -2
- package/dist/listbox/index.js +2 -2
- package/dist/menu/hover-aim.js.map +1 -1
- package/dist/menu/index.js +3 -3
- package/dist/menu/primitives.d.ts +1 -1
- package/dist/menu/primitives.js +6 -6
- package/dist/menu/primitives.js.map +1 -1
- package/dist/popover/index.js +3 -3
- package/dist/popover/scroll-lock.js.map +1 -1
- package/dist/radio/index.js +7 -7
- package/dist/radio/index.js.map +1 -1
- package/dist/runtime/client-entry-boundary.d.ts +14 -0
- package/dist/runtime/client-entry-boundary.js +29 -0
- package/dist/runtime/client-entry-boundary.js.map +1 -0
- package/dist/runtime/component.d.ts +19 -4
- package/dist/runtime/component.js +39 -9
- package/dist/runtime/component.js.map +1 -1
- package/dist/runtime/core/attributes.js +36 -3
- package/dist/runtime/core/attributes.js.map +1 -1
- package/dist/runtime/core/children.d.ts +2 -0
- package/dist/runtime/core/children.js +26 -2
- package/dist/runtime/core/children.js.map +1 -1
- package/dist/runtime/core/props.js +2 -2
- package/dist/runtime/core/vnode.d.ts +3 -3
- package/dist/runtime/core/vnode.js +22 -1
- package/dist/runtime/core/vnode.js.map +1 -1
- package/dist/runtime/create-element.d.ts +2 -2
- package/dist/runtime/create-element.js +3 -2
- package/dist/runtime/create-element.js.map +1 -1
- package/dist/runtime/diff-dom.js +307 -220
- package/dist/runtime/diff-dom.js.map +1 -1
- package/dist/runtime/diff-props.js +3 -3
- package/dist/runtime/dom.d.ts +12 -0
- package/dist/runtime/element-function.d.ts +3 -0
- package/dist/runtime/element-function.js +2 -0
- package/dist/runtime/element-function.js.map +1 -0
- package/dist/runtime/form-navigation.d.ts +25 -0
- package/dist/runtime/form-navigation.js +132 -0
- package/dist/runtime/form-navigation.js.map +1 -0
- package/dist/runtime/frame-resolution.d.ts +5 -0
- package/dist/runtime/frame-resolution.js +10 -0
- package/dist/runtime/frame-resolution.js.map +1 -0
- package/dist/runtime/frame.d.ts +59 -15
- package/dist/runtime/frame.js +383 -114
- package/dist/runtime/frame.js.map +1 -1
- package/dist/runtime/jsx.d.ts +1 -1
- package/dist/runtime/jsx.js +1 -1
- package/dist/runtime/jsx.js.map +1 -1
- package/dist/runtime/key.d.ts +1 -0
- package/dist/runtime/key.js +2 -0
- package/dist/runtime/key.js.map +1 -0
- package/dist/runtime/mixins/attrs-mixin.js +2 -2
- package/dist/runtime/mixins/link-mixin.js +4 -3
- package/dist/runtime/mixins/link-mixin.js.map +1 -1
- package/dist/runtime/mixins/mixin.d.ts +15 -10
- package/dist/runtime/mixins/mixin.js +4 -4
- package/dist/runtime/mixins/mixin.js.map +1 -1
- package/dist/runtime/mixins/on-mixin.js +1 -1
- package/dist/runtime/mixins/ref-mixin.js +1 -1
- package/dist/runtime/module-preloader.d.ts +8 -0
- package/dist/runtime/module-preloader.js +95 -0
- package/dist/runtime/module-preloader.js.map +1 -0
- package/dist/runtime/navigation.d.ts +4 -1
- package/dist/runtime/navigation.js +157 -32
- package/dist/runtime/navigation.js.map +1 -1
- package/dist/runtime/reconcile.d.ts +11 -10
- package/dist/runtime/reconcile.js +549 -421
- package/dist/runtime/reconcile.js.map +1 -1
- package/dist/runtime/refresh.d.ts +28 -0
- package/dist/runtime/refresh.js +31 -0
- package/dist/runtime/refresh.js.map +1 -0
- package/dist/runtime/render.js +1 -1
- package/dist/runtime/render.js.map +1 -1
- package/dist/runtime/run.d.ts +3 -1
- package/dist/runtime/run.js +15 -7
- package/dist/runtime/run.js.map +1 -1
- package/dist/runtime/scheduler.js +8 -16
- package/dist/runtime/scheduler.js.map +1 -1
- package/dist/runtime/to-vnode.d.ts +2 -2
- package/dist/runtime/to-vnode.js +68 -20
- package/dist/runtime/to-vnode.js.map +1 -1
- package/dist/runtime/vdom.d.ts +4 -2
- package/dist/runtime/vdom.js +87 -42
- package/dist/runtime/vdom.js.map +1 -1
- package/dist/runtime/vnode.d.ts +138 -67
- package/dist/runtime/vnode.js +17 -12
- package/dist/runtime/vnode.js.map +1 -1
- package/dist/select/index.js +11 -11
- package/dist/select/index.js.map +1 -1
- package/dist/select/primitives.d.ts +1 -1
- package/dist/select/primitives.js +6 -6
- package/dist/server/stream.d.ts +2 -0
- package/dist/server/stream.js +74 -29
- package/dist/server/stream.js.map +1 -1
- package/dist/shared/focus-styles.d.ts +1 -1
- package/dist/shared/focus-styles.js +1 -1
- package/dist/shared/focus-styles.js.map +1 -1
- package/dist/shared/listbox-popover-styles.js +1 -1
- package/dist/shared/style-values.js +26 -26
- package/dist/shared/style-values.js.map +1 -1
- package/dist/style/css-mixin.js +3 -3
- package/dist/style/index.js +2 -2
- package/dist/style/style.js +25 -6
- package/dist/style/style.js.map +1 -1
- package/dist/style/stylesheet.d.ts +0 -1
- package/dist/style/stylesheet.js +13 -54
- package/dist/style/stylesheet.js.map +1 -1
- package/dist/tabs/index.js +11 -11
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/primitives.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/toggle/index.js +9 -9
- package/dist/toggle/index.js.map +1 -1
- package/dist/toggle/primitives.d.ts +1 -1
- package/package.json +10 -7
- package/src/animation/animate-mixins.ts +3 -3
- package/src/animation/demos/color-interpolation.tsx +1 -1
- package/src/button/index.ts +24 -24
- package/src/checkbox/index.ts +10 -8
- package/src/combobox/index.tsx +1 -1
- package/src/dev/refresh.ts +1 -0
- package/src/index.ts +1 -1
- package/src/input/index.ts +8 -8
- package/src/radio/index.ts +6 -5
- package/src/runtime/client-entry-boundary.ts +54 -0
- package/src/runtime/component.ts +65 -16
- package/src/runtime/core/attributes.ts +35 -1
- package/src/runtime/core/children.ts +24 -2
- package/src/runtime/core/vnode.ts +25 -4
- package/src/runtime/create-element.ts +6 -5
- package/src/runtime/demos/readme.demo.tsx +4 -4
- package/src/runtime/diff-dom.ts +370 -244
- package/src/runtime/dom.ts +331 -214
- package/src/runtime/element-function.ts +1 -0
- package/src/runtime/event-listeners.ts +1 -1
- package/src/runtime/form-navigation.ts +184 -0
- package/src/runtime/frame-resolution.ts +13 -0
- package/src/runtime/frame.ts +500 -124
- package/src/runtime/jsx.ts +3 -5
- package/src/runtime/key.ts +1 -0
- package/src/runtime/mixins/link-mixin.ts +1 -0
- package/src/runtime/mixins/mixin.ts +21 -18
- package/src/runtime/module-preloader.ts +115 -0
- package/src/runtime/navigation.ts +204 -30
- package/src/runtime/reconcile.ts +762 -759
- package/src/runtime/refresh.ts +46 -0
- package/src/runtime/run.ts +12 -2
- package/src/runtime/scheduler.ts +9 -29
- package/src/runtime/to-vnode.ts +85 -23
- package/src/runtime/vdom.ts +89 -70
- package/src/runtime/vnode.ts +192 -88
- package/src/select/index.tsx +9 -9
- package/src/server/README.md +13 -0
- package/src/server/stream.ts +93 -30
- package/src/shared/focus-styles.ts +1 -1
- package/src/shared/style-values.ts +26 -26
- package/src/style/style.ts +25 -6
- package/src/style/stylesheet.ts +32 -57
- package/src/tabs/index.tsx +12 -11
- package/src/test/README.md +151 -60
- package/src/toggle/index.tsx +9 -7
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ElementProps, ElementType, RemixElement
|
|
1
|
+
import type { ElementProps, ElementType, RemixElement } from '../jsx.ts'
|
|
2
2
|
|
|
3
3
|
export function createRemixElement(
|
|
4
4
|
type: ElementType,
|
|
5
5
|
props: ElementProps | null | undefined,
|
|
6
|
-
key?:
|
|
6
|
+
key?: any,
|
|
7
7
|
): RemixElement {
|
|
8
8
|
return {
|
|
9
9
|
$rmx: true,
|
|
@@ -13,19 +13,40 @@ export function createRemixElement(
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export function isRemixElement(node:
|
|
17
|
-
|
|
16
|
+
export function isRemixElement(node: unknown): node is RemixElement {
|
|
17
|
+
if (typeof node !== 'object' || node === null) return false
|
|
18
|
+
let type = Reflect.get(node, 'type')
|
|
19
|
+
let props = Reflect.get(node, 'props')
|
|
20
|
+
return (
|
|
21
|
+
Reflect.get(node, '$rmx') === true &&
|
|
22
|
+
(typeof type === 'string' || typeof type === 'function') &&
|
|
23
|
+
typeof props === 'object' &&
|
|
24
|
+
props !== null
|
|
25
|
+
)
|
|
18
26
|
}
|
|
19
27
|
|
|
20
28
|
function normalizeElementProps(props: ElementProps | null | undefined): ElementProps {
|
|
21
29
|
if (!props) return {}
|
|
22
30
|
if (!('mix' in props)) return props
|
|
23
31
|
|
|
32
|
+
// Fast path: `mix={[a, b]}` with flat, truthy entries is already normalized.
|
|
33
|
+
// Skipping the copy avoids two prop-object spreads per element per render.
|
|
34
|
+
if (isNormalizedMix(props.mix)) return props
|
|
35
|
+
|
|
24
36
|
let { mix, ...rest } = props
|
|
25
37
|
let normalizedMix = normalizeMixValue(mix)
|
|
26
38
|
return normalizedMix === undefined ? rest : { ...rest, mix: normalizedMix }
|
|
27
39
|
}
|
|
28
40
|
|
|
41
|
+
function isNormalizedMix(mix: unknown): boolean {
|
|
42
|
+
if (!Array.isArray(mix) || mix.length === 0) return false
|
|
43
|
+
for (let i = 0; i < mix.length; i++) {
|
|
44
|
+
let item = mix[i]
|
|
45
|
+
if (!item || Array.isArray(item)) return false
|
|
46
|
+
}
|
|
47
|
+
return true
|
|
48
|
+
}
|
|
49
|
+
|
|
29
50
|
function normalizeMixValue(mix: unknown): unknown[] | undefined {
|
|
30
51
|
if (!mix) return undefined
|
|
31
52
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from './jsx.ts'
|
|
2
|
-
import type { ElementType, RemixElement } from './jsx.ts'
|
|
3
|
-
import { normalizeChildren } from './core/children.ts'
|
|
2
|
+
import type { ElementProps, ElementType, RemixElement } from './jsx.ts'
|
|
3
|
+
import { assertRemixNodes, normalizeChildren } from './core/children.ts'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Creates a Remix virtual element from a JSX-like call signature.
|
|
@@ -12,8 +12,8 @@ import { normalizeChildren } from './core/children.ts'
|
|
|
12
12
|
*/
|
|
13
13
|
export function createElement(
|
|
14
14
|
type: ElementType,
|
|
15
|
-
props?:
|
|
16
|
-
...children:
|
|
15
|
+
props?: ElementProps,
|
|
16
|
+
...children: unknown[]
|
|
17
17
|
): RemixElement {
|
|
18
18
|
let nextProps = { ...(props ?? {}) }
|
|
19
19
|
if (isMixinElementType(type)) {
|
|
@@ -21,6 +21,7 @@ export function createElement(
|
|
|
21
21
|
console.error(new Error('mixin elements must not receive children'))
|
|
22
22
|
}
|
|
23
23
|
} else {
|
|
24
|
+
assertRemixNodes(children)
|
|
24
25
|
nextProps.children = normalizeChildren(children)
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -34,6 +35,6 @@ export function createElement(
|
|
|
34
35
|
|
|
35
36
|
function isMixinElementType(
|
|
36
37
|
type: ElementType,
|
|
37
|
-
): type is
|
|
38
|
+
): type is ElementType & { __rmxMixinElementType: string } {
|
|
38
39
|
return typeof type === 'function' && '__rmxMixinElementType' in type
|
|
39
40
|
}
|
|
@@ -278,7 +278,7 @@ function ButtonAdvanced() {
|
|
|
278
278
|
}),
|
|
279
279
|
]}
|
|
280
280
|
>
|
|
281
|
-
<span
|
|
281
|
+
<span class="icon">★</span>
|
|
282
282
|
Click me
|
|
283
283
|
</button>
|
|
284
284
|
)
|
|
@@ -607,9 +607,9 @@ function ListWithFragment() {
|
|
|
607
607
|
// ============================================================================
|
|
608
608
|
function Example(handle: Handle<{ title: string; children: RemixNode }>) {
|
|
609
609
|
return () => (
|
|
610
|
-
<div
|
|
610
|
+
<div class="example">
|
|
611
611
|
<h2>{handle.props.title}</h2>
|
|
612
|
-
<div
|
|
612
|
+
<div class="example-content">{handle.props.children}</div>
|
|
613
613
|
</div>
|
|
614
614
|
)
|
|
615
615
|
}
|
|
@@ -623,7 +623,7 @@ function Example(handle: Handle<{ title: string; children: RemixNode }>) {
|
|
|
623
623
|
*/
|
|
624
624
|
export default function DemoApp() {
|
|
625
625
|
return () => (
|
|
626
|
-
<div
|
|
626
|
+
<div class="examples-grid">
|
|
627
627
|
<Example title="Getting Started - Counter">
|
|
628
628
|
<App />
|
|
629
629
|
</Example>
|