@davidsouther/jiffies 2.2.4 → 2.3.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/LICENSE +1 -1
- package/lib/cjs/assert.d.ts +2 -2
- package/lib/cjs/awaitable.d.ts +1 -1
- package/lib/cjs/components/button_bar.d.ts +2 -2
- package/lib/cjs/components/inline_edit.d.ts +2 -2
- package/lib/cjs/components/logger.d.ts +1 -1
- package/lib/cjs/components/select.d.ts +4 -7
- package/lib/cjs/components/test.d.ts +1 -1
- package/lib/cjs/components/virtual_scroll.d.ts +6 -4
- package/lib/cjs/context.d.ts +5 -9
- package/lib/cjs/debounce.d.ts +1 -1
- package/lib/cjs/diff.d.ts +2 -2
- package/lib/cjs/display.d.ts +1 -1
- package/lib/cjs/dom/css/border.d.ts +2 -2
- package/lib/cjs/dom/css/constants.d.ts +3 -3
- package/lib/cjs/dom/css/core.d.ts +1 -1
- package/lib/cjs/dom/css/fstyle.d.ts +2 -2
- package/lib/cjs/dom/css/sizing.d.ts +2 -2
- package/lib/cjs/dom/dom.d.ts +8 -8
- package/lib/cjs/dom/fc.d.ts +8 -12
- package/lib/cjs/dom/form/form.d.ts +5 -6
- package/lib/cjs/dom/html.d.ts +112 -113
- package/lib/cjs/dom/observable.d.ts +1 -1
- package/lib/cjs/dom/provide.d.ts +1 -1
- package/lib/cjs/dom/router/router.d.ts +2 -2
- package/lib/cjs/dom/svg.d.ts +64 -64
- package/lib/cjs/dom/types/css.d.ts +10 -32
- package/lib/cjs/dom/types/html.d.ts +4 -6
- package/lib/cjs/equal.d.ts +8 -5
- package/lib/cjs/flags.d.ts +1 -1
- package/lib/cjs/fs.d.ts +3 -3
- package/lib/cjs/fs_node.d.ts +1 -1
- package/lib/cjs/lock.d.ts +1 -1
- package/lib/cjs/log.d.ts +9 -9
- package/lib/cjs/observable/event.d.ts +2 -2
- package/lib/cjs/observable/observable.d.ts +37 -35
- package/lib/cjs/result.d.ts +21 -21
- package/lib/cjs/safe.d.ts +1 -1
- package/lib/cjs/scope/describe.d.ts +4 -4
- package/lib/cjs/scope/display/console.d.ts +1 -1
- package/lib/cjs/scope/display/dom.d.ts +2 -2
- package/lib/cjs/scope/display/junit.d.ts +1 -1
- package/lib/cjs/scope/execute.d.ts +2 -2
- package/lib/cjs/scope/index.d.ts +3 -3
- package/lib/cjs/scope/scope.d.ts +3 -3
- package/lib/cjs/scope/state.d.ts +1 -1
- package/lib/cjs/server/http/apps.d.ts +1 -1
- package/lib/cjs/server/http/css.d.ts +1 -1
- package/lib/cjs/server/http/index.d.ts +4 -9
- package/lib/cjs/server/http/response.d.ts +3 -3
- package/lib/cjs/server/http/sitemap.d.ts +1 -1
- package/lib/cjs/server/http/static.d.ts +1 -1
- package/lib/cjs/server/http/typescript.d.ts +1 -1
- package/lib/cjs/test_all.d.ts +9 -9
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/assert.d.ts +2 -2
- package/lib/esm/awaitable.d.ts +1 -1
- package/lib/esm/components/button_bar.d.ts +2 -2
- package/lib/esm/components/inline_edit.d.ts +2 -2
- package/lib/esm/components/logger.d.ts +1 -1
- package/lib/esm/components/select.d.ts +3 -3
- package/lib/esm/components/test.d.ts +1 -1
- package/lib/esm/components/virtual_scroll.d.ts +6 -4
- package/lib/esm/context.d.ts +5 -9
- package/lib/esm/debounce.d.ts +1 -2
- package/lib/esm/diff.d.ts +2 -2
- package/lib/esm/display.d.ts +1 -1
- package/lib/esm/dom/css/border.d.ts +2 -2
- package/lib/esm/dom/css/constants.d.ts +3 -3
- package/lib/esm/dom/css/core.d.ts +1 -1
- package/lib/esm/dom/css/fstyle.d.ts +2 -2
- package/lib/esm/dom/css/sizing.d.ts +2 -2
- package/lib/esm/dom/dom.d.ts +8 -8
- package/lib/esm/dom/fc.d.ts +8 -12
- package/lib/esm/dom/form/form.d.ts +5 -6
- package/lib/esm/dom/html.d.ts +112 -113
- package/lib/esm/dom/observable.d.ts +1 -1
- package/lib/esm/dom/provide.d.ts +1 -1
- package/lib/esm/dom/router/router.d.ts +2 -2
- package/lib/esm/dom/svg.d.ts +64 -64
- package/lib/esm/dom/types/css.d.ts +10 -32
- package/lib/esm/dom/types/html.d.ts +4 -6
- package/lib/esm/equal.d.ts +8 -5
- package/lib/esm/flags.d.ts +1 -1
- package/lib/esm/fs.d.ts +3 -3
- package/lib/esm/fs_node.d.ts +1 -1
- package/lib/esm/lock.d.ts +1 -1
- package/lib/esm/log.d.ts +9 -9
- package/lib/esm/observable/event.d.ts +2 -2
- package/lib/esm/observable/observable.d.ts +37 -35
- package/lib/esm/result.d.ts +21 -21
- package/lib/esm/safe.d.ts +1 -1
- package/lib/esm/scope/describe.d.ts +4 -4
- package/lib/esm/scope/display/console.d.ts +1 -1
- package/lib/esm/scope/display/dom.d.ts +2 -2
- package/lib/esm/scope/display/junit.d.ts +1 -1
- package/lib/esm/scope/execute.d.ts +2 -2
- package/lib/esm/scope/index.d.ts +3 -3
- package/lib/esm/scope/scope.d.ts +3 -3
- package/lib/esm/scope/state.d.ts +1 -1
- package/lib/esm/server/http/apps.d.ts +1 -1
- package/lib/esm/server/http/css.d.ts +1 -1
- package/lib/esm/server/http/index.d.ts +4 -9
- package/lib/esm/server/http/response.d.ts +3 -3
- package/lib/esm/server/http/sitemap.d.ts +1 -1
- package/lib/esm/server/http/static.d.ts +1 -1
- package/lib/esm/server/http/typescript.d.ts +1 -1
- package/lib/esm/test_all.d.ts +9 -9
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -9
- package/src/assert.ts +5 -5
- package/src/components/button_bar.ts +28 -30
- package/src/components/inline_edit.ts +8 -7
- package/src/components/logger.ts +6 -6
- package/src/components/select.ts +7 -7
- package/src/components/test.ts +5 -0
- package/src/components/virtual_scroll.test.ts +9 -6
- package/src/components/virtual_scroll.ts +29 -24
- package/src/context.test.ts +4 -4
- package/src/context.ts +16 -11
- package/src/debounce.ts +9 -3
- package/src/diff.test.ts +4 -4
- package/src/diff.ts +14 -16
- package/src/dom/css/border.ts +11 -11
- package/src/dom/css/core.ts +1 -1
- package/src/dom/css/fstyle.ts +4 -4
- package/src/dom/css/sizing.ts +1 -1
- package/src/dom/dom.ts +57 -47
- package/src/dom/fc.test.ts +8 -8
- package/src/dom/fc.ts +32 -35
- package/src/dom/form/form.app.ts +9 -9
- package/src/dom/form/form.ts +25 -16
- package/src/dom/form/index.html +3 -2
- package/src/dom/html.test.ts +12 -10
- package/src/dom/html.ts +2 -3
- package/src/dom/observable.test.ts +6 -6
- package/src/dom/observable.ts +2 -2
- package/src/dom/provide.ts +1 -1
- package/src/dom/router/link.ts +3 -3
- package/src/dom/router/router.ts +5 -5
- package/src/dom/svg.ts +7 -6
- package/src/dom/test.ts +3 -0
- package/src/dom/types/css.ts +43 -61
- package/src/dom/types/html.ts +2 -4
- package/src/dom/xml.ts +2 -2
- package/src/equal.test.ts +3 -3
- package/src/equal.ts +27 -14
- package/src/flags.test.ts +2 -2
- package/src/flags.ts +2 -2
- package/src/fs.test.ts +5 -5
- package/src/fs.ts +26 -20
- package/src/fs_node.ts +4 -4
- package/src/fs_win.test.ts +1 -1
- package/src/generator.test.ts +4 -3
- package/src/generator.ts +1 -1
- package/src/hooks/_notes +4 -1
- package/src/index.html +7 -7
- package/src/lock.test.ts +4 -4
- package/src/lock.ts +8 -7
- package/src/log.ts +28 -18
- package/src/observable/event.ts +7 -7
- package/src/observable/observable.test.ts +3 -3
- package/src/observable/observable.ts +71 -52
- package/src/result.test.ts +7 -10
- package/src/result.ts +51 -47
- package/src/safe.ts +1 -1
- package/src/scope/describe.ts +12 -11
- package/src/scope/display/console.ts +4 -4
- package/src/scope/display/dom.ts +9 -9
- package/src/scope/display/junit.ts +21 -24
- package/src/scope/execute.ts +17 -12
- package/src/scope/expect.ts +22 -22
- package/src/scope/fix.ts +10 -7
- package/src/scope/index.ts +3 -3
- package/src/scope/scope.ts +2 -2
- package/src/scope/state.ts +2 -2
- package/src/server/http/apps.ts +5 -5
- package/src/server/http/css.ts +10 -26
- package/src/server/http/index.ts +30 -24
- package/src/server/http/response.ts +12 -5
- package/src/server/http/sitemap.ts +8 -8
- package/src/server/http/static.ts +9 -6
- package/src/server/http/typescript.ts +25 -25
- package/src/server/main.ts +7 -4
- package/src/test.mjs +8 -8
- package/src/test_all.ts +16 -13
- package/src/transpile.mjs +6 -18
- package/build/pico.css +0 -2466
- package/build/pico.css.map +0 -1
- package/lib/cjs/assert.js +0 -46
- package/lib/cjs/awaitable.js +0 -2
- package/lib/cjs/case.js +0 -9
- package/lib/cjs/components/button_bar.js +0 -29
- package/lib/cjs/components/inline_edit.js +0 -51
- package/lib/cjs/components/logger.js +0 -27
- package/lib/cjs/components/select.js +0 -6
- package/lib/cjs/components/test.js +0 -7
- package/lib/cjs/components/virtual_scroll.js +0 -102
- package/lib/cjs/components/virtual_scroll.test.js +0 -22
- package/lib/cjs/context.js +0 -48
- package/lib/cjs/context.test.js +0 -48
- package/lib/cjs/debounce.js +0 -12
- package/lib/cjs/diff.js +0 -58
- package/lib/cjs/diff.test.js +0 -41
- package/lib/cjs/display.js +0 -16
- package/lib/cjs/dom/css/border.js +0 -33
- package/lib/cjs/dom/css/constants.js +0 -31
- package/lib/cjs/dom/css/core.js +0 -31
- package/lib/cjs/dom/css/fstyle.js +0 -36
- package/lib/cjs/dom/css/sizing.js +0 -14
- package/lib/cjs/dom/dom.js +0 -110
- package/lib/cjs/dom/fc.js +0 -39
- package/lib/cjs/dom/fc.test.js +0 -23
- package/lib/cjs/dom/form/form.app.js +0 -27
- package/lib/cjs/dom/form/form.js +0 -49
- package/lib/cjs/dom/form/form.test.js +0 -1
- package/lib/cjs/dom/html.js +0 -119
- package/lib/cjs/dom/html.test.js +0 -60
- package/lib/cjs/dom/observable.js +0 -10
- package/lib/cjs/dom/observable.test.js +0 -35
- package/lib/cjs/dom/provide.js +0 -12
- package/lib/cjs/dom/router/link.js +0 -7
- package/lib/cjs/dom/router/router.js +0 -55
- package/lib/cjs/dom/svg.js +0 -69
- package/lib/cjs/dom/test.js +0 -13
- package/lib/cjs/dom/types/css.js +0 -24
- package/lib/cjs/dom/types/dom.js +0 -1
- package/lib/cjs/dom/types/html.js +0 -2
- package/lib/cjs/dom/xml.js +0 -8
- package/lib/cjs/equal.js +0 -48
- package/lib/cjs/equal.test.js +0 -22
- package/lib/cjs/flags.js +0 -52
- package/lib/cjs/flags.test.js +0 -37
- package/lib/cjs/fs.js +0 -235
- package/lib/cjs/fs.test.js +0 -86
- package/lib/cjs/fs_node.js +0 -50
- package/lib/cjs/fs_win.test.js +0 -10
- package/lib/cjs/generator.js +0 -14
- package/lib/cjs/generator.test.js +0 -26
- package/lib/cjs/is_browser.js +0 -4
- package/lib/cjs/loader-register.d.mts +0 -1
- package/lib/cjs/loader-register.d.ts +0 -1
- package/lib/cjs/loader-register.js +0 -4
- package/lib/cjs/loader-register.mjs +0 -4
- package/lib/cjs/loader.d.mts +0 -23
- package/lib/cjs/loader.mjs +0 -41
- package/lib/cjs/lock.js +0 -27
- package/lib/cjs/lock.test.js +0 -18
- package/lib/cjs/log.js +0 -98
- package/lib/cjs/observable/event.js +0 -61
- package/lib/cjs/observable/observable.js +0 -363
- package/lib/cjs/observable/observable.test.js +0 -65
- package/lib/cjs/package.json +0 -1
- package/lib/cjs/range.js +0 -11
- package/lib/cjs/result.js +0 -80
- package/lib/cjs/result.test.js +0 -78
- package/lib/cjs/safe.js +0 -14
- package/lib/cjs/scope/describe.js +0 -73
- package/lib/cjs/scope/display/console.js +0 -25
- package/lib/cjs/scope/display/dom.js +0 -30
- package/lib/cjs/scope/display/junit.js +0 -21
- package/lib/cjs/scope/execute.js +0 -91
- package/lib/cjs/scope/expect.js +0 -110
- package/lib/cjs/scope/fix.js +0 -26
- package/lib/cjs/scope/index.js +0 -15
- package/lib/cjs/scope/scope.js +0 -2
- package/lib/cjs/scope/state.js +0 -12
- package/lib/cjs/server/http/apps.js +0 -27
- package/lib/cjs/server/http/css.js +0 -54
- package/lib/cjs/server/http/index.js +0 -77
- package/lib/cjs/server/http/response.js +0 -45
- package/lib/cjs/server/http/sitemap.js +0 -46
- package/lib/cjs/server/http/static.js +0 -25
- package/lib/cjs/server/http/typescript.js +0 -44
- package/lib/cjs/server/main.js +0 -14
- package/lib/cjs/test.mjs +0 -28
- package/lib/cjs/test_all.js +0 -30
- package/lib/cjs/transpile.mjs +0 -22
- package/lib/esm/assert.js +0 -38
- package/lib/esm/awaitable.js +0 -1
- package/lib/esm/case.js +0 -5
- package/lib/esm/components/button_bar.js +0 -27
- package/lib/esm/components/inline_edit.js +0 -48
- package/lib/esm/components/logger.js +0 -22
- package/lib/esm/components/select.js +0 -3
- package/lib/esm/components/test.js +0 -3
- package/lib/esm/components/virtual_scroll.js +0 -94
- package/lib/esm/components/virtual_scroll.test.js +0 -20
- package/lib/esm/context.js +0 -43
- package/lib/esm/context.test.js +0 -46
- package/lib/esm/debounce.js +0 -8
- package/lib/esm/diff.js +0 -54
- package/lib/esm/diff.test.js +0 -39
- package/lib/esm/display.js +0 -11
- package/lib/esm/dom/css/border.js +0 -27
- package/lib/esm/dom/css/constants.js +0 -28
- package/lib/esm/dom/css/core.js +0 -24
- package/lib/esm/dom/css/fstyle.js +0 -32
- package/lib/esm/dom/css/sizing.js +0 -10
- package/lib/esm/dom/dom.js +0 -104
- package/lib/esm/dom/fc.js +0 -35
- package/lib/esm/dom/fc.test.js +0 -21
- package/lib/esm/dom/form/form.app.js +0 -23
- package/lib/esm/dom/form/form.js +0 -34
- package/lib/esm/dom/form/form.test.js +0 -1
- package/lib/esm/dom/html.js +0 -114
- package/lib/esm/dom/html.test.js +0 -58
- package/lib/esm/dom/observable.js +0 -6
- package/lib/esm/dom/observable.test.js +0 -33
- package/lib/esm/dom/provide.js +0 -7
- package/lib/esm/dom/router/link.js +0 -3
- package/lib/esm/dom/router/router.js +0 -52
- package/lib/esm/dom/svg.js +0 -65
- package/lib/esm/dom/test.js +0 -9
- package/lib/esm/dom/types/css.js +0 -23
- package/lib/esm/dom/types/dom.js +0 -1
- package/lib/esm/dom/types/html.js +0 -1
- package/lib/esm/dom/xml.js +0 -4
- package/lib/esm/equal.js +0 -41
- package/lib/esm/equal.test.js +0 -20
- package/lib/esm/flags.js +0 -48
- package/lib/esm/flags.test.js +0 -35
- package/lib/esm/fs.js +0 -226
- package/lib/esm/fs.test.js +0 -84
- package/lib/esm/fs_node.js +0 -45
- package/lib/esm/fs_win.test.js +0 -8
- package/lib/esm/generator.js +0 -10
- package/lib/esm/generator.test.js +0 -24
- package/lib/esm/is_browser.js +0 -1
- package/lib/esm/loader-register.d.mts +0 -1
- package/lib/esm/loader-register.mjs +0 -2
- package/lib/esm/loader.d.mts +0 -23
- package/lib/esm/loader.mjs +0 -36
- package/lib/esm/lock.js +0 -23
- package/lib/esm/lock.test.js +0 -16
- package/lib/esm/log.js +0 -88
- package/lib/esm/observable/event.js +0 -46
- package/lib/esm/observable/observable.js +0 -343
- package/lib/esm/observable/observable.test.js +0 -63
- package/lib/esm/range.js +0 -7
- package/lib/esm/result.js +0 -65
- package/lib/esm/result.test.js +0 -76
- package/lib/esm/safe.js +0 -10
- package/lib/esm/scope/describe.js +0 -60
- package/lib/esm/scope/display/console.js +0 -21
- package/lib/esm/scope/display/dom.js +0 -26
- package/lib/esm/scope/display/junit.js +0 -17
- package/lib/esm/scope/execute.js +0 -85
- package/lib/esm/scope/expect.js +0 -104
- package/lib/esm/scope/fix.js +0 -22
- package/lib/esm/scope/index.js +0 -3
- package/lib/esm/scope/scope.js +0 -1
- package/lib/esm/scope/state.js +0 -8
- package/lib/esm/server/http/apps.js +0 -23
- package/lib/esm/server/http/css.js +0 -50
- package/lib/esm/server/http/index.js +0 -73
- package/lib/esm/server/http/response.js +0 -40
- package/lib/esm/server/http/sitemap.js +0 -42
- package/lib/esm/server/http/static.js +0 -21
- package/lib/esm/server/http/typescript.js +0 -40
- package/lib/esm/server/main.js +0 -12
- package/lib/esm/test.mjs +0 -26
- package/lib/esm/test_all.js +0 -28
- package/lib/esm/transpile.mjs +0 -18
- package/src/components/test.js +0 -3
- package/src/loader-register.mjs +0 -3
- package/src/loader.mjs +0 -46
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { debounce } from "../debounce.
|
|
2
|
-
import { FC, State } from "../dom/fc.
|
|
3
|
-
import { div } from "../dom/html.
|
|
1
|
+
import { debounce } from "../debounce.ts";
|
|
2
|
+
import { FC, State } from "../dom/fc.ts";
|
|
3
|
+
import { div } from "../dom/html.ts";
|
|
4
4
|
|
|
5
5
|
export interface VirtualScrollSettings {
|
|
6
6
|
minIndex: number;
|
|
@@ -11,9 +11,10 @@ export interface VirtualScrollSettings {
|
|
|
11
11
|
tolerance: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
export type VirtualScrollDataAdapter<T> = (
|
|
15
|
+
offset: number,
|
|
16
|
+
limit: number,
|
|
17
|
+
) => Iterable<T>;
|
|
17
18
|
|
|
18
19
|
export function arrayAdapter<T>(data: T[]): VirtualScrollDataAdapter<T> {
|
|
19
20
|
return (offset, limit) => data.slice(offset, offset + limit);
|
|
@@ -26,7 +27,7 @@ export interface VirtualScrollProps<T, U extends HTMLElement> {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export function fillVirtualScrollSettings(
|
|
29
|
-
settings: Partial<VirtualScrollSettings
|
|
30
|
+
settings: Partial<VirtualScrollSettings>,
|
|
30
31
|
): VirtualScrollSettings {
|
|
31
32
|
const {
|
|
32
33
|
minIndex = 0,
|
|
@@ -41,7 +42,7 @@ export function fillVirtualScrollSettings(
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
export function initialState<T>(
|
|
44
|
-
settings: VirtualScrollSettings
|
|
45
|
+
settings: VirtualScrollSettings,
|
|
45
46
|
): VirtualScrollState<T> {
|
|
46
47
|
// From Denis Hilt, https://blog.logrocket.com/virtual-scrolling-core-principles-and-basic-implementation-in-react/
|
|
47
48
|
const { minIndex, maxIndex, startIndex, itemHeight, count, tolerance } =
|
|
@@ -75,7 +76,7 @@ export function getData<T>(
|
|
|
75
76
|
maxIndex: number,
|
|
76
77
|
offset: number,
|
|
77
78
|
limit: number,
|
|
78
|
-
get: VirtualScrollDataAdapter<T
|
|
79
|
+
get: VirtualScrollDataAdapter<T>,
|
|
79
80
|
): T[] {
|
|
80
81
|
const start = Math.max(0, minIndex, offset);
|
|
81
82
|
const end = Math.min(maxIndex, offset + limit - 1);
|
|
@@ -86,7 +87,7 @@ export function getData<T>(
|
|
|
86
87
|
export function doScroll<T>(
|
|
87
88
|
scrollTop: number,
|
|
88
89
|
state: VirtualScrollState<T>,
|
|
89
|
-
get: VirtualScrollDataAdapter<T
|
|
90
|
+
get: VirtualScrollDataAdapter<T>,
|
|
90
91
|
): {
|
|
91
92
|
scrollTop: number;
|
|
92
93
|
topPaddingHeight: number;
|
|
@@ -105,7 +106,7 @@ export function doScroll<T>(
|
|
|
105
106
|
const topPaddingHeight = Math.max((index - minIndex) * itemHeight, 0);
|
|
106
107
|
const bottomPaddingHeight = Math.max(
|
|
107
108
|
totalHeight - (topPaddingHeight + data.length * itemHeight),
|
|
108
|
-
0
|
|
109
|
+
0,
|
|
109
110
|
);
|
|
110
111
|
|
|
111
112
|
return { scrollTop, topPaddingHeight, bottomPaddingHeight, data };
|
|
@@ -124,23 +125,24 @@ interface VirtualScrollState<T, U extends HTMLElement = HTMLElement> {
|
|
|
124
125
|
rows: U[];
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
export interface VirtualScroll<T, U extends HTMLElement> {
|
|
129
|
+
state: VirtualScrollState<T>;
|
|
130
|
+
rows: U[];
|
|
131
|
+
}
|
|
131
132
|
|
|
132
133
|
export const VirtualScroll = FC<
|
|
133
|
-
VirtualScrollProps<
|
|
134
|
-
VirtualScrollState<
|
|
134
|
+
VirtualScrollProps<unknown, HTMLElement>,
|
|
135
|
+
VirtualScrollState<unknown, HTMLElement>
|
|
135
136
|
>("virtual-scroll", (element, props) => {
|
|
136
137
|
const settings = fillVirtualScrollSettings(props.settings);
|
|
137
|
-
const state =
|
|
138
|
+
const state = {
|
|
138
139
|
...initialState(settings),
|
|
139
140
|
...element[State],
|
|
140
|
-
}
|
|
141
|
+
};
|
|
142
|
+
element[State] = state;
|
|
141
143
|
|
|
142
144
|
const scrollTo = (
|
|
143
|
-
{ target }: { target?: { scrollTop: number } } = { target: state }
|
|
145
|
+
{ target }: { target?: { scrollTop: number } } = { target: state },
|
|
144
146
|
) => {
|
|
145
147
|
const scrollTop = target?.scrollTop ?? state.topPaddingHeight;
|
|
146
148
|
const updatedSate = {
|
|
@@ -152,7 +154,10 @@ export const VirtualScroll = FC<
|
|
|
152
154
|
|
|
153
155
|
const viewportElement = div({
|
|
154
156
|
style: { height: `${state.viewportHeight}px`, overflowY: "scroll" },
|
|
155
|
-
events: {
|
|
157
|
+
events: {
|
|
158
|
+
// @ts-expect-error
|
|
159
|
+
scroll: debounce(scrollTo, 0),
|
|
160
|
+
},
|
|
156
161
|
});
|
|
157
162
|
setTimeout(() => {
|
|
158
163
|
viewportElement.scroll({ top: state.scrollTop });
|
|
@@ -176,13 +181,13 @@ export const VirtualScroll = FC<
|
|
|
176
181
|
class: `VirtualScroll__item_${i}`,
|
|
177
182
|
style: { height: `${settings.itemHeight}px` },
|
|
178
183
|
},
|
|
179
|
-
row
|
|
180
|
-
)
|
|
184
|
+
row,
|
|
185
|
+
),
|
|
181
186
|
),
|
|
182
187
|
div({
|
|
183
188
|
class: "VirtualScroll__bottomPadding",
|
|
184
189
|
style: { height: `${state.bottomPaddingHeight}px` },
|
|
185
|
-
})
|
|
190
|
+
}),
|
|
186
191
|
);
|
|
187
192
|
};
|
|
188
193
|
|
package/src/context.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Context, Enter, Exit, using } from "./context.
|
|
2
|
-
import { Err, isErr, isOk, Ok, unwrap } from "./result.
|
|
3
|
-
import { describe, it } from "./scope/describe.
|
|
4
|
-
import { expect } from "./scope/expect.
|
|
1
|
+
import { type Context, Enter, Exit, using } from "./context.ts";
|
|
2
|
+
import { Err, isErr, isOk, Ok, unwrap } from "./result.ts";
|
|
3
|
+
import { describe, it } from "./scope/describe.ts";
|
|
4
|
+
import { expect } from "./scope/expect.ts";
|
|
5
5
|
|
|
6
6
|
describe("Context", () => {
|
|
7
7
|
it("performs an operation using a context", () => {
|
package/src/context.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Err, isResult, Ok, type Result } from "./result.ts";
|
|
2
2
|
|
|
3
3
|
export const Enter = Symbol("Context Enter");
|
|
4
4
|
export const Exit = Symbol("Context Exit");
|
|
@@ -8,18 +8,20 @@ export interface Context {
|
|
|
8
8
|
[Exit]: () => void;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export type Operation<T, E extends Error, C extends Context> = (
|
|
12
|
+
c: C,
|
|
13
|
+
) => T | Result<T, E>;
|
|
14
14
|
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
export type AsyncOperation<T, E extends Error, C extends Context> = (
|
|
16
|
+
c: C,
|
|
17
|
+
) => Promise<T | Result<T, E>>;
|
|
18
18
|
|
|
19
19
|
export function using<T, E extends Error, C extends Context>(
|
|
20
20
|
context: C | (() => C) | Operation<T, E, C>,
|
|
21
21
|
operation?: Operation<T, E, C>,
|
|
22
|
-
normalizeError: (e: Error | unknown
|
|
22
|
+
normalizeError: (e: Error | unknown) => Err<E> = (e) =>
|
|
23
|
+
// @ts-expect-error
|
|
24
|
+
Err(e),
|
|
23
25
|
): Result<T, E> {
|
|
24
26
|
if (typeof context === "function") {
|
|
25
27
|
if (context.length === 1) {
|
|
@@ -32,7 +34,7 @@ export function using<T, E extends Error, C extends Context>(
|
|
|
32
34
|
let result: Result<T, E>;
|
|
33
35
|
try {
|
|
34
36
|
context[Enter]();
|
|
35
|
-
const op = operation
|
|
37
|
+
const op = operation?.(context);
|
|
36
38
|
result = isResult(op as Result<T, E>) ? (op as Result<T, E>) : Ok(op as T);
|
|
37
39
|
} catch (e) {
|
|
38
40
|
result = normalizeError(e);
|
|
@@ -45,7 +47,7 @@ export function using<T, E extends Error, C extends Context>(
|
|
|
45
47
|
export async function asyncUsing<T, E extends Error, C extends Context>(
|
|
46
48
|
context: C | (() => Promise<C>),
|
|
47
49
|
operation: AsyncOperation<T, E, C>,
|
|
48
|
-
normalizeError: (e:
|
|
50
|
+
normalizeError: (e: E) => Err<E> = (e: E) => Err(e),
|
|
49
51
|
): Promise<Result<T, E>> {
|
|
50
52
|
context = typeof context === "function" ? await context() : context;
|
|
51
53
|
let result: Result<T, E>;
|
|
@@ -54,7 +56,10 @@ export async function asyncUsing<T, E extends Error, C extends Context>(
|
|
|
54
56
|
const op = await operation(context);
|
|
55
57
|
result = isResult(op as Result<T, E>) ? (op as Result<T, E>) : Ok(op as T);
|
|
56
58
|
} catch (e) {
|
|
57
|
-
result = normalizeError(
|
|
59
|
+
result = normalizeError(
|
|
60
|
+
// @ts-expect-error
|
|
61
|
+
e,
|
|
62
|
+
);
|
|
58
63
|
} finally {
|
|
59
64
|
context[Exit]();
|
|
60
65
|
}
|
package/src/debounce.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
export function debounce
|
|
1
|
+
export function debounce<T extends unknown[]>(
|
|
2
|
+
fn: (...args: T) => void,
|
|
3
|
+
ms = 32,
|
|
4
|
+
): (...args: T) => void {
|
|
2
5
|
let timer: ReturnType<typeof setTimeout>;
|
|
3
|
-
return (...args:
|
|
6
|
+
return (...args: T) => {
|
|
4
7
|
clearTimeout(timer);
|
|
5
|
-
timer = setTimeout(() =>
|
|
8
|
+
timer = setTimeout(() => {
|
|
9
|
+
clearTimeout(timer);
|
|
10
|
+
return fn(...args);
|
|
11
|
+
}, ms);
|
|
6
12
|
return timer;
|
|
7
13
|
};
|
|
8
14
|
}
|
package/src/diff.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { diff } from "./diff.
|
|
2
|
-
import { describe, it } from "./scope/describe.
|
|
3
|
-
import { expect } from "./scope/expect.
|
|
1
|
+
import { diff } from "./diff.ts";
|
|
2
|
+
import { describe, it } from "./scope/describe.ts";
|
|
3
|
+
import { expect } from "./scope/expect.ts";
|
|
4
4
|
|
|
5
5
|
describe("diff", () => {
|
|
6
6
|
it("diffs primitives", () => {
|
|
@@ -36,7 +36,7 @@ describe("diff", () => {
|
|
|
36
36
|
it("diffs objects in an array", () => {
|
|
37
37
|
const diffed = diff(
|
|
38
38
|
[{ a: { b: 1 } }, { a: { b: 2 } }, { a: { b: 3 } }],
|
|
39
|
-
[{ a: { b: 1 } }, { a: { b: 4 } }, { a: { b: 3 } }]
|
|
39
|
+
[{ a: { b: 1 } }, { a: { b: 4 } }, { a: { b: 3 } }],
|
|
40
40
|
);
|
|
41
41
|
expect(diffed).toEqual([
|
|
42
42
|
{
|
package/src/diff.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { range } from "./range.
|
|
2
|
-
import { isSome, None, Option, Some } from "./result.
|
|
1
|
+
import { range } from "./range.ts";
|
|
2
|
+
import { isSome, None, type Option, Some } from "./result.ts";
|
|
3
3
|
|
|
4
4
|
export const DiffA = Symbol("A");
|
|
5
5
|
export const DiffB = Symbol("B");
|
|
@@ -20,29 +20,27 @@ interface DiffList {
|
|
|
20
20
|
|
|
21
21
|
function doDiff<T>(va: T, vb: T, k: DiffIndex): Option<DiffList | DiffEntry> {
|
|
22
22
|
if (Array.isArray(va)) {
|
|
23
|
-
// @ts-
|
|
23
|
+
// @ts-expect-error
|
|
24
24
|
return diffArray(va, vb, k);
|
|
25
25
|
}
|
|
26
26
|
if (typeof va === "object") {
|
|
27
|
-
const d = diffObject(va, vb, k);
|
|
27
|
+
const d = diffObject(va ?? {}, vb ?? {}, k);
|
|
28
28
|
if (d.children.length === 0) {
|
|
29
29
|
return None();
|
|
30
|
-
} else {
|
|
31
|
-
return Some(d);
|
|
32
30
|
}
|
|
31
|
+
return Some(d);
|
|
33
32
|
}
|
|
34
33
|
if (Object.is(va, vb)) {
|
|
35
34
|
return None();
|
|
36
|
-
} else {
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
return { key: k, left: va, right: vb };
|
|
39
35
|
}
|
|
36
|
+
// @ts-expect-error
|
|
37
|
+
return { key: k, left: va, right: vb };
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
function diffArray<T>(
|
|
43
41
|
a: Partial<T>[],
|
|
44
42
|
b: Partial<T>[],
|
|
45
|
-
key: DiffIndex
|
|
43
|
+
key: DiffIndex,
|
|
46
44
|
): Option<DiffList> {
|
|
47
45
|
const indexes = Math.max(a.length, b.length);
|
|
48
46
|
const children = range(0, indexes)
|
|
@@ -54,11 +52,11 @@ function diffArray<T>(
|
|
|
54
52
|
function diffObject<T>(
|
|
55
53
|
a: Partial<T>,
|
|
56
54
|
b: Partial<T>,
|
|
57
|
-
key: DiffIndex = ""
|
|
55
|
+
key: DiffIndex = "",
|
|
58
56
|
): DiffList {
|
|
59
57
|
const keys = new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
60
58
|
const children = [...keys]
|
|
61
|
-
// @ts-
|
|
59
|
+
// @ts-expect-error
|
|
62
60
|
.map((k) => doDiff(a[k], b[k], k))
|
|
63
61
|
.filter(isSome);
|
|
64
62
|
return {
|
|
@@ -69,16 +67,16 @@ function diffObject<T>(
|
|
|
69
67
|
|
|
70
68
|
export function diff<T>(
|
|
71
69
|
a: Partial<T>,
|
|
72
|
-
b: Partial<T
|
|
70
|
+
b: Partial<T>,
|
|
73
71
|
): (DiffEntry | DiffList)[] {
|
|
74
|
-
if (typeof a
|
|
75
|
-
// @ts-
|
|
72
|
+
if (typeof a !== "object" && !Object.is(a, b)) {
|
|
73
|
+
// @ts-expect-error
|
|
76
74
|
return [{ key: "", left: a, right: b }];
|
|
77
75
|
}
|
|
78
76
|
return (
|
|
79
77
|
Array.isArray(a)
|
|
80
78
|
? // @ts-ignore
|
|
81
|
-
diffArray(a, b, "") ?? { children: [] }
|
|
79
|
+
(diffArray(a, b, "") ?? { children: [] })
|
|
82
80
|
: diffObject(a, b, "")
|
|
83
81
|
).children;
|
|
84
82
|
}
|
package/src/dom/css/border.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Properties } from "../types/css.
|
|
2
|
-
import { Side, Size } from "./constants.
|
|
3
|
-
import {
|
|
1
|
+
import type { Properties } from "../types/css.ts";
|
|
2
|
+
import type { Side, Size } from "./constants.ts";
|
|
3
|
+
import { getSide, getSize, isSide } from "./core.ts";
|
|
4
4
|
|
|
5
5
|
export function rounded(size: Size = "", side: Side = "") {
|
|
6
6
|
if (isSide(size)) {
|
|
@@ -12,7 +12,7 @@ export function rounded(size: Size = "", side: Side = "") {
|
|
|
12
12
|
if (curr === "") {
|
|
13
13
|
prev.borderRadius = sized;
|
|
14
14
|
} else {
|
|
15
|
-
// @ts-
|
|
15
|
+
// @ts-expect-error
|
|
16
16
|
prev[`border${curr}Radius`] = sized;
|
|
17
17
|
}
|
|
18
18
|
return prev;
|
|
@@ -20,11 +20,11 @@ export function rounded(size: Size = "", side: Side = "") {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function border({
|
|
23
|
-
side = "",
|
|
24
|
-
style = "solid",
|
|
25
|
-
radius = "",
|
|
26
|
-
width = 1,
|
|
27
|
-
color = "black",
|
|
23
|
+
side: _side = "",
|
|
24
|
+
style: _style = "solid",
|
|
25
|
+
radius: _radius = "",
|
|
26
|
+
width: _width = 1,
|
|
27
|
+
color: _color = "black",
|
|
28
28
|
}: {
|
|
29
29
|
side?: Side;
|
|
30
30
|
style?: "solid" | "dotted" | "dashed" | "double" | "none";
|
|
@@ -37,8 +37,8 @@ export function border({
|
|
|
37
37
|
|
|
38
38
|
export function inset(
|
|
39
39
|
width: 0 | 1 | 2 | 4 | 8,
|
|
40
|
-
color1
|
|
41
|
-
color2
|
|
40
|
+
color1 = "gray",
|
|
41
|
+
color2 = "lightgray",
|
|
42
42
|
) {
|
|
43
43
|
return {
|
|
44
44
|
...border({ side: "tl", width, color: color1, radius: "none" }),
|
package/src/dom/css/core.ts
CHANGED
package/src/dom/css/fstyle.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { dashCase } from "../../case.
|
|
2
|
-
import { Properties } from "../types/css.
|
|
1
|
+
import { dashCase } from "../../case.ts";
|
|
2
|
+
import type { Properties } from "../types/css.ts";
|
|
3
3
|
|
|
4
4
|
export type FStyle =
|
|
5
5
|
| Properties
|
|
@@ -12,7 +12,7 @@ export function compileFStyle(fstyle: FStyle, prefix = ""): string {
|
|
|
12
12
|
const rules: { key: string; value: FStyle }[] = [];
|
|
13
13
|
|
|
14
14
|
for (const [key, value] of Object.entries(fstyle)) {
|
|
15
|
-
if (typeof value
|
|
15
|
+
if (typeof value === "string") {
|
|
16
16
|
properties.push({ key, value });
|
|
17
17
|
} else {
|
|
18
18
|
rules.push({ key, value });
|
|
@@ -33,7 +33,7 @@ export function compileFStyle(fstyle: FStyle, prefix = ""): string {
|
|
|
33
33
|
if (key.startsWith("@media")) {
|
|
34
34
|
rule += `${key} {\n`;
|
|
35
35
|
rule += compileFStyle(value, " ");
|
|
36
|
-
rule +=
|
|
36
|
+
rule += "}\n\n";
|
|
37
37
|
} else {
|
|
38
38
|
rule += compileFStyle(value, `${prefix} ${key}`);
|
|
39
39
|
}
|
package/src/dom/css/sizing.ts
CHANGED
package/src/dom/dom.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { assertExists } from "../assert.ts";
|
|
2
|
+
import type { Properties as SVGProperties } from "./types/css.ts";
|
|
3
|
+
|
|
4
|
+
export const XHTML_NAMESPACE_URI = "http://www.w3.org/1999/xhtml";
|
|
5
|
+
export const SVG_NAMESPACE_URI = "http://www.w3.org/2000/svg";
|
|
2
6
|
|
|
3
7
|
const Events = Symbol("events");
|
|
4
8
|
export const CLEAR = Symbol("Clear children");
|
|
@@ -10,18 +14,18 @@ export type DOMElement = Element & ElementCSSInlineStyle;
|
|
|
10
14
|
|
|
11
15
|
export type DomAttrs = {
|
|
12
16
|
class: string | string[];
|
|
13
|
-
style: Partial<
|
|
17
|
+
style: Partial<SVGProperties> | string;
|
|
14
18
|
role: "button" | "list" | "listbox";
|
|
15
19
|
events: Partial<{
|
|
16
20
|
[K in keyof HTMLElementEventMap]: EventHandler | null;
|
|
17
21
|
}>;
|
|
18
22
|
};
|
|
19
23
|
|
|
20
|
-
export type Attrs<E extends Omit<Element, "update">, S =
|
|
21
|
-
Omit<E, "style"> & S & DomAttrs
|
|
24
|
+
export type Attrs<E extends Omit<Element, "update">, S = object> = Partial<
|
|
25
|
+
Omit<{ [k in keyof E]: string | number | boolean }, "style"> & S & DomAttrs
|
|
22
26
|
>;
|
|
23
27
|
|
|
24
|
-
export type DenormAttrs<E extends Omit<Element, "update">, S =
|
|
28
|
+
export type DenormAttrs<E extends Omit<Element, "update">, S = object> =
|
|
25
29
|
| Attrs<E, S>
|
|
26
30
|
| DenormChildren;
|
|
27
31
|
|
|
@@ -79,57 +83,63 @@ export function update(
|
|
|
79
83
|
children: DenormChildren[]
|
|
80
84
|
): Element {
|
|
81
85
|
// Track events, to remove later
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
element.addEventListener(k as keyof ElementEventMap, v);
|
|
94
|
-
$events.set(k, v);
|
|
86
|
+
element[Events] ??= new Map<string, EventHandler>();
|
|
87
|
+
const $events = element[Events];
|
|
88
|
+
// const { style = {}, events = {}, ...rest } = attrs;
|
|
89
|
+
|
|
90
|
+
for (const [k, v] of Object.entries(
|
|
91
|
+
(attrs.events as NonNullable<typeof attrs.events>) ?? {}
|
|
92
|
+
)) {
|
|
93
|
+
if (v === null) {
|
|
94
|
+
if ($events.has(k)) {
|
|
95
|
+
const listener = assertExists($events.get(k));
|
|
96
|
+
element.removeEventListener(k, listener);
|
|
95
97
|
}
|
|
98
|
+
} else if (v !== undefined) {
|
|
99
|
+
element.addEventListener(k as keyof ElementEventMap, v);
|
|
100
|
+
$events.set(k, v);
|
|
96
101
|
}
|
|
97
|
-
|
|
102
|
+
}
|
|
98
103
|
|
|
99
104
|
const _style = (element as { style?: Partial<CSSStyleDeclaration> }).style;
|
|
100
105
|
if (_style) {
|
|
101
|
-
if (typeof style === "string") {
|
|
102
|
-
_style.cssText = style;
|
|
106
|
+
if (typeof attrs.style === "string") {
|
|
107
|
+
_style.cssText = attrs.style;
|
|
103
108
|
} else {
|
|
104
|
-
|
|
105
|
-
(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
for (const [k, v] of Object.entries(
|
|
110
|
+
(attrs.style as Partial<CSSStyleDeclaration>) ?? {}
|
|
111
|
+
)) {
|
|
112
|
+
// @ts-expect-error Object.entries is unable to statically look into args
|
|
113
|
+
_style[k] = v;
|
|
114
|
+
}
|
|
110
115
|
}
|
|
111
116
|
}
|
|
112
117
|
|
|
113
|
-
|
|
118
|
+
for (const [k, v] of Object.entries(attrs)) {
|
|
119
|
+
if (k === "style") {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (k === "events") {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
|
|
114
127
|
if (k === "class") {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
element.classList.add(c);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
return;
|
|
128
|
+
const cs = Array.isArray(v) ? v : String(v).split(/\s+/m).filter(Boolean);
|
|
129
|
+
for (const c of cs) {
|
|
130
|
+
if (c.startsWith("!")) {
|
|
131
|
+
element.classList.remove(c.substring(1));
|
|
132
|
+
} else {
|
|
133
|
+
element.classList.add(c);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
continue;
|
|
128
137
|
}
|
|
129
138
|
|
|
130
|
-
const useNamespace =
|
|
131
|
-
|
|
132
|
-
element.namespaceURI
|
|
139
|
+
const useNamespace = false;
|
|
140
|
+
element.namespaceURI &&
|
|
141
|
+
element.namespaceURI !== XHTML_NAMESPACE_URI &&
|
|
142
|
+
element.namespaceURI !== SVG_NAMESPACE_URI;
|
|
133
143
|
const remove = !v;
|
|
134
144
|
|
|
135
145
|
if (useNamespace) {
|
|
@@ -138,7 +148,7 @@ export function update(
|
|
|
138
148
|
} else if (v === true) {
|
|
139
149
|
element.setAttributeNS(element.namespaceURI, k, k);
|
|
140
150
|
} else {
|
|
141
|
-
element.setAttributeNS(element.namespaceURI, k, v
|
|
151
|
+
element.setAttributeNS(element.namespaceURI, k, String(v));
|
|
142
152
|
}
|
|
143
153
|
} else {
|
|
144
154
|
if (remove) {
|
|
@@ -146,10 +156,10 @@ export function update(
|
|
|
146
156
|
} else if (v === true) {
|
|
147
157
|
element.setAttribute(k, k);
|
|
148
158
|
} else {
|
|
149
|
-
element.setAttribute(k, v
|
|
159
|
+
element.setAttribute(k, String(v));
|
|
150
160
|
}
|
|
151
161
|
}
|
|
152
|
-
}
|
|
162
|
+
}
|
|
153
163
|
|
|
154
164
|
if (children?.length > 0) {
|
|
155
165
|
element.replaceChildren(
|
package/src/dom/fc.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { describe,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { describe, expect, it } from "../scope/index.ts";
|
|
2
|
+
import { FC } from "./fc.ts";
|
|
3
|
+
import { button, div, form, input, label, small } from "./html.ts";
|
|
4
4
|
|
|
5
5
|
describe("FC", () => {
|
|
6
6
|
it("creates FCs", () => {
|
|
@@ -9,8 +9,8 @@ describe("FC", () => {
|
|
|
9
9
|
name: string;
|
|
10
10
|
required?: boolean;
|
|
11
11
|
type?: string;
|
|
12
|
-
}>("fc-input", (
|
|
13
|
-
label(attrs.placeholder ?? attrs.name, input(attrs), ...children)
|
|
12
|
+
}>("fc-input", (_el, attrs, children) =>
|
|
13
|
+
label(attrs.placeholder ?? attrs.name, input(attrs), ...children),
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
const f = form(
|
|
@@ -26,13 +26,13 @@ describe("FC", () => {
|
|
|
26
26
|
name: "lastName",
|
|
27
27
|
placeholder: "Last Name",
|
|
28
28
|
required: true,
|
|
29
|
-
})
|
|
29
|
+
}),
|
|
30
30
|
),
|
|
31
31
|
Input(
|
|
32
32
|
{ name: "email", type: "email", placeholder: "E-Mail" },
|
|
33
|
-
small("We'll never share your information.")
|
|
33
|
+
small("We'll never share your information."),
|
|
34
34
|
),
|
|
35
|
-
button({ type: "submit" }, "Submit")
|
|
35
|
+
button({ type: "submit" }, "Submit"),
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
// document.body.appendChild(f);
|