adding vdom

This commit is contained in:
tsukino
2023-12-23 16:08:02 -08:00
parent 5fdc829fe1
commit 1fbd823b89
8 changed files with 394 additions and 132 deletions

241
package-lock.json generated
View File

@@ -2822,6 +2822,12 @@
"@types/node": "*"
}
},
"node_modules/@types/virtual-dom": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@types/virtual-dom/-/virtual-dom-2.1.4.tgz",
"integrity": "sha512-Y7L/frVydXRd16MevczslJZQu+QWsrqZlj6ytk7mST3xen0fkx7Ollw31By/89A8Wq+nfNWm/IoTR1ac/0fRhA==",
"dev": true
},
"node_modules/@types/ws": {
"version": "8.5.10",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz",
@@ -4956,6 +4962,11 @@
"run-parallel-limit": "^1.1.0"
}
},
"node_modules/browser-split": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/browser-split/-/browser-split-0.0.1.tgz",
"integrity": "sha512-JhvgRb2ihQhsljNda3BI8/UcRHVzrVwo3Q+P8vDtSiyobXuFpuZ9mq+MbRGMnC22CjW3RrfXdg6j6ITX8M+7Ow=="
},
"node_modules/browserify-aes": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
@@ -5339,6 +5350,14 @@
"node": ">=0.10.0"
}
},
"node_modules/camelize": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.1.tgz",
"integrity": "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001570",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz",
@@ -7563,6 +7582,16 @@
"resolved": "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz",
"integrity": "sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA=="
},
"node_modules/error": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/error/-/error-4.4.0.tgz",
"integrity": "sha512-SNDKualLUtT4StGFP7xNfuFybL2f6iJujFtrWuvJqGbVQGaN+adE23veqzPz1hjUjTunLi2EnJ+0SJxtbJreKw==",
"dependencies": {
"camelize": "^1.0.0",
"string-template": "~0.2.0",
"xtend": "~4.0.0"
}
},
"node_modules/error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
@@ -8179,6 +8208,14 @@
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz",
"integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA=="
},
"node_modules/ev-store": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/ev-store/-/ev-store-7.0.0.tgz",
"integrity": "sha512-otazchNRnGzp2YarBJ+GXKVGvhxVATB1zmaStxJBYet0Dyq7A9VhH8IUEB/gRcL6Ch52lfpgPTRJ2m49epyMsQ==",
"dependencies": {
"individual": "^3.0.0"
}
},
"node_modules/event-iterator": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/event-iterator/-/event-iterator-2.0.0.tgz",
@@ -10093,6 +10130,19 @@
"node": ">=14.18.0"
}
},
"node_modules/hyperscript-attribute-to-property": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/hyperscript-attribute-to-property/-/hyperscript-attribute-to-property-1.0.2.tgz",
"integrity": "sha512-oerMul16jZCmrbNsUw8QgrtDzF8lKgFri1bKQjReLw1IhiiNkI59CWuzZjJDGT79UQ1YiWqXhJMv/tRMVqgtkA=="
},
"node_modules/hyperx": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/hyperx/-/hyperx-3.0.1.tgz",
"integrity": "sha512-gIqI/O3pgataWKjJTPwe0Uv73DWoaWpFA0iIs8zKWrEo1+eMLuk5XjdwJ7C5ymyF4EdMGpPUwoYCuelHUjOGag==",
"dependencies": {
"hyperscript-attribute-to-property": "^1.0.0"
}
},
"node_modules/iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
@@ -10730,6 +10780,11 @@
"node": ">=8"
}
},
"node_modules/individual": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/individual/-/individual-3.0.0.tgz",
"integrity": "sha512-rUY5vtT748NMRbEMrTNiFfy29BgGZwGXUi2NFUVMWQrogSLzlJvQV9eeMWi+g1aVaQ53tpyLAQtd5x/JH0Nh1g=="
},
"node_modules/inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@@ -11211,8 +11266,6 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz",
"integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==",
"dev": true,
"optional": true,
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@@ -12394,6 +12447,15 @@
"yallist": "^3.0.2"
}
},
"node_modules/main-loop": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/main-loop/-/main-loop-3.4.0.tgz",
"integrity": "sha512-5EBuVe5Akul2I1Hf+BQFTI2YYq0UBUv4y2q6w8gvWR1ActuW07NY9iPRGxMYEeqIhUCFzoivT/5IQ+o0/GJjQQ==",
"dependencies": {
"error": "^4.1.1",
"raf": "^2.0.1"
}
},
"node_modules/make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@@ -14718,6 +14780,19 @@
"resolved": "https://registry.npmjs.org/race-signal/-/race-signal-1.0.2.tgz",
"integrity": "sha512-o3xNv0iTcIDQCXFlF6fPAMEBRjFxssgGoRqLbg06m+AdzEXXLUmoNOoUHTVz2NoBI8hHwKFKoC6IqyNtWr2bww=="
},
"node_modules/raf": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/raf/-/raf-2.0.4.tgz",
"integrity": "sha512-/1MFu3i+bZeLZDRNKe+BC1d4elEHqM+ksh64WcW/5KCvxntnV6A4h6vLH3ebFKk/l8JxmHnGjOBhDq+5Jm0WnA==",
"dependencies": {
"performance-now": "~0.1.3"
}
},
"node_modules/raf/node_modules/performance-now": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.1.4.tgz",
"integrity": "sha512-iaeVTVGLcGTsN9WVFTV9YZH6gYD+SurpzHdDxeqRxqkK3IgfQiexetIjlkNSUIeV9HljjwT07jv0fAxsDuGSHg=="
},
"node_modules/randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
@@ -16335,6 +16410,11 @@
"integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==",
"dev": true
},
"node_modules/string-template": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/string-template/-/string-template-0.2.1.tgz",
"integrity": "sha512-Yptehjogou2xm4UJbxJ4CxgZx12HBfeystp0y3x7s4Dj32ltVVG1Gg8YhKjHZkHicuKpZX/ffilA8505VbUbpw=="
},
"node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
@@ -17788,6 +17868,26 @@
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ=="
},
"node_modules/virtual-dom": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/virtual-dom/-/virtual-dom-2.1.1.tgz",
"integrity": "sha512-wb6Qc9Lbqug0kRqo/iuApfBpJJAq14Sk1faAnSmtqXiwahg7PVTvWMs9L02Z8nNIMqbwsxzBAA90bbtRLbw0zg==",
"dependencies": {
"browser-split": "0.0.1",
"error": "^4.3.0",
"ev-store": "^7.0.0",
"global": "^4.3.0",
"is-object": "^1.0.1",
"next-tick": "^0.2.2",
"x-is-array": "0.1.0",
"x-is-string": "0.1.0"
}
},
"node_modules/virtual-dom/node_modules/next-tick": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-0.2.2.tgz",
"integrity": "sha512-f7h4svPtl+QidoBv4taKXUjJ70G2asaZ8G28nS0OkqaalX8dwwrtWtyxEDPK62AC00ur/+/E0pUwBwY5EPn15Q=="
},
"node_modules/vm-browserify": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz",
@@ -18865,6 +18965,16 @@
}
}
},
"node_modules/x-is-array": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/x-is-array/-/x-is-array-0.1.0.tgz",
"integrity": "sha512-goHPif61oNrr0jJgsXRfc8oqtYzvfiMJpTqwE7Z4y9uH+T3UozkGqQ4d2nX9mB9khvA8U2o/UbPOFjgC7hLWIA=="
},
"node_modules/x-is-string": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz",
"integrity": "sha512-GojqklwG8gpzOVEVki5KudKNoq7MbbjYZCbyWzEz7tyPA7eleiE0+ePwOWQQRb5fm86rD3S8Tc0tSFf3AOv50w=="
},
"node_modules/xhr": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz",
@@ -19159,10 +19269,14 @@
"@autismjs/message": "^0.2.1",
"@fortawesome/fontawesome-free": "^6.5.1",
"dayjs": "^1.11.10",
"minidenticons": "^4.2.0"
"hyperx": "^3.0.1",
"main-loop": "^3.4.0",
"minidenticons": "^4.2.0",
"virtual-dom": "^2.1.1"
},
"devDependencies": {
"@libp2p/interface": "^0.1.2",
"@types/virtual-dom": "^2.1.4",
"browserify-zlib": "^0.2.0",
"console-browserify": "^1.2.0",
"constants-browserify": "^1.0.0",
@@ -19370,6 +19484,7 @@
"@autismjs/message": "^0.2.1",
"@fortawesome/fontawesome-free": "^6.5.1",
"@libp2p/interface": "^0.1.2",
"@types/virtual-dom": "^2.1.4",
"browserify-zlib": "^0.2.0",
"console-browserify": "^1.2.0",
"constants-browserify": "^1.0.0",
@@ -19381,7 +19496,9 @@
"html-loader": "^4.2.0",
"html-webpack-plugin": "^5.6.0",
"https-browserify": "^1.0.0",
"hyperx": "^3.0.1",
"image-webpack-loader": "^8.1.0",
"main-loop": "^3.4.0",
"minidenticons": "^4.2.0",
"os-browserify": "^0.3.0",
"path-browserify": "^1.0.1",
@@ -19391,6 +19508,7 @@
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"style-loader": "^3.3.3",
"virtual-dom": "^2.1.1",
"vm-browserify": "^1.1.2"
}
},
@@ -21563,6 +21681,12 @@
"@types/node": "*"
}
},
"@types/virtual-dom": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@types/virtual-dom/-/virtual-dom-2.1.4.tgz",
"integrity": "sha512-Y7L/frVydXRd16MevczslJZQu+QWsrqZlj6ytk7mST3xen0fkx7Ollw31By/89A8Wq+nfNWm/IoTR1ac/0fRhA==",
"dev": true
},
"@types/ws": {
"version": "8.5.10",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz",
@@ -23273,6 +23397,11 @@
"run-parallel-limit": "^1.1.0"
}
},
"browser-split": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/browser-split/-/browser-split-0.0.1.tgz",
"integrity": "sha512-JhvgRb2ihQhsljNda3BI8/UcRHVzrVwo3Q+P8vDtSiyobXuFpuZ9mq+MbRGMnC22CjW3RrfXdg6j6ITX8M+7Ow=="
},
"browserify-aes": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
@@ -23573,6 +23702,11 @@
}
}
},
"camelize": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.1.tgz",
"integrity": "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ=="
},
"caniuse-lite": {
"version": "1.0.30001570",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz",
@@ -25316,6 +25450,16 @@
"resolved": "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz",
"integrity": "sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA=="
},
"error": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/error/-/error-4.4.0.tgz",
"integrity": "sha512-SNDKualLUtT4StGFP7xNfuFybL2f6iJujFtrWuvJqGbVQGaN+adE23veqzPz1hjUjTunLi2EnJ+0SJxtbJreKw==",
"requires": {
"camelize": "^1.0.0",
"string-template": "~0.2.0",
"xtend": "~4.0.0"
}
},
"error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
@@ -25801,6 +25945,14 @@
}
}
},
"ev-store": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/ev-store/-/ev-store-7.0.0.tgz",
"integrity": "sha512-otazchNRnGzp2YarBJ+GXKVGvhxVATB1zmaStxJBYet0Dyq7A9VhH8IUEB/gRcL6Ch52lfpgPTRJ2m49epyMsQ==",
"requires": {
"individual": "^3.0.0"
}
},
"event-iterator": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/event-iterator/-/event-iterator-2.0.0.tgz",
@@ -27265,6 +27417,19 @@
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz",
"integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ=="
},
"hyperscript-attribute-to-property": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/hyperscript-attribute-to-property/-/hyperscript-attribute-to-property-1.0.2.tgz",
"integrity": "sha512-oerMul16jZCmrbNsUw8QgrtDzF8lKgFri1bKQjReLw1IhiiNkI59CWuzZjJDGT79UQ1YiWqXhJMv/tRMVqgtkA=="
},
"hyperx": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/hyperx/-/hyperx-3.0.1.tgz",
"integrity": "sha512-gIqI/O3pgataWKjJTPwe0Uv73DWoaWpFA0iIs8zKWrEo1+eMLuk5XjdwJ7C5ymyF4EdMGpPUwoYCuelHUjOGag==",
"requires": {
"hyperscript-attribute-to-property": "^1.0.0"
}
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
@@ -27730,6 +27895,11 @@
"integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
"dev": true
},
"individual": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/individual/-/individual-3.0.0.tgz",
"integrity": "sha512-rUY5vtT748NMRbEMrTNiFfy29BgGZwGXUi2NFUVMWQrogSLzlJvQV9eeMWi+g1aVaQ53tpyLAQtd5x/JH0Nh1g=="
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@@ -28060,9 +28230,7 @@
"is-object": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz",
"integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==",
"dev": true,
"optional": true
"integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA=="
},
"is-path-inside": {
"version": "3.0.3",
@@ -28998,6 +29166,15 @@
"yallist": "^3.0.2"
}
},
"main-loop": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/main-loop/-/main-loop-3.4.0.tgz",
"integrity": "sha512-5EBuVe5Akul2I1Hf+BQFTI2YYq0UBUv4y2q6w8gvWR1ActuW07NY9iPRGxMYEeqIhUCFzoivT/5IQ+o0/GJjQQ==",
"requires": {
"error": "^4.1.1",
"raf": "^2.0.1"
}
},
"make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@@ -30708,6 +30885,21 @@
"resolved": "https://registry.npmjs.org/race-signal/-/race-signal-1.0.2.tgz",
"integrity": "sha512-o3xNv0iTcIDQCXFlF6fPAMEBRjFxssgGoRqLbg06m+AdzEXXLUmoNOoUHTVz2NoBI8hHwKFKoC6IqyNtWr2bww=="
},
"raf": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/raf/-/raf-2.0.4.tgz",
"integrity": "sha512-/1MFu3i+bZeLZDRNKe+BC1d4elEHqM+ksh64WcW/5KCvxntnV6A4h6vLH3ebFKk/l8JxmHnGjOBhDq+5Jm0WnA==",
"requires": {
"performance-now": "~0.1.3"
},
"dependencies": {
"performance-now": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.1.4.tgz",
"integrity": "sha512-iaeVTVGLcGTsN9WVFTV9YZH6gYD+SurpzHdDxeqRxqkK3IgfQiexetIjlkNSUIeV9HljjwT07jv0fAxsDuGSHg=="
}
}
},
"randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
@@ -31974,6 +32166,11 @@
"integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==",
"dev": true
},
"string-template": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/string-template/-/string-template-0.2.1.tgz",
"integrity": "sha512-Yptehjogou2xm4UJbxJ4CxgZx12HBfeystp0y3x7s4Dj32ltVVG1Gg8YhKjHZkHicuKpZX/ffilA8505VbUbpw=="
},
"string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
@@ -33052,6 +33249,28 @@
}
}
},
"virtual-dom": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/virtual-dom/-/virtual-dom-2.1.1.tgz",
"integrity": "sha512-wb6Qc9Lbqug0kRqo/iuApfBpJJAq14Sk1faAnSmtqXiwahg7PVTvWMs9L02Z8nNIMqbwsxzBAA90bbtRLbw0zg==",
"requires": {
"browser-split": "0.0.1",
"error": "^4.3.0",
"ev-store": "^7.0.0",
"global": "^4.3.0",
"is-object": "^1.0.1",
"next-tick": "^0.2.2",
"x-is-array": "0.1.0",
"x-is-string": "0.1.0"
},
"dependencies": {
"next-tick": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-0.2.2.tgz",
"integrity": "sha512-f7h4svPtl+QidoBv4taKXUjJ70G2asaZ8G28nS0OkqaalX8dwwrtWtyxEDPK62AC00ur/+/E0pUwBwY5EPn15Q=="
}
}
},
"vm-browserify": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz",
@@ -33868,6 +34087,16 @@
"dev": true,
"requires": {}
},
"x-is-array": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/x-is-array/-/x-is-array-0.1.0.tgz",
"integrity": "sha512-goHPif61oNrr0jJgsXRfc8oqtYzvfiMJpTqwE7Z4y9uH+T3UozkGqQ4d2nX9mB9khvA8U2o/UbPOFjgC7hLWIA=="
},
"x-is-string": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz",
"integrity": "sha512-GojqklwG8gpzOVEVki5KudKNoq7MbbjYZCbyWzEz7tyPA7eleiE0+ePwOWQQRb5fm86rD3S8Tc0tSFf3AOv50w=="
},
"xhr": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz",

