@benev/tact 0.4.0-1 → 0.4.0-10
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/README.md +134 -46
- package/package.json +7 -6
- package/s/demo/main.css +38 -3
- package/s/index.html.ts +26 -20
- package/s/lib/index.ts +1 -1
- package/s/lib/input/controller.ts +4 -1
- package/s/lib/input/data/intent/decode.ts +2 -2
- package/s/lib/input/data/intent/encode.ts +2 -2
- package/s/lib/input/data/intent/minihash.ts +5 -0
- package/s/lib/input/decoder.ts +2 -2
- package/s/lib/input/evaluate/context.ts +5 -1
- package/s/lib/input/evaluate/evaluate.ts +27 -14
- package/s/lib/input/investigate/hash-bindings.ts +5 -3
- package/s/lib/input/investigate/investigate.ts +24 -9
- package/s/lib/input/test.ts +52 -30
- package/s/lib/input/testing/quickbind.ts +3 -3
- package/s/lib/ui/deck/auto-gamepads.ts +1 -0
- package/s/lib/ui/deck/controls/internal/data.ts +7 -5
- package/s/lib/ui/deck/hub.ts +4 -3
- package/s/lib/ui/deck/players.ts +73 -0
- package/s/lib/ui/deck/setup/deck.ts +33 -20
- package/s/lib/ui/deck/setup/tact.ts +26 -11
- package/s/lib/ui/deck/setup/types.ts +1 -0
- package/s/lib/ui/deck/setup/utils/broadcast-channel.ts +17 -0
- package/s/lib/ui/deck/setup/utils/kv.ts +20 -0
- package/s/lib/ui/deck/types.ts +1 -1
- package/s/lib/ui/views/controllers/style.css.ts +1 -1
- package/s/lib/ui/views/controllers/view.ts +3 -2
- package/s/lib/ui/views/customize/style.css.ts +1 -1
- package/s/lib/ui/views/customize/view.ts +6 -5
- package/s/lib/ui/views/deck/style.css.ts +1 -1
- package/s/lib/ui/views/deck/view.ts +13 -7
- package/s/lib/ui/views/theme.css.ts +1 -1
- package/s/lib/ui/views/visualizer/style.css.ts +8 -6
- package/s/lib/ui/views/visualizer/view.ts +1 -0
- package/s/lib/utils/hash.ts +47 -0
- package/x/demo/main.bundle.min.js +330 -326
- package/x/demo/main.bundle.min.js.map +4 -4
- package/x/demo/main.css +38 -3
- package/x/gamepad/index.html +2 -2
- package/x/gamepad/main.bundle.min.js +8 -8
- package/x/gamepad/main.bundle.min.js.map +4 -4
- package/x/index.html +28 -22
- package/x/index.html.js +26 -20
- package/x/index.html.js.map +1 -1
- package/x/lib/index.d.ts +1 -1
- package/x/lib/index.js +1 -1
- package/x/lib/index.js.map +1 -1
- package/x/lib/input/controller.js +1 -1
- package/x/lib/input/controller.js.map +1 -1
- package/x/lib/input/data/intent/decode.d.ts +1 -1
- package/x/lib/input/data/intent/decode.js +2 -2
- package/x/lib/input/data/intent/decode.js.map +1 -1
- package/x/lib/input/data/intent/encode.d.ts +1 -1
- package/x/lib/input/data/intent/encode.js +2 -2
- package/x/lib/input/data/intent/encode.js.map +1 -1
- package/x/lib/input/data/intent/minihash.d.ts +1 -0
- package/x/lib/input/data/intent/minihash.js +4 -0
- package/x/lib/input/data/intent/minihash.js.map +1 -0
- package/x/lib/input/decoder.d.ts +1 -1
- package/x/lib/input/decoder.js +2 -2
- package/x/lib/input/decoder.js.map +1 -1
- package/x/lib/input/evaluate/context.d.ts +3 -1
- package/x/lib/input/evaluate/context.js.map +1 -1
- package/x/lib/input/evaluate/evaluate.js +24 -11
- package/x/lib/input/evaluate/evaluate.js.map +1 -1
- package/x/lib/input/investigate/hash-bindings.d.ts +1 -1
- package/x/lib/input/investigate/hash-bindings.js +5 -3
- package/x/lib/input/investigate/hash-bindings.js.map +1 -1
- package/x/lib/input/investigate/investigate.d.ts +2 -1
- package/x/lib/input/investigate/investigate.js +14 -9
- package/x/lib/input/investigate/investigate.js.map +1 -1
- package/x/lib/input/test.d.ts +4 -2
- package/x/lib/input/test.js +49 -22
- package/x/lib/input/test.js.map +1 -1
- package/x/lib/input/testing/quickbind.d.ts +3 -2
- package/x/lib/input/testing/quickbind.js +3 -3
- package/x/lib/input/testing/quickbind.js.map +1 -1
- package/x/lib/ui/deck/auto-gamepads.js +1 -0
- package/x/lib/ui/deck/auto-gamepads.js.map +1 -1
- package/x/lib/ui/deck/controls/internal/data.d.ts +1 -1
- package/x/lib/ui/deck/controls/internal/data.js +4 -1
- package/x/lib/ui/deck/controls/internal/data.js.map +1 -1
- package/x/lib/ui/deck/hub.js +4 -3
- package/x/lib/ui/deck/hub.js.map +1 -1
- package/x/lib/ui/deck/players.d.ts +16 -0
- package/x/lib/ui/deck/players.js +56 -0
- package/x/lib/ui/deck/players.js.map +1 -0
- package/x/lib/ui/deck/setup/deck.js +23 -13
- package/x/lib/ui/deck/setup/deck.js.map +1 -1
- package/x/lib/ui/deck/setup/tact.d.ts +3 -0
- package/x/lib/ui/deck/setup/tact.js +19 -8
- package/x/lib/ui/deck/setup/tact.js.map +1 -1
- package/x/lib/ui/deck/setup/types.d.ts +1 -0
- package/x/lib/ui/deck/setup/utils/broadcast-channel.d.ts +4 -0
- package/x/lib/ui/deck/setup/utils/broadcast-channel.js +10 -0
- package/x/lib/ui/deck/setup/utils/broadcast-channel.js.map +1 -0
- package/x/lib/ui/deck/setup/utils/kv.d.ts +5 -0
- package/x/lib/ui/deck/setup/utils/kv.js +12 -0
- package/x/lib/ui/deck/setup/utils/kv.js.map +1 -0
- package/x/lib/ui/deck/types.d.ts +1 -0
- package/x/lib/ui/views/controllers/style.css.js +1 -1
- package/x/lib/ui/views/controllers/view.js +3 -2
- package/x/lib/ui/views/controllers/view.js.map +1 -1
- package/x/lib/ui/views/customize/style.css.js +1 -1
- package/x/lib/ui/views/customize/view.js +6 -5
- package/x/lib/ui/views/customize/view.js.map +1 -1
- package/x/lib/ui/views/deck/style.css.js +1 -1
- package/x/lib/ui/views/deck/view.js +13 -6
- package/x/lib/ui/views/deck/view.js.map +1 -1
- package/x/lib/ui/views/theme.css.js +1 -1
- package/x/lib/ui/views/visualizer/style.css.js +8 -6
- package/x/lib/ui/views/visualizer/style.css.js.map +1 -1
- package/x/lib/ui/views/visualizer/view.js +1 -0
- package/x/lib/ui/views/visualizer/view.js.map +1 -1
- package/x/lib/utils/hash.d.ts +1 -0
- package/x/lib/utils/hash.js +47 -0
- package/x/lib/utils/hash.js.map +1 -0
- package/s/lib/ui/deck/collector.ts +0 -52
- package/x/lib/ui/deck/collector.d.ts +0 -13
- package/x/lib/ui/deck/collector.js +0 -35
- package/x/lib/ui/deck/collector.js.map +0 -1
|
@@ -8,15 +8,17 @@ export default css`@layer view {
|
|
|
8
8
|
|
|
9
9
|
output {
|
|
10
10
|
opacity: 0.5;
|
|
11
|
-
color: var(--prime);
|
|
12
|
-
font-size: 1em;
|
|
13
|
-
font-family: monospace;
|
|
14
11
|
display: block;
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
|
|
13
|
+
font-size: 1em;
|
|
17
14
|
height: 8em;
|
|
18
|
-
|
|
15
|
+
|
|
19
16
|
overflow: hidden;
|
|
17
|
+
overflow-wrap: anywhere;
|
|
18
|
+
|
|
19
|
+
font-family: monospace;
|
|
20
|
+
color: var(--prime);
|
|
21
|
+
text-overflow: ellipsis;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
}`
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
import {blake3} from "@awasm/noble/js.js"
|
|
3
|
+
import {dataViewFrom, txt} from "@e280/stz"
|
|
4
|
+
|
|
5
|
+
const endian = false
|
|
6
|
+
enum EntropyType {String, Number, Bytes}
|
|
7
|
+
|
|
8
|
+
export function hash(...entropy: (string | number | Uint8Array)[]) {
|
|
9
|
+
if (entropy.length === 0)
|
|
10
|
+
throw new RangeError("hash requires entropy")
|
|
11
|
+
|
|
12
|
+
const hasher = blake3.create()
|
|
13
|
+
const typeTag = new Uint8Array(1)
|
|
14
|
+
const lengthTag = new Uint8Array(4)
|
|
15
|
+
const lengthDataview = dataViewFrom(lengthTag)
|
|
16
|
+
|
|
17
|
+
for (const part of entropy) {
|
|
18
|
+
if (typeof part === "string") {
|
|
19
|
+
const bytes = txt.toBytes(part)
|
|
20
|
+
typeTag[0] = EntropyType.String
|
|
21
|
+
lengthDataview.setUint32(0, bytes.byteLength, endian)
|
|
22
|
+
hasher.update(typeTag)
|
|
23
|
+
hasher.update(lengthTag)
|
|
24
|
+
hasher.update(bytes)
|
|
25
|
+
}
|
|
26
|
+
else if (typeof part === "number") {
|
|
27
|
+
const bytes = new Uint8Array(8)
|
|
28
|
+
dataViewFrom(bytes).setFloat64(0, part, endian)
|
|
29
|
+
typeTag[0] = EntropyType.Number
|
|
30
|
+
lengthDataview.setUint32(0, bytes.byteLength, endian)
|
|
31
|
+
hasher.update(typeTag)
|
|
32
|
+
hasher.update(lengthTag)
|
|
33
|
+
hasher.update(bytes)
|
|
34
|
+
}
|
|
35
|
+
else if (part instanceof Uint8Array) {
|
|
36
|
+
typeTag[0] = EntropyType.Bytes
|
|
37
|
+
lengthDataview.setUint32(0, part.byteLength, endian)
|
|
38
|
+
hasher.update(typeTag)
|
|
39
|
+
hasher.update(lengthTag)
|
|
40
|
+
hasher.update(part)
|
|
41
|
+
}
|
|
42
|
+
else throw new Error("unknown part type")
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return hasher.digest() as Uint8Array
|
|
46
|
+
}
|
|
47
|
+
|