@awacloud/fw 0.1.0 → 1.0.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 +125 -0
- package/NOTICE +8 -0
- package/README.md +163 -31
- package/dist/build/fw.core.pure.meta.json +6 -6
- package/dist/build/fw.core.pure.min.js +15 -12
- package/dist/build/fw.full.pure.meta.json +13 -7
- package/dist/build/fw.full.pure.min.js +45 -42
- package/dist/build/fw.minimal.pure.meta.json +6 -6
- package/dist/build/fw.minimal.pure.min.js +16 -13
- package/dist/build/fw.pack.compress-heavy.pure.meta.json +6 -6
- package/dist/build/fw.pack.compress-heavy.pure.min.js +3 -3
- package/dist/build/fw.pack.crypto-advanced.pure.meta.json +6 -6
- package/dist/build/fw.pack.crypto-advanced.pure.min.js +1 -1
- package/dist/build/fw.pack.crypto-basic.pure.meta.json +6 -6
- package/dist/build/fw.pack.crypto-basic.pure.min.js +1 -1
- package/dist/build/fw.pack.crypto-identity.pure.meta.json +7 -6
- package/dist/build/fw.pack.crypto-identity.pure.min.js +4 -4
- package/dist/build/fw.pwa.pure.meta.json +7 -6
- package/dist/build/fw.pwa.pure.min.js +38 -35
- package/dist/build/fw.site-interactive.pure.meta.json +6 -6
- package/dist/build/fw.site-interactive.pure.min.js +37 -34
- package/dist/build/fw.site.pure.meta.json +6 -6
- package/dist/build/fw.site.pure.min.js +24 -21
- package/dist/build/fw.spa.pure.meta.json +8 -7
- package/dist/build/fw.spa.pure.min.js +41 -38
- package/dist/build/sanity-base-classic.min.js +1 -1
- package/dist/build/sanity.min.js +1 -1
- package/dist/types/core/internal.d.ts +29 -0
- package/dist/types/core/internal.d.ts.map +1 -0
- package/dist/types/core/logger.d.ts +23 -4
- package/dist/types/core/logger.d.ts.map +1 -1
- package/dist/types/core/modules.d.ts +374 -61
- package/dist/types/core/modules.d.ts.map +1 -1
- package/dist/types/core/runtime.d.ts +10 -6
- package/dist/types/core/runtime.d.ts.map +1 -1
- package/dist/types/core/worker-helper.d.ts +35 -0
- package/dist/types/core/worker-helper.d.ts.map +1 -1
- package/dist/types/crypto/cipher/aes.d.ts +1 -7
- package/dist/types/crypto/cipher/aes.d.ts.map +1 -1
- package/dist/types/crypto/cipher/chacha20.d.ts +0 -10
- package/dist/types/crypto/cipher/chacha20.d.ts.map +1 -1
- package/dist/types/crypto/hash/argon2.d.ts +0 -15
- package/dist/types/crypto/hash/argon2.d.ts.map +1 -1
- package/dist/types/crypto/hash/blake2b.d.ts.map +1 -1
- package/dist/types/crypto/hash/hmac.d.ts.map +1 -1
- package/dist/types/crypto/hash/pbkdf2.d.ts.map +1 -1
- package/dist/types/crypto/hash/poly1305.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha224.d.ts +1 -1
- package/dist/types/crypto/hash/sha256.d.ts +4 -13
- package/dist/types/crypto/hash/sha256.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha3.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha384.d.ts +1 -1
- package/dist/types/crypto/hash/sha512.d.ts +4 -13
- package/dist/types/crypto/hash/sha512.d.ts.map +1 -1
- package/dist/types/crypto/mode/cmac.d.ts +0 -6
- package/dist/types/crypto/mode/cmac.d.ts.map +1 -1
- package/dist/types/crypto/mode/ctr.d.ts +0 -6
- package/dist/types/crypto/mode/ctr.d.ts.map +1 -1
- package/dist/types/crypto/mode/gcm.d.ts +0 -9
- package/dist/types/crypto/mode/gcm.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ecc.d.ts +0 -1
- package/dist/types/crypto/pkc/ecc.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ed25519.d.ts +4 -25
- package/dist/types/crypto/pkc/ed25519.d.ts.map +1 -1
- package/dist/types/crypto/pkc/hybridSign.d.ts +25 -5
- package/dist/types/crypto/pkc/hybridSign.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ml_dsa.d.ts +6 -26
- package/dist/types/crypto/pkc/ml_dsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ml_kem.d.ts +0 -43
- package/dist/types/crypto/pkc/ml_kem.d.ts.map +1 -1
- package/dist/types/crypto/pkc/rsa.d.ts +0 -24
- package/dist/types/crypto/pkc/rsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/slh_dsa.d.ts +6 -16
- package/dist/types/crypto/pkc/slh_dsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/x25519.d.ts +0 -6
- package/dist/types/crypto/pkc/x25519.d.ts.map +1 -1
- package/dist/types/crypto/utils/bitArray.d.ts +0 -8
- package/dist/types/crypto/utils/bitArray.d.ts.map +1 -1
- package/dist/types/crypto/utils/jws.d.ts +6 -14
- package/dist/types/crypto/utils/jws.d.ts.map +1 -1
- package/dist/types/crypto/utils/keyformat.d.ts +52 -0
- package/dist/types/crypto/utils/keyformat.d.ts.map +1 -1
- package/dist/types/crypto/utils/random.d.ts +1 -10
- package/dist/types/crypto/utils/random.d.ts.map +1 -1
- package/dist/types/crypto/utils/rsaKeygen.d.ts +0 -10
- package/dist/types/crypto/utils/rsaKeygen.d.ts.map +1 -1
- package/dist/types/crypto/utils/uuid.d.ts.map +1 -1
- package/dist/types/crypto/utils/x509.d.ts +397 -0
- package/dist/types/crypto/utils/x509.d.ts.map +1 -0
- package/dist/types/crypto/wasm/argon2.d.ts +2 -1
- package/dist/types/crypto/wasm/argon2.d.ts.map +1 -1
- package/dist/types/crypto/wasm/pbkdf2.d.ts +2 -2
- package/dist/types/crypto/wasm/pbkdf2.d.ts.map +1 -1
- package/dist/types/crypto/wasm/rsa.d.ts.map +1 -1
- package/dist/types/crypto/wasm/runtime.d.ts +13 -0
- package/dist/types/crypto/wasm/runtime.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/aes.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/aeskw.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/digest.d.ts +0 -4
- package/dist/types/crypto/webcrypto/digest.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/rsa.d.ts.map +1 -1
- package/dist/types/dom/fs/fileIntake.d.ts +59 -0
- package/dist/types/dom/fs/fileIntake.d.ts.map +1 -0
- package/dist/types/dom/fs/fsAccess.d.ts.map +1 -1
- package/dist/types/dom/query/dnd.d.ts.map +1 -1
- package/dist/types/dom/query/sound.d.ts +89 -0
- package/dist/types/dom/query/sound.d.ts.map +1 -0
- package/dist/types/dom/rendering/chart.d.ts.map +1 -1
- package/dist/types/dom/rendering/component.d.ts +9 -3
- package/dist/types/dom/rendering/component.d.ts.map +1 -1
- package/dist/types/dom/rendering/parser.d.ts +39 -0
- package/dist/types/dom/rendering/parser.d.ts.map +1 -1
- package/dist/types/dom/rendering/render.d.ts.map +1 -1
- package/dist/types/dom/rendering/sanitize.d.ts +4 -0
- package/dist/types/dom/rendering/sanitize.d.ts.map +1 -1
- package/dist/types/dom/rendering/secPolicy.d.ts.map +1 -1
- package/dist/types/dom/rendering/styleSheet.d.ts +74 -0
- package/dist/types/dom/rendering/styleSheet.d.ts.map +1 -0
- package/dist/types/dom/rendering/template.d.ts +9 -3
- package/dist/types/dom/rendering/template.d.ts.map +1 -1
- package/dist/types/dom/rendering/themeTokens.d.ts +9 -3
- package/dist/types/dom/rendering/themeTokens.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession-core.d.ts +9 -3
- package/dist/types/dom/rendering/uiSession-core.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession-list.d.ts +9 -3
- package/dist/types/dom/rendering/uiSession-list.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession.d.ts +18 -6
- package/dist/types/dom/rendering/uiSession.d.ts.map +1 -1
- package/dist/types/dom/sw/installPrompt.d.ts +89 -0
- package/dist/types/dom/sw/installPrompt.d.ts.map +1 -0
- package/dist/types/dom/sw/precache.d.ts +149 -0
- package/dist/types/dom/sw/precache.d.ts.map +1 -0
- package/dist/types/dom/sw/swUpdate.d.ts +129 -0
- package/dist/types/dom/sw/swUpdate.d.ts.map +1 -0
- package/dist/types/dom/utils/clipboard.d.ts +8 -0
- package/dist/types/dom/utils/clipboard.d.ts.map +1 -1
- package/dist/types/dom/utils/keybindings.d.ts.map +1 -1
- package/dist/types/dom/utils/route.d.ts.map +1 -1
- package/dist/types/dom/utils/ua.d.ts +2 -2
- package/dist/types/dom/utils/ua.d.ts.map +1 -1
- package/dist/types/io/calc/crc32.d.ts.map +1 -1
- package/dist/types/io/codec/b64.d.ts +24 -0
- package/dist/types/io/codec/b64.d.ts.map +1 -1
- package/dist/types/io/codec/cbor.d.ts +1 -0
- package/dist/types/io/codec/cbor.d.ts.map +1 -1
- package/dist/types/io/codec/hex.d.ts.map +1 -1
- package/dist/types/io/codec/msgpack.d.ts +1 -0
- package/dist/types/io/codec/msgpack.d.ts.map +1 -1
- package/dist/types/io/codec/url.d.ts +3 -1
- package/dist/types/io/codec/url.d.ts.map +1 -1
- package/dist/types/io/codec/utf8.d.ts.map +1 -1
- package/dist/types/io/compress/bitstream.d.ts +1 -1
- package/dist/types/io/compress/brotli.d.ts +0 -1
- package/dist/types/io/compress/brotli.d.ts.map +1 -1
- package/dist/types/io/compress/brotli_shared.d.ts +0 -4
- package/dist/types/io/compress/brotli_shared.d.ts.map +1 -1
- package/dist/types/io/compress/deflate.d.ts +14 -1
- package/dist/types/io/compress/deflate.d.ts.map +1 -1
- package/dist/types/io/compress/gzip.d.ts +4 -0
- package/dist/types/io/compress/gzip.d.ts.map +1 -1
- package/dist/types/io/compress/huffman.d.ts +7 -0
- package/dist/types/io/compress/huffman.d.ts.map +1 -1
- package/dist/types/io/compress/lz4.d.ts +4 -2
- package/dist/types/io/compress/lz4.d.ts.map +1 -1
- package/dist/types/io/compress/lz77.d.ts +17 -0
- package/dist/types/io/compress/lz77.d.ts.map +1 -1
- package/dist/types/io/compress/lzw.d.ts +2 -0
- package/dist/types/io/compress/lzw.d.ts.map +1 -1
- package/dist/types/io/compress/zip.d.ts.map +1 -1
- package/dist/types/io/compress/zlib.d.ts +9 -2
- package/dist/types/io/compress/zlib.d.ts.map +1 -1
- package/dist/types/io/math/linalg.d.ts.map +1 -1
- package/dist/types/process/rpc.d.ts.map +1 -1
- package/dist/types/process/workerPool.d.ts.map +1 -1
- package/dist/types/sanity/base.d.ts +12 -2
- package/dist/types/sanity/base.d.ts.map +1 -1
- package/dist/types/sanity/lockdown.d.ts +6 -5
- package/dist/types/sanity/lockdown.d.ts.map +1 -1
- package/dist/types/sanity/wasm-gate.d.ts +1 -1
- package/docs/README.md +17 -10
- package/docs/api/README.md +5 -5
- package/docs/api/core/logger.md +2 -1
- package/docs/api/core/modules.md +3 -3
- package/docs/api/core/runtime.md +9 -9
- package/docs/api/core/worker-helper.md +12 -2
- package/docs/api/crypto/README.md +1 -1
- package/docs/api/crypto/cipher/README.md +2 -2
- package/docs/api/crypto/cipher/aes.md +5 -10
- package/docs/api/crypto/cipher/chacha20.md +3 -8
- package/docs/api/crypto/hash/README.md +5 -5
- package/docs/api/crypto/hash/adf.md +21 -11
- package/docs/api/crypto/hash/argon2.md +3 -12
- package/docs/api/crypto/hash/blake2b.md +12 -14
- package/docs/api/crypto/hash/pbkdf2.md +1 -1
- package/docs/api/crypto/hash/sha224.md +2 -2
- package/docs/api/crypto/hash/sha256.md +4 -4
- package/docs/api/crypto/hash/sha3.md +2 -2
- package/docs/api/crypto/hash/sha384.md +1 -1
- package/docs/api/crypto/hash/sha512.md +5 -5
- package/docs/api/crypto/hash/sha512_224.md +1 -1
- package/docs/api/crypto/hash/sha512_256.md +1 -1
- package/docs/api/crypto/mode/README.md +3 -3
- package/docs/api/crypto/mode/cbc.md +2 -2
- package/docs/api/crypto/mode/chacha20poly1305.md +1 -1
- package/docs/api/crypto/mode/cmac.md +4 -4
- package/docs/api/crypto/mode/ctr.md +2 -3
- package/docs/api/crypto/mode/gcm.md +5 -5
- package/docs/api/crypto/mode/kw.md +4 -4
- package/docs/api/crypto/pkc/README.md +8 -8
- package/docs/api/crypto/pkc/ecc.md +19 -17
- package/docs/api/crypto/pkc/ed25519.md +10 -15
- package/docs/api/crypto/pkc/hybridKem.md +8 -2
- package/docs/api/crypto/pkc/hybridSign.md +34 -7
- package/docs/api/crypto/pkc/ml_dsa.md +20 -19
- package/docs/api/crypto/pkc/ml_kem.md +3 -3
- package/docs/api/crypto/pkc/rsa.md +7 -9
- package/docs/api/crypto/pkc/slh_dsa.md +12 -12
- package/docs/api/crypto/pkc/x25519.md +5 -4
- package/docs/api/crypto/utils/README.md +7 -7
- package/docs/api/crypto/utils/aes_modes.md +2 -5
- package/docs/api/crypto/utils/asn1.md +25 -16
- package/docs/api/crypto/utils/jws.md +6 -4
- package/docs/api/crypto/utils/keyformat.md +24 -15
- package/docs/api/crypto/utils/pad.md +1 -1
- package/docs/api/crypto/utils/pem.md +3 -3
- package/docs/api/crypto/utils/random.md +3 -4
- package/docs/api/crypto/utils/rsaKeygen.md +2 -2
- package/docs/api/crypto/utils/totp.md +2 -2
- package/docs/api/crypto/utils/uuid.md +5 -5
- package/docs/api/crypto/utils/x509.md +124 -0
- package/docs/api/crypto/wasm/aes.md +1 -1
- package/docs/api/crypto/wasm/argon2.md +6 -4
- package/docs/api/crypto/wasm/ml_kem.md +1 -0
- package/docs/api/crypto/wasm/pbkdf2.md +8 -8
- package/docs/api/crypto/wasm/rsa.md +1 -1
- package/docs/api/crypto/wasm/runtime.md +27 -10
- package/docs/api/crypto/webcrypto/aes.md +1 -1
- package/docs/api/crypto/webcrypto/aeskw.md +2 -2
- package/docs/api/crypto/webcrypto/digest.md +3 -5
- package/docs/api/crypto/webcrypto/ecc.md +1 -1
- package/docs/api/crypto/webcrypto/ed25519.md +1 -1
- package/docs/api/crypto/webcrypto/rsa.md +3 -2
- package/docs/api/crypto/webcrypto/x25519.md +1 -1
- package/docs/api/dom/README.md +6 -1
- package/docs/api/dom/fs/README.md +1 -0
- package/docs/api/dom/fs/fileIntake.md +120 -0
- package/docs/api/dom/fs/fsAccess.md +1 -0
- package/docs/api/dom/fs/indexedDB.md +1 -1
- package/docs/api/dom/fs/storage.md +1 -1
- package/docs/api/dom/query/README.md +2 -1
- package/docs/api/dom/query/dnd.md +4 -1
- package/docs/api/dom/query/dom.md +5 -0
- package/docs/api/dom/query/sound.md +103 -0
- package/docs/api/dom/rendering/README.md +4 -3
- package/docs/api/dom/rendering/chart.md +5 -4
- package/docs/api/dom/rendering/component.md +25 -3
- package/docs/api/dom/rendering/parser.md +5 -2
- package/docs/api/dom/rendering/reactiveBind.md +1 -1
- package/docs/api/dom/rendering/render.md +2 -2
- package/docs/api/dom/rendering/sanitize.md +10 -2
- package/docs/api/dom/rendering/secPolicy.md +4 -4
- package/docs/api/dom/rendering/styleSheet.md +85 -0
- package/docs/api/dom/rendering/template.md +20 -5
- package/docs/api/dom/rendering/themeTokens.md +6 -3
- package/docs/api/dom/rendering/uiSession.md +18 -5
- package/docs/api/dom/rendering/virtualScroll.md +2 -2
- package/docs/api/dom/sensors/geolocation.md +1 -1
- package/docs/api/dom/sw/README.md +7 -1
- package/docs/api/dom/sw/cache.md +2 -1
- package/docs/api/dom/sw/installPrompt.md +111 -0
- package/docs/api/dom/sw/precache.md +124 -0
- package/docs/api/dom/sw/serviceWorker.md +4 -2
- package/docs/api/dom/sw/swUpdate.md +112 -0
- package/docs/api/dom/utils/clipboard.md +56 -5
- package/docs/api/dom/utils/entropyCollector.md +1 -1
- package/docs/api/dom/utils/keybindings.md +17 -2
- package/docs/api/dom/utils/leaderElection.md +2 -2
- package/docs/api/dom/utils/route.md +1 -0
- package/docs/api/dom/utils/ua.md +15 -10
- package/docs/api/io/calc/crc32.md +4 -1
- package/docs/api/io/codec/README.md +2 -2
- package/docs/api/io/codec/b64.md +31 -2
- package/docs/api/io/codec/buffer.md +1 -1
- package/docs/api/io/codec/cbor.md +6 -4
- package/docs/api/io/codec/csv.md +178 -178
- package/docs/api/io/codec/hex.md +10 -2
- package/docs/api/io/codec/msgpack.md +4 -3
- package/docs/api/io/codec/url.md +4 -3
- package/docs/api/io/codec/utf8.md +3 -3
- package/docs/api/io/compress/bitstream.md +6 -3
- package/docs/api/io/compress/brotli.md +36 -4
- package/docs/api/io/compress/brotli_shared.md +1 -1
- package/docs/api/io/compress/deflate.md +42 -34
- package/docs/api/io/compress/gzip.md +26 -6
- package/docs/api/io/compress/huffman.md +2 -1
- package/docs/api/io/compress/lz4.md +5 -3
- package/docs/api/io/compress/lz77.md +26 -3
- package/docs/api/io/compress/lzw.md +13 -8
- package/docs/api/io/compress/zip.md +36 -10
- package/docs/api/io/compress/zlib.md +21 -5
- package/docs/api/io/math/linalg.md +1 -1
- package/docs/api/io/utils/valid.md +1 -1
- package/docs/api/process/rpc.md +3 -2
- package/docs/api/process/workerPool.md +1 -1
- package/docs/api/sanity/base.md +9 -5
- package/docs/api/sanity/lockdown.md +7 -6
- package/docs/api/surface.json +12311 -0
- package/docs/api/typed.md +5 -3
- package/docs/dev/README.md +2 -0
- package/docs/dev/bench.md +76 -0
- package/docs/dev/crypto-references.md +54 -0
- package/docs/dev/provenance.md +30 -7
- package/docs/dev/publishing.md +7 -7
- package/docs/dev/runtime.md +1 -1
- package/docs/dev/testing.md +13 -0
- package/docs/evidence/l4-evidence.md +86 -0
- package/docs/evidence/pqc-hybrid-evidence.md +7 -6
- package/docs/guide/README.md +1 -0
- package/docs/guide/_QUICK_REF.md +5 -5
- package/docs/guide/doc-format.md +4 -3
- package/docs/guide/integrations-hmr.md +1 -1
- package/docs/guide/module-creation-workflow.md +8 -8
- package/docs/guide/rendering-pipeline.md +11 -4
- package/docs/guide/security.md +7 -5
- package/docs/guide/stability.md +123 -0
- package/docs/guide/tutorial-todo.md +20 -8
- package/docs/guide/typescript.md +9 -0
- package/docs/guide/worker-confinement.md +30 -17
- package/docs/notes/lz77-deflate-factorization.md +3 -3
- package/docs/tools/README.md +1 -1
- package/docs/tools/bundler.md +3 -3
- package/docs/tools/codegen.md +1 -1
- package/docs/tools/standalone.md +0 -1
- package/fw.config.json +2 -2
- package/integrations/_shared/catalog.generated.json +7 -1
- package/integrations/_shared/core.js +1 -1
- package/integrations/astro/index.js +1 -1
- package/integrations/eslint/README.md +7 -1
- package/integrations/nextjs/index.js +1 -1
- package/integrations/nodejs/README.md +3 -3
- package/integrations/turbopack/index.js +2 -2
- package/integrations/typedoc/categorize.js +1 -1
- package/integrations/typedoc/typedoc.json +2 -1
- package/integrations/vite/index.js +2 -2
- package/integrations/vite/vite-env.d.ts +7 -4
- package/integrations/webpack/index.js +3 -3
- package/package.json +76 -10
- package/src/core/internal.js +31 -0
- package/src/core/logger.js +95 -23
- package/src/core/modules.js +17 -8
- package/src/core/readyState.js +1 -1
- package/src/core/runtime.js +74 -27
- package/src/core/worker-helper.js +83 -4
- package/src/crypto/NIST_CONFORMANCE.md +47 -34
- package/src/crypto/cipher/aes.acvp.md +7 -8
- package/src/crypto/cipher/aes.js +280 -229
- package/src/crypto/cipher/chacha20.acvp.md +6 -7
- package/src/crypto/cipher/chacha20.js +91 -61
- package/src/crypto/hash/adf.js +1 -1
- package/src/crypto/hash/argon2.acvp.md +11 -15
- package/src/crypto/hash/argon2.js +9 -24
- package/src/crypto/hash/blake2b.js +157 -125
- package/src/crypto/hash/hkdf.acvp.md +15 -15
- package/src/crypto/hash/hkdf.js +1 -1
- package/src/crypto/hash/hmac.acvp.md +10 -12
- package/src/crypto/hash/hmac.js +5 -1
- package/src/crypto/hash/pbkdf2.acvp.md +13 -13
- package/src/crypto/hash/pbkdf2.js +36 -8
- package/src/crypto/hash/poly1305.acvp.md +10 -6
- package/src/crypto/hash/poly1305.js +171 -50
- package/src/crypto/hash/sha224.acvp.md +3 -3
- package/src/crypto/hash/sha224.js +4 -4
- package/src/crypto/hash/sha256.acvp.md +2 -2
- package/src/crypto/hash/sha256.js +514 -50
- package/src/crypto/hash/sha3.acvp.md +9 -9
- package/src/crypto/hash/sha3.js +127 -71
- package/src/crypto/hash/sha384.acvp.md +3 -3
- package/src/crypto/hash/sha384.js +4 -4
- package/src/crypto/hash/sha512.acvp.md +7 -8
- package/src/crypto/hash/sha512.js +107 -108
- package/src/crypto/hash/sha512_224.acvp.md +6 -6
- package/src/crypto/hash/sha512_224.js +2 -2
- package/src/crypto/hash/sha512_256.acvp.md +6 -6
- package/src/crypto/hash/sha512_256.js +2 -2
- package/src/crypto/mode/cbc.acvp.md +2 -2
- package/src/crypto/mode/cbc.js +1 -1
- package/src/crypto/mode/chacha20poly1305.acvp.md +6 -6
- package/src/crypto/mode/chacha20poly1305.js +3 -3
- package/src/crypto/mode/cmac.acvp.md +5 -5
- package/src/crypto/mode/cmac.js +8 -8
- package/src/crypto/mode/ctr.acvp.md +2 -2
- package/src/crypto/mode/ctr.js +1 -3
- package/src/crypto/mode/gcm.acvp.md +6 -6
- package/src/crypto/mode/gcm.js +7 -7
- package/src/crypto/mode/kw.acvp.md +4 -4
- package/src/crypto/mode/kw.js +5 -5
- package/src/crypto/pkc/ecc.acvp.md +13 -13
- package/src/crypto/pkc/ecc.js +9 -11
- package/src/crypto/pkc/ed25519.acvp.md +30 -34
- package/src/crypto/pkc/ed25519.js +453 -94
- package/src/crypto/pkc/hybrid-kat.provenance.md +4 -4
- package/src/crypto/pkc/hybridSign.js +103 -24
- package/src/crypto/pkc/ml_dsa.acvp.md +18 -18
- package/src/crypto/pkc/ml_dsa.js +29 -32
- package/src/crypto/pkc/ml_kem.acvp.md +7 -7
- package/src/crypto/pkc/ml_kem.js +15 -21
- package/src/crypto/pkc/rsa.acvp.md +11 -15
- package/src/crypto/pkc/rsa.js +7 -44
- package/src/crypto/pkc/slh_dsa.acvp.md +16 -16
- package/src/crypto/pkc/slh_dsa.js +16 -18
- package/src/crypto/pkc/x25519.acvp.md +13 -10
- package/src/crypto/pkc/x25519.js +273 -29
- package/src/crypto/utils/aes_modes.acvp.md +1 -2
- package/src/crypto/utils/aes_modes.js +2 -2
- package/src/crypto/utils/asn1-oid.js +1 -1
- package/src/crypto/utils/asn1.js +1 -1
- package/src/crypto/utils/bitArray.js +33 -48
- package/src/crypto/utils/bn.js +1 -1
- package/src/crypto/utils/jws.js +37 -41
- package/src/crypto/utils/keyformat.js +181 -2
- package/src/crypto/utils/pem.js +1 -1
- package/src/crypto/utils/random.acvp.md +5 -5
- package/src/crypto/utils/random.js +845 -846
- package/src/crypto/utils/rsaKeygen.acvp.md +3 -2
- package/src/crypto/utils/rsaKeygen.js +6 -6
- package/src/crypto/utils/totp.js +1 -1
- package/src/crypto/utils/uuid.acvp.md +5 -5
- package/src/crypto/utils/uuid.js +11 -10
- package/src/crypto/utils/x509.js +591 -0
- package/src/crypto/wasm/aes.js +1 -1
- package/src/crypto/wasm/aes.scalar.wasm +0 -0
- package/src/crypto/wasm/argon2.js +17 -1
- package/src/crypto/wasm/argon2.scalar.wasm +0 -0
- package/src/crypto/wasm/blake2b.scalar.wasm +0 -0
- package/src/crypto/wasm/blake2b.simd.wasm +0 -0
- package/src/crypto/wasm/chacha20poly1305.scalar.wasm +0 -0
- package/src/crypto/wasm/chacha20poly1305.simd.wasm +0 -0
- package/src/crypto/wasm/cmac.scalar.wasm +0 -0
- package/src/crypto/wasm/ecc.js +3 -3
- package/src/crypto/wasm/ecc.scalar.wasm +0 -0
- package/src/crypto/wasm/ed25519.js +1 -1
- package/src/crypto/wasm/ed25519.scalar.wasm +0 -0
- package/src/crypto/wasm/hkdf.scalar.wasm +0 -0
- package/src/crypto/wasm/hmac.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_dsa.js +2 -2
- package/src/crypto/wasm/ml_dsa.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_dsa.simd.wasm +0 -0
- package/src/crypto/wasm/ml_kem.js +2 -2
- package/src/crypto/wasm/ml_kem.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_kem.simd.wasm +0 -0
- package/src/crypto/wasm/pbkdf2.js +8 -6
- package/src/crypto/wasm/pbkdf2.scalar.wasm +0 -0
- package/src/crypto/wasm/rsa.js +6 -5
- package/src/crypto/wasm/rsa.scalar.wasm +0 -0
- package/src/crypto/wasm/runtime.js +84 -17
- package/src/crypto/wasm/sha2.scalar.wasm +0 -0
- package/src/crypto/wasm/sha3.scalar.wasm +0 -0
- package/src/crypto/wasm/sha3.simd.wasm +0 -0
- package/src/crypto/wasm/slh_dsa.js +1 -1
- package/src/crypto/wasm/slh_dsa.scalar.wasm +0 -0
- package/src/crypto/wasm/x25519.js +1 -1
- package/src/crypto/wasm/x25519.scalar.wasm +0 -0
- package/src/crypto/webcrypto/aes.js +8 -2
- package/src/crypto/webcrypto/aeskw.js +7 -2
- package/src/crypto/webcrypto/digest.js +1 -15
- package/src/crypto/webcrypto/ecc.js +2 -2
- package/src/crypto/webcrypto/ed25519.js +2 -2
- package/src/crypto/webcrypto/hmac.js +2 -2
- package/src/crypto/webcrypto/rsa.js +7 -2
- package/src/crypto/webcrypto/x25519.js +2 -2
- package/src/dom/display/animate.js +1 -1
- package/src/dom/display/fullscreen.js +1 -1
- package/src/dom/fs/download.js +1 -1
- package/src/dom/fs/fileIntake.js +192 -0
- package/src/dom/fs/fsAccess.js +2 -3
- package/src/dom/fs/indexedDB.js +1 -1
- package/src/dom/fs/remoteStore.js +1 -1
- package/src/dom/fs/storage.js +1 -1
- package/src/dom/lifecycle/idle.js +1 -1
- package/src/dom/lifecycle/visibility.js +1 -1
- package/src/dom/lifecycle/wakeLock.js +1 -1
- package/src/dom/net/ajax.js +1 -1
- package/src/dom/net/network.js +1 -1
- package/src/dom/net/sse.js +1 -1
- package/src/dom/net/webrtc.js +1 -1
- package/src/dom/net/ws.js +1 -1
- package/src/dom/query/dnd.js +56 -4
- package/src/dom/query/dom.js +1 -1
- package/src/dom/query/events.js +1 -1
- package/src/dom/query/gesture.js +1 -1
- package/src/dom/query/media.js +1 -1
- package/src/dom/query/sound.js +333 -0
- package/src/dom/rendering/chart.js +736 -663
- package/src/dom/rendering/component.js +25 -14
- package/src/dom/rendering/devtools.js +2 -2
- package/src/dom/rendering/parser.js +155 -12
- package/src/dom/rendering/render.js +14 -4
- package/src/dom/rendering/sanitize.js +11 -4
- package/src/dom/rendering/secPolicy.js +6 -4
- package/src/dom/rendering/styleSheet.js +217 -0
- package/src/dom/rendering/template.js +72 -13
- package/src/dom/rendering/themeTokens.js +542 -522
- package/src/dom/rendering/uiSession-core.js +51 -6
- package/src/dom/rendering/uiSession-direct.js +1 -1
- package/src/dom/rendering/uiSession-list.js +4 -4
- package/src/dom/rendering/uiSession.js +1 -1
- package/src/dom/rendering/virtualScroll.js +341 -341
- package/src/dom/sensors/battery.js +1 -1
- package/src/dom/sensors/geolocation.js +1 -1
- package/src/dom/sensors/networkInfo.js +1 -1
- package/src/dom/sensors/sensors.js +1 -1
- package/src/dom/sw/backgroundSync.js +1 -1
- package/src/dom/sw/cache.js +1 -1
- package/src/dom/sw/installPrompt.js +151 -0
- package/src/dom/sw/precache.js +257 -0
- package/src/dom/sw/push.js +1 -1
- package/src/dom/sw/sharedWorker.js +1 -1
- package/src/dom/sw/swUpdate.js +239 -0
- package/src/dom/utils/a11y.js +1 -1
- package/src/dom/utils/clipboard.js +56 -6
- package/src/dom/utils/entropyCollector.js +1 -1
- package/src/dom/utils/focus.js +1 -1
- package/src/dom/utils/form.js +1 -1
- package/src/dom/utils/keybindings.js +600 -574
- package/src/dom/utils/leaderElection.js +1 -1
- package/src/dom/utils/notifications.js +1 -1
- package/src/dom/utils/permissions.js +107 -107
- package/src/dom/utils/route.js +14 -2
- package/src/dom/utils/ua.js +42 -28
- package/src/dom/utils/webauthn.js +1 -1
- package/src/io/binary/reader.js +1 -1
- package/src/io/binary/writer.js +1 -1
- package/src/io/calc/bigint.js +1 -1
- package/src/io/calc/crc32.js +28 -2
- package/src/io/calc/easing.js +514 -514
- package/src/io/codec/b64.js +189 -52
- package/src/io/codec/base32.js +1 -1
- package/src/io/codec/base58.js +1 -1
- package/src/io/codec/buffer.js +1 -1
- package/src/io/codec/cbor.js +111 -18
- package/src/io/codec/csv.js +1 -1
- package/src/io/codec/hex.js +51 -6
- package/src/io/codec/mime.js +1 -1
- package/src/io/codec/msgpack.js +47 -6
- package/src/io/codec/url.js +24 -7
- package/src/io/codec/utf8.js +5 -3
- package/src/io/codec/xml.js +1 -1
- package/src/io/compress/bitstream.js +2 -2
- package/src/io/compress/brotli.js +663 -163
- package/src/io/compress/brotli_dict.js +1 -1
- package/src/io/compress/brotli_dict_words.js +1 -1
- package/src/io/compress/brotli_frame.js +1 -1
- package/src/io/compress/brotli_shared.js +7 -7
- package/src/io/compress/deflate.js +87 -53
- package/src/io/compress/gzip.js +187 -74
- package/src/io/compress/huffman.js +24 -1
- package/src/io/compress/lz4.js +45 -7
- package/src/io/compress/lz77.js +148 -63
- package/src/io/compress/lzw.js +35 -19
- package/src/io/compress/zip.js +862 -815
- package/src/io/compress/zlib.js +87 -7
- package/src/io/i18n/i18n.js +1 -1
- package/src/io/math/fixed-point.js +1 -1
- package/src/io/math/geom.js +1 -1
- package/src/io/math/interp.js +1 -1
- package/src/io/math/linalg.js +10 -4
- package/src/io/math/stats.js +1 -1
- package/src/io/structures/btree.js +1 -1
- package/src/io/structures/heap.js +1 -1
- package/src/io/structures/lruCache.js +1 -1
- package/src/io/structures/ringBuffer.js +1 -1
- package/src/io/structures/tree-walker.js +1 -1
- package/src/io/structures/trie.js +1 -1
- package/src/io/sync/abort.js +1 -1
- package/src/io/sync/atomics.js +1 -1
- package/src/io/sync/cancellable.js +1 -1
- package/src/io/sync/channel.js +1 -1
- package/src/io/sync/mutex.js +1 -1
- package/src/io/sync/semaphore.js +1 -1
- package/src/io/sync/tokenBucket.js +1 -1
- package/src/io/text/ansi.js +1 -1
- package/src/io/text/html-entities.js +1 -1
- package/src/io/time/date.js +1 -1
- package/src/io/timing/clock.js +1 -1
- package/src/io/timing/rateLimit.js +1 -1
- package/src/io/timing/scheduler.js +1 -1
- package/src/io/utils/errors.js +1 -1
- package/src/io/utils/eventBus.js +1 -1
- package/src/io/utils/signal.js +1 -1
- package/src/io/utils/valid.js +1 -1
- package/src/main.js +1 -1
- package/src/process/message.js +1 -1
- package/src/process/rpc.js +7 -3
- package/src/process/workerPool.js +11 -4
- package/src/sanity/base.js +85 -39
- package/src/sanity/lockdown-apply.js +3 -3
- package/src/sanity/lockdown.js +58 -32
- package/src/sanity/wasm-gate.js +2 -2
- package/src/typed.js +7 -3
- package/third-party/NOTICE-brotli-dictionary.txt +69 -0
- package/third-party/NOTICE-fw-wasm-crypto.txt +576 -0
- package/third-party/NOTICE-whatwg-entities.txt +44 -0
- package/types/registry.generated.d.ts +7 -1
- package/types/typed.d.ts +7 -3
- package/dist/types/crypto/utils/aes_ctr.d.ts +0 -84
- package/dist/types/crypto/utils/aes_ctr.d.ts.map +0 -1
- package/docs/api/crypto/utils/aes_ctr.md +0 -71
- package/src/crypto/utils/aes_ctr.acvp.md +0 -67
- package/src/crypto/utils/aes_ctr.js +0 -134
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
2
|
// Author: Matthieu Bouilloux
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
@@ -49,8 +49,12 @@
|
|
|
49
49
|
* Scoped CSS : `spec.css` is injected **once per define()** into the page's
|
|
50
50
|
* `<head>`. Inside the CSS, `&` is rewritten to the unique scope class
|
|
51
51
|
* generated for the blueprint (`.fw-comp-N`). The scope class is added to
|
|
52
|
-
* every instance's root element automatically.
|
|
53
|
-
*
|
|
52
|
+
* every instance's root element automatically. The CSS goes through the
|
|
53
|
+
* `styleSheet` module: in its default mode a `<style data-fw-component>`
|
|
54
|
+
* element is added to `<head>` (CSP nonce auto-detected from
|
|
55
|
+
* `<meta name="csp-nonce">` and applied to it); under
|
|
56
|
+
* `styleSheet.mode('adopted')` no `<style>` element is created, the CSS is
|
|
57
|
+
* attached as a constructable stylesheet.
|
|
54
58
|
*
|
|
55
59
|
* Props shape : `self.props` always holds the **transformed** shape (the
|
|
56
60
|
* exact data the DOM template was bound against). The original validated
|
|
@@ -63,9 +67,8 @@
|
|
|
63
67
|
* automatically re-write the DOM from the new props — re-binding is left to the
|
|
64
68
|
* hook. Wire the changed fields explicitly in `update(self, prev)` via
|
|
65
69
|
* `self.text(...)` / `self.attr(...)` (or a `reactiveBind` set up in `mount`).
|
|
66
|
-
* (
|
|
67
|
-
*
|
|
68
|
-
* `ai/plans/ui-templates`.)
|
|
70
|
+
* (Measured 2026-06-30 while building `@awacloud/ui-templates`' dual-form
|
|
71
|
+
* components.)
|
|
69
72
|
*
|
|
70
73
|
*/
|
|
71
74
|
|
|
@@ -96,16 +99,17 @@
|
|
|
96
99
|
*/
|
|
97
100
|
|
|
98
101
|
import { reactiveBind } from './reactiveBind.js';
|
|
102
|
+
import { styleSheet } from './styleSheet.js';
|
|
99
103
|
|
|
100
104
|
export const component = {
|
|
101
105
|
name: 'component',
|
|
102
106
|
version: '1.3.0',
|
|
103
107
|
type: 'fw.dom.rendering',
|
|
104
|
-
dependencies: ['reactiveBind'],
|
|
105
|
-
deps: [reactiveBind],
|
|
108
|
+
dependencies: ['reactiveBind', 'styleSheet'],
|
|
109
|
+
deps: [reactiveBind, styleSheet],
|
|
106
110
|
|
|
107
111
|
/** @returns {ComponentAPI} */
|
|
108
|
-
factory(reactiveBind) {
|
|
112
|
+
factory(reactiveBind, styleSheet) {
|
|
109
113
|
|
|
110
114
|
// Shared counter for scope class names across all `define()` calls.
|
|
111
115
|
let _scopeSeq = 0;
|
|
@@ -198,7 +202,7 @@ export const component = {
|
|
|
198
202
|
* are resolved iteratively until no `&` remains.
|
|
199
203
|
*
|
|
200
204
|
* The function does NOT parse full CSS — it operates with targeted
|
|
201
|
-
* regexes that cover the
|
|
205
|
+
* regexes that cover the documented patterns. Corner-cases
|
|
202
206
|
* involving `&` inside attribute selectors or string values are
|
|
203
207
|
* intentionally out-of-scope.
|
|
204
208
|
*
|
|
@@ -270,10 +274,12 @@ export const component = {
|
|
|
270
274
|
}
|
|
271
275
|
|
|
272
276
|
/**
|
|
273
|
-
* Inject
|
|
274
|
-
* to refer to the scope ; we rewrite to `.<scopeClass>` so the
|
|
275
|
-
* is plain CSS understood by all browsers (no nesting
|
|
276
|
-
* Extended to handle nested `&`, `:global(sel)` and
|
|
277
|
+
* Inject the CSS scoped to `scopeClass` through `styleSheet`. User CSS
|
|
278
|
+
* uses `&` to refer to the scope ; we rewrite to `.<scopeClass>` so the
|
|
279
|
+
* result is plain CSS understood by all browsers (no nesting
|
|
280
|
+
* requirement). Extended to handle nested `&`, `:global(sel)` and
|
|
281
|
+
* `@keyframes`. Under `styleSheet.mode('adopted')` no `<style>` element
|
|
282
|
+
* is created (a constructable stylesheet is attached instead).
|
|
277
283
|
*/
|
|
278
284
|
function _injectScopedCss(cssSource, scopeClass) {
|
|
279
285
|
if (typeof document === 'undefined') return;
|
|
@@ -283,6 +289,11 @@ export const component = {
|
|
|
283
289
|
if (_injectedScopes.has(scopeClass)) return;
|
|
284
290
|
_injectedScopes.add(scopeClass);
|
|
285
291
|
const scoped = _rewriteCss(cssSource, scopeClass);
|
|
292
|
+
if (styleSheet) {
|
|
293
|
+
styleSheet.attach(scoped, { attrs: { 'data-fw-component': scopeClass }, nonce: _cspNonce });
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
// hand-wired without styleSheet: the element path, as before
|
|
286
297
|
const styleEl = document.createElement('style');
|
|
287
298
|
styleEl.textContent = scoped;
|
|
288
299
|
styleEl.setAttribute('data-fw-component', scopeClass);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
2
|
// Author: Matthieu Bouilloux
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
@@ -251,7 +251,7 @@ export const devtools = {
|
|
|
251
251
|
// descriptors (`src/core/runtime.js`) — so `_clock` here already IS
|
|
252
252
|
// the `ClockAPI` object (`{ now, monotonic, since, iso, format }`),
|
|
253
253
|
// not `clock` the module. Call `monotonic()` on it directly; no
|
|
254
|
-
// `.factory()` hop (
|
|
254
|
+
// `.factory()` hop (that hop threw a TypeError on the canonical
|
|
255
255
|
// `runtime.resolve('devtools')` path, e.g. sde-core's taskmgr).
|
|
256
256
|
|
|
257
257
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
2
|
// Author: Matthieu Bouilloux
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
@@ -105,6 +105,22 @@
|
|
|
105
105
|
* and non-string entries are ignored. Supplying the option BYPASSES the
|
|
106
106
|
* source-keyed `ParseResult` cache (read and write): the reservation changes
|
|
107
107
|
* which ids are minted, so a cached entry would violate the contract.
|
|
108
|
+
* @property {SharedParseCache} [cache] - A cache from `createCache`, shared
|
|
109
|
+
* by any number of parser instances, used INSTEAD of this instance's own.
|
|
110
|
+
* It is transparent: a hit returns exactly what a fresh parse on this
|
|
111
|
+
* instance would, auto ids re-minted by this instance's counter.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* A parse cache shared across parser instances (`parser.createCache`). The
|
|
116
|
+
* underscored members are the parser's internal protocol.
|
|
117
|
+
*
|
|
118
|
+
* @typedef {Object} SharedParseCache
|
|
119
|
+
* @property {() => number} size - Entries held.
|
|
120
|
+
* @property {() => void} clear - Drop every entry and reset the counters.
|
|
121
|
+
* @property {() => {hits: number, misses: number, evictions: number, size: number, max: number}} stats - Counters.
|
|
122
|
+
* @property {(key: string) => (object|undefined)} _get
|
|
123
|
+
* @property {(key: string, entry: object) => void} _set
|
|
108
124
|
*/
|
|
109
125
|
|
|
110
126
|
/**
|
|
@@ -114,6 +130,7 @@
|
|
|
114
130
|
* @property {(htmlString: string, options?: FromHTMLOptions) => ParseResult} fromHTML - Parse HTML to a (cached) {@link ParseResult}.
|
|
115
131
|
* @property {(input: ElmNode[]|ParseResult) => string} toHTML - Serialise an elm array / ParseResult back to HTML.
|
|
116
132
|
* @property {ParserCache} cache - Manual cache controls.
|
|
133
|
+
* @property {(opts?: {max?: number}) => SharedParseCache} createCache - A cache several instances share through `fromHTML(html, { cache })`.
|
|
117
134
|
*/
|
|
118
135
|
|
|
119
136
|
import { secPolicy } from './secPolicy.js';
|
|
@@ -186,6 +203,14 @@ export const parser = {
|
|
|
186
203
|
return el;
|
|
187
204
|
}
|
|
188
205
|
function _makeText(value) { return { nodeType: NODE_TEXT, nodeValue: value }; }
|
|
206
|
+
|
|
207
|
+
/** Phrasing elements whose neighbouring whitespace renders as a space. */
|
|
208
|
+
const INLINE_TAGS = new Set(['a', 'abbr', 'b', 'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn', 'em', 'i',
|
|
209
|
+
'img', 'kbd', 'label', 'mark', 'q', 's', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'time', 'u',
|
|
210
|
+
'var', 'wbr', 'button', 'input', 'select', 'textarea', 'output', 'svg']);
|
|
211
|
+
function _isInlineElement(n) {
|
|
212
|
+
return !!n && n.nodeType === NODE_ELEMENT && INLINE_TAGS.has(String(n.tagName).toLowerCase());
|
|
213
|
+
}
|
|
189
214
|
function _makeComment(value) { return { nodeType: NODE_COMMENT, nodeValue: value }; }
|
|
190
215
|
|
|
191
216
|
// Parse an opening tag starting at `pos` (which points to '<').
|
|
@@ -364,6 +389,11 @@ export const parser = {
|
|
|
364
389
|
|
|
365
390
|
let _seq = 0;
|
|
366
391
|
|
|
392
|
+
/** Ids `nextId` mints while a recorded parse runs (shared cache), else null. @type {string[]|null} */
|
|
393
|
+
let _mintLog = null;
|
|
394
|
+
/** The explicit ids of the document `_fromHTMLImpl` parsed last. @type {Set<string>} */
|
|
395
|
+
let _lastExplicit = new Set();
|
|
396
|
+
|
|
367
397
|
/**
|
|
368
398
|
* Explicit ids reserved for the WHOLE parser instance: every explicit id
|
|
369
399
|
* seen by a previous `fromHTML` call, plus every id a caller declared up
|
|
@@ -428,6 +458,7 @@ export const parser = {
|
|
|
428
458
|
while ((reserved && reserved.has(id)) || _reservedAll.has(id)) {
|
|
429
459
|
id = 'p' + (_seq++);
|
|
430
460
|
}
|
|
461
|
+
if (_mintLog) _mintLog.push(id);
|
|
431
462
|
return id;
|
|
432
463
|
};
|
|
433
464
|
|
|
@@ -818,6 +849,7 @@ export const parser = {
|
|
|
818
849
|
// that an auto-minted `pN` never collides with an explicit `pN` —
|
|
819
850
|
// including one that only appears further down the tree.
|
|
820
851
|
const reserved = collectExplicitIds(rootNode);
|
|
852
|
+
_lastExplicit = new Set(reserved);
|
|
821
853
|
// Cross-call layers, both applied BEFORE the walk as well:
|
|
822
854
|
// - ids the caller declared up front for the whole assembled
|
|
823
855
|
// document (covers explicit ids this instance has not met yet);
|
|
@@ -932,15 +964,30 @@ export const parser = {
|
|
|
932
964
|
// Non-empty text nodes that live alongside element siblings
|
|
933
965
|
// cannot be represented as elm.text; they become synthetic
|
|
934
966
|
// child elements instead.
|
|
935
|
-
plainKids.forEach(c => {
|
|
967
|
+
plainKids.forEach((c, k) => {
|
|
936
968
|
if (c.nodeType === NODE_ELEMENT) {
|
|
937
969
|
walkElement(c, id, out);
|
|
938
970
|
|
|
939
971
|
} else if (c.nodeType === NODE_TEXT) {
|
|
940
|
-
|
|
941
|
-
|
|
972
|
+
// A text node keeps the boundary space an inline
|
|
973
|
+
// sibling renders (BL-2374, D9 G7): `or <b>this</b>`
|
|
974
|
+
// keeps "or ". A whitespace-only node is still
|
|
975
|
+
// skipped — a synthetic text node renders as a
|
|
976
|
+
// <span>, so keeping it would add an element to the
|
|
977
|
+
// DOM; beside block elements and at the parent's
|
|
978
|
+
// edges whitespace is dropped, as rendering does.
|
|
979
|
+
const raw = c.nodeValue;
|
|
980
|
+
const trimmed = raw.trim();
|
|
981
|
+
if (!trimmed) return; // whitespace-only → skip
|
|
982
|
+
const prevInline = _isInlineElement(plainKids[k - 1]);
|
|
983
|
+
const nextInline = _isInlineElement(plainKids[k + 1]);
|
|
984
|
+
let rawText = trimmed;
|
|
985
|
+
{
|
|
986
|
+
if (prevInline && /^\s/.test(raw)) rawText = ' ' + rawText;
|
|
987
|
+
if (nextInline && /\s$/.test(raw)) rawText = rawText + ' ';
|
|
988
|
+
}
|
|
942
989
|
|
|
943
|
-
const slotM =
|
|
990
|
+
const slotM = trimmed.match(RE_SLOT);
|
|
944
991
|
if (slotM) {
|
|
945
992
|
// ${slot} text node with element siblings → <span>
|
|
946
993
|
// (the memo rule: "has neighbours → span tag")
|
|
@@ -998,10 +1045,11 @@ export const parser = {
|
|
|
998
1045
|
};
|
|
999
1046
|
|
|
1000
1047
|
/**
|
|
1001
|
-
* Cached `fromHTML` :
|
|
1002
|
-
*
|
|
1003
|
-
*
|
|
1004
|
-
* evicted on
|
|
1048
|
+
* Cached `fromHTML` : identical input strings are parsed once. Every
|
|
1049
|
+
* call returns its own deep copy of the cached ParseResult (hit or
|
|
1050
|
+
* miss), so a caller may mutate what it gets without reaching the cache
|
|
1051
|
+
* or any other caller. Cache is bounded; oldest entries are evicted on
|
|
1052
|
+
* overflow.
|
|
1005
1053
|
*
|
|
1006
1054
|
* Supplying `options.reserveIds` BYPASSES the cache in both directions:
|
|
1007
1055
|
* the reservation changes which auto ids are minted, so a hit keyed on
|
|
@@ -1023,13 +1071,108 @@ export const parser = {
|
|
|
1023
1071
|
if (reserveIdsInput !== undefined && reserveIdsInput !== null) {
|
|
1024
1072
|
return _fromHTMLImpl(htmlString, reserveIdsInput);
|
|
1025
1073
|
}
|
|
1074
|
+
const shared = options ? options.cache : undefined;
|
|
1075
|
+
if (shared && typeof shared._get === 'function') return _fromShared(htmlString, shared);
|
|
1026
1076
|
const cached = _cacheGet(htmlString);
|
|
1027
|
-
if (cached !== undefined) return cached;
|
|
1077
|
+
if (cached !== undefined) return _cloneResult(cached);
|
|
1028
1078
|
const result = _fromHTMLImpl(htmlString);
|
|
1029
1079
|
_cacheSet(htmlString, result);
|
|
1030
|
-
return result;
|
|
1080
|
+
return _cloneResult(result);
|
|
1031
1081
|
};
|
|
1032
1082
|
|
|
1083
|
+
/**
|
|
1084
|
+
* `fromHTML` through a shared cache. An entry keeps the result, the
|
|
1085
|
+
* auto ids in mint order and the document's explicit ids. A hit does
|
|
1086
|
+
* what a parse does to this instance — the explicit ids join the
|
|
1087
|
+
* instance set, then every auto id is minted by this instance's own
|
|
1088
|
+
* `nextId` in the original order — and rewrites `id` / `parent` in a
|
|
1089
|
+
* copy, so it returns exactly what a fresh parse would. The key carries
|
|
1090
|
+
* the parse path: DOMParser and the internal tokenizer may build
|
|
1091
|
+
* different trees from one source.
|
|
1092
|
+
*
|
|
1093
|
+
* @param {string} htmlString
|
|
1094
|
+
* @param {SharedParseCache} shared
|
|
1095
|
+
* @returns {ParseResult}
|
|
1096
|
+
*/
|
|
1097
|
+
function _fromShared(htmlString, shared) {
|
|
1098
|
+
const key = (typeof DOMParser !== 'undefined' ? 'd:' : 't:') + htmlString;
|
|
1099
|
+
const entry = shared._get(key);
|
|
1100
|
+
if (entry === undefined) {
|
|
1101
|
+
_mintLog = [];
|
|
1102
|
+
let result;
|
|
1103
|
+
try {
|
|
1104
|
+
result = _fromHTMLImpl(htmlString);
|
|
1105
|
+
shared._set(key, { result, minted: _mintLog, explicit: Array.from(_lastExplicit) });
|
|
1106
|
+
} finally {
|
|
1107
|
+
_mintLog = null;
|
|
1108
|
+
}
|
|
1109
|
+
return _cloneResult(result);
|
|
1110
|
+
}
|
|
1111
|
+
for (const id of entry.explicit) _reservedAll.add(id);
|
|
1112
|
+
const reserved = new Set(entry.explicit);
|
|
1113
|
+
const remap = new Map();
|
|
1114
|
+
for (const old of entry.minted) remap.set(old, nextId(reserved));
|
|
1115
|
+
const copy = _cloneResult(entry.result);
|
|
1116
|
+
const rewrite = (elms) => {
|
|
1117
|
+
for (const elm of elms) {
|
|
1118
|
+
if (remap.has(elm.id)) elm.id = remap.get(elm.id);
|
|
1119
|
+
if (elm.parent !== undefined && remap.has(elm.parent)) elm.parent = remap.get(elm.parent);
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
rewrite(copy.template);
|
|
1123
|
+
if (copy.iterates) for (const name of Object.keys(copy.iterates)) rewrite(copy.iterates[name]);
|
|
1124
|
+
return copy;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
/**
|
|
1128
|
+
* A parse cache several parser instances share (`fromHTML(html, { cache })`).
|
|
1129
|
+
* Bounded like the instance cache: the oldest entry goes on overflow.
|
|
1130
|
+
*
|
|
1131
|
+
* @param {{max?: number}} [opts] - `max` entries (default 64; 0 disables).
|
|
1132
|
+
* @returns {SharedParseCache}
|
|
1133
|
+
*/
|
|
1134
|
+
function createCache(opts) {
|
|
1135
|
+
const max = Math.max(0, (opts && opts.max !== undefined ? opts.max : 64) | 0);
|
|
1136
|
+
const map = new Map();
|
|
1137
|
+
const st = { hits: 0, misses: 0, evictions: 0 };
|
|
1138
|
+
return {
|
|
1139
|
+
size() { return map.size; },
|
|
1140
|
+
clear() { map.clear(); st.hits = 0; st.misses = 0; st.evictions = 0; },
|
|
1141
|
+
stats() { return { ...st, size: map.size, max }; },
|
|
1142
|
+
_get(key) {
|
|
1143
|
+
if (max === 0) return undefined;
|
|
1144
|
+
const hit = map.get(key);
|
|
1145
|
+
if (hit === undefined) { st.misses++; return undefined; }
|
|
1146
|
+
map.delete(key); map.set(key, hit);
|
|
1147
|
+
st.hits++;
|
|
1148
|
+
return hit;
|
|
1149
|
+
},
|
|
1150
|
+
_set(key, entry) {
|
|
1151
|
+
if (max === 0) return;
|
|
1152
|
+
if (map.size >= max) { map.delete(map.keys().next().value); st.evictions++; }
|
|
1153
|
+
map.set(key, entry);
|
|
1154
|
+
},
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* Deep copy of a ParseResult: plain objects, arrays and primitives only
|
|
1160
|
+
* (what the parser produces). About an order of magnitude cheaper than
|
|
1161
|
+
* the parse it replaces on a hit.
|
|
1162
|
+
*
|
|
1163
|
+
* @param {*} v
|
|
1164
|
+
* @returns {*}
|
|
1165
|
+
*/
|
|
1166
|
+
function _cloneResult(v) {
|
|
1167
|
+
if (Array.isArray(v)) return v.map(_cloneResult);
|
|
1168
|
+
if (v !== null && typeof v === 'object') {
|
|
1169
|
+
const out = {};
|
|
1170
|
+
for (const k of Object.keys(v)) out[k] = _cloneResult(v[k]);
|
|
1171
|
+
return out;
|
|
1172
|
+
}
|
|
1173
|
+
return v;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1033
1176
|
/**
|
|
1034
1177
|
* Manual cache controls (test / power-user).
|
|
1035
1178
|
*/
|
|
@@ -1050,6 +1193,6 @@ export const parser = {
|
|
|
1050
1193
|
stats() { return { ..._cacheStats, size: _cacheMap.size, max: _cacheMax }; },
|
|
1051
1194
|
};
|
|
1052
1195
|
|
|
1053
|
-
return { fromHTML, toHTML, cache };
|
|
1196
|
+
return { fromHTML, toHTML, cache, createCache };
|
|
1054
1197
|
}
|
|
1055
1198
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
2
|
// Author: Matthieu Bouilloux
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
@@ -478,8 +478,10 @@ export const render = {
|
|
|
478
478
|
* @param {ElmNode} elm - Bound elm node (data/text already applied).
|
|
479
479
|
* @param {Map} kidsByParent - Map<parentId, ElmNode[]>.
|
|
480
480
|
* @param {Object} opts - SSR options (slots, iterates, hydrate, idPrefix).
|
|
481
|
+
* @param {number} [rowIndex] - Set on the root(s) of an iterate row:
|
|
482
|
+
* its 0-based index, emitted as `data-fw-row` when hydrating.
|
|
481
483
|
*/
|
|
482
|
-
function _ssrNode(elm, kidsByParent, opts) {
|
|
484
|
+
function _ssrNode(elm, kidsByParent, opts, rowIndex) {
|
|
483
485
|
const outTag = _ssrTagFor(elm.tag);
|
|
484
486
|
const isVoid = VOID_TAGS_SSR.has(outTag);
|
|
485
487
|
|
|
@@ -504,6 +506,12 @@ export const render = {
|
|
|
504
506
|
const id = opts.idPrefix ? opts.idPrefix + ':' + elm.id : elm.id;
|
|
505
507
|
parts.push(' data-fw-id="' + _ssrEscape(id) + '"');
|
|
506
508
|
}
|
|
509
|
+
// Rows of an iterate block share their parser ids (UIList.adopt
|
|
510
|
+
// finds each node inside its own row); the index makes a row
|
|
511
|
+
// addressable on its own.
|
|
512
|
+
if (opts.hydrate && rowIndex !== undefined) {
|
|
513
|
+
parts.push(' data-fw-row="' + rowIndex + '"');
|
|
514
|
+
}
|
|
507
515
|
|
|
508
516
|
const openTag = '<' + outTag + parts.join('');
|
|
509
517
|
|
|
@@ -529,7 +537,7 @@ export const render = {
|
|
|
529
537
|
const bound = elms(subTpl, rowData);
|
|
530
538
|
const bIdx = _ssrIndex(bound);
|
|
531
539
|
for (const root of bIdx.roots) {
|
|
532
|
-
lines.push(_ssrNode(root, bIdx.kids, opts));
|
|
540
|
+
lines.push(_ssrNode(root, bIdx.kids, opts, i));
|
|
533
541
|
}
|
|
534
542
|
}
|
|
535
543
|
body = lines.join('');
|
|
@@ -564,7 +572,9 @@ export const render = {
|
|
|
564
572
|
* optional `iterates`) or a raw elm-array.
|
|
565
573
|
* @param {Object} [data] - Variable bindings for `#{var}`.
|
|
566
574
|
* @param {Object} [opts]
|
|
567
|
-
* @param {boolean} [opts.hydrate=true] - Emit `data-fw-id` markers
|
|
575
|
+
* @param {boolean} [opts.hydrate=true] - Emit `data-fw-id` markers, and
|
|
576
|
+
* `data-fw-row="<i>"` on the root(s) of each iterate row (the rows
|
|
577
|
+
* share their `data-fw-id` values; the index addresses one row).
|
|
568
578
|
* @param {string} [opts.idPrefix] - Namespace prefix for `data-fw-id`,
|
|
569
579
|
* useful when multiple SSR blocks coexist on one page.
|
|
570
580
|
* @param {Object<string,string|Function>} [opts.slots] - Map of
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
2
|
// Author: Matthieu Bouilloux
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
* @property {Record<string, Set<string>>} [allowedAttributes]
|
|
39
39
|
* @property {string[]} [urlSchemes]
|
|
40
40
|
* @property {boolean} [dropDangerousContent=true]
|
|
41
|
+
* @property {boolean} [allowDataImage=false] - keep `data:image/*` on `<img src>` only.
|
|
41
42
|
*/
|
|
42
43
|
|
|
43
44
|
import { secPolicy } from './secPolicy.js';
|
|
@@ -212,9 +213,11 @@ export const sanitize = {
|
|
|
212
213
|
if (!isAttrAllowed(name, tag, al)) continue;
|
|
213
214
|
let value = attrs[name];
|
|
214
215
|
// URL attributes: enforce scheme allowlist.
|
|
215
|
-
// data:
|
|
216
|
+
// A data:image/* URL passes only on <img src> under opts.allowDataImage
|
|
217
|
+
// (an image element runs no script); href and any other src never take data:.
|
|
216
218
|
if (name === 'href' || name === 'src') {
|
|
217
|
-
|
|
219
|
+
const dataImage = al.allowDataImage && tag === 'img' && name === 'src';
|
|
220
|
+
if (!isSafeUrl(value, schemes, dataImage)) continue;
|
|
218
221
|
}
|
|
219
222
|
// Sanitize value: strip angle brackets and quotes to prevent injection.
|
|
220
223
|
value = String(value).replace(/[<>"]/g, '').replace(/\s+/g, ' ').trim();
|
|
@@ -268,6 +271,9 @@ export const sanitize = {
|
|
|
268
271
|
* @param {string[]} [opts.urlSchemes] - override allowed URL schemes.
|
|
269
272
|
* @param {boolean} [opts.dropDangerousContent=true] - strip inner content of
|
|
270
273
|
* dangerous tags (script, iframe, style…).
|
|
274
|
+
* @param {boolean} [opts.allowDataImage=false] - keep a `data:image/*` URL
|
|
275
|
+
* (`secPolicy.DATA_IMAGE_RE` types) on `<img src>` only; `href` and
|
|
276
|
+
* every other element's `src` still drop any `data:` URL.
|
|
271
277
|
* @returns {string}
|
|
272
278
|
*/
|
|
273
279
|
function sanitizeHtml(html, opts) {
|
|
@@ -290,7 +296,8 @@ export const sanitize = {
|
|
|
290
296
|
attributes: (opts && opts.allowedAttributes !== undefined)
|
|
291
297
|
? opts.allowedAttributes
|
|
292
298
|
: DEFAULT_ATTRIBUTES,
|
|
293
|
-
urlSchemes: (opts && opts.urlSchemes) ? opts.urlSchemes : DEFAULT_URL_SCHEMES
|
|
299
|
+
urlSchemes: (opts && opts.urlSchemes) ? opts.urlSchemes : DEFAULT_URL_SCHEMES,
|
|
300
|
+
allowDataImage: opts ? opts.allowDataImage === true : false
|
|
294
301
|
};
|
|
295
302
|
const dropDangerous = !(opts && opts.dropDangerousContent === false);
|
|
296
303
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
2
|
// Author: Matthieu Bouilloux
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
@@ -93,9 +93,11 @@ export const secPolicy = {
|
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
95
|
* Accepted `data:image/*` MIME types ; consulted by {@link isSafeUrl}
|
|
96
|
-
* when `allowDataImage` is true.
|
|
96
|
+
* when `allowDataImage` is true. The MIME type is followed by a
|
|
97
|
+
* parameter (`;base64`, `;utf8`) or directly by the data (`,`): both
|
|
98
|
+
* are RFC 2397 forms.
|
|
97
99
|
*/
|
|
98
|
-
const DATA_IMAGE_RE = /^data:image\/(png|jpe?g|gif|webp|svg\+xml|bmp|ico|avif|apng)
|
|
100
|
+
const DATA_IMAGE_RE = /^data:image\/(png|jpe?g|gif|webp|svg\+xml|bmp|ico|avif|apng)[;,]/;
|
|
99
101
|
|
|
100
102
|
/**
|
|
101
103
|
* Decide whether `url` may be safely set on a URL-bearing attribute.
|
|
@@ -137,7 +139,7 @@ export const secPolicy = {
|
|
|
137
139
|
if (colon === -1) return true;
|
|
138
140
|
const slash = trimmed.indexOf('/');
|
|
139
141
|
if (slash !== -1 && slash < colon) return true;
|
|
140
|
-
const allowed = Array.isArray(schemes) ? schemes : SAFE_SCHEMES;
|
|
142
|
+
const allowed = (Array.isArray(schemes) || schemes instanceof Set) ? schemes : SAFE_SCHEMES;
|
|
141
143
|
const scheme = trimmed.slice(0, colon);
|
|
142
144
|
return allowed instanceof Set ? allowed.has(scheme) : allowed.includes(scheme);
|
|
143
145
|
}
|