@wrnrlr/prelude 0.1.9 → 0.2.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/.github/workflows/publish.yml +12 -11
- package/{deno.json → deno.jsonc} +13 -8
- package/example/index.html +43 -0
- package/package.json +6 -2
- package/src/constants.ts +110 -52
- package/src/controlflow.ts +140 -91
- package/src/hyperscript.ts +85 -109
- package/src/mod.ts +3 -5
- package/src/reactive.ts +29 -17
- package/src/runtime.ts +128 -66
- package/test/hyperscript.js +7 -6
- package/test/reactive.js +22 -2
- package/test/types.ts +44 -0
- package/src/components.js +0 -20
- package/src/ui/accordion.ts +0 -8
- package/src/ui/button.ts +0 -9
- package/src/ui/canvas.ts +0 -8
- package/src/ui/date.ts +0 -8
- package/src/ui/dialog.ts +0 -12
- package/src/ui/filter.ts +0 -8
- package/src/ui/form.ts +0 -7
- package/src/ui/h.ts +0 -48
- package/src/ui/image.ts +0 -5
- package/src/ui/input.ts +0 -49
- package/src/ui/mod.ts +0 -12
- package/src/ui/multiselect.ts +0 -42
- package/src/ui/option.ts +0 -1
- package/src/ui/select.ts +0 -28
- package/src/ui/tab.ts +0 -7
- package/src/ui/table.ts +0 -9
- package/src/ui/upload.ts +0 -7
- package/www/assets/css/presets.css +0 -504
- package/www/assets/css/style.css +0 -90
- package/www/demo.html +0 -28
- package/www/index.html +0 -211
- package/www/playground.html +0 -184
- package/www/public/banner.svg +0 -6
- package/www/public/example/admin.html +0 -88
- package/www/public/example/counter.html +0 -24
- package/www/public/example/greeting.html +0 -25
- package/www/public/example/select.html +0 -27
- package/www/public/example/show.html +0 -18
- package/www/public/example/todo.html +0 -70
- package/www/public/fonts/fab.ttf +0 -0
- package/www/public/fonts/fab.woff2 +0 -0
- package/www/public/fonts/far.ttf +0 -0
- package/www/public/fonts/far.woff2 +0 -0
- package/www/public/fonts/fas.ttf +0 -0
- package/www/public/fonts/fas.woff2 +0 -0
- package/www/public/logo.svg +0 -16
- package/www/typedoc.json +0 -13
- package/www/ui.html +0 -49
- package/www/vite.config.js +0 -106
@@ -37,17 +37,18 @@ jobs:
|
|
37
37
|
- name: Build
|
38
38
|
run: deno task build
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
40
|
+
# Moving artifacts, website and docs into their own project...
|
41
|
+
# - name: Setup Pages
|
42
|
+
# uses: actions/configure-pages@v5
|
43
|
+
|
44
|
+
# - name: Upload artifact
|
45
|
+
# uses: actions/upload-pages-artifact@v3
|
46
|
+
# with:
|
47
|
+
# path: './www/dist'
|
48
|
+
|
49
|
+
# - name: Deploy to GitHub Pages
|
50
|
+
# id: deployment
|
51
|
+
# uses: actions/deploy-pages@v4
|
51
52
|
|
52
53
|
# - name: Setup NPM
|
53
54
|
# run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > /home/runner/.npmrc
|
package/{deno.json → deno.jsonc}
RENAMED
@@ -1,11 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wrnrlr/prelude",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.2.0",
|
4
4
|
"exports": "./src/mod.ts",
|
5
5
|
"compilerOptions": {
|
6
|
-
"strict":
|
7
|
-
"checkJs": false,
|
8
|
-
"noImplicitThis": false,
|
6
|
+
"strict": true,
|
7
|
+
// "checkJs": false,
|
9
8
|
"lib": ["dom", "dom.iterable", "dom.asynciterable", "deno.ns"]
|
10
9
|
},
|
11
10
|
"imports": {
|
@@ -13,7 +12,7 @@
|
|
13
12
|
"@std/fs": "jsr:@std/fs@^1.0.5",
|
14
13
|
"@std/path": "jsr:@std/path@^1.0.6",
|
15
14
|
"@std/testing": "jsr:@std/testing@^0.225.3",
|
16
|
-
"
|
15
|
+
"happy-dom": "npm:happy-dom@^17.1.0",
|
17
16
|
"typedoc": "npm:typedoc@^0.26.6",
|
18
17
|
"vite": "npm:vite@^5.4.9",
|
19
18
|
"esbuild": "npm:esbuild@^0.24.0"
|
@@ -21,12 +20,18 @@
|
|
21
20
|
"tasks": {
|
22
21
|
"dev": "deno run -A npm:vite --config www/vite.config.js",
|
23
22
|
"test": "deno test -A ./test/*.[jt]s",
|
24
|
-
"docs": "deno run -A npm:typedoc --options www/typedoc.json",
|
25
|
-
"build": "deno run -A npm:vite build --mode production --config www/vite.config.js",
|
23
|
+
// "docs": "deno run -A npm:typedoc --options www/typedoc.json",
|
24
|
+
// "build": "deno run -A npm:vite build --mode production --config www/vite.config.js",
|
26
25
|
"release": "deno publish --allow-slow-types --allow-dirty && npm publish --access public",
|
27
|
-
"clean": "rm -rf dist/ www/dist www/docs"
|
26
|
+
// "clean": "rm -rf dist/ www/dist www/docs"
|
28
27
|
},
|
29
28
|
"lint": {
|
30
29
|
"include": ["src"]
|
30
|
+
},
|
31
|
+
"fmt": {
|
32
|
+
"lineWidth": 120,
|
33
|
+
"indentWidth": 2,
|
34
|
+
"semiColons": false,
|
35
|
+
"singleQuote": true
|
31
36
|
}
|
32
37
|
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<title>Todo</title>
|
3
|
+
|
4
|
+
<script type="module">
|
5
|
+
|
6
|
+
import {h,signal,effect,batch,wrap,render,List} from '../src/mod.ts'
|
7
|
+
|
8
|
+
function Checkbox(props) {
|
9
|
+
// effect(()=>console.log('checkbox value ', props.value))
|
10
|
+
return h('input',{
|
11
|
+
type: 'checkbox',
|
12
|
+
checked: props.value,
|
13
|
+
onInput: e => props.value(e.target.checked)
|
14
|
+
})
|
15
|
+
}
|
16
|
+
|
17
|
+
function App() {
|
18
|
+
// const todos = signal([false])
|
19
|
+
const obj = signal({todos:[false]})
|
20
|
+
const todos = wrap(obj,'todos')
|
21
|
+
const first = wrap(todos, 0)
|
22
|
+
return [
|
23
|
+
h('button', {onClick:(e)=>{const old = todos(); todos([...old, false])}}, '+'),
|
24
|
+
h('ol', h(List, {each:()=>todos}, (value, i) =>
|
25
|
+
// (console.log('value',value),h('li', h(Checkbox, { value:()=>value })))
|
26
|
+
h('li', h(Checkbox, { value:()=>value }))
|
27
|
+
)),
|
28
|
+
h(Checkbox, { value:()=>first }),
|
29
|
+
h('pre.hello',()=>'todos: '+JSON.stringify(todos(),undefined,2))
|
30
|
+
]
|
31
|
+
}
|
32
|
+
|
33
|
+
render(App, document.body)
|
34
|
+
|
35
|
+
</script>
|
36
|
+
|
37
|
+
<style>
|
38
|
+
html {background-color:lightgray}
|
39
|
+
ul {margin:0;padding:0}
|
40
|
+
/* ul,li {list-style-type: none} */
|
41
|
+
input {border-width: 0 0 1px 0; margin:0.25em}
|
42
|
+
li>button {border:none; background:none}
|
43
|
+
</style>
|
package/package.json
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wrnrlr/prelude",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.2.0",
|
5
5
|
"author": "Werner Laurensse",
|
6
6
|
"description": "A signal based frontend library with fine-grained reactivity",
|
7
7
|
"main": "./src/mod.ts",
|
8
8
|
"scripts": {},
|
9
|
-
"dependencies": {
|
9
|
+
"dependencies": {
|
10
|
+
"@codemirror/lang-html": "^6.4.9",
|
11
|
+
"codemirror": "^6.0.1",
|
12
|
+
"happy-dom": "^17.1.0"
|
13
|
+
}
|
10
14
|
}
|
package/src/constants.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
// @ts-nocheck:
|
2
1
|
/**
|
3
2
|
* Non-breakable space in Unicode
|
4
3
|
* @group Utils
|
@@ -6,15 +5,14 @@
|
|
6
5
|
export const nbsp:string = '\u00A0'
|
7
6
|
|
8
7
|
export declare type Window = { document: Document; SVGElement: typeof SVGElements}
|
9
|
-
export declare type Elem = any
|
10
|
-
declare type SVGElement = any
|
11
|
-
declare type Document = any
|
12
|
-
declare type ShadowRoot = any
|
13
|
-
declare type DocumentFragment = any
|
14
|
-
export declare type Node = any
|
8
|
+
// export declare type Elem = any
|
9
|
+
// declare type SVGElement = any
|
10
|
+
// declare type Document = any
|
11
|
+
// declare type ShadowRoot = any
|
12
|
+
// declare type DocumentFragment = any
|
13
|
+
// export declare type Node = any
|
15
14
|
|
16
|
-
|
17
|
-
type ExpandableNode = Node & { [key: string]: unknown };
|
15
|
+
// type ExpandableNode = Node & { [key: string]: unknown };
|
18
16
|
|
19
17
|
// type Expect<T extends true> = T;
|
20
18
|
// type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
@@ -332,26 +330,11 @@ const DOMElements:Set<string> = /*#__PURE__*/ new Set([
|
|
332
330
|
'details',
|
333
331
|
'slot',
|
334
332
|
'template',
|
335
|
-
// 'acronym',
|
336
|
-
// 'applet',
|
337
|
-
// 'basefont',
|
338
|
-
// 'bgsound',
|
339
|
-
// 'big',
|
340
|
-
// 'blink',
|
341
|
-
// 'center',
|
342
333
|
'content',
|
343
|
-
// 'dir',
|
344
|
-
// 'font',
|
345
334
|
'frame',
|
346
|
-
// 'frameset',
|
347
335
|
'hgroup',
|
348
336
|
'image',
|
349
|
-
// 'keygen',
|
350
|
-
// 'marquee',
|
351
337
|
'menuitem',
|
352
|
-
// 'nobr',
|
353
|
-
// 'noembed',
|
354
|
-
// 'noframes',
|
355
338
|
'plaintext',
|
356
339
|
'rb',
|
357
340
|
'rtc',
|
@@ -364,26 +347,20 @@ const DOMElements:Set<string> = /*#__PURE__*/ new Set([
|
|
364
347
|
'abbr',
|
365
348
|
'acronym',
|
366
349
|
'address',
|
367
|
-
// 'applet',
|
368
350
|
'area',
|
369
351
|
'article',
|
370
352
|
'aside',
|
371
353
|
'audio',
|
372
354
|
'b',
|
373
355
|
'base',
|
374
|
-
// 'basefont',
|
375
356
|
'bdi',
|
376
357
|
'bdo',
|
377
|
-
// 'bgsound',
|
378
|
-
// 'big',
|
379
|
-
// 'blink',
|
380
358
|
'blockquote',
|
381
359
|
'body',
|
382
360
|
'br',
|
383
361
|
'button',
|
384
362
|
'canvas',
|
385
363
|
'caption',
|
386
|
-
// 'center',
|
387
364
|
'cite',
|
388
365
|
'code',
|
389
366
|
'col',
|
@@ -396,20 +373,15 @@ const DOMElements:Set<string> = /*#__PURE__*/ new Set([
|
|
396
373
|
'details',
|
397
374
|
'dfn',
|
398
375
|
'dialog',
|
399
|
-
// 'dir',
|
400
376
|
'div',
|
401
377
|
'dl',
|
402
378
|
'dt',
|
403
379
|
'em',
|
404
|
-
// 'embed',
|
405
380
|
'fieldset',
|
406
381
|
'figcaption',
|
407
382
|
'figure',
|
408
|
-
// 'font',
|
409
383
|
'footer',
|
410
384
|
'form',
|
411
|
-
// 'frame',
|
412
|
-
// 'frameset',
|
413
385
|
'head',
|
414
386
|
'header',
|
415
387
|
'hgroup',
|
@@ -422,7 +394,6 @@ const DOMElements:Set<string> = /*#__PURE__*/ new Set([
|
|
422
394
|
'input',
|
423
395
|
'ins',
|
424
396
|
'kbd',
|
425
|
-
// 'keygen',
|
426
397
|
'label',
|
427
398
|
'legend',
|
428
399
|
'li',
|
@@ -430,15 +401,9 @@ const DOMElements:Set<string> = /*#__PURE__*/ new Set([
|
|
430
401
|
'main',
|
431
402
|
'map',
|
432
403
|
'mark',
|
433
|
-
// 'marquee',
|
434
|
-
// 'menu',
|
435
|
-
// 'menuitem',
|
436
404
|
'meta',
|
437
405
|
'meter',
|
438
406
|
'nav',
|
439
|
-
// 'nobr',
|
440
|
-
// 'noembed',
|
441
|
-
// 'noframes',
|
442
407
|
'noscript',
|
443
408
|
'object',
|
444
409
|
'ol',
|
@@ -446,19 +411,14 @@ const DOMElements:Set<string> = /*#__PURE__*/ new Set([
|
|
446
411
|
'option',
|
447
412
|
'output',
|
448
413
|
'p',
|
449
|
-
// 'param',
|
450
414
|
'picture',
|
451
|
-
// 'plaintext',
|
452
415
|
'portal',
|
453
416
|
'pre',
|
454
417
|
'progress',
|
455
418
|
'q',
|
456
|
-
// 'rb',
|
457
419
|
'rp',
|
458
420
|
'rt',
|
459
|
-
// 'rtc',
|
460
421
|
'ruby',
|
461
|
-
// 's',
|
462
422
|
'samp',
|
463
423
|
'script',
|
464
424
|
'section',
|
@@ -467,9 +427,7 @@ const DOMElements:Set<string> = /*#__PURE__*/ new Set([
|
|
467
427
|
'slot',
|
468
428
|
'small',
|
469
429
|
'source',
|
470
|
-
// 'spacer',
|
471
430
|
'span',
|
472
|
-
// 'strike',
|
473
431
|
'strong',
|
474
432
|
'style',
|
475
433
|
'sub',
|
@@ -487,13 +445,10 @@ const DOMElements:Set<string> = /*#__PURE__*/ new Set([
|
|
487
445
|
'title',
|
488
446
|
'tr',
|
489
447
|
'track',
|
490
|
-
// 'tt',
|
491
448
|
'u',
|
492
449
|
'ul',
|
493
|
-
// 'var',
|
494
450
|
'video',
|
495
451
|
'wbr',
|
496
|
-
// 'xmp',
|
497
452
|
'input',
|
498
453
|
'h1',
|
499
454
|
'h2',
|
@@ -503,6 +458,109 @@ const DOMElements:Set<string> = /*#__PURE__*/ new Set([
|
|
503
458
|
'h6'
|
504
459
|
]);
|
505
460
|
|
461
|
+
export const SelfClosingTags = new Set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr', 'command', 'keygen', 'menuitem', 'frame'])
|
462
|
+
|
463
|
+
export const DepricatedTags = new Set([
|
464
|
+
'acronym',
|
465
|
+
'applet',
|
466
|
+
'basefont',
|
467
|
+
'bgsound',
|
468
|
+
'big',
|
469
|
+
'blink',
|
470
|
+
'center',
|
471
|
+
'dir',
|
472
|
+
'font',
|
473
|
+
'frameset',
|
474
|
+
'keygen',
|
475
|
+
'marquee',
|
476
|
+
'nobr',
|
477
|
+
'noembed',
|
478
|
+
'noframes',
|
479
|
+
'applet',
|
480
|
+
'basefont',
|
481
|
+
'bgsound',
|
482
|
+
'big',
|
483
|
+
'blink',
|
484
|
+
'center',
|
485
|
+
'dir',
|
486
|
+
'embed',
|
487
|
+
'font',
|
488
|
+
'frame',
|
489
|
+
'frameset',
|
490
|
+
'keygen',
|
491
|
+
'marquee',
|
492
|
+
'menu',
|
493
|
+
'menuitem',
|
494
|
+
'nobr',
|
495
|
+
'noembed',
|
496
|
+
'noframes',
|
497
|
+
'param',
|
498
|
+
'plaintext',
|
499
|
+
'rb',
|
500
|
+
'rtc',
|
501
|
+
's',
|
502
|
+
'spacer',
|
503
|
+
'strike',
|
504
|
+
'tt',
|
505
|
+
'var',
|
506
|
+
'xmp'
|
507
|
+
])
|
508
|
+
|
509
|
+
// data-*
|
510
|
+
// anchor (experimental, not standard)
|
511
|
+
// virtualkeyboardpolicyExperimental
|
512
|
+
|
513
|
+
export const GlobalAttributes = [
|
514
|
+
'src',
|
515
|
+
'id',
|
516
|
+
'class',
|
517
|
+
'style',
|
518
|
+
'title',
|
519
|
+
'lang',
|
520
|
+
'dir',
|
521
|
+
'hidden',
|
522
|
+
'tabindex',
|
523
|
+
'accesskey',
|
524
|
+
'contenteditable',
|
525
|
+
'spellcheck',
|
526
|
+
'draggable',
|
527
|
+
'translate',
|
528
|
+
] as const
|
529
|
+
|
530
|
+
export const AllAttributes = [
|
531
|
+
'accesskey',
|
532
|
+
'autocapitalize',
|
533
|
+
'autocorrect',
|
534
|
+
'autofocus',
|
535
|
+
'class',
|
536
|
+
'contenteditable',
|
537
|
+
'dir',
|
538
|
+
'draggable',
|
539
|
+
'enterkeyhint',
|
540
|
+
'exportparts',
|
541
|
+
'hidden',
|
542
|
+
'id',
|
543
|
+
'inert',
|
544
|
+
'inputmode',
|
545
|
+
'is',
|
546
|
+
'itemid',
|
547
|
+
'itemprop',
|
548
|
+
'itemref',
|
549
|
+
'itemscope',
|
550
|
+
'itemtype',
|
551
|
+
'lang',
|
552
|
+
'nonce',
|
553
|
+
'part',
|
554
|
+
'popover',
|
555
|
+
'slot',
|
556
|
+
'spellcheck',
|
557
|
+
'style',
|
558
|
+
'tabindex',
|
559
|
+
'title',
|
560
|
+
'translate',
|
561
|
+
'writingsuggestions',
|
562
|
+
]
|
563
|
+
|
506
564
|
export {
|
507
565
|
BooleanAttributes,
|
508
566
|
Properties,
|