@b9g/crank 0.7.4 → 0.7.6
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/_css.cjs.map +1 -1
- package/_css.js.map +1 -1
- package/_svg.cjs +94 -0
- package/_svg.cjs.map +1 -0
- package/_svg.js +92 -0
- package/_svg.js.map +1 -0
- package/_utils.cjs.map +1 -1
- package/_utils.js.map +1 -1
- package/async.cjs +2 -1
- package/async.cjs.map +1 -1
- package/async.js +2 -1
- package/async.js.map +1 -1
- package/crank.cjs +198 -16
- package/crank.cjs.map +1 -1
- package/crank.js +198 -16
- package/crank.js.map +1 -1
- package/dom.cjs +326 -258
- package/dom.cjs.map +1 -1
- package/dom.js +326 -258
- package/dom.js.map +1 -1
- package/event-target.cjs.map +1 -1
- package/event-target.js.map +1 -1
- package/html.cjs +35 -5
- package/html.cjs.map +1 -1
- package/html.js +35 -5
- package/html.js.map +1 -1
- package/jsx-runtime.cjs.map +1 -1
- package/jsx-runtime.js.map +1 -1
- package/jsx-tag.cjs +86 -21
- package/jsx-tag.cjs.map +1 -1
- package/jsx-tag.js +86 -22
- package/jsx-tag.js.map +1 -1
- package/package.json +1 -2
- package/standalone.cjs +7 -0
- package/standalone.cjs.map +1 -1
- package/standalone.js +2 -0
- package/standalone.js.map +1 -1
- package/umd.js +653 -285
- package/umd.js.map +1 -1
- package/_css.d.ts +0 -21
- package/_utils.d.ts +0 -14
- package/async.d.ts +0 -107
- package/crank.d.ts +0 -732
- package/dom.d.ts +0 -14
- package/event-target.d.ts +0 -26
- package/html.d.ts +0 -24
- package/jsx-runtime.d.ts +0 -6
- package/jsx-tag.d.ts +0 -4
- package/standalone.d.ts +0 -2
- package/umd.d.ts +0 -3
package/_css.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSS utility functions for style property transformation.
|
|
3
|
-
*
|
|
4
|
-
* This module handles camelCase to kebab-case conversion and automatic
|
|
5
|
-
* px unit conversion for numeric CSS values, making Crank more React-compatible.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Converts camelCase CSS property names to kebab-case.
|
|
9
|
-
* Handles vendor prefixes correctly (WebkitTransform -> -webkit-transform).
|
|
10
|
-
*/
|
|
11
|
-
export declare function camelToKebabCase(str: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* CSS properties that should remain unitless when given numeric values.
|
|
14
|
-
* Based on React's list of unitless properties.
|
|
15
|
-
*/
|
|
16
|
-
export declare const UNITLESS_PROPERTIES: Set<string>;
|
|
17
|
-
/**
|
|
18
|
-
* Formats CSS property values, automatically adding "px" to numeric values
|
|
19
|
-
* for properties that are not unitless.
|
|
20
|
-
*/
|
|
21
|
-
export declare function formatStyleValue(name: string, value: unknown): string;
|
package/_utils.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare function wrap<T>(value: Array<T> | T | undefined): Array<T>;
|
|
2
|
-
export declare function unwrap<T>(arr: Array<T>): Array<T> | T | undefined;
|
|
3
|
-
export type NonStringIterable<T> = Iterable<T> & object;
|
|
4
|
-
/**
|
|
5
|
-
* Ensures a value is an array.
|
|
6
|
-
*
|
|
7
|
-
* This function does the same thing as wrap() above except it handles nulls
|
|
8
|
-
* and iterables, so it is appropriate for wrapping user-provided element
|
|
9
|
-
* children.
|
|
10
|
-
*/
|
|
11
|
-
export declare function arrayify<T>(value: NonStringIterable<T> | T | null | undefined): Array<T>;
|
|
12
|
-
export declare function isIteratorLike(value: any): value is Iterator<unknown> | AsyncIterator<unknown>;
|
|
13
|
-
export declare function isPromiseLike(value: any): value is PromiseLike<unknown>;
|
|
14
|
-
export declare function safeRace<T>(contenders: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;
|
package/async.d.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import type { Children, Component, Context } from "./crank.js";
|
|
2
|
-
/**
|
|
3
|
-
* Creates a lazy-loaded component from an initializer function.
|
|
4
|
-
*
|
|
5
|
-
* @param initializer - Function that returns a Promise resolving to a component or module
|
|
6
|
-
* @returns A component that loads the target component on first render
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```jsx
|
|
10
|
-
* const LazyComponent = lazy(() => import('./MyComponent'));
|
|
11
|
-
*
|
|
12
|
-
* <Suspense fallback={<div>Loading...</div>}>
|
|
13
|
-
* <LazyComponent prop="value" />
|
|
14
|
-
* </Suspense>
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare function lazy<T extends Component>(initializer: () => Promise<T | {
|
|
18
|
-
default: T;
|
|
19
|
-
}>): T;
|
|
20
|
-
/**
|
|
21
|
-
* A component that displays a fallback while its children are loading.
|
|
22
|
-
*
|
|
23
|
-
* When used within a SuspenseList, coordinates with siblings to control
|
|
24
|
-
* reveal order and fallback behavior.
|
|
25
|
-
*
|
|
26
|
-
* @param children - The content to display when loading is complete
|
|
27
|
-
* @param fallback - The content to display while children are loading
|
|
28
|
-
* @param timeout - Time in milliseconds before showing fallback (defaults to
|
|
29
|
-
* 300ms standalone, or inherits from SuspenseList)
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```jsx
|
|
33
|
-
* <Suspense fallback={<div>Loading...</div>}>
|
|
34
|
-
* <AsyncComponent />
|
|
35
|
-
* </Suspense>
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare function Suspense(this: Context, { children, fallback, timeout, }: {
|
|
39
|
-
children: Children;
|
|
40
|
-
fallback: Children;
|
|
41
|
-
timeout?: number;
|
|
42
|
-
}): AsyncGenerator<Children>;
|
|
43
|
-
declare const SuspenseListController: unique symbol;
|
|
44
|
-
interface SuspenseListItem {
|
|
45
|
-
ctx: Context;
|
|
46
|
-
resolve: () => void;
|
|
47
|
-
promise: Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
interface SuspenseListController {
|
|
50
|
-
timeout?: number;
|
|
51
|
-
revealOrder?: "forwards" | "backwards" | "together";
|
|
52
|
-
tail?: "collapsed" | "hidden";
|
|
53
|
-
register(ctx: Context): Promise<Array<SuspenseListItem>>;
|
|
54
|
-
isHead(ctx: Context, items: Array<SuspenseListItem>): boolean;
|
|
55
|
-
scheduleFallback(ctx: Context, items: Array<SuspenseListItem>): Promise<void>;
|
|
56
|
-
scheduleChildren(ctx: Context, items: Array<SuspenseListItem>): Promise<void>;
|
|
57
|
-
}
|
|
58
|
-
declare global {
|
|
59
|
-
namespace Crank {
|
|
60
|
-
interface ProvisionMap {
|
|
61
|
-
[SuspenseListController]: SuspenseListController;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Controls when child <Suspense> components show their content or fallbacks
|
|
67
|
-
* based on the specified reveal order. The <SuspenseList> resolves when
|
|
68
|
-
* coordination effort is complete (not necessarily when all content is
|
|
69
|
-
* loaded).
|
|
70
|
-
*
|
|
71
|
-
* @param revealOrder - How children should be revealed:
|
|
72
|
-
* - "forwards" (default): Show children in document order, waiting for
|
|
73
|
-
* predecessors
|
|
74
|
-
* - "backwards": Show children in reverse order, waiting for successors
|
|
75
|
-
* - "together": Show all children simultaneously when all are ready
|
|
76
|
-
* In Crank, the default behavior of async components is to render together,
|
|
77
|
-
* so "together" might not be necessary if you are not using <Suspense>
|
|
78
|
-
* fallbacks.
|
|
79
|
-
*e@param tail - How to handle fallbacks:
|
|
80
|
-
* - "collapsed" (default): Show only the fallback for the next unresolved
|
|
81
|
-
* Suspense component
|
|
82
|
-
* - "hidden": Hide all fallbacks
|
|
83
|
-
* Tail behavior only applies when revealOrder is not "together".
|
|
84
|
-
* @param timeout - Default timeout for Suspense children in milliseconds
|
|
85
|
-
* @param children - The elements containing Suspense components to coordinate.
|
|
86
|
-
* Suspense components which are not rendered immediately (because they are
|
|
87
|
-
* the children of another async component) will not be coordinated.
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* ```jsx
|
|
91
|
-
* <SuspenseList revealOrder="forwards" tail="collapsed">
|
|
92
|
-
* <Suspense fallback={<div>Loading A...</div>}>
|
|
93
|
-
* <ComponentA />
|
|
94
|
-
* </Suspense>
|
|
95
|
-
* <Suspense fallback={<div>Loading B...</div>}>
|
|
96
|
-
* <ComponentB />
|
|
97
|
-
* </Suspense>
|
|
98
|
-
* </SuspenseList>
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
export declare function SuspenseList(this: Context, { revealOrder, tail, timeout, children, }: {
|
|
102
|
-
revealOrder?: "forwards" | "backwards" | "together";
|
|
103
|
-
tail?: "collapsed" | "hidden";
|
|
104
|
-
timeout?: number;
|
|
105
|
-
children: Children;
|
|
106
|
-
}): Generator<Children>;
|
|
107
|
-
export {};
|