View File

@@ -274,14 +274,16 @@ export default class LevelDBAdapter implements BaseDBAdapter {
return this.#query(db, predicate, options);
}
async getReplies(
getReplies = async (
reference: string,
options?: {
reverse?: boolean;
limit?: number;
offset?: string;
},
): Promise<Any[]> {
): Promise<Any[]> => {
if (!reference) return [];
const predicate = (msg: Any) => {
switch (msg.subtype) {
case PostSubtype.Default:
@@ -301,7 +303,7 @@ export default class LevelDBAdapter implements BaseDBAdapter {
.sublevel(MessageType[MessageType.Post]);
return this.#query(db, predicate, options);
}
};
async getModerations(
reference: string,

View File

@@ -1,25 +1,71 @@
import vdom, { VText, VTree } from 'virtual-dom';
import createElement from 'virtual-dom/create-element';
import diff from 'virtual-dom/diff';
import patch from 'virtual-dom/patch';
const hyperx = require('hyperx');
const hpx = hyperx(vdom.h);
interface CustomElementConstructor {
new (): CustomElement;
}
export class CustomElement extends HTMLElement {
interface ICustomElement extends HTMLElement {
state: any;
render(): void;
}
export class CustomElement extends HTMLElement implements ICustomElement {
css: string;
html: string;
connectedCallback() {
this.attachShadow({ mode: 'open' });
const temp = document.createElement('template');
temp.innerHTML = `<style>${this.css}</style>${this.html}`;
this.shadowRoot?.appendChild(temp.content);
#tree?: VTree;
#root?: any;
async render(): Promise<VTree> {
return hpx``;
}
get state() {
return Array.from(this.attributes).reduce(
(map: { [key: string]: string }, { name, value }) => {
map[name] = value;
return map;
},
{},
);
}
async connectedCallback() {
this.attachShadow({ mode: 'open' });
await this.patch();
}
patch = async () => {
if (!this.#root) {
this.#tree = await this.render();
this.#root = createElement(this.#tree as VText);
this.shadowRoot?.appendChild(html(`<style>${this.css}</style>`));
this.shadowRoot?.appendChild(this.#root);
} else if (this.#tree) {
const newTree = await this.render();
const patches = diff(this.#tree!, newTree);
console.log(patches);
this.#root = patch(this.#root, patches);
// this.#tree = newTree;
}
};
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function html(htmlString: string) {
const temp = document.createElement('template');
temp.innerHTML = htmlString;
return temp.content;
}
export function hx(...args: any[]) {
return hpx.apply(hpx, args);
}
export function register(name: string, el: CustomElementConstructor) {
window.customElements.define(name, el);
}

View File

@@ -19,10 +19,14 @@
"@fortawesome/fontawesome-free": "^6.5.1",
"@autismjs/message": "^0.2.1",
"dayjs": "^1.11.10",
"minidenticons": "^4.2.0"
"minidenticons": "^4.2.0",
"hyperx": "^3.0.1",
"main-loop": "^3.4.0",
"virtual-dom": "^2.1.1"
},
"devDependencies": {
"@libp2p/interface": "^0.1.2",
"@types/virtual-dom": "^2.1.4",
"browserify-zlib": "^0.2.0",
"constants-browserify": "^1.0.0",
"console-browserify": "^1.2.0",

View File

@@ -1,14 +1,16 @@
import { CustomElement, register } from '../../../lib/ui.ts';
import { CustomElement, hx, register } from '../../../lib/ui.ts';
import css from './index.scss';
export default class Button extends CustomElement {
css = css.toString();
html = `
<button>
<slot></slot>
</button>
`;
render() {
return hx`
<button>
<slot></slot>
</button>
`;
}
}
register('c-button', Button);

View File

@@ -1,4 +1,4 @@
import { CustomElement, Q, register } from '../../../lib/ui.ts';
import { CustomElement, hx, register } from '../../../lib/ui.ts';
import { getStore } from '../../state';
import { default as NodeStore } from '../../state/node.ts';
import { fromNow, userId, userName } from '../../utils/misc.ts';
@@ -12,71 +12,58 @@ import css from './index.scss';
export default class Post extends CustomElement {
css = css.toString();
html = `
<div class="post">
<profile-image></profile-image>
<div class="top">
<div class="creator"></div>
<div class="userId"></div>
<div class="createAt-top"></div>
</div>
<div class="content"></div>
<div class="bottom">
<c-button class="comment-btn">
<img src="${CommentIcon}" />
<span></span>
</c-button>
<c-button class="repost-btn">
<img src="${RepostIcon}" />
<span></span>
</c-button>
<c-button class="like-btn">
<img src="${LikeIcon}" />
<span></span>
</c-button>
</div>
</div>
`;
async connectedCallback() {
super.connectedCallback();
this.loadPost();
this.subscribe();
}
async loadPost() {
async render() {
const node = getStore().get<NodeStore>('node');
const hash = this.dataset.hash!;
const post = await node.$posts.get(hash);
const p = post?.state;
const user = await node.node.db.db.getProfile(p?.json.creator || '');
// const meta = await node.node.db.db.getPostMeta(p?.messageId || '');
const displayName = user.name || userName(p?.json.creator) || 'Anonymous';
const userHandle = userId(p?.json.creator);
return hx`
<div class="post">
<profile-image address="${p?.json.creator || ''}"></profile-image>
<div class="top">
<div class="creator">${displayName}</div>
<div class="userId">${userHandle || ''}</div>
<div class="createAt-top">
<span>&#183;</span>
<span>${fromNow(p?.json.createdAt)}</span>
</div>
</div>
<div class="content">${p?.json.content || ''}</div>
<div class="bottom">
<c-button class="comment-btn">
<img src="${CommentIcon}" />
<span>${0}</span>
</c-button>
<c-button class="repost-btn">
<img src="${RepostIcon}" />
<span>0</span>
</c-button>
<c-button class="like-btn">
<img src="${LikeIcon}" />
<span>0</span>
</c-button>
</div>
</div>
`;
}
async subscribe() {
const store = getStore();
const node = store.get<NodeStore>('node');
const hash = this.dataset.hash!;
const post = await node.$posts.get(hash);
const q = Q(this.shadowRoot!)!;
post!.subscribe(async (p) => {
const user = await node.node.db.db.getProfile(p?.json.creator || '');
const meta = await node.node.db.db.getPostMeta(p?.messageId || '');
const displayName = user.name || userName(p?.json.creator) || 'Anonymous';
const userHandle = userId(p?.json.creator);
q.find('profile-image')!.attr('address', p?.json.creator || '');
q.find('div.creator')!.content(displayName);
q.find('div.userId')!.content(userHandle || '');
q.find('div.content')!.content(p?.json.content || '');
if (p?.json.createdAt) {
q.find('div.createAt-top')!.html(`
<span>&#183;</span>
<span>${fromNow(p.json.createdAt)}</span>
`);
}
if (typeof meta?.replies === 'number') {
q.find('c-button.comment-btn')!
.find('span')!
.content('' + meta.replies);
}
q.find('c-button.repost-btn')!.find('span')!.content('0');
q.find('c-button.like-btn')!.find('span')!.content('0');
});
post!.subscribe(this.patch);
}
}

View File

@@ -1,4 +1,4 @@
import { CustomElement, Q, register } from '../../../lib/ui.ts';
import { CustomElement, hx, register } from '../../../lib/ui.ts';
import { getStore } from '../../state';
import { default as NodeStore } from '../../state/node.ts';
import css from './index.scss';
@@ -12,36 +12,29 @@ export default class ProfileImage extends CustomElement {
css = css.toString();
html = `
<img />
`;
async attributeChangedCallback(key: string, oldVal: string, newVal: string) {
if (newVal === oldVal) return;
async render() {
return hx`
<img src="${await this.getSrc()}" />
`;
}
async getSrc() {
const { address } = this.state;
const store = getStore();
const node: NodeStore = store.get('node');
const img = Q(this.shadowRoot!)!.find('img')!;
if (key === 'address') {
const user = await node.node.db.db.getProfile(newVal || '');
if (user.profileImageUrl) {
img.attr('src', user.profileImageUrl);
} else if (newVal) {
img.attr(
'src',
'data:image/svg+xml;utf8,' +
encodeURIComponent(minidenticon(newVal, 50, 50)),
);
} else {
img.attr(
'src',
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAABNZJREFUeF7tnFmW6jAMRJP975Ut0CcNnc5gR6XRcmL+HtFQqitDMzzm1+v1nsbN1oF5nqa3zNZ5ALFlUao2T9OE4ukXCGdKynNOLU4s0bdUigZSE2AojPIr+3VLK1YglkWzG5hZH31CMquvaku4XqAkNZD1DwqwoZ4v2AgM0+vRVDiLVANZ5HQxO+ib7yx0dRMg66x0P9AWfljD1nyxFxm2QEylIcW0GLT5lEZ+fRAIvzAl9enXq68moFfqFA/qemL3s0m/PCHZxCbmei2NYST4kAVawWgMVgTCbJqqq5AF/gOuQm2BCN67ARz3DyHNpCUYlPhtEgqEHksasdix3ND3VKV9/PPcgGAbU48qXcFq+pvm2cENCCb6CRZjTvxFNQbCE9t1NLh7sUBAUWmN3+j3GsUByDzN0/vw9OolPyE65qjHcDUQZn9jB9t2Nx6mzz97QxGENvvgLZwQZxVG5Y3KeCy5qmbxIQsaFgpSacub7DX7fJtX6nnZkcoOcNVP6mTDEcByYABh2aULRh7p3IBcN0ekgcMblgI74mECbW5ASNWnV0R+b9ZyfeHGk7MyAphAFFIVqYx5DEIpodR13feimEAM5tWWAPwgW1jUIJvIAkRA/OfRdEBz0biNsVTK9joVW+H1BSLMli0BkQVoAUJcpAUUFZ2QAF2PbWEE5MYrG7waRkBiVMPY4UCmbq+626cp6JuLTN2PCC/CqRNDWXZ1Qp4A+jZA0A1EoFrWQvptYxoAaTku1574+HggCXhIJEhyJP+1LB7IcekEkwpS4lcd6bgb5PMPGsiaJLChkCKogox2mxgayG1GLQ9iuiCaYsvn6e/xmXrQuuGkHnJCcEP4hGxr3wAIaEjhCZRvvjIDkEoAOVQACtKSTYrQbTqNAE/IMDGKLwjERk7XWIPEhwKxwdp3FYrrAJKM7wYIxa6knJfDi07m1EmOzzTjhDTgfvWjpWcgbPDsBDsLGra2G2JfiTwhN5zZy0tR3aO/JJC1yyCj+44oiAsHon9OByUlCGu4fDogCby7k4RlD3yBWGyaRY2OqPkCuTCi7PNy73LL96s+UXvRDEgfS2uFAa/jCAQX0QccnUrUDR4QtKpOO/uBzq1dg8JlIFfGN4fi6ZLzcED5IpDLPKCoh2WN2tZHcRJ08ZDF6ciJ9cDlVPM7VuR0vOcQzdyRU2l0Vt+RiBkgDoi1Sc3qlcBs76uAA3kOIJ5gQQhbCQOIJxBB7fZABFskmLObFCEQwkVjk5FySMyJiijJl+0eSEKBvuPnqy48IT6DxO9DfEfKuVRAKLF3vv63Gu5A8u1gbqyOQAYKCfpfICfr1jsiTV0PbcpPDCXmSnLMT0gkQsnAa06EUEEPcyAqk0ay37dOBMvRLQ75rOfMfCdEPp3rh0n/sgoCDTXnA9LtOQGFb776Xnwjv/R7WYbAaZVOzZzK0vNUIlA96hOCNhJPok1ML3A/oBqI1q+m+QlhNQWS0A96P5xFxwNxHoh29CpCKa6ajtVdotyBYFJ0Nt4pmwckm7vZ9BQ3gyeSB6TBKvLGaSDQuGV6IMbzfsq5U5Y3UAGRt3Wx+VzUU6CoNp2kAhJkq28b2iNGf30xBZBK8+/d+6t6oQxXug5VADnObW+6fcX8rPhAnuhSIEc+kEBxT2z1A58ObwvXw1MMAAAAAElFTkSuQmCC',
);
}
const user = await node.node.db.db.getProfile(address || '');
if (user.profileImageUrl) {
return user.profileImageUrl;
} else if (address) {
return encodeURIComponent(minidenticon(address, 50, 50));
} else {
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAABNZJREFUeF7tnFmW6jAMRJP975Ut0CcNnc5gR6XRcmL+HtFQqitDMzzm1+v1nsbN1oF5nqa3zNZ5ALFlUao2T9OE4ukXCGdKynNOLU4s0bdUigZSE2AojPIr+3VLK1YglkWzG5hZH31CMquvaku4XqAkNZD1DwqwoZ4v2AgM0+vRVDiLVANZ5HQxO+ib7yx0dRMg66x0P9AWfljD1nyxFxm2QEylIcW0GLT5lEZ+fRAIvzAl9enXq68moFfqFA/qemL3s0m/PCHZxCbmei2NYST4kAVawWgMVgTCbJqqq5AF/gOuQm2BCN67ARz3DyHNpCUYlPhtEgqEHksasdix3ND3VKV9/PPcgGAbU48qXcFq+pvm2cENCCb6CRZjTvxFNQbCE9t1NLh7sUBAUWmN3+j3GsUByDzN0/vw9OolPyE65qjHcDUQZn9jB9t2Nx6mzz97QxGENvvgLZwQZxVG5Y3KeCy5qmbxIQsaFgpSacub7DX7fJtX6nnZkcoOcNVP6mTDEcByYABh2aULRh7p3IBcN0ekgcMblgI74mECbW5ASNWnV0R+b9ZyfeHGk7MyAphAFFIVqYx5DEIpodR13feimEAM5tWWAPwgW1jUIJvIAkRA/OfRdEBz0biNsVTK9joVW+H1BSLMli0BkQVoAUJcpAUUFZ2QAF2PbWEE5MYrG7waRkBiVMPY4UCmbq+626cp6JuLTN2PCC/CqRNDWXZ1Qp4A+jZA0A1EoFrWQvptYxoAaTku1574+HggCXhIJEhyJP+1LB7IcekEkwpS4lcd6bgb5PMPGsiaJLChkCKogox2mxgayG1GLQ9iuiCaYsvn6e/xmXrQuuGkHnJCcEP4hGxr3wAIaEjhCZRvvjIDkEoAOVQACtKSTYrQbTqNAE/IMDGKLwjERk7XWIPEhwKxwdp3FYrrAJKM7wYIxa6knJfDi07m1EmOzzTjhDTgfvWjpWcgbPDsBDsLGra2G2JfiTwhN5zZy0tR3aO/JJC1yyCj+44oiAsHon9OByUlCGu4fDogCby7k4RlD3yBWGyaRY2OqPkCuTCi7PNy73LL96s+UXvRDEgfS2uFAa/jCAQX0QccnUrUDR4QtKpOO/uBzq1dg8JlIFfGN4fi6ZLzcED5IpDLPKCoh2WN2tZHcRJ08ZDF6ciJ9cDlVPM7VuR0vOcQzdyRU2l0Vt+RiBkgDoi1Sc3qlcBs76uAA3kOIJ5gQQhbCQOIJxBB7fZABFskmLObFCEQwkVjk5FySMyJiijJl+0eSEKBvuPnqy48IT6DxO9DfEfKuVRAKLF3vv63Gu5A8u1gbqyOQAYKCfpfICfr1jsiTV0PbcpPDCXmSnLMT0gkQsnAa06EUEEPcyAqk0ay37dOBMvRLQ75rOfMfCdEPp3rh0n/sgoCDTXnA9LtOQGFb776Xnwjv/R7WYbAaZVOzZzK0vNUIlA96hOCNhJPok1ML3A/oBqI1q+m+QlhNQWS0A96P5xFxwNxHoh29CpCKa6ajtVdotyBYFJ0Nt4pmwckm7vZ9BQ3gyeSB6TBKvLGaSDQuGV6IMbzfsq5U5Y3UAGRt3Wx+VzUU6CoNp2kAhJkq28b2iNGf30xBZBK8+/d+6t6oQxXug5VADnObW+6fcX8rPhAnuhSIEc+kEBxT2z1A58ObwvXw1MMAAAAAElFTkSuQmCC';
}
}
async attributeChangedCallback(key: string, oldVal: string, newVal: string) {
this.patch();
}
}
register('profile-image', ProfileImage);

View File

@@ -1,4 +1,4 @@
import { CustomElement, html, Q, register } from '../../../lib/ui.ts';
import { CustomElement, hx, register } from '../../../lib/ui.ts';
import { getStore } from '../../state';
import { default as NodeState } from '../../state/node.ts';
import '../../components/Post';
@@ -7,39 +7,38 @@ import css from './index.scss';
export default class App extends CustomElement {
css = css.toString();
html = `
<div class="app">
<div class="posts"></div>
<div class="sidebar">
hi
</div>
</div>
`;
async connectedCallback() {
super.connectedCallback();
this.subscribeToPosts();
}
async render() {
const state = getStore();
const node = state.get<NodeState>('node');
const posts = node.$globalPosts.state;
return hx`
<div class="app">
<div class="posts">
${posts.map((hash) => {
return hx`
<post-card
key="${hash}"
data-hash="${hash}"
/>
`;
})}
</div>
<div class="sidebar">
</div>
</div>
`;
}
subscribeToPosts() {
const state = getStore();
const node = state.get<NodeState>('node');
node.$globalPosts.subscribe((hashes) => {
const app = Q(this.shadowRoot!)!.find('div.posts')!;
const old = Q(app.el)!.findAll('post-card');
old.patch(
hashes,
(hash: string) => hash,
(hash: string) =>
html(`
<post-card
key="${hash}"
data-hash="${hash}"
/>
`),
);
});
node.$globalPosts.subscribe(this.patch);
}
}