@awacloud/fw 0.1.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/CHANGELOG.md +79 -0
- package/LICENSE +176 -0
- package/NOTICE +12 -0
- package/README.md +355 -0
- package/dist/build/fw.core.pure.meta.json +29 -0
- package/dist/build/fw.core.pure.min.js +26 -0
- package/dist/build/fw.full.pure.meta.json +224 -0
- package/dist/build/fw.full.pure.min.js +60 -0
- package/dist/build/fw.minimal.pure.meta.json +21 -0
- package/dist/build/fw.minimal.pure.min.js +26 -0
- package/dist/build/fw.pack.compress-heavy.pure.meta.json +29 -0
- package/dist/build/fw.pack.compress-heavy.pure.min.js +8 -0
- package/dist/build/fw.pack.crypto-advanced.pure.meta.json +38 -0
- package/dist/build/fw.pack.crypto-advanced.pure.min.js +6 -0
- package/dist/build/fw.pack.crypto-basic.pure.meta.json +29 -0
- package/dist/build/fw.pack.crypto-basic.pure.min.js +6 -0
- package/dist/build/fw.pack.crypto-identity.pure.meta.json +29 -0
- package/dist/build/fw.pack.crypto-identity.pure.min.js +9 -0
- package/dist/build/fw.pack.realtime.pure.meta.json +21 -0
- package/dist/build/fw.pack.realtime.pure.min.js +6 -0
- package/dist/build/fw.pack.sensors.pure.meta.json +21 -0
- package/dist/build/fw.pack.sensors.pure.min.js +6 -0
- package/dist/build/fw.pack.structures-advanced.pure.meta.json +20 -0
- package/dist/build/fw.pack.structures-advanced.pure.min.js +6 -0
- package/dist/build/fw.pack.text-advanced.pure.meta.json +20 -0
- package/dist/build/fw.pack.text-advanced.pure.min.js +6 -0
- package/dist/build/fw.pwa.pure.meta.json +127 -0
- package/dist/build/fw.pwa.pure.min.js +55 -0
- package/dist/build/fw.site-interactive.pure.meta.json +81 -0
- package/dist/build/fw.site-interactive.pure.min.js +52 -0
- package/dist/build/fw.site.pure.meta.json +51 -0
- package/dist/build/fw.site.pure.min.js +35 -0
- package/dist/build/fw.spa.pure.meta.json +108 -0
- package/dist/build/fw.spa.pure.min.js +55 -0
- package/dist/build/io/compress/brotli_dict.bin +432 -0
- package/dist/build/sanity-base-classic.min.js +6 -0
- package/dist/build/sanity-community-classic.min.js +6 -0
- package/dist/build/sanity.min.js +6 -0
- package/dist/types/core/logger.d.ts +71 -0
- package/dist/types/core/logger.d.ts.map +1 -0
- package/dist/types/core/modules.d.ts +3962 -0
- package/dist/types/core/modules.d.ts.map +1 -0
- package/dist/types/core/readyState.d.ts +14 -0
- package/dist/types/core/readyState.d.ts.map +1 -0
- package/dist/types/core/runtime.d.ts +625 -0
- package/dist/types/core/runtime.d.ts.map +1 -0
- package/dist/types/core/worker-helper.d.ts +153 -0
- package/dist/types/core/worker-helper.d.ts.map +1 -0
- package/dist/types/crypto/cipher/aes.d.ts +55 -0
- package/dist/types/crypto/cipher/aes.d.ts.map +1 -0
- package/dist/types/crypto/cipher/chacha20.d.ts +33 -0
- package/dist/types/crypto/cipher/chacha20.d.ts.map +1 -0
- package/dist/types/crypto/hash/adf.d.ts +65 -0
- package/dist/types/crypto/hash/adf.d.ts.map +1 -0
- package/dist/types/crypto/hash/argon2.d.ts +79 -0
- package/dist/types/crypto/hash/argon2.d.ts.map +1 -0
- package/dist/types/crypto/hash/blake2b.d.ts +40 -0
- package/dist/types/crypto/hash/blake2b.d.ts.map +1 -0
- package/dist/types/crypto/hash/hkdf.d.ts +88 -0
- package/dist/types/crypto/hash/hkdf.d.ts.map +1 -0
- package/dist/types/crypto/hash/hmac.d.ts +85 -0
- package/dist/types/crypto/hash/hmac.d.ts.map +1 -0
- package/dist/types/crypto/hash/pbkdf2.d.ts +80 -0
- package/dist/types/crypto/hash/pbkdf2.d.ts.map +1 -0
- package/dist/types/crypto/hash/poly1305.d.ts +31 -0
- package/dist/types/crypto/hash/poly1305.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha224.d.ts +80 -0
- package/dist/types/crypto/hash/sha224.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha256.d.ts +82 -0
- package/dist/types/crypto/hash/sha256.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha3.d.ts +111 -0
- package/dist/types/crypto/hash/sha3.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha384.d.ts +84 -0
- package/dist/types/crypto/hash/sha384.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha512.d.ts +87 -0
- package/dist/types/crypto/hash/sha512.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha512_224.d.ts +84 -0
- package/dist/types/crypto/hash/sha512_224.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha512_256.d.ts +84 -0
- package/dist/types/crypto/hash/sha512_256.d.ts.map +1 -0
- package/dist/types/crypto/mode/cbc.d.ts +38 -0
- package/dist/types/crypto/mode/cbc.d.ts.map +1 -0
- package/dist/types/crypto/mode/chacha20poly1305.d.ts +71 -0
- package/dist/types/crypto/mode/chacha20poly1305.d.ts.map +1 -0
- package/dist/types/crypto/mode/cmac.d.ts +56 -0
- package/dist/types/crypto/mode/cmac.d.ts.map +1 -0
- package/dist/types/crypto/mode/ctr.d.ts +52 -0
- package/dist/types/crypto/mode/ctr.d.ts.map +1 -0
- package/dist/types/crypto/mode/gcm.d.ts +88 -0
- package/dist/types/crypto/mode/gcm.d.ts.map +1 -0
- package/dist/types/crypto/mode/kw.d.ts +60 -0
- package/dist/types/crypto/mode/kw.d.ts.map +1 -0
- package/dist/types/crypto/pkc/ecc.d.ts +284 -0
- package/dist/types/crypto/pkc/ecc.d.ts.map +1 -0
- package/dist/types/crypto/pkc/ed25519.d.ts +107 -0
- package/dist/types/crypto/pkc/ed25519.d.ts.map +1 -0
- package/dist/types/crypto/pkc/hybridKem.d.ts +154 -0
- package/dist/types/crypto/pkc/hybridKem.d.ts.map +1 -0
- package/dist/types/crypto/pkc/hybridSign.d.ts +383 -0
- package/dist/types/crypto/pkc/hybridSign.d.ts.map +1 -0
- package/dist/types/crypto/pkc/ml_dsa.d.ts +174 -0
- package/dist/types/crypto/pkc/ml_dsa.d.ts.map +1 -0
- package/dist/types/crypto/pkc/ml_kem.d.ts +194 -0
- package/dist/types/crypto/pkc/ml_kem.d.ts.map +1 -0
- package/dist/types/crypto/pkc/rsa.d.ts +175 -0
- package/dist/types/crypto/pkc/rsa.d.ts.map +1 -0
- package/dist/types/crypto/pkc/slh_dsa.d.ts +232 -0
- package/dist/types/crypto/pkc/slh_dsa.d.ts.map +1 -0
- package/dist/types/crypto/pkc/x25519.d.ts +37 -0
- package/dist/types/crypto/pkc/x25519.d.ts.map +1 -0
- package/dist/types/crypto/utils/aes_ctr.d.ts +84 -0
- package/dist/types/crypto/utils/aes_ctr.d.ts.map +1 -0
- package/dist/types/crypto/utils/aes_modes.d.ts +128 -0
- package/dist/types/crypto/utils/aes_modes.d.ts.map +1 -0
- package/dist/types/crypto/utils/asn1-oid.d.ts +45 -0
- package/dist/types/crypto/utils/asn1-oid.d.ts.map +1 -0
- package/dist/types/crypto/utils/asn1.d.ts +115 -0
- package/dist/types/crypto/utils/asn1.d.ts.map +1 -0
- package/dist/types/crypto/utils/bitArray.d.ts +75 -0
- package/dist/types/crypto/utils/bitArray.d.ts.map +1 -0
- package/dist/types/crypto/utils/bn.d.ts +214 -0
- package/dist/types/crypto/utils/bn.d.ts.map +1 -0
- package/dist/types/crypto/utils/jws.d.ts +159 -0
- package/dist/types/crypto/utils/jws.d.ts.map +1 -0
- package/dist/types/crypto/utils/keyformat.d.ts +100 -0
- package/dist/types/crypto/utils/keyformat.d.ts.map +1 -0
- package/dist/types/crypto/utils/pad.d.ts +44 -0
- package/dist/types/crypto/utils/pad.d.ts.map +1 -0
- package/dist/types/crypto/utils/pem.d.ts +41 -0
- package/dist/types/crypto/utils/pem.d.ts.map +1 -0
- package/dist/types/crypto/utils/random.d.ts +203 -0
- package/dist/types/crypto/utils/random.d.ts.map +1 -0
- package/dist/types/crypto/utils/rsaKeygen.d.ts +162 -0
- package/dist/types/crypto/utils/rsaKeygen.d.ts.map +1 -0
- package/dist/types/crypto/utils/totp.d.ts +183 -0
- package/dist/types/crypto/utils/totp.d.ts.map +1 -0
- package/dist/types/crypto/utils/uuid.d.ts +29 -0
- package/dist/types/crypto/utils/uuid.d.ts.map +1 -0
- package/dist/types/crypto/wasm/aes.d.ts +59 -0
- package/dist/types/crypto/wasm/aes.d.ts.map +1 -0
- package/dist/types/crypto/wasm/argon2.d.ts +70 -0
- package/dist/types/crypto/wasm/argon2.d.ts.map +1 -0
- package/dist/types/crypto/wasm/blake2b.d.ts +59 -0
- package/dist/types/crypto/wasm/blake2b.d.ts.map +1 -0
- package/dist/types/crypto/wasm/chacha20poly1305.d.ts +43 -0
- package/dist/types/crypto/wasm/chacha20poly1305.d.ts.map +1 -0
- package/dist/types/crypto/wasm/cmac.d.ts +42 -0
- package/dist/types/crypto/wasm/cmac.d.ts.map +1 -0
- package/dist/types/crypto/wasm/ecc.d.ts +56 -0
- package/dist/types/crypto/wasm/ecc.d.ts.map +1 -0
- package/dist/types/crypto/wasm/ed25519.d.ts +52 -0
- package/dist/types/crypto/wasm/ed25519.d.ts.map +1 -0
- package/dist/types/crypto/wasm/hkdf.d.ts +40 -0
- package/dist/types/crypto/wasm/hkdf.d.ts.map +1 -0
- package/dist/types/crypto/wasm/hmac.d.ts +42 -0
- package/dist/types/crypto/wasm/hmac.d.ts.map +1 -0
- package/dist/types/crypto/wasm/ml_dsa.d.ts +48 -0
- package/dist/types/crypto/wasm/ml_dsa.d.ts.map +1 -0
- package/dist/types/crypto/wasm/ml_kem.d.ts +58 -0
- package/dist/types/crypto/wasm/ml_kem.d.ts.map +1 -0
- package/dist/types/crypto/wasm/pbkdf2.d.ts +38 -0
- package/dist/types/crypto/wasm/pbkdf2.d.ts.map +1 -0
- package/dist/types/crypto/wasm/rsa.d.ts +56 -0
- package/dist/types/crypto/wasm/rsa.d.ts.map +1 -0
- package/dist/types/crypto/wasm/runtime.d.ts +99 -0
- package/dist/types/crypto/wasm/runtime.d.ts.map +1 -0
- package/dist/types/crypto/wasm/sha2.d.ts +45 -0
- package/dist/types/crypto/wasm/sha2.d.ts.map +1 -0
- package/dist/types/crypto/wasm/sha3.d.ts +57 -0
- package/dist/types/crypto/wasm/sha3.d.ts.map +1 -0
- package/dist/types/crypto/wasm/slh_dsa.d.ts +62 -0
- package/dist/types/crypto/wasm/slh_dsa.d.ts.map +1 -0
- package/dist/types/crypto/wasm/x25519.d.ts +53 -0
- package/dist/types/crypto/wasm/x25519.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/aes.d.ts +59 -0
- package/dist/types/crypto/webcrypto/aes.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/aeskw.d.ts +40 -0
- package/dist/types/crypto/webcrypto/aeskw.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/digest.d.ts +43 -0
- package/dist/types/crypto/webcrypto/digest.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/ecc.d.ts +51 -0
- package/dist/types/crypto/webcrypto/ecc.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/ed25519.d.ts +43 -0
- package/dist/types/crypto/webcrypto/ed25519.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/hkdf.d.ts +18 -0
- package/dist/types/crypto/webcrypto/hkdf.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/hmac.d.ts +43 -0
- package/dist/types/crypto/webcrypto/hmac.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/pbkdf2.d.ts +18 -0
- package/dist/types/crypto/webcrypto/pbkdf2.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/rsa.d.ts +51 -0
- package/dist/types/crypto/webcrypto/rsa.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/x25519.d.ts +43 -0
- package/dist/types/crypto/webcrypto/x25519.d.ts.map +1 -0
- package/dist/types/dom/display/animate.d.ts +35 -0
- package/dist/types/dom/display/animate.d.ts.map +1 -0
- package/dist/types/dom/display/fullscreen.d.ts +59 -0
- package/dist/types/dom/display/fullscreen.d.ts.map +1 -0
- package/dist/types/dom/fs/download.d.ts +36 -0
- package/dist/types/dom/fs/download.d.ts.map +1 -0
- package/dist/types/dom/fs/fsAccess.d.ts +107 -0
- package/dist/types/dom/fs/fsAccess.d.ts.map +1 -0
- package/dist/types/dom/fs/indexedDB.d.ts +62 -0
- package/dist/types/dom/fs/indexedDB.d.ts.map +1 -0
- package/dist/types/dom/fs/remoteStore.d.ts +64 -0
- package/dist/types/dom/fs/remoteStore.d.ts.map +1 -0
- package/dist/types/dom/fs/storage.d.ts +56 -0
- package/dist/types/dom/fs/storage.d.ts.map +1 -0
- package/dist/types/dom/lifecycle/idle.d.ts +91 -0
- package/dist/types/dom/lifecycle/idle.d.ts.map +1 -0
- package/dist/types/dom/lifecycle/visibility.d.ts +49 -0
- package/dist/types/dom/lifecycle/visibility.d.ts.map +1 -0
- package/dist/types/dom/lifecycle/wakeLock.d.ts +69 -0
- package/dist/types/dom/lifecycle/wakeLock.d.ts.map +1 -0
- package/dist/types/dom/net/ajax.d.ts +27 -0
- package/dist/types/dom/net/ajax.d.ts.map +1 -0
- package/dist/types/dom/net/broadcastChannel.d.ts +51 -0
- package/dist/types/dom/net/broadcastChannel.d.ts.map +1 -0
- package/dist/types/dom/net/network.d.ts +80 -0
- package/dist/types/dom/net/network.d.ts.map +1 -0
- package/dist/types/dom/net/sse.d.ts +72 -0
- package/dist/types/dom/net/sse.d.ts.map +1 -0
- package/dist/types/dom/net/webrtc.d.ts +149 -0
- package/dist/types/dom/net/webrtc.d.ts.map +1 -0
- package/dist/types/dom/net/ws.d.ts +70 -0
- package/dist/types/dom/net/ws.d.ts.map +1 -0
- package/dist/types/dom/query/dnd.d.ts +86 -0
- package/dist/types/dom/query/dnd.d.ts.map +1 -0
- package/dist/types/dom/query/dom.d.ts +194 -0
- package/dist/types/dom/query/dom.d.ts.map +1 -0
- package/dist/types/dom/query/events.d.ts +135 -0
- package/dist/types/dom/query/events.d.ts.map +1 -0
- package/dist/types/dom/query/gesture.d.ts +59 -0
- package/dist/types/dom/query/gesture.d.ts.map +1 -0
- package/dist/types/dom/query/media.d.ts +156 -0
- package/dist/types/dom/query/media.d.ts.map +1 -0
- package/dist/types/dom/rendering/chart.d.ts +143 -0
- package/dist/types/dom/rendering/chart.d.ts.map +1 -0
- package/dist/types/dom/rendering/component.d.ts +92 -0
- package/dist/types/dom/rendering/component.d.ts.map +1 -0
- package/dist/types/dom/rendering/devtools-ui.d.ts +83 -0
- package/dist/types/dom/rendering/devtools-ui.d.ts.map +1 -0
- package/dist/types/dom/rendering/devtools.d.ts +68 -0
- package/dist/types/dom/rendering/devtools.d.ts.map +1 -0
- package/dist/types/dom/rendering/parser.d.ts +216 -0
- package/dist/types/dom/rendering/parser.d.ts.map +1 -0
- package/dist/types/dom/rendering/reactiveBind.d.ts +101 -0
- package/dist/types/dom/rendering/reactiveBind.d.ts.map +1 -0
- package/dist/types/dom/rendering/render.d.ts +121 -0
- package/dist/types/dom/rendering/render.d.ts.map +1 -0
- package/dist/types/dom/rendering/sanitize.d.ts +48 -0
- package/dist/types/dom/rendering/sanitize.d.ts.map +1 -0
- package/dist/types/dom/rendering/secPolicy.d.ts +89 -0
- package/dist/types/dom/rendering/secPolicy.d.ts.map +1 -0
- package/dist/types/dom/rendering/template.d.ts +251 -0
- package/dist/types/dom/rendering/template.d.ts.map +1 -0
- package/dist/types/dom/rendering/themeTokens.d.ts +61 -0
- package/dist/types/dom/rendering/themeTokens.d.ts.map +1 -0
- package/dist/types/dom/rendering/uiSession-core.d.ts +192 -0
- package/dist/types/dom/rendering/uiSession-core.d.ts.map +1 -0
- package/dist/types/dom/rendering/uiSession-direct.d.ts +63 -0
- package/dist/types/dom/rendering/uiSession-direct.d.ts.map +1 -0
- package/dist/types/dom/rendering/uiSession-list.d.ts +205 -0
- package/dist/types/dom/rendering/uiSession-list.d.ts.map +1 -0
- package/dist/types/dom/rendering/uiSession.d.ts +285 -0
- package/dist/types/dom/rendering/uiSession.d.ts.map +1 -0
- package/dist/types/dom/rendering/virtualScroll.d.ts +80 -0
- package/dist/types/dom/rendering/virtualScroll.d.ts.map +1 -0
- package/dist/types/dom/sensors/battery.d.ts +71 -0
- package/dist/types/dom/sensors/battery.d.ts.map +1 -0
- package/dist/types/dom/sensors/geolocation.d.ts +83 -0
- package/dist/types/dom/sensors/geolocation.d.ts.map +1 -0
- package/dist/types/dom/sensors/networkInfo.d.ts +82 -0
- package/dist/types/dom/sensors/networkInfo.d.ts.map +1 -0
- package/dist/types/dom/sensors/sensors.d.ts +191 -0
- package/dist/types/dom/sensors/sensors.d.ts.map +1 -0
- package/dist/types/dom/sw/backgroundSync.d.ts +48 -0
- package/dist/types/dom/sw/backgroundSync.d.ts.map +1 -0
- package/dist/types/dom/sw/cache.d.ts +71 -0
- package/dist/types/dom/sw/cache.d.ts.map +1 -0
- package/dist/types/dom/sw/push.d.ts +77 -0
- package/dist/types/dom/sw/push.d.ts.map +1 -0
- package/dist/types/dom/sw/serviceWorker.d.ts +57 -0
- package/dist/types/dom/sw/serviceWorker.d.ts.map +1 -0
- package/dist/types/dom/sw/sharedWorker.d.ts +81 -0
- package/dist/types/dom/sw/sharedWorker.d.ts.map +1 -0
- package/dist/types/dom/utils/a11y.d.ts +53 -0
- package/dist/types/dom/utils/a11y.d.ts.map +1 -0
- package/dist/types/dom/utils/clipboard.d.ts +44 -0
- package/dist/types/dom/utils/clipboard.d.ts.map +1 -0
- package/dist/types/dom/utils/entropyCollector.d.ts +58 -0
- package/dist/types/dom/utils/entropyCollector.d.ts.map +1 -0
- package/dist/types/dom/utils/focus.d.ts +123 -0
- package/dist/types/dom/utils/focus.d.ts.map +1 -0
- package/dist/types/dom/utils/form.d.ts +227 -0
- package/dist/types/dom/utils/form.d.ts.map +1 -0
- package/dist/types/dom/utils/formKit.d.ts +206 -0
- package/dist/types/dom/utils/formKit.d.ts.map +1 -0
- package/dist/types/dom/utils/keybindings.d.ts +53 -0
- package/dist/types/dom/utils/keybindings.d.ts.map +1 -0
- package/dist/types/dom/utils/leaderElection.d.ts +70 -0
- package/dist/types/dom/utils/leaderElection.d.ts.map +1 -0
- package/dist/types/dom/utils/notifications.d.ts +164 -0
- package/dist/types/dom/utils/notifications.d.ts.map +1 -0
- package/dist/types/dom/utils/permissions.d.ts +35 -0
- package/dist/types/dom/utils/permissions.d.ts.map +1 -0
- package/dist/types/dom/utils/route.d.ts +117 -0
- package/dist/types/dom/utils/route.d.ts.map +1 -0
- package/dist/types/dom/utils/ua.d.ts +35 -0
- package/dist/types/dom/utils/ua.d.ts.map +1 -0
- package/dist/types/dom/utils/webauthn.d.ts +98 -0
- package/dist/types/dom/utils/webauthn.d.ts.map +1 -0
- package/dist/types/io/binary/reader.d.ts +59 -0
- package/dist/types/io/binary/reader.d.ts.map +1 -0
- package/dist/types/io/binary/writer.d.ts +56 -0
- package/dist/types/io/binary/writer.d.ts.map +1 -0
- package/dist/types/io/calc/adler32.d.ts +31 -0
- package/dist/types/io/calc/adler32.d.ts.map +1 -0
- package/dist/types/io/calc/bigint.d.ts +74 -0
- package/dist/types/io/calc/bigint.d.ts.map +1 -0
- package/dist/types/io/calc/crc32.d.ts +36 -0
- package/dist/types/io/calc/crc32.d.ts.map +1 -0
- package/dist/types/io/calc/easing.d.ts +60 -0
- package/dist/types/io/calc/easing.d.ts.map +1 -0
- package/dist/types/io/codec/b64.d.ts +28 -0
- package/dist/types/io/codec/b64.d.ts.map +1 -0
- package/dist/types/io/codec/base32.d.ts +28 -0
- package/dist/types/io/codec/base32.d.ts.map +1 -0
- package/dist/types/io/codec/base58.d.ts +28 -0
- package/dist/types/io/codec/base58.d.ts.map +1 -0
- package/dist/types/io/codec/buffer.d.ts +66 -0
- package/dist/types/io/codec/buffer.d.ts.map +1 -0
- package/dist/types/io/codec/cbor.d.ts +43 -0
- package/dist/types/io/codec/cbor.d.ts.map +1 -0
- package/dist/types/io/codec/csv.d.ts +35 -0
- package/dist/types/io/codec/csv.d.ts.map +1 -0
- package/dist/types/io/codec/hex.d.ts +28 -0
- package/dist/types/io/codec/hex.d.ts.map +1 -0
- package/dist/types/io/codec/mime.d.ts +100 -0
- package/dist/types/io/codec/mime.d.ts.map +1 -0
- package/dist/types/io/codec/msgpack.d.ts +36 -0
- package/dist/types/io/codec/msgpack.d.ts.map +1 -0
- package/dist/types/io/codec/url.d.ts +52 -0
- package/dist/types/io/codec/url.d.ts.map +1 -0
- package/dist/types/io/codec/utf8.d.ts +22 -0
- package/dist/types/io/codec/utf8.d.ts.map +1 -0
- package/dist/types/io/codec/xml.d.ts +91 -0
- package/dist/types/io/codec/xml.d.ts.map +1 -0
- package/dist/types/io/compress/bitstream.d.ts +51 -0
- package/dist/types/io/compress/bitstream.d.ts.map +1 -0
- package/dist/types/io/compress/brotli.d.ts +86 -0
- package/dist/types/io/compress/brotli.d.ts.map +1 -0
- package/dist/types/io/compress/brotli_dict.d.ts +76 -0
- package/dist/types/io/compress/brotli_dict.d.ts.map +1 -0
- package/dist/types/io/compress/brotli_dict_words.d.ts +43 -0
- package/dist/types/io/compress/brotli_dict_words.d.ts.map +1 -0
- package/dist/types/io/compress/brotli_frame.d.ts +166 -0
- package/dist/types/io/compress/brotli_frame.d.ts.map +1 -0
- package/dist/types/io/compress/brotli_shared.d.ts +165 -0
- package/dist/types/io/compress/brotli_shared.d.ts.map +1 -0
- package/dist/types/io/compress/deflate.d.ts +89 -0
- package/dist/types/io/compress/deflate.d.ts.map +1 -0
- package/dist/types/io/compress/gzip.d.ts +100 -0
- package/dist/types/io/compress/gzip.d.ts.map +1 -0
- package/dist/types/io/compress/huffman.d.ts +37 -0
- package/dist/types/io/compress/huffman.d.ts.map +1 -0
- package/dist/types/io/compress/lz4.d.ts +45 -0
- package/dist/types/io/compress/lz4.d.ts.map +1 -0
- package/dist/types/io/compress/lz77.d.ts +66 -0
- package/dist/types/io/compress/lz77.d.ts.map +1 -0
- package/dist/types/io/compress/lzw.d.ts +37 -0
- package/dist/types/io/compress/lzw.d.ts.map +1 -0
- package/dist/types/io/compress/zip.d.ts +112 -0
- package/dist/types/io/compress/zip.d.ts.map +1 -0
- package/dist/types/io/compress/zlib.d.ts +97 -0
- package/dist/types/io/compress/zlib.d.ts.map +1 -0
- package/dist/types/io/i18n/i18n.d.ts +64 -0
- package/dist/types/io/i18n/i18n.d.ts.map +1 -0
- package/dist/types/io/math/fixed-point.d.ts +30 -0
- package/dist/types/io/math/fixed-point.d.ts.map +1 -0
- package/dist/types/io/math/geom.d.ts +125 -0
- package/dist/types/io/math/geom.d.ts.map +1 -0
- package/dist/types/io/math/interp.d.ts +48 -0
- package/dist/types/io/math/interp.d.ts.map +1 -0
- package/dist/types/io/math/linalg.d.ts +117 -0
- package/dist/types/io/math/linalg.d.ts.map +1 -0
- package/dist/types/io/math/stats.d.ts +45 -0
- package/dist/types/io/math/stats.d.ts.map +1 -0
- package/dist/types/io/structures/btree.d.ts +84 -0
- package/dist/types/io/structures/btree.d.ts.map +1 -0
- package/dist/types/io/structures/heap.d.ts +75 -0
- package/dist/types/io/structures/heap.d.ts.map +1 -0
- package/dist/types/io/structures/lruCache.d.ts +88 -0
- package/dist/types/io/structures/lruCache.d.ts.map +1 -0
- package/dist/types/io/structures/ringBuffer.d.ts +82 -0
- package/dist/types/io/structures/ringBuffer.d.ts.map +1 -0
- package/dist/types/io/structures/tree-walker.d.ts +95 -0
- package/dist/types/io/structures/tree-walker.d.ts.map +1 -0
- package/dist/types/io/structures/trie.d.ts +71 -0
- package/dist/types/io/structures/trie.d.ts.map +1 -0
- package/dist/types/io/sync/abort.d.ts +59 -0
- package/dist/types/io/sync/abort.d.ts.map +1 -0
- package/dist/types/io/sync/atomics.d.ts +107 -0
- package/dist/types/io/sync/atomics.d.ts.map +1 -0
- package/dist/types/io/sync/cancellable.d.ts +69 -0
- package/dist/types/io/sync/cancellable.d.ts.map +1 -0
- package/dist/types/io/sync/channel.d.ts +70 -0
- package/dist/types/io/sync/channel.d.ts.map +1 -0
- package/dist/types/io/sync/mutex.d.ts +39 -0
- package/dist/types/io/sync/mutex.d.ts.map +1 -0
- package/dist/types/io/sync/semaphore.d.ts +40 -0
- package/dist/types/io/sync/semaphore.d.ts.map +1 -0
- package/dist/types/io/sync/tokenBucket.d.ts +53 -0
- package/dist/types/io/sync/tokenBucket.d.ts.map +1 -0
- package/dist/types/io/text/ansi.d.ts +125 -0
- package/dist/types/io/text/ansi.d.ts.map +1 -0
- package/dist/types/io/text/html-entities.d.ts +35 -0
- package/dist/types/io/text/html-entities.d.ts.map +1 -0
- package/dist/types/io/text/semver.d.ts +75 -0
- package/dist/types/io/text/semver.d.ts.map +1 -0
- package/dist/types/io/text/str.d.ts +88 -0
- package/dist/types/io/text/str.d.ts.map +1 -0
- package/dist/types/io/text/unicode.d.ts +70 -0
- package/dist/types/io/text/unicode.d.ts.map +1 -0
- package/dist/types/io/time/date.d.ts +73 -0
- package/dist/types/io/time/date.d.ts.map +1 -0
- package/dist/types/io/timing/clock.d.ts +39 -0
- package/dist/types/io/timing/clock.d.ts.map +1 -0
- package/dist/types/io/timing/rateLimit.d.ts +40 -0
- package/dist/types/io/timing/rateLimit.d.ts.map +1 -0
- package/dist/types/io/timing/scheduler.d.ts +122 -0
- package/dist/types/io/timing/scheduler.d.ts.map +1 -0
- package/dist/types/io/utils/bitmap.d.ts +34 -0
- package/dist/types/io/utils/bitmap.d.ts.map +1 -0
- package/dist/types/io/utils/errors.d.ts +94 -0
- package/dist/types/io/utils/errors.d.ts.map +1 -0
- package/dist/types/io/utils/eventBus.d.ts +68 -0
- package/dist/types/io/utils/eventBus.d.ts.map +1 -0
- package/dist/types/io/utils/queue.d.ts +69 -0
- package/dist/types/io/utils/queue.d.ts.map +1 -0
- package/dist/types/io/utils/signal.d.ts +362 -0
- package/dist/types/io/utils/signal.d.ts.map +1 -0
- package/dist/types/io/utils/ui8.d.ts +34 -0
- package/dist/types/io/utils/ui8.d.ts.map +1 -0
- package/dist/types/io/utils/valid.d.ts +130 -0
- package/dist/types/io/utils/valid.d.ts.map +1 -0
- package/dist/types/main.d.ts +25 -0
- package/dist/types/main.d.ts.map +1 -0
- package/dist/types/process/message.d.ts +64 -0
- package/dist/types/process/message.d.ts.map +1 -0
- package/dist/types/process/rpc.d.ts +35 -0
- package/dist/types/process/rpc.d.ts.map +1 -0
- package/dist/types/process/workerPool.d.ts +62 -0
- package/dist/types/process/workerPool.d.ts.map +1 -0
- package/dist/types/sanity/base.d.ts +28 -0
- package/dist/types/sanity/base.d.ts.map +1 -0
- package/dist/types/sanity/community.d.ts +20 -0
- package/dist/types/sanity/community.d.ts.map +1 -0
- package/dist/types/sanity/lockdown-apply.d.ts +7 -0
- package/dist/types/sanity/lockdown-apply.d.ts.map +1 -0
- package/dist/types/sanity/lockdown.d.ts +43 -0
- package/dist/types/sanity/lockdown.d.ts.map +1 -0
- package/dist/types/sanity/wasm-gate.d.ts +128 -0
- package/dist/types/sanity/wasm-gate.d.ts.map +1 -0
- package/docs/README.md +301 -0
- package/docs/api/README.md +33 -0
- package/docs/api/core/README.md +14 -0
- package/docs/api/core/logger.md +151 -0
- package/docs/api/core/main.md +105 -0
- package/docs/api/core/modules.md +123 -0
- package/docs/api/core/readyState.md +94 -0
- package/docs/api/core/runtime.md +499 -0
- package/docs/api/core/worker-helper.md +180 -0
- package/docs/api/crypto/README.md +39 -0
- package/docs/api/crypto/cipher/README.md +24 -0
- package/docs/api/crypto/cipher/aes.md +101 -0
- package/docs/api/crypto/cipher/chacha20.md +85 -0
- package/docs/api/crypto/hash/README.md +49 -0
- package/docs/api/crypto/hash/adf.md +61 -0
- package/docs/api/crypto/hash/argon2.md +92 -0
- package/docs/api/crypto/hash/blake2b.md +88 -0
- package/docs/api/crypto/hash/hkdf.md +82 -0
- package/docs/api/crypto/hash/hmac.md +90 -0
- package/docs/api/crypto/hash/pbkdf2.md +93 -0
- package/docs/api/crypto/hash/poly1305.md +71 -0
- package/docs/api/crypto/hash/sha224.md +61 -0
- package/docs/api/crypto/hash/sha256.md +84 -0
- package/docs/api/crypto/hash/sha3.md +89 -0
- package/docs/api/crypto/hash/sha384.md +58 -0
- package/docs/api/crypto/hash/sha512.md +73 -0
- package/docs/api/crypto/hash/sha512_224.md +59 -0
- package/docs/api/crypto/hash/sha512_256.md +58 -0
- package/docs/api/crypto/mode/README.md +33 -0
- package/docs/api/crypto/mode/cbc.md +69 -0
- package/docs/api/crypto/mode/chacha20poly1305.md +77 -0
- package/docs/api/crypto/mode/cmac.md +79 -0
- package/docs/api/crypto/mode/ctr.md +66 -0
- package/docs/api/crypto/mode/gcm.md +93 -0
- package/docs/api/crypto/mode/kw.md +84 -0
- package/docs/api/crypto/pkc/README.md +48 -0
- package/docs/api/crypto/pkc/ecc.md +91 -0
- package/docs/api/crypto/pkc/ed25519.md +99 -0
- package/docs/api/crypto/pkc/hybridKem.md +178 -0
- package/docs/api/crypto/pkc/hybridSign.md +192 -0
- package/docs/api/crypto/pkc/ml_dsa.md +99 -0
- package/docs/api/crypto/pkc/ml_kem.md +90 -0
- package/docs/api/crypto/pkc/rsa.md +87 -0
- package/docs/api/crypto/pkc/slh_dsa.md +86 -0
- package/docs/api/crypto/pkc/x25519.md +84 -0
- package/docs/api/crypto/utils/README.md +39 -0
- package/docs/api/crypto/utils/aes_ctr.md +71 -0
- package/docs/api/crypto/utils/aes_modes.md +81 -0
- package/docs/api/crypto/utils/asn1-oid.md +130 -0
- package/docs/api/crypto/utils/asn1.md +69 -0
- package/docs/api/crypto/utils/bitArray.md +77 -0
- package/docs/api/crypto/utils/bn.md +67 -0
- package/docs/api/crypto/utils/jws.md +94 -0
- package/docs/api/crypto/utils/keyformat.md +78 -0
- package/docs/api/crypto/utils/pad.md +66 -0
- package/docs/api/crypto/utils/pem.md +63 -0
- package/docs/api/crypto/utils/random.md +103 -0
- package/docs/api/crypto/utils/rsaKeygen.md +118 -0
- package/docs/api/crypto/utils/totp.md +159 -0
- package/docs/api/crypto/utils/uuid.md +98 -0
- package/docs/api/crypto/wasm/README.md +76 -0
- package/docs/api/crypto/wasm/aes.md +128 -0
- package/docs/api/crypto/wasm/argon2.md +110 -0
- package/docs/api/crypto/wasm/blake2b.md +103 -0
- package/docs/api/crypto/wasm/chacha20poly1305.md +120 -0
- package/docs/api/crypto/wasm/cmac.md +119 -0
- package/docs/api/crypto/wasm/ecc.md +114 -0
- package/docs/api/crypto/wasm/ed25519.md +117 -0
- package/docs/api/crypto/wasm/hkdf.md +163 -0
- package/docs/api/crypto/wasm/hmac.md +129 -0
- package/docs/api/crypto/wasm/ml_dsa.md +99 -0
- package/docs/api/crypto/wasm/ml_kem.md +91 -0
- package/docs/api/crypto/wasm/pbkdf2.md +111 -0
- package/docs/api/crypto/wasm/rsa.md +113 -0
- package/docs/api/crypto/wasm/runtime.md +172 -0
- package/docs/api/crypto/wasm/sha2.md +95 -0
- package/docs/api/crypto/wasm/sha3.md +127 -0
- package/docs/api/crypto/wasm/slh_dsa.md +89 -0
- package/docs/api/crypto/wasm/x25519.md +116 -0
- package/docs/api/crypto/webcrypto/README.md +56 -0
- package/docs/api/crypto/webcrypto/aes.md +140 -0
- package/docs/api/crypto/webcrypto/aeskw.md +120 -0
- package/docs/api/crypto/webcrypto/digest.md +103 -0
- package/docs/api/crypto/webcrypto/ecc.md +122 -0
- package/docs/api/crypto/webcrypto/ed25519.md +121 -0
- package/docs/api/crypto/webcrypto/hkdf.md +141 -0
- package/docs/api/crypto/webcrypto/hmac.md +112 -0
- package/docs/api/crypto/webcrypto/pbkdf2.md +140 -0
- package/docs/api/crypto/webcrypto/rsa.md +149 -0
- package/docs/api/crypto/webcrypto/x25519.md +96 -0
- package/docs/api/dom/README.md +117 -0
- package/docs/api/dom/display/README.md +27 -0
- package/docs/api/dom/display/animate.md +113 -0
- package/docs/api/dom/display/fullscreen.md +121 -0
- package/docs/api/dom/fs/README.md +36 -0
- package/docs/api/dom/fs/download.md +108 -0
- package/docs/api/dom/fs/fsAccess.md +200 -0
- package/docs/api/dom/fs/indexedDB.md +219 -0
- package/docs/api/dom/fs/remoteStore.md +158 -0
- package/docs/api/dom/fs/storage.md +197 -0
- package/docs/api/dom/lifecycle/README.md +11 -0
- package/docs/api/dom/lifecycle/idle.md +89 -0
- package/docs/api/dom/lifecycle/visibility.md +73 -0
- package/docs/api/dom/lifecycle/wakeLock.md +94 -0
- package/docs/api/dom/net/README.md +31 -0
- package/docs/api/dom/net/ajax.md +176 -0
- package/docs/api/dom/net/broadcastChannel.md +110 -0
- package/docs/api/dom/net/network.md +137 -0
- package/docs/api/dom/net/sse.md +141 -0
- package/docs/api/dom/net/webrtc.md +158 -0
- package/docs/api/dom/net/ws.md +168 -0
- package/docs/api/dom/query/README.md +30 -0
- package/docs/api/dom/query/dnd.md +137 -0
- package/docs/api/dom/query/dom.md +275 -0
- package/docs/api/dom/query/events.md +211 -0
- package/docs/api/dom/query/gesture.md +137 -0
- package/docs/api/dom/query/media.md +188 -0
- package/docs/api/dom/rendering/README.md +41 -0
- package/docs/api/dom/rendering/chart.md +149 -0
- package/docs/api/dom/rendering/component.md +287 -0
- package/docs/api/dom/rendering/devtools-ui.md +129 -0
- package/docs/api/dom/rendering/devtools.md +157 -0
- package/docs/api/dom/rendering/parser.md +200 -0
- package/docs/api/dom/rendering/reactiveBind.md +234 -0
- package/docs/api/dom/rendering/render.md +219 -0
- package/docs/api/dom/rendering/sanitize.md +97 -0
- package/docs/api/dom/rendering/secPolicy.md +155 -0
- package/docs/api/dom/rendering/template.md +301 -0
- package/docs/api/dom/rendering/themeTokens.md +175 -0
- package/docs/api/dom/rendering/uiSession.md +546 -0
- package/docs/api/dom/rendering/virtualScroll.md +126 -0
- package/docs/api/dom/sensors/README.md +12 -0
- package/docs/api/dom/sensors/battery.md +70 -0
- package/docs/api/dom/sensors/geolocation.md +115 -0
- package/docs/api/dom/sensors/networkInfo.md +73 -0
- package/docs/api/dom/sensors/sensors.md +123 -0
- package/docs/api/dom/sw/README.md +31 -0
- package/docs/api/dom/sw/backgroundSync.md +145 -0
- package/docs/api/dom/sw/cache.md +116 -0
- package/docs/api/dom/sw/push.md +114 -0
- package/docs/api/dom/sw/serviceWorker.md +90 -0
- package/docs/api/dom/sw/sharedWorker.md +131 -0
- package/docs/api/dom/utils/README.md +25 -0
- package/docs/api/dom/utils/a11y.md +143 -0
- package/docs/api/dom/utils/clipboard.md +146 -0
- package/docs/api/dom/utils/entropyCollector.md +175 -0
- package/docs/api/dom/utils/focus.md +140 -0
- package/docs/api/dom/utils/form.md +196 -0
- package/docs/api/dom/utils/formKit.md +181 -0
- package/docs/api/dom/utils/keybindings.md +138 -0
- package/docs/api/dom/utils/leaderElection.md +130 -0
- package/docs/api/dom/utils/notifications.md +106 -0
- package/docs/api/dom/utils/permissions.md +82 -0
- package/docs/api/dom/utils/route.md +112 -0
- package/docs/api/dom/utils/ua.md +119 -0
- package/docs/api/dom/utils/webauthn.md +190 -0
- package/docs/api/io/README.md +20 -0
- package/docs/api/io/binary/README.md +29 -0
- package/docs/api/io/binary/reader.md +126 -0
- package/docs/api/io/binary/writer.md +127 -0
- package/docs/api/io/calc/README.md +22 -0
- package/docs/api/io/calc/adler32.md +75 -0
- package/docs/api/io/calc/bigint.md +105 -0
- package/docs/api/io/calc/crc32.md +74 -0
- package/docs/api/io/calc/easing.md +118 -0
- package/docs/api/io/codec/README.md +35 -0
- package/docs/api/io/codec/b64.md +92 -0
- package/docs/api/io/codec/base32.md +98 -0
- package/docs/api/io/codec/base58.md +104 -0
- package/docs/api/io/codec/buffer.md +144 -0
- package/docs/api/io/codec/cbor.md +179 -0
- package/docs/api/io/codec/csv.md +178 -0
- package/docs/api/io/codec/hex.md +75 -0
- package/docs/api/io/codec/mime.md +156 -0
- package/docs/api/io/codec/msgpack.md +142 -0
- package/docs/api/io/codec/url.md +265 -0
- package/docs/api/io/codec/utf8.md +84 -0
- package/docs/api/io/codec/xml.md +87 -0
- package/docs/api/io/compress/README.md +62 -0
- package/docs/api/io/compress/bitstream.md +131 -0
- package/docs/api/io/compress/brotli.md +232 -0
- package/docs/api/io/compress/brotli_dict.md +119 -0
- package/docs/api/io/compress/brotli_dict_words.md +142 -0
- package/docs/api/io/compress/brotli_frame.md +214 -0
- package/docs/api/io/compress/brotli_shared.md +144 -0
- package/docs/api/io/compress/deflate.md +474 -0
- package/docs/api/io/compress/gzip.md +130 -0
- package/docs/api/io/compress/huffman.md +210 -0
- package/docs/api/io/compress/lz4.md +278 -0
- package/docs/api/io/compress/lz77.md +180 -0
- package/docs/api/io/compress/lzw.md +121 -0
- package/docs/api/io/compress/zip.md +209 -0
- package/docs/api/io/compress/zlib.md +125 -0
- package/docs/api/io/i18n/README.md +23 -0
- package/docs/api/io/i18n/i18n.md +128 -0
- package/docs/api/io/math/README.md +24 -0
- package/docs/api/io/math/fixed-point.md +115 -0
- package/docs/api/io/math/geom.md +144 -0
- package/docs/api/io/math/interp.md +115 -0
- package/docs/api/io/math/linalg.md +138 -0
- package/docs/api/io/math/stats.md +109 -0
- package/docs/api/io/structures/README.md +31 -0
- package/docs/api/io/structures/btree.md +155 -0
- package/docs/api/io/structures/heap.md +166 -0
- package/docs/api/io/structures/lruCache.md +156 -0
- package/docs/api/io/structures/ringBuffer.md +188 -0
- package/docs/api/io/structures/tree-walker.md +132 -0
- package/docs/api/io/structures/trie.md +138 -0
- package/docs/api/io/sync/README.md +29 -0
- package/docs/api/io/sync/abort.md +129 -0
- package/docs/api/io/sync/atomics.md +159 -0
- package/docs/api/io/sync/cancellable.md +176 -0
- package/docs/api/io/sync/channel.md +125 -0
- package/docs/api/io/sync/mutex.md +93 -0
- package/docs/api/io/sync/semaphore.md +106 -0
- package/docs/api/io/sync/tokenBucket.md +139 -0
- package/docs/api/io/text/README.md +23 -0
- package/docs/api/io/text/ansi.md +182 -0
- package/docs/api/io/text/html-entities.md +79 -0
- package/docs/api/io/text/semver.md +158 -0
- package/docs/api/io/text/str.md +129 -0
- package/docs/api/io/text/unicode.md +89 -0
- package/docs/api/io/time/README.md +22 -0
- package/docs/api/io/time/date.md +128 -0
- package/docs/api/io/timing/README.md +32 -0
- package/docs/api/io/timing/clock.md +102 -0
- package/docs/api/io/timing/rateLimit.md +137 -0
- package/docs/api/io/timing/scheduler.md +163 -0
- package/docs/api/io/utils/README.md +30 -0
- package/docs/api/io/utils/bitmap.md +96 -0
- package/docs/api/io/utils/errors.md +165 -0
- package/docs/api/io/utils/eventBus.md +162 -0
- package/docs/api/io/utils/queue.md +141 -0
- package/docs/api/io/utils/signal.md +388 -0
- package/docs/api/io/utils/ui8.md +111 -0
- package/docs/api/io/utils/valid.md +272 -0
- package/docs/api/process/README.md +18 -0
- package/docs/api/process/message.md +166 -0
- package/docs/api/process/rpc.md +161 -0
- package/docs/api/process/workerPool.md +130 -0
- package/docs/api/sanity/base.md +132 -0
- package/docs/api/sanity/community.md +96 -0
- package/docs/api/sanity/lockdown.md +128 -0
- package/docs/api/typed.md +85 -0
- package/docs/dev/README.md +25 -0
- package/docs/dev/provenance.md +80 -0
- package/docs/dev/publishing.md +31 -0
- package/docs/dev/runtime.md +64 -0
- package/docs/dev/testing.md +61 -0
- package/docs/dev/types.md +35 -0
- package/docs/evidence/pqc-hybrid-evidence.md +438 -0
- package/docs/guide/README.md +38 -0
- package/docs/guide/_QUICK_REF.md +341 -0
- package/docs/guide/by-use-case.md +160 -0
- package/docs/guide/doc-format.md +306 -0
- package/docs/guide/gesture-dnd-side-channel.md +119 -0
- package/docs/guide/getting-started.md +134 -0
- package/docs/guide/hmr.md +187 -0
- package/docs/guide/integration-bundlers.md +193 -0
- package/docs/guide/integrations-hmr.md +103 -0
- package/docs/guide/module-creation-workflow.md +342 -0
- package/docs/guide/module-pattern.md +244 -0
- package/docs/guide/rendering-pipeline.md +422 -0
- package/docs/guide/security.md +346 -0
- package/docs/guide/test-format.md +190 -0
- package/docs/guide/tutorial-todo.md +298 -0
- package/docs/guide/typescript.md +215 -0
- package/docs/guide/worker-confinement.md +301 -0
- package/docs/guide/workers.md +168 -0
- package/docs/notes/lz77-deflate-factorization.md +96 -0
- package/docs/notes/worker-confinement-spike.md +302 -0
- package/docs/tools/README.md +56 -0
- package/docs/tools/aot.md +108 -0
- package/docs/tools/audit.md +61 -0
- package/docs/tools/bundler.md +215 -0
- package/docs/tools/codegen.md +64 -0
- package/docs/tools/jsx.md +236 -0
- package/docs/tools/precompilation.md +88 -0
- package/docs/tools/standalone.md +107 -0
- package/fw.config.json +129 -0
- package/integrations/README.md +52 -0
- package/integrations/_shared/catalog.generated.json +207 -0
- package/integrations/_shared/config-resolve.js +201 -0
- package/integrations/_shared/core.js +362 -0
- package/integrations/astro/README.md +96 -0
- package/integrations/astro/index.d.ts +42 -0
- package/integrations/astro/index.js +94 -0
- package/integrations/bun/README.md +62 -0
- package/integrations/bun/index.d.ts +30 -0
- package/integrations/bun/index.js +134 -0
- package/integrations/deno/README.md +55 -0
- package/integrations/deno/deno.json +10 -0
- package/integrations/esbuild/README.md +75 -0
- package/integrations/esbuild/backend.js +147 -0
- package/integrations/esbuild/index.d.ts +32 -0
- package/integrations/esbuild/index.js +147 -0
- package/integrations/eslint/README.md +27 -0
- package/integrations/eslint/no-factory-capture.js +99 -0
- package/integrations/jest/README.md +45 -0
- package/integrations/jest/bun-test-shim.js +43 -0
- package/integrations/nestjs/README.md +68 -0
- package/integrations/nestjs/index.d.ts +38 -0
- package/integrations/nestjs/index.js +99 -0
- package/integrations/nextjs/README.md +149 -0
- package/integrations/nextjs/index.d.ts +30 -0
- package/integrations/nextjs/index.js +98 -0
- package/integrations/nodejs/README.md +46 -0
- package/integrations/nodejs/package.node.example.json +31 -0
- package/integrations/rollup/README.md +65 -0
- package/integrations/rollup/backend.js +132 -0
- package/integrations/rollup/index.d.ts +32 -0
- package/integrations/rollup/index.js +84 -0
- package/integrations/turbopack/README.md +56 -0
- package/integrations/turbopack/index.d.ts +47 -0
- package/integrations/turbopack/index.js +164 -0
- package/integrations/typedoc/README.md +57 -0
- package/integrations/typedoc/categorize.js +121 -0
- package/integrations/typedoc/tsconfig.typedoc.json +14 -0
- package/integrations/typedoc/typedoc.json +19 -0
- package/integrations/vite/README.md +115 -0
- package/integrations/vite/index.d.ts +29 -0
- package/integrations/vite/index.js +182 -0
- package/integrations/vite/package.json +8 -0
- package/integrations/vite/vite-env.d.ts +36 -0
- package/integrations/vitest/README.md +77 -0
- package/integrations/vitest/bun-test-shim.js +92 -0
- package/integrations/vitest/vitest.config.js +41 -0
- package/integrations/webpack/README.md +53 -0
- package/integrations/webpack/index.d.ts +29 -0
- package/integrations/webpack/index.js +182 -0
- package/package.json +303 -0
- package/src/core/logger.js +373 -0
- package/src/core/modules.js +289 -0
- package/src/core/readyState.js +119 -0
- package/src/core/runtime.js +929 -0
- package/src/core/worker-helper.js +261 -0
- package/src/crypto/NIST_CONFORMANCE.md +249 -0
- package/src/crypto/cipher/aes.acvp.md +74 -0
- package/src/crypto/cipher/aes.js +512 -0
- package/src/crypto/cipher/chacha20.acvp.md +117 -0
- package/src/crypto/cipher/chacha20.js +147 -0
- package/src/crypto/hash/adf.acvp.md +144 -0
- package/src/crypto/hash/adf.js +127 -0
- package/src/crypto/hash/argon2.acvp.md +144 -0
- package/src/crypto/hash/argon2.js +517 -0
- package/src/crypto/hash/blake2b.acvp.md +122 -0
- package/src/crypto/hash/blake2b.js +367 -0
- package/src/crypto/hash/hkdf.acvp.md +128 -0
- package/src/crypto/hash/hkdf.js +145 -0
- package/src/crypto/hash/hmac.acvp.md +110 -0
- package/src/crypto/hash/hmac.js +177 -0
- package/src/crypto/hash/pbkdf2.acvp.md +122 -0
- package/src/crypto/hash/pbkdf2.js +120 -0
- package/src/crypto/hash/poly1305.acvp.md +111 -0
- package/src/crypto/hash/poly1305.js +126 -0
- package/src/crypto/hash/sha224.acvp.md +81 -0
- package/src/crypto/hash/sha224.js +60 -0
- package/src/crypto/hash/sha256.acvp.md +75 -0
- package/src/crypto/hash/sha256.js +217 -0
- package/src/crypto/hash/sha3.acvp.md +133 -0
- package/src/crypto/hash/sha3.js +391 -0
- package/src/crypto/hash/sha384.acvp.md +82 -0
- package/src/crypto/hash/sha384.js +61 -0
- package/src/crypto/hash/sha512.acvp.md +84 -0
- package/src/crypto/hash/sha512.js +314 -0
- package/src/crypto/hash/sha512_224.acvp.md +90 -0
- package/src/crypto/hash/sha512_224.js +66 -0
- package/src/crypto/hash/sha512_256.acvp.md +96 -0
- package/src/crypto/hash/sha512_256.js +75 -0
- package/src/crypto/mode/cbc.acvp.md +105 -0
- package/src/crypto/mode/cbc.js +136 -0
- package/src/crypto/mode/chacha20poly1305.acvp.md +116 -0
- package/src/crypto/mode/chacha20poly1305.js +190 -0
- package/src/crypto/mode/cmac.acvp.md +106 -0
- package/src/crypto/mode/cmac.js +172 -0
- package/src/crypto/mode/ctr.acvp.md +110 -0
- package/src/crypto/mode/ctr.js +174 -0
- package/src/crypto/mode/gcm.acvp.md +129 -0
- package/src/crypto/mode/gcm.js +333 -0
- package/src/crypto/mode/kw.acvp.md +145 -0
- package/src/crypto/mode/kw.js +323 -0
- package/src/crypto/pkc/ecc.acvp.md +181 -0
- package/src/crypto/pkc/ecc.js +941 -0
- package/src/crypto/pkc/ed25519.acvp.md +172 -0
- package/src/crypto/pkc/ed25519.js +582 -0
- package/src/crypto/pkc/hybrid-kat.provenance.md +89 -0
- package/src/crypto/pkc/hybridKem.js +255 -0
- package/src/crypto/pkc/hybridSign.js +437 -0
- package/src/crypto/pkc/ml_dsa.acvp.md +146 -0
- package/src/crypto/pkc/ml_dsa.js +984 -0
- package/src/crypto/pkc/ml_kem.acvp.md +117 -0
- package/src/crypto/pkc/ml_kem.js +596 -0
- package/src/crypto/pkc/rsa.acvp.md +187 -0
- package/src/crypto/pkc/rsa.js +470 -0
- package/src/crypto/pkc/slh_dsa.acvp.md +155 -0
- package/src/crypto/pkc/slh_dsa.js +820 -0
- package/src/crypto/pkc/x25519.acvp.md +113 -0
- package/src/crypto/pkc/x25519.js +290 -0
- package/src/crypto/utils/aes_ctr.acvp.md +67 -0
- package/src/crypto/utils/aes_ctr.js +134 -0
- package/src/crypto/utils/aes_modes.acvp.md +66 -0
- package/src/crypto/utils/aes_modes.js +241 -0
- package/src/crypto/utils/asn1-oid.js +369 -0
- package/src/crypto/utils/asn1.js +343 -0
- package/src/crypto/utils/bitArray.js +312 -0
- package/src/crypto/utils/bn.js +825 -0
- package/src/crypto/utils/jws.js +222 -0
- package/src/crypto/utils/keyformat.js +303 -0
- package/src/crypto/utils/pad.js +198 -0
- package/src/crypto/utils/pem.js +90 -0
- package/src/crypto/utils/random.acvp.md +167 -0
- package/src/crypto/utils/random.js +846 -0
- package/src/crypto/utils/rsaKeygen.acvp.md +158 -0
- package/src/crypto/utils/rsaKeygen.js +448 -0
- package/src/crypto/utils/totp.js +409 -0
- package/src/crypto/utils/uuid.acvp.md +137 -0
- package/src/crypto/utils/uuid.js +176 -0
- package/src/crypto/wasm/aes.js +494 -0
- package/src/crypto/wasm/argon2.js +236 -0
- package/src/crypto/wasm/blake2b.js +213 -0
- package/src/crypto/wasm/chacha20poly1305.js +238 -0
- package/src/crypto/wasm/cmac.js +207 -0
- package/src/crypto/wasm/ecc.js +437 -0
- package/src/crypto/wasm/ed25519.js +307 -0
- package/src/crypto/wasm/hkdf.js +183 -0
- package/src/crypto/wasm/hmac.js +215 -0
- package/src/crypto/wasm/ml_dsa.js +375 -0
- package/src/crypto/wasm/ml_kem.js +313 -0
- package/src/crypto/wasm/pbkdf2.js +205 -0
- package/src/crypto/wasm/rsa.js +674 -0
- package/src/crypto/wasm/runtime.js +400 -0
- package/src/crypto/wasm/sha2.js +183 -0
- package/src/crypto/wasm/sha3.js +221 -0
- package/src/crypto/wasm/slh_dsa.js +397 -0
- package/src/crypto/wasm/x25519.js +241 -0
- package/src/crypto/webcrypto/aes.js +370 -0
- package/src/crypto/webcrypto/aeskw.js +185 -0
- package/src/crypto/webcrypto/digest.js +136 -0
- package/src/crypto/webcrypto/ecc.js +371 -0
- package/src/crypto/webcrypto/ed25519.js +248 -0
- package/src/crypto/webcrypto/hkdf.js +132 -0
- package/src/crypto/webcrypto/hmac.js +213 -0
- package/src/crypto/webcrypto/pbkdf2.js +146 -0
- package/src/crypto/webcrypto/rsa.js +415 -0
- package/src/crypto/webcrypto/x25519.js +250 -0
- package/src/dom/display/animate.js +154 -0
- package/src/dom/display/fullscreen.js +305 -0
- package/src/dom/fs/download.js +118 -0
- package/src/dom/fs/fsAccess.js +307 -0
- package/src/dom/fs/indexedDB.js +465 -0
- package/src/dom/fs/remoteStore.js +484 -0
- package/src/dom/fs/storage.js +440 -0
- package/src/dom/lifecycle/idle.js +133 -0
- package/src/dom/lifecycle/visibility.js +140 -0
- package/src/dom/lifecycle/wakeLock.js +187 -0
- package/src/dom/net/ajax.js +303 -0
- package/src/dom/net/broadcastChannel.js +89 -0
- package/src/dom/net/network.js +260 -0
- package/src/dom/net/sse.js +295 -0
- package/src/dom/net/webrtc.js +381 -0
- package/src/dom/net/ws.js +290 -0
- package/src/dom/query/dnd.js +409 -0
- package/src/dom/query/dom.js +831 -0
- package/src/dom/query/events.js +425 -0
- package/src/dom/query/gesture.js +396 -0
- package/src/dom/query/media.js +616 -0
- package/src/dom/rendering/chart.js +663 -0
- package/src/dom/rendering/component.js +469 -0
- package/src/dom/rendering/devtools-ui.js +399 -0
- package/src/dom/rendering/devtools.js +352 -0
- package/src/dom/rendering/parser.js +1055 -0
- package/src/dom/rendering/reactiveBind.js +341 -0
- package/src/dom/rendering/render.js +601 -0
- package/src/dom/rendering/sanitize.js +364 -0
- package/src/dom/rendering/secPolicy.js +281 -0
- package/src/dom/rendering/template.js +1031 -0
- package/src/dom/rendering/themeTokens.js +522 -0
- package/src/dom/rendering/uiSession-core.js +597 -0
- package/src/dom/rendering/uiSession-direct.js +251 -0
- package/src/dom/rendering/uiSession-list.js +751 -0
- package/src/dom/rendering/uiSession.js +145 -0
- package/src/dom/rendering/virtualScroll.js +341 -0
- package/src/dom/sensors/battery.js +153 -0
- package/src/dom/sensors/geolocation.js +156 -0
- package/src/dom/sensors/networkInfo.js +136 -0
- package/src/dom/sensors/sensors.js +340 -0
- package/src/dom/sw/backgroundSync.js +113 -0
- package/src/dom/sw/cache.js +139 -0
- package/src/dom/sw/push.js +181 -0
- package/src/dom/sw/serviceWorker.js +193 -0
- package/src/dom/sw/sharedWorker.js +192 -0
- package/src/dom/utils/a11y.js +244 -0
- package/src/dom/utils/clipboard.js +113 -0
- package/src/dom/utils/entropyCollector.js +344 -0
- package/src/dom/utils/focus.js +421 -0
- package/src/dom/utils/form.js +535 -0
- package/src/dom/utils/formKit.js +427 -0
- package/src/dom/utils/keybindings.js +574 -0
- package/src/dom/utils/leaderElection.js +280 -0
- package/src/dom/utils/notifications.js +218 -0
- package/src/dom/utils/permissions.js +107 -0
- package/src/dom/utils/route.js +482 -0
- package/src/dom/utils/ua.js +109 -0
- package/src/dom/utils/webauthn.js +369 -0
- package/src/external/README.md +15 -0
- package/src/io/binary/reader.js +374 -0
- package/src/io/binary/writer.js +351 -0
- package/src/io/calc/adler32.js +94 -0
- package/src/io/calc/bigint.js +276 -0
- package/src/io/calc/crc32.js +111 -0
- package/src/io/calc/easing.js +514 -0
- package/src/io/codec/b64.js +235 -0
- package/src/io/codec/base32.js +147 -0
- package/src/io/codec/base58.js +167 -0
- package/src/io/codec/buffer.js +630 -0
- package/src/io/codec/cbor.js +550 -0
- package/src/io/codec/csv.js +299 -0
- package/src/io/codec/hex.js +129 -0
- package/src/io/codec/mime.js +398 -0
- package/src/io/codec/msgpack.js +491 -0
- package/src/io/codec/url.js +530 -0
- package/src/io/codec/utf8.js +181 -0
- package/src/io/codec/xml.js +428 -0
- package/src/io/compress/bitstream.js +199 -0
- package/src/io/compress/brotli.js +3073 -0
- package/src/io/compress/brotli_dict.bin +432 -0
- package/src/io/compress/brotli_dict.js +356 -0
- package/src/io/compress/brotli_dict_words.js +157 -0
- package/src/io/compress/brotli_frame.js +420 -0
- package/src/io/compress/brotli_shared.js +715 -0
- package/src/io/compress/deflate.js +1432 -0
- package/src/io/compress/gzip.js +406 -0
- package/src/io/compress/huffman.js +322 -0
- package/src/io/compress/lz4.js +451 -0
- package/src/io/compress/lz77.js +408 -0
- package/src/io/compress/lzw.js +332 -0
- package/src/io/compress/zip.js +815 -0
- package/src/io/compress/zlib.js +340 -0
- package/src/io/i18n/i18n.js +236 -0
- package/src/io/math/fixed-point.js +269 -0
- package/src/io/math/geom.js +350 -0
- package/src/io/math/interp.js +263 -0
- package/src/io/math/linalg.js +472 -0
- package/src/io/math/stats.js +339 -0
- package/src/io/structures/btree.js +357 -0
- package/src/io/structures/heap.js +249 -0
- package/src/io/structures/lruCache.js +219 -0
- package/src/io/structures/ringBuffer.js +208 -0
- package/src/io/structures/tree-walker.js +413 -0
- package/src/io/structures/trie.js +219 -0
- package/src/io/sync/abort.js +196 -0
- package/src/io/sync/atomics.js +342 -0
- package/src/io/sync/cancellable.js +279 -0
- package/src/io/sync/channel.js +301 -0
- package/src/io/sync/mutex.js +148 -0
- package/src/io/sync/semaphore.js +156 -0
- package/src/io/sync/tokenBucket.js +208 -0
- package/src/io/text/ansi.js +536 -0
- package/src/io/text/html-entities.js +143 -0
- package/src/io/text/semver.js +375 -0
- package/src/io/text/str.js +243 -0
- package/src/io/text/unicode.js +188 -0
- package/src/io/time/date.js +355 -0
- package/src/io/timing/clock.js +79 -0
- package/src/io/timing/rateLimit.js +264 -0
- package/src/io/timing/scheduler.js +351 -0
- package/src/io/utils/bitmap.js +94 -0
- package/src/io/utils/errors.js +269 -0
- package/src/io/utils/eventBus.js +315 -0
- package/src/io/utils/queue.js +223 -0
- package/src/io/utils/signal.js +858 -0
- package/src/io/utils/ui8.js +99 -0
- package/src/io/utils/valid.js +556 -0
- package/src/main.js +41 -0
- package/src/polyfill/README.md +9 -0
- package/src/process/message.js +257 -0
- package/src/process/rpc.js +286 -0
- package/src/process/workerPool.js +392 -0
- package/src/sanity/base.js +374 -0
- package/src/sanity/community.js +254 -0
- package/src/sanity/lockdown-apply.js +58 -0
- package/src/sanity/lockdown.js +408 -0
- package/src/sanity/wasm-gate.js +316 -0
- package/src/typed.js +53 -0
- package/third-party/NOTICE-penner-easing +88 -0
- package/third-party/NOTICE-sjcl +50 -0
- package/tools/_lib/cli-help.js +55 -0
- package/tools/rendering/aot/index.js +148 -0
- package/tools/rendering/aot/lib/dom-codegen.js +295 -0
- package/tools/rendering/jsx/index.js +654 -0
- package/tools/rendering/precompilation/index.js +368 -0
- package/types/registry.generated.d.ts +217 -0
- package/types/typed.d.ts +106 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Bitmap helpers module factory.
|
|
7
|
+
* Converts between Uint8Array and bit arrays (0/1).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const api = bitmap.factory();
|
|
11
|
+
* const bits = api.bytesToBits(new Uint8Array([3])); // [1,1,0,0,0,0,0,0]
|
|
12
|
+
* api.padBitsToByte(bits);
|
|
13
|
+
* const bytes = api.bitsToBytes(bits); // Uint8Array([3])
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Bitmap conversion helper surface returned by `factory()`.
|
|
18
|
+
* @typedef {object} BitmapAPI
|
|
19
|
+
* @property {(ui8a: Uint8Array, ret?: number[]) => number[]} bytesToBits - Convert a Uint8Array to an array of bits (0/1), LSB-first per byte.
|
|
20
|
+
* @property {(ba: number[], validateLength?: boolean) => Uint8Array} bitsToBytes - Convert an array of bits (0/1) to a Uint8Array, LSB-first per byte.
|
|
21
|
+
* @property {(arr: number[], fill?: number) => number[]} padBitsToByte - Pad a bit array with `fill` so its length is a multiple of 8.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export const bitmap = {
|
|
25
|
+
name: 'bitmap',
|
|
26
|
+
version: '1.0.0',
|
|
27
|
+
type: 'fw.io.utils',
|
|
28
|
+
dependencies: [],
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Create bitmap helper API.
|
|
32
|
+
* @returns {BitmapAPI}
|
|
33
|
+
*/
|
|
34
|
+
factory() {
|
|
35
|
+
|
|
36
|
+
const map = [];
|
|
37
|
+
for(let i = 0; i < 256; i++){
|
|
38
|
+
map[i] = [];
|
|
39
|
+
for(let j = 0; j < 8; j++) {
|
|
40
|
+
map[i].push((i >> j) & 0x01);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Convert a Uint8Array to an array of bits (0/1), LSB-first per byte.
|
|
46
|
+
* @param {Uint8Array} ui8a
|
|
47
|
+
* @param {number[]} [ret]
|
|
48
|
+
* @returns {number[]}
|
|
49
|
+
*/
|
|
50
|
+
const bytesToBits = function(ui8a, ret = []){
|
|
51
|
+
for(let i = 0; i < ui8a.length; i++){
|
|
52
|
+
ret.push(...map[ui8a[i]]);
|
|
53
|
+
}
|
|
54
|
+
return ret;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Convert an array of bits (0/1) to a Uint8Array, LSB-first per byte.
|
|
59
|
+
* Input length should be a multiple of 8 (use padBitsToByte).
|
|
60
|
+
* @param {number[]} ba
|
|
61
|
+
* @param {boolean} [validateLength=false] Throw if length is not a multiple of 8.
|
|
62
|
+
* @returns {Uint8Array}
|
|
63
|
+
*/
|
|
64
|
+
const bitsToBytes = function(ba, validateLength = false){
|
|
65
|
+
if (validateLength && (ba.length & 7) !== 0) {
|
|
66
|
+
throw new Error('bitsToBytes expects a bit array length that is a multiple of 8');
|
|
67
|
+
}
|
|
68
|
+
const ret = new Uint8Array(ba.length >> 3);
|
|
69
|
+
for(let i = 0; i < ba.length; i+=8){
|
|
70
|
+
ret[i >> 3] = ba[i] + (ba[i+1] << 1) + (ba[i+2] << 2) + (ba[i+3] << 3) + (ba[i+4] << 4) + (ba[i+5] << 5) + (ba[i+6] << 6) + (ba[i+7] << 7);
|
|
71
|
+
}
|
|
72
|
+
return ret;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Pad a bit array with `fill` so its length is a multiple of 8.
|
|
77
|
+
* Uses `arr.length & 7` (equivalent to `arr.length % 8` for positive ints).
|
|
78
|
+
* @param {number[]} arr
|
|
79
|
+
* @param {number} [fill=0]
|
|
80
|
+
* @returns {number[]}
|
|
81
|
+
*/
|
|
82
|
+
const padBitsToByte = function(arr, fill = 0){
|
|
83
|
+
const need = 8 - (arr.length & 7);
|
|
84
|
+
if(need < 8) {
|
|
85
|
+
for (let i = 0; i < need; i++) {
|
|
86
|
+
arr.push(fill);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return arr;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return { bytesToBits, bitsToBytes, padBitsToByte };
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview Error-handling primitives - exception boundaries for UI
|
|
7
|
+
* blocks and a structured logger.
|
|
8
|
+
*
|
|
9
|
+
* **Scope.** This module targets **fw standalone consumers**. Apps running
|
|
10
|
+
* under sde/sdc replace these with the host's richer reporting (logger →
|
|
11
|
+
* service workers + remote sink, boundaries → host error overlay). When
|
|
12
|
+
* building on fw alone, this module gives a minimal floor : structured
|
|
13
|
+
* console output and a guarded execution wrapper.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const errs = runtime.resolve('errors');
|
|
17
|
+
* const log = errs.logger({ level: 'info', prefix: 'auth' });
|
|
18
|
+
* log.info('login ok', { user: 'alice' });
|
|
19
|
+
*
|
|
20
|
+
* const guarded = errs.guard({
|
|
21
|
+
* onError: (err, ctx) => log.error('render failed', { err: err.message, ctx }),
|
|
22
|
+
* });
|
|
23
|
+
* guarded(() => render.full(items));
|
|
24
|
+
*
|
|
25
|
+
* // Block-level boundary tied to a uiSession :
|
|
26
|
+
* const boundary = errs.boundary(ui, 'panel', {
|
|
27
|
+
* fallback: 'Something went wrong - refresh',
|
|
28
|
+
* onError: (err) => log.error(err.message),
|
|
29
|
+
* });
|
|
30
|
+
* boundary(() => mountComplexThing(ui));
|
|
31
|
+
*
|
|
32
|
+
* @typedef {Object} LogRecord
|
|
33
|
+
* @property {string} level - Severity name ('debug'|'info'|'warn'|'error').
|
|
34
|
+
* @property {string} prefix - Tag prepended to the message (may be empty).
|
|
35
|
+
* @property {number} time - Milliseconds since epoch (Date.now()).
|
|
36
|
+
* @property {string} message - The log message coerced to string.
|
|
37
|
+
* @property {Object} context - Arbitrary structured payload (defaults to {}).
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Structured logger instance returned by `errors.factory().logger(...)`.
|
|
43
|
+
* @typedef {object} Logger
|
|
44
|
+
* @property {(msg: string, ctx?: object) => void} debug Emit a `debug` record.
|
|
45
|
+
* @property {(msg: string, ctx?: object) => void} info Emit an `info` record.
|
|
46
|
+
* @property {(msg: string, ctx?: object) => void} warn Emit a `warn` record.
|
|
47
|
+
* @property {(msg: string, ctx?: object) => void} error Emit an `error` record.
|
|
48
|
+
* @property {(subPrefix: string) => Logger} child Spawn a child logger that appends to the current prefix.
|
|
49
|
+
* @property {string} level Current severity threshold (readable and writable accessor).
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Public shape returned by `errors.factory()`.
|
|
54
|
+
* @typedef {object} ErrorsAPI
|
|
55
|
+
* @property {(opts?: { level?: ('debug'|'info'|'warn'|'error'|'silent'), prefix?: string, sink?: (record: LogRecord) => void }) => Logger} logger Create a structured logger.
|
|
56
|
+
* @property {(opts?: { onError?: (err: Error, ctx: any) => void, rethrow?: boolean }) => ((fn: Function, ctx?: any) => any)} guard Build a higher-order wrapper that catches sync/async errors.
|
|
57
|
+
* @property {(ui: object, blockId: string, opts?: { onError?: (err: Error) => void, render?: (err: Error, ui: object, blockId: string) => void, fallback?: string, clear?: boolean }) => ((fn: Function) => any)} boundary Construct a UI-block error boundary guard.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
export const errors = {
|
|
61
|
+
name: 'errors',
|
|
62
|
+
version: '1.0.0',
|
|
63
|
+
type: 'fw.io.utils',
|
|
64
|
+
dependencies: [],
|
|
65
|
+
|
|
66
|
+
/** @returns {ErrorsAPI} */
|
|
67
|
+
factory() {
|
|
68
|
+
|
|
69
|
+
// Severity thresholds. Declared INSIDE the factory so that
|
|
70
|
+
// `factory.toString()` shipped to a Worker still recreates the binding
|
|
71
|
+
// (strict factory pattern : no module-scope closures).
|
|
72
|
+
const LEVELS = { debug: 10, info: 20, warn: 30, error: 40, silent: 99 };
|
|
73
|
+
|
|
74
|
+
// ── Structured logger ──────────────────────────────────────────────
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Create a structured logger. Output goes to `console.<level>` by
|
|
78
|
+
* default ; a custom `sink(record)` can be plugged for testing or
|
|
79
|
+
* for redirection to a transport (only useful in fw standalone -
|
|
80
|
+
* sde/sdc will replace with their own).
|
|
81
|
+
*
|
|
82
|
+
* The returned object exposes `debug`, `info`, `warn`, `error` as
|
|
83
|
+
* methods, a `child(subPrefix)` factory, and a `level` accessor that
|
|
84
|
+
* can be both read and written at runtime to change the threshold.
|
|
85
|
+
*
|
|
86
|
+
* @param {Object} [opts]
|
|
87
|
+
* @param {'debug'|'info'|'warn'|'error'|'silent'} [opts.level='info']
|
|
88
|
+
* Initial severity threshold ; records below it are dropped.
|
|
89
|
+
* @param {string} [opts.prefix=''] - Prepended in brackets to messages.
|
|
90
|
+
* @param {(record: LogRecord) => void} [opts.sink] - Override default
|
|
91
|
+
* console output. Receives `{ level, prefix, time, message, context }`.
|
|
92
|
+
* @returns {{
|
|
93
|
+
* debug: (msg: string, ctx?: object) => void,
|
|
94
|
+
* info: (msg: string, ctx?: object) => void,
|
|
95
|
+
* warn: (msg: string, ctx?: object) => void,
|
|
96
|
+
* error: (msg: string, ctx?: object) => void,
|
|
97
|
+
* child: (subPrefix: string) => object,
|
|
98
|
+
* level: string
|
|
99
|
+
* }}
|
|
100
|
+
*/
|
|
101
|
+
function logger(opts = {}) {
|
|
102
|
+
const prefix = opts.prefix || '';
|
|
103
|
+
let levelName = opts.level && LEVELS[opts.level] !== undefined ? opts.level : 'info';
|
|
104
|
+
let levelNum = LEVELS[levelName];
|
|
105
|
+
const sink = typeof opts.sink === 'function' ? opts.sink : null;
|
|
106
|
+
|
|
107
|
+
function _emit(level, message, context) {
|
|
108
|
+
if (LEVELS[level] < levelNum) return;
|
|
109
|
+
const record = {
|
|
110
|
+
level,
|
|
111
|
+
prefix,
|
|
112
|
+
time: Date.now(),
|
|
113
|
+
message: typeof message === 'string' ? message : String(message),
|
|
114
|
+
context: (context && typeof context === 'object') ? context : {},
|
|
115
|
+
};
|
|
116
|
+
if (sink) {
|
|
117
|
+
try { sink(record); } catch { /* never break the caller */ }
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
// Default sink : `console[level](…)`.
|
|
121
|
+
const tag = prefix ? `[${prefix}]` : '';
|
|
122
|
+
const args = context !== undefined ? [tag, record.message, record.context] : [tag, record.message];
|
|
123
|
+
const fn = (typeof console !== 'undefined' && console[level]) || (typeof console !== 'undefined' && console.log);
|
|
124
|
+
if (fn) try { fn.apply(console, args); } catch { /* swallow */ }
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const api = {
|
|
128
|
+
debug(msg, ctx) { _emit('debug', msg, ctx); },
|
|
129
|
+
info(msg, ctx) { _emit('info', msg, ctx); },
|
|
130
|
+
warn(msg, ctx) { _emit('warn', msg, ctx); },
|
|
131
|
+
error(msg, ctx) { _emit('error', msg, ctx); },
|
|
132
|
+
|
|
133
|
+
/** Spawn a child logger that **appends** to the current prefix. */
|
|
134
|
+
child(subPrefix) {
|
|
135
|
+
const childPrefix = prefix ? `${prefix}:${subPrefix}` : subPrefix;
|
|
136
|
+
return logger({ level: levelName, prefix: childPrefix, sink });
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
/** Dynamic level setter ; `silent` mutes everything. */
|
|
140
|
+
set level(name) {
|
|
141
|
+
if (LEVELS[name] !== undefined) {
|
|
142
|
+
levelName = name;
|
|
143
|
+
levelNum = LEVELS[name];
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
get level() { return levelName; },
|
|
147
|
+
};
|
|
148
|
+
return api;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// ── Guarded execution ───────────────────────────────────────────────
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Build a higher-order wrapper that catches sync / async errors.
|
|
155
|
+
*
|
|
156
|
+
* @param {Object} opts
|
|
157
|
+
* @param {(err: Error, ctx: any) => void} [opts.onError] - Called with
|
|
158
|
+
* the caught error and any contextual data passed via the returned
|
|
159
|
+
* wrapper's optional second argument.
|
|
160
|
+
* @param {boolean} [opts.rethrow=false] - When `true`, the wrapper
|
|
161
|
+
* re-throws after `onError` ; default swallows.
|
|
162
|
+
* @returns {(fn: Function, ctx?: any) => any}
|
|
163
|
+
* A function `guard(fn, ctx)` that calls `fn()`. If `fn` throws or
|
|
164
|
+
* returns a rejecting Promise, `onError(err, ctx)` fires.
|
|
165
|
+
*/
|
|
166
|
+
function guard(opts = {}) {
|
|
167
|
+
const onError = typeof opts.onError === 'function' ? opts.onError : null;
|
|
168
|
+
const rethrow = !!opts.rethrow;
|
|
169
|
+
|
|
170
|
+
return function guarded(fn, ctx) {
|
|
171
|
+
if (typeof fn !== 'function')
|
|
172
|
+
throw new Error('errors.guard: fn must be a function');
|
|
173
|
+
let result;
|
|
174
|
+
try {
|
|
175
|
+
result = fn();
|
|
176
|
+
} catch (err) {
|
|
177
|
+
if (onError) { try { onError(err, ctx); } catch { /* never throw inside handler */ } }
|
|
178
|
+
if (rethrow) throw err;
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
// Async path : `fn` returned a Promise. Chain a catch.
|
|
182
|
+
if (result && typeof result.then === 'function') {
|
|
183
|
+
return result.catch((err) => {
|
|
184
|
+
if (onError) { try { onError(err, ctx); } catch { /* swallow */ } }
|
|
185
|
+
if (rethrow) throw err;
|
|
186
|
+
return undefined;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// ── UI block boundary ───────────────────────────────────────────────
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Construct a boundary bound to a uiSession block. When the guarded
|
|
197
|
+
* function throws (sync or async), the boundary :
|
|
198
|
+
* 1. Calls `opts.onError(err)` if provided.
|
|
199
|
+
* 2. Renders the `opts.fallback` text into the block (if the block
|
|
200
|
+
* exists and `fallback` is a non-empty string), OR calls
|
|
201
|
+
* `opts.render(err, ui, blockId)` if a custom renderer is given.
|
|
202
|
+
* 3. Optionally clears the block (`opts.clear: true`).
|
|
203
|
+
*
|
|
204
|
+
* The returned function is the guard. It can be reused.
|
|
205
|
+
*
|
|
206
|
+
* @param {Object} ui - A UISession instance (must expose `text`, `get`,
|
|
207
|
+
* and `clear` methods).
|
|
208
|
+
* @param {string} blockId - Identifier of the target block inside `ui`.
|
|
209
|
+
* @param {Object} [opts]
|
|
210
|
+
* @param {(err: Error) => void} [opts.onError] - Called with the
|
|
211
|
+
* caught error before fallback rendering. Exceptions thrown by this
|
|
212
|
+
* callback are swallowed (the boundary must never throw).
|
|
213
|
+
* @param {(err: Error, ui: Object, blockId: string) => void} [opts.render]
|
|
214
|
+
* Custom error renderer. When provided, supersedes `fallback`.
|
|
215
|
+
* @param {string} [opts.fallback] - Plain-text fallback written into
|
|
216
|
+
* the block when no `render` is given and the block still exists.
|
|
217
|
+
* @param {boolean} [opts.clear=false] - When true, call `ui.clear(blockId)`
|
|
218
|
+
* after rendering the fallback.
|
|
219
|
+
* @returns {(fn: Function) => any} Boundary guard ; pass it the
|
|
220
|
+
* function whose exceptions must be intercepted.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* const boundary = errs.boundary(ui, 'panel', {
|
|
224
|
+
* onError: (err) => log.error(err.message),
|
|
225
|
+
* fallback: 'Unable to load panel.',
|
|
226
|
+
* });
|
|
227
|
+
* boundary(() => buildPanel()); // sync
|
|
228
|
+
* await boundary(async () => fetchAndRender()); // async
|
|
229
|
+
*/
|
|
230
|
+
function boundary(ui, blockId, opts = {}) {
|
|
231
|
+
if (!ui || typeof ui.text !== 'function')
|
|
232
|
+
throw new Error('errors.boundary: ui (UISession) is required');
|
|
233
|
+
if (typeof blockId !== 'string')
|
|
234
|
+
throw new Error('errors.boundary: blockId must be a string');
|
|
235
|
+
|
|
236
|
+
const onError = typeof opts.onError === 'function' ? opts.onError : null;
|
|
237
|
+
const renderFn = typeof opts.render === 'function' ? opts.render : null;
|
|
238
|
+
const fallback = typeof opts.fallback === 'string' ? opts.fallback : null;
|
|
239
|
+
const doClear = !!opts.clear;
|
|
240
|
+
|
|
241
|
+
function handle(err) {
|
|
242
|
+
if (onError) { try { onError(err); } catch { /* swallow */ } }
|
|
243
|
+
try {
|
|
244
|
+
if (renderFn) {
|
|
245
|
+
renderFn(err, ui, blockId);
|
|
246
|
+
} else if (fallback != null) {
|
|
247
|
+
// Only set text when the block still exists.
|
|
248
|
+
if (ui.get(blockId)) ui.text(blockId, fallback);
|
|
249
|
+
}
|
|
250
|
+
if (doClear) ui.clear(blockId);
|
|
251
|
+
} catch { /* never throw out of the boundary */ }
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return function boundaryGuard(fn) {
|
|
255
|
+
if (typeof fn !== 'function')
|
|
256
|
+
throw new Error('errors.boundary: fn must be a function');
|
|
257
|
+
let result;
|
|
258
|
+
try { result = fn(); }
|
|
259
|
+
catch (err) { handle(err); return undefined; }
|
|
260
|
+
if (result && typeof result.then === 'function') {
|
|
261
|
+
return result.catch((err) => { handle(err); return undefined; });
|
|
262
|
+
}
|
|
263
|
+
return result;
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return { logger, guard, boundary };
|
|
268
|
+
},
|
|
269
|
+
};
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description
|
|
7
|
+
* Application-level pub/sub keyed by topic, distinct from DOM events (`fw.events`).
|
|
8
|
+
* Supports plain named topics (`'log:error'`), sticky values (last value
|
|
9
|
+
* replayed to new subscribers via `set`/`sticky`), limited wildcards
|
|
10
|
+
* (`'a:*'` - a single trailing star), and scopes for atomic unsubscription.
|
|
11
|
+
*
|
|
12
|
+
* Each thread instantiates its own bus via `eventBus.create()`.
|
|
13
|
+
* Cross-tab / cross-worker routing is delegated to `broadcastChannel` / `processMessage`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const eventBus = runtime.resolve('eventBus');
|
|
17
|
+
* const bus = eventBus.create();
|
|
18
|
+
* const off = bus.on('log:error', (data) => console.error(data));
|
|
19
|
+
* bus.emit('log:error', { msg: 'oops' });
|
|
20
|
+
* off(); // unsubscribe
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A single event bus instance returned by `create()`.
|
|
25
|
+
* @typedef {object} EventBusInstance
|
|
26
|
+
* @property {(topic: string, fn: Function, opts?: {replay?: boolean}) => Function} on - Subscribe to a topic (exact or `'a:*'` wildcard); returns an unsubscribe function.
|
|
27
|
+
* @property {(topic: string, fn: Function) => void} off - Unsubscribe a handler from a topic.
|
|
28
|
+
* @property {(topic: string, data: *) => void} emit - Synchronously dispatch data to all matching subscribers.
|
|
29
|
+
* @property {(topic: string, fn: Function) => Function} sticky - Subscribe and immediately replay the last sticky value if any; returns an unsubscribe function.
|
|
30
|
+
* @property {(topic: string, value: *) => void} set - Publish a value and store it for future sticky subscribers.
|
|
31
|
+
* @property {(topic?: string) => void} clear - Clear the sticky value of a topic, or all sticky values when omitted.
|
|
32
|
+
* @property {() => {on: (topic: string, fn: Function) => Function, sticky: (topic: string, fn: Function) => Function, dispose: () => void}} scope - Create a scope for atomic unsubscription of a group of subscriptions.
|
|
33
|
+
* @property {() => string[]} topics - List active topics (with subscribers or sticky values).
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Application-level pub/sub surface returned by `factory()`.
|
|
38
|
+
* @typedef {object} EventBusAPI
|
|
39
|
+
* @property {() => EventBusInstance} create - Create an independent event bus instance.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
export const eventBus = {
|
|
43
|
+
name: 'eventBus',
|
|
44
|
+
version: '1.0.0',
|
|
45
|
+
type: 'fw.io.utils',
|
|
46
|
+
dependencies: [],
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @returns {EventBusAPI}
|
|
50
|
+
*/
|
|
51
|
+
factory() {
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Validates and normalizes a topic.
|
|
55
|
+
* Throws if the topic is the global wildcard `'*'` or an invalid wildcard.
|
|
56
|
+
* @param {string} topic
|
|
57
|
+
* @param {boolean} [allowWildcard=true]
|
|
58
|
+
*/
|
|
59
|
+
function _validateTopic(topic, allowWildcard = true) {
|
|
60
|
+
if (typeof topic !== 'string' || topic.length === 0) {
|
|
61
|
+
throw new TypeError('eventBus: topic must be a non-empty string');
|
|
62
|
+
}
|
|
63
|
+
if (topic === '*') {
|
|
64
|
+
throw new Error('eventBus: global wildcard "*" is not allowed; use a namespaced pattern like "ns:*"');
|
|
65
|
+
}
|
|
66
|
+
const starCount = (topic.match(/\*/g) || []).length;
|
|
67
|
+
if (starCount > 0) {
|
|
68
|
+
if (!allowWildcard) {
|
|
69
|
+
throw new Error('eventBus: wildcards not allowed in emit/set/clear topic: ' + topic);
|
|
70
|
+
}
|
|
71
|
+
if (starCount > 1 || !topic.endsWith(':*')) {
|
|
72
|
+
throw new Error('eventBus: invalid wildcard pattern "' + topic + '"; only "prefix:*" is allowed');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Tests whether a published topic matches a subscribed pattern.
|
|
79
|
+
* @param {string} pattern - pattern (may contain `:*`)
|
|
80
|
+
* @param {string} emittedTopic - exact emitted topic
|
|
81
|
+
* @returns {boolean}
|
|
82
|
+
*/
|
|
83
|
+
function _matches(pattern, emittedTopic) {
|
|
84
|
+
if (pattern === emittedTopic) return true;
|
|
85
|
+
if (pattern.endsWith(':*')) {
|
|
86
|
+
const prefix = pattern.slice(0, -1); // 'a:' for 'a:*'
|
|
87
|
+
return emittedTopic.startsWith(prefix) && emittedTopic.length > prefix.length;
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Creates an independent event bus instance.
|
|
94
|
+
* @returns {object}
|
|
95
|
+
*/
|
|
96
|
+
function create() {
|
|
97
|
+
// Map<topic, Set<Function>> - exact-topic subscribers
|
|
98
|
+
const _subscribers = new Map();
|
|
99
|
+
// Map<wildcard_pattern, Set<Function>> - separate index for wildcard subscribers
|
|
100
|
+
const _wildcardSubscribers = new Map();
|
|
101
|
+
// Map<topic, any> - sticky values
|
|
102
|
+
const _sticky = new Map();
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Returns or creates the subscriber Set for an exact topic.
|
|
106
|
+
*/
|
|
107
|
+
function _getSet(topic) {
|
|
108
|
+
if (!_subscribers.has(topic)) _subscribers.set(topic, new Set());
|
|
109
|
+
return _subscribers.get(topic);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Returns or creates the subscriber Set for a wildcard pattern.
|
|
114
|
+
*/
|
|
115
|
+
function _getWildcardSet(pattern) {
|
|
116
|
+
if (!_wildcardSubscribers.has(pattern)) _wildcardSubscribers.set(pattern, new Set());
|
|
117
|
+
return _wildcardSubscribers.get(pattern);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Subscribes to a topic (exact or wildcard `'a:*'`).
|
|
122
|
+
*
|
|
123
|
+
* Option `{replay: true}` - alias of `sticky(topic, fn)`:
|
|
124
|
+
* subscribes AND immediately replays the last value published via
|
|
125
|
+
* `set` if one exists.
|
|
126
|
+
*
|
|
127
|
+
* Note: `{replay: true}` (and `sticky()`) only replay exact-topic
|
|
128
|
+
* sticky values. Wildcard subscribers (`'log:*'`) receive future
|
|
129
|
+
* emits but never replay sticky values - sticky storage is keyed
|
|
130
|
+
* by exact topic, so `replay` is a no-op for wildcard patterns.
|
|
131
|
+
*
|
|
132
|
+
* @param {string} topic
|
|
133
|
+
* @param {Function} fn
|
|
134
|
+
* @param {{replay?: boolean}} [opts]
|
|
135
|
+
* @returns {Function} unsubscribe
|
|
136
|
+
*/
|
|
137
|
+
function on(topic, fn, opts) {
|
|
138
|
+
_validateTopic(topic, true);
|
|
139
|
+
if (typeof fn !== 'function') throw new TypeError('eventBus: listener must be a function');
|
|
140
|
+
|
|
141
|
+
let unsubscribe;
|
|
142
|
+
if (topic.endsWith(':*')) {
|
|
143
|
+
_getWildcardSet(topic).add(fn);
|
|
144
|
+
unsubscribe = () => off(topic, fn);
|
|
145
|
+
} else {
|
|
146
|
+
_getSet(topic).add(fn);
|
|
147
|
+
unsubscribe = () => off(topic, fn);
|
|
148
|
+
}
|
|
149
|
+
// Replay sticky if requested (additive alias of `sticky`).
|
|
150
|
+
if (opts && opts.replay === true && _sticky.has(topic)) {
|
|
151
|
+
try { fn(_sticky.get(topic)); }
|
|
152
|
+
catch (e) { console.error('eventBus sticky replay error:', e); }
|
|
153
|
+
}
|
|
154
|
+
return unsubscribe;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Unsubscribes a handler from a topic. When the resulting subscriber
|
|
159
|
+
* Set becomes empty, the entry is removed from the underlying map so
|
|
160
|
+
* `topics()` does not report phantom topics and memory does not grow
|
|
161
|
+
* with the number of topics ever subscribed.
|
|
162
|
+
* @param {string} topic
|
|
163
|
+
* @param {Function} fn
|
|
164
|
+
*/
|
|
165
|
+
function off(topic, fn) {
|
|
166
|
+
_validateTopic(topic, true);
|
|
167
|
+
if (topic.endsWith(':*')) {
|
|
168
|
+
const s = _wildcardSubscribers.get(topic);
|
|
169
|
+
if (s) {
|
|
170
|
+
s.delete(fn);
|
|
171
|
+
if (s.size === 0) _wildcardSubscribers.delete(topic);
|
|
172
|
+
}
|
|
173
|
+
} else {
|
|
174
|
+
const s = _subscribers.get(topic);
|
|
175
|
+
if (s) {
|
|
176
|
+
s.delete(fn);
|
|
177
|
+
if (s.size === 0) _subscribers.delete(topic);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Synchronously dispatches to all matching subscribers of the topic
|
|
184
|
+
* (exact subscribers plus wildcard subscribers whose pattern matches).
|
|
185
|
+
* If a handler throws, the error is logged via console.error and the
|
|
186
|
+
* remaining handlers still run.
|
|
187
|
+
* @param {string} topic
|
|
188
|
+
* @param {*} data
|
|
189
|
+
*/
|
|
190
|
+
function emit(topic, data) {
|
|
191
|
+
_validateTopic(topic, false);
|
|
192
|
+
|
|
193
|
+
// Exact subscribers
|
|
194
|
+
const exact = _subscribers.get(topic);
|
|
195
|
+
if (exact && exact.size > 0) {
|
|
196
|
+
for (const fn of [...exact]) {
|
|
197
|
+
try { fn(data); } catch (e) { console.error('eventBus handler error:', e); }
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Wildcards
|
|
202
|
+
for (const [pattern, fns] of _wildcardSubscribers) {
|
|
203
|
+
if (_matches(pattern, topic)) {
|
|
204
|
+
for (const fn of [...fns]) {
|
|
205
|
+
try { fn(data); } catch (e) { console.error('eventBus handler error:', e); }
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Subscribes AND immediately replays the last value if one exists (via `set`).
|
|
213
|
+
*
|
|
214
|
+
* Note: only exact-topic sticky values are replayed. Wildcard
|
|
215
|
+
* patterns (`'log:*'`) are accepted as the subscription target but
|
|
216
|
+
* never trigger a replay, because sticky values are keyed by exact
|
|
217
|
+
* topic.
|
|
218
|
+
*
|
|
219
|
+
* @param {string} topic
|
|
220
|
+
* @param {Function} fn
|
|
221
|
+
* @returns {Function} unsubscribe
|
|
222
|
+
*/
|
|
223
|
+
function sticky(topic, fn) {
|
|
224
|
+
_validateTopic(topic, true);
|
|
225
|
+
if (typeof fn !== 'function') throw new TypeError('eventBus: listener must be a function');
|
|
226
|
+
const unsubscribe = on(topic, fn);
|
|
227
|
+
if (_sticky.has(topic)) {
|
|
228
|
+
try { fn(_sticky.get(topic)); } catch (e) { console.error('eventBus sticky replay error:', e); }
|
|
229
|
+
}
|
|
230
|
+
return unsubscribe;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Publishes AND stores the value for future `sticky(topic)` subscribers.
|
|
235
|
+
* @param {string} topic
|
|
236
|
+
* @param {*} value
|
|
237
|
+
*/
|
|
238
|
+
function set(topic, value) {
|
|
239
|
+
_validateTopic(topic, false);
|
|
240
|
+
_sticky.set(topic, value);
|
|
241
|
+
emit(topic, value);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Clears the sticky value of a topic, or all sticky values if topic is omitted.
|
|
246
|
+
* @param {string} [topic]
|
|
247
|
+
*/
|
|
248
|
+
function clear(topic) {
|
|
249
|
+
if (topic === undefined) {
|
|
250
|
+
_sticky.clear();
|
|
251
|
+
} else {
|
|
252
|
+
_validateTopic(topic, false);
|
|
253
|
+
_sticky.delete(topic);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Creates a scope for atomic unsubscription of a group of subscriptions.
|
|
259
|
+
*
|
|
260
|
+
* Note: `dispose()` is terminal. After `dispose()` has been called,
|
|
261
|
+
* the scope object is drained and no longer guarantees the original
|
|
262
|
+
* atomic-cleanup grouping for further registrations - create a fresh
|
|
263
|
+
* scope rather than re-registering on a disposed one.
|
|
264
|
+
*
|
|
265
|
+
* @returns {{ on: Function, sticky: Function, dispose: Function }}
|
|
266
|
+
*/
|
|
267
|
+
function scope() {
|
|
268
|
+
const _unsubscribers = [];
|
|
269
|
+
|
|
270
|
+
function scopeOn(topic, fn) {
|
|
271
|
+
const unsubscribe = on(topic, fn);
|
|
272
|
+
_unsubscribers.push(unsubscribe);
|
|
273
|
+
return unsubscribe;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function scopeSticky(topic, fn) {
|
|
277
|
+
const unsubscribe = sticky(topic, fn);
|
|
278
|
+
_unsubscribers.push(unsubscribe);
|
|
279
|
+
return unsubscribe;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function dispose() {
|
|
283
|
+
for (const unsubscribe of _unsubscribers) {
|
|
284
|
+
try { unsubscribe(); } catch (e) { console.error('eventBus scope dispose error:', e); }
|
|
285
|
+
}
|
|
286
|
+
_unsubscribers.length = 0;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return { on: scopeOn, sticky: scopeSticky, dispose };
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Lists active topics (those with at least one subscriber or a sticky value). Debug use.
|
|
294
|
+
* @returns {string[]}
|
|
295
|
+
*/
|
|
296
|
+
function topics() {
|
|
297
|
+
const result = new Set();
|
|
298
|
+
for (const [topic, fns] of _subscribers) {
|
|
299
|
+
if (fns.size > 0) result.add(topic);
|
|
300
|
+
}
|
|
301
|
+
for (const [pattern, fns] of _wildcardSubscribers) {
|
|
302
|
+
if (fns.size > 0) result.add(pattern);
|
|
303
|
+
}
|
|
304
|
+
for (const topic of _sticky.keys()) {
|
|
305
|
+
result.add(topic);
|
|
306
|
+
}
|
|
307
|
+
return [...result];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return { on, off, emit, sticky, set, clear, scope, topics };
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return { create };
|
|
314
|
+
}
|
|
315
|
+
};
|