@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/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 {
@@ -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.window = window
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
- // await test('regex content', () => assertHTML(h('b',/\w/), '<b>/\\w/</b>'))
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