@wrnrlr/prelude 0.2.16 → 0.2.18
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/deno.jsonc +2 -2
- package/example/context.html +29 -0
- package/example/h.html +24 -0
- package/example/index.html +17 -4
- package/example/reset.css +505 -0
- package/example/style.css +27 -0
- package/example/table.html +25 -0
- package/example/vite.config.js +17 -0
- package/example/widget.html +112 -0
- package/package.json +1 -1
- package/readme.md +5 -1
- package/src/canvas.js +1 -1
- package/src/form.js +80 -7
- package/src/hyperscript.ts +184 -140
- package/src/mod.ts +2 -1
- package/src/reactive.ts +19 -18
- package/src/runtime.ts +3 -17
- package/test/hyperscript.js +4 -7
- package/src/select.js +0 -1
- /package/{src/osm.js → example/atlas.html} +0 -0
package/src/runtime.ts
CHANGED
@@ -2,26 +2,12 @@
|
|
2
2
|
import {effect,untrack,root} from './reactive.ts'
|
3
3
|
import {SVGNamespace,SVGElements,ChildProperties,getPropAlias,Properties,Aliases,DelegatedEvents} from './constants.ts'
|
4
4
|
import {reconcileArrays} from './domdiff.ts'
|
5
|
-
// import type {Mountable} from './constants.ts'
|
6
5
|
|
7
6
|
const {isArray} = Array
|
8
7
|
|
9
8
|
export type Mountable = HTMLElement | Document | ShadowRoot | DocumentFragment | Node | string | number | bigint | symbol;
|
10
9
|
|
11
|
-
export const r = { render, insert, spread, assign, element, component, text, isChild, clearDelegatedEvents}
|
12
|
-
|
13
|
-
// declare global {
|
14
|
-
// interface Document {
|
15
|
-
// '_$DX_DELEGATE'?: Record<string, Set<unknown>>
|
16
|
-
// }
|
17
|
-
// // interface SVGElement {}
|
18
|
-
// }
|
19
|
-
|
20
|
-
// interface Element {
|
21
|
-
// style?: string
|
22
|
-
// }
|
23
|
-
|
24
|
-
// declare const globalThis: Document
|
10
|
+
export const r = { render, insert, spread, assign, element, component, text, isChild, clearDelegatedEvents, SVGElements }
|
25
11
|
|
26
12
|
/**
|
27
13
|
|
@@ -67,8 +53,8 @@ function isChild(a:unknown): a is Element {
|
|
67
53
|
return a instanceof Element
|
68
54
|
}
|
69
55
|
|
70
|
-
function component(fn:()=>unknown) {
|
71
|
-
return untrack(fn)
|
56
|
+
function component(fn:()=>unknown, props: unknown) {
|
57
|
+
return untrack(()=>fn(props))
|
72
58
|
}
|
73
59
|
|
74
60
|
function render(code: ()=>void, element:Element|Document, init?: unknown): void {
|
package/test/hyperscript.js
CHANGED
@@ -1,16 +1,13 @@
|
|
1
|
-
// import {runtime} from '../src/runtime.ts'
|
2
1
|
import { Window } from 'happy-dom'
|
3
2
|
import {assertEquals} from '@std/assert'
|
4
3
|
|
5
4
|
const window = new Window
|
6
5
|
|
7
|
-
globalThis
|
8
|
-
globalThis.document = window.document
|
9
|
-
globalThis.navigator = window.navigator
|
6
|
+
globalThis = window
|
10
7
|
|
11
|
-
import {signal,root} from '../src/reactive.ts'
|
8
|
+
import { signal, root } from '../src/reactive.ts'
|
12
9
|
import { r } from '../src/runtime.ts'
|
13
|
-
import {h} from '../src/hyperscript.ts'
|
10
|
+
import { h } from '../src/hyperscript.ts'
|
14
11
|
|
15
12
|
function testing(name, props, f=props) {
|
16
13
|
const htest = t => (name, f) => {
|
@@ -44,7 +41,7 @@ testing('h with basic element', async test => {
|
|
44
41
|
await test("number content", () => assertHTML(h('i',1), '<i>1</i>'))
|
45
42
|
await test("bigint content", () => assertHTML(h('i',2n), '<i>2</i>'))
|
46
43
|
await test("symbol content", () => assertHTML(h('i',Symbol('A')), '<i>Symbol(A)</i>'))
|
47
|
-
|
44
|
+
await test('regex content', () => assertHTML(h('b',/\w/), '<b>/\\w/</b>'))
|
48
45
|
await test("signal content", () => assertHTML(h('i',()=>1), '<i>1</i>'))
|
49
46
|
await test('array content', () => assertHTML(h('i',['A',1,2n]), '<i>A12</i>'))
|
50
47
|
await test('ref property', () => assertHTML(h('hr',{ref:el=>el.setAttribute('a','1')}), '<hr a="1">'))
|
package/src/select.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
|
File without changes
|