@visulima/html 1.0.0-alpha.9 → 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.
Files changed (37) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/LICENSE.md +27 -55
  3. package/README.md +69 -10
  4. package/dist/css.d.ts +38 -0
  5. package/dist/css.js +2 -0
  6. package/dist/escape.d.ts +20 -0
  7. package/dist/escape.js +1 -0
  8. package/dist/html.d.ts +58 -0
  9. package/dist/html.js +1 -0
  10. package/dist/index.d.ts +68 -13
  11. package/dist/index.js +1 -1
  12. package/dist/packem_shared/_commonjsHelpers-CWAkuNXM.js +1 -0
  13. package/dist/packem_shared/decode-DPHm0sXO.js +1 -0
  14. package/dist/packem_shared/escapeCss-BtzOEJZW.js +1 -0
  15. package/dist/packem_shared/escapeHtml-CiWsYlrs.js +1 -0
  16. package/dist/packem_shared/escapeJs-C4cWI12i.js +1 -0
  17. package/dist/packem_shared/htmlTags-BWCBwnc_.js +1 -0
  18. package/dist/packem_shared/isHtml-B7-ANsKf.js +1 -0
  19. package/dist/packem_shared/isValidCustomElementName-BGH0NihB.js +1 -0
  20. package/dist/packem_shared/stripHtml-BJMSstzr.js +53 -0
  21. package/dist/packem_shared/voidHtmlTags-Cb8VOd4K.js +1 -0
  22. package/dist/sanitize.d.ts +1 -0
  23. package/dist/sanitize.js +1 -0
  24. package/dist/strip.d.ts +67 -0
  25. package/dist/strip.js +1 -0
  26. package/package.json +38 -20
  27. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +0 -1
  28. package/dist/packem_shared/css-Dln-sxQh.js +0 -1
  29. package/dist/packem_shared/encode-CXgEtaTS.js +0 -1
  30. package/dist/packem_shared/escapeCss-oDJXzCKj.js +0 -1
  31. package/dist/packem_shared/escapeHtml-BGTH-nez.js +0 -1
  32. package/dist/packem_shared/escapeJs-BS03wnwB.js +0 -1
  33. package/dist/packem_shared/html-BiXubKfv.js +0 -1
  34. package/dist/packem_shared/htmlTags-Nlm7Pr1p.js +0 -1
  35. package/dist/packem_shared/isValidCustomElementName-gLEw9R2V.js +0 -1
  36. package/dist/packem_shared/stripHtmlDefaultOptions-BNHq9dEC.js +0 -54
  37. package/dist/packem_shared/voidHtmlTags-CRXTgEWG.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,192 @@
1
+ ## @visulima/html 1.0.0 (2026-07-03)
2
+
3
+ ### Features
4
+
5
+ * add string analysis functions for counting occurrences and detecting text direction ([de84ab0](https://github.com/visulima/visulima/commit/de84ab072e36d3fc834dd8d971db46fd62be249a))
6
+ * create new html package ([#567](https://github.com/visulima/visulima/issues/567)) ([#583](https://github.com/visulima/visulima/issues/583)) ([cae765f](https://github.com/visulima/visulima/commit/cae765f59f31338cc9ab58d90de7945e73ded2bb))
7
+ * **html:** add subpaths, html fragment composition, css quote-safe minify ([4e13cc9](https://github.com/visulima/visulima/commit/4e13cc90c79ed9629141d12251b5050bf29946a4))
8
+ * **web:** auto-generate packages page from workspace metadata ([623e520](https://github.com/visulima/visulima/commit/623e5207693a7fe720f5f2f179593a3654c880e3))
9
+
10
+ ### Bug Fixes
11
+
12
+ * **data-manipulation:** resolve eslint and type-safety issues ([f1682c2](https://github.com/visulima/visulima/commit/f1682c2611cbcc6c85d4bbea520d43464b42e7ee))
13
+ * enhance package.json keywords for HTML manipulation ([f02045a](https://github.com/visulima/visulima/commit/f02045ab37bfb24c97b54669585b3ca333482835))
14
+ * **html:** 1 bug fix ([a300939](https://github.com/visulima/visulima/commit/a300939fb1689808be2dd972364740d925d3789b))
15
+ * **html:** escape by default in html overload ([3a3cbe2](https://github.com/visulima/visulima/commit/3a3cbe29f448782a64580d05d81f26b4a5632aad))
16
+ * **html:** resolve eslint and formatting issues ([e455a78](https://github.com/visulima/visulima/commit/e455a78dc8464049c3e557cba096fc3694de8812))
17
+ * **html:** suppress no-base-to-string for intentional String() coercions ([258b6c0](https://github.com/visulima/visulima/commit/258b6c000d7b06e0c216a0eeb3d729d3009fee3a))
18
+ * **html:** update package files ([6b8982d](https://github.com/visulima/visulima/commit/6b8982d2eb7f3c6998a33f7c70a828ac1d3d85ab))
19
+ * **html:** update packem to 2.0.0-alpha.54 ([ad2ebac](https://github.com/visulima/visulima/commit/ad2ebac46d076866b9b9653948273935013b5724))
20
+ * move JSR dependencies from catalog to package.json ([579468b](https://github.com/visulima/visulima/commit/579468bc7c1e0980b8dae413fa44cf56b9073b6f))
21
+ * Remove JSR configuration generation script and generated jsr.json files ([#616](https://github.com/visulima/visulima/issues/616)) ([533744b](https://github.com/visulima/visulima/commit/533744b103b74896941db5b727173e617a27a63b))
22
+ * **storage-client:** percent-encode user fields in defaultFingerprint ([7c78a0f](https://github.com/visulima/visulima/commit/7c78a0f9512e2a673b941d80839e9f1e86b7b5d0))
23
+ * **web:** improve build setup with incremental stats caching and prod install ([fe33e75](https://github.com/visulima/visulima/commit/fe33e75827586779b4b3a0c6d57b39f889ee6207))
24
+
25
+ ### Documentation
26
+
27
+ * **humanizer,html,iso-locale,package,tsconfig:** add comprehensive Fumadocs documentation ([19781ce](https://github.com/visulima/visulima/commit/19781ce5d27605971a9f2fdf0a99863effd98091))
28
+
29
+ ### Styles
30
+
31
+ * cs fix ([dbe0cfd](https://github.com/visulima/visulima/commit/dbe0cfd27507cd145d4635482533bec2bbc42a32))
32
+ * cs fixes ([2a960bb](https://github.com/visulima/visulima/commit/2a960bb1772c9dc70080e2d75d3a0d827034e294))
33
+
34
+ ### Miscellaneous Chores
35
+
36
+ * add fallow code-intelligence across all packages ([a3b4821](https://github.com/visulima/visulima/commit/a3b48215002e86fed20f2973038b5d4a0aa1ce04))
37
+ * apply eslint + prettier autofixes across packages ([c1bb784](https://github.com/visulima/visulima/commit/c1bb7848a0d93d0dfe2960c77e3cda22239c79a0))
38
+ * bump engines.node to ^22.14.0 || >=24.10.0 ([c3d0931](https://github.com/visulima/visulima/commit/c3d0931d1504e4f21ebf50ea680cfa7ce4ba15ce))
39
+ * **ci-stability:** green CI across vis, native, lint, tests, attw ([#651](https://github.com/visulima/visulima/issues/651)) ([d4eb684](https://github.com/visulima/visulima/commit/d4eb684b5f75c818c9251048c605a0ed54a268e3))
40
+ * **data-manipulation:** remove empty dependency objects from package.json ([c0e8f76](https://github.com/visulima/visulima/commit/c0e8f7689a2da413f771494f6ecb07babc4b5e06))
41
+ * **data-manipulation:** update dependencies ([49458ab](https://github.com/visulima/visulima/commit/49458ab8f8e17d875840b1b4fe8b5efe12ff3513))
42
+ * fixed jsr.json ([5d85e51](https://github.com/visulima/visulima/commit/5d85e5179de38e284ec433b14d77c71a1619c8d6))
43
+ * **html:** add tsconfig.eslint.json for type-aware linting ([1661c2c](https://github.com/visulima/visulima/commit/1661c2c215e768e9d814ac00facb41d10d45276e))
44
+ * **html:** apply auto-fix formatting ([9491631](https://github.com/visulima/visulima/commit/9491631e4a188a6ecdb36a9afc9bd31393190390))
45
+ * **html:** apply pending changes ([6a79de6](https://github.com/visulima/visulima/commit/6a79de644efc546fae8d67be6208196ed3fd4ac3))
46
+ * **html:** apply pending lint and source updates ([71d3af2](https://github.com/visulima/visulima/commit/71d3af23f31b5eaac262ac5231a73d9ca82ddc82))
47
+ * **html:** apply prettier formatting ([2c8e184](https://github.com/visulima/visulima/commit/2c8e184252d348986e1415f17f3c713f8cbd5ca0))
48
+ * **html:** apply safe eslint formatting ([f12769c](https://github.com/visulima/visulima/commit/f12769c6ae6328499d933a00dd2a91d882cdb2dd))
49
+ * **html:** housekeeping cleanup ([2582bc2](https://github.com/visulima/visulima/commit/2582bc220b2eec56acf441dee4654d4b4721381e))
50
+ * **html:** migrate .prettierrc.cjs to prettier.config.js ([63aa430](https://github.com/visulima/visulima/commit/63aa430c8ad29de43c67a65fc3022834389484f0))
51
+ * **html:** migrate deps to pnpm catalogs ([18e9713](https://github.com/visulima/visulima/commit/18e97133d72cd7f9ca1fb0636790f8f9aa9dbe81))
52
+ * **html:** update dependencies ([2d72396](https://github.com/visulima/visulima/commit/2d72396550bbc39e24624aed55a32e4c93d51aec))
53
+ * **html:** update dependencies ([bfcd109](https://github.com/visulima/visulima/commit/bfcd1097249502c8a0219a5008941d854bf01c5d))
54
+ * **html:** update dependencies ([2d1ca24](https://github.com/visulima/visulima/commit/2d1ca2493ab702a4210f0f60acd25cbefe6a1699))
55
+ * **html:** upgrade packem to 2.0.0-alpha.76 ([6de95f0](https://github.com/visulima/visulima/commit/6de95f036c3277d6b65be6728406897b1ffc13ac))
56
+ * jsr.json update and lock file ([73fce38](https://github.com/visulima/visulima/commit/73fce38c7cb4603f3fffb88609b1b18e2feb4937))
57
+ * re-sort workspace package.json files via vis sort-package-json ([f625696](https://github.com/visulima/visulima/commit/f625696cfac974325774b3243e1a83c3d23acbd7))
58
+ * **release:** @visulima/html@1.0.0-alpha.1 [skip ci]\n\n## @visulima/html 1.0.0-alpha.1 (2025-12-12) ([8212d2e](https://github.com/visulima/visulima/commit/8212d2eda770c0b2dcbaeecb1adb45fba3b84ca5))
59
+ * **release:** @visulima/html@1.0.0-alpha.10 [skip ci]\n\n## @visulima/html [1.0.0-alpha.10](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.9...@visulima/html@1.0.0-alpha.10) (2026-04-21) ([f221374](https://github.com/visulima/visulima/commit/f22137407f3d6a349b3e45bc207f6d9b00aa6ab9))
60
+ * **release:** @visulima/html@1.0.0-alpha.11 [skip ci]\n\n## @visulima/html [1.0.0-alpha.11](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.10...@visulima/html@1.0.0-alpha.11) (2026-04-21) ([60d574d](https://github.com/visulima/visulima/commit/60d574d56ab4e0801a5964922a5637ebba5dedd5))
61
+ * **release:** @visulima/html@1.0.0-alpha.12 [skip ci]\n\n## @visulima/html [1.0.0-alpha.12](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.11...@visulima/html@1.0.0-alpha.12) (2026-04-22) ([dabf269](https://github.com/visulima/visulima/commit/dabf269674e5c7b4dc4f98ba164f1f27dc9ea79c))
62
+ * **release:** @visulima/html@1.0.0-alpha.13 [skip ci]\n\n## @visulima/html [1.0.0-alpha.13](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.12...@visulima/html@1.0.0-alpha.13) (2026-05-19) ([a7458fb](https://github.com/visulima/visulima/commit/a7458fb7c8398ff4ae828d5e2d02f50b9e516426))
63
+ * **release:** @visulima/html@1.0.0-alpha.14 [skip ci]\n\n## @visulima/html [1.0.0-alpha.14](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.13...@visulima/html@1.0.0-alpha.14) (2026-05-20) ([0e8b212](https://github.com/visulima/visulima/commit/0e8b21279a31ec685cc9a503745de3bf4d0f3ef6))
64
+ * **release:** @visulima/html@1.0.0-alpha.15 [skip ci]\n\n## @visulima/html [1.0.0-alpha.15](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.14...@visulima/html@1.0.0-alpha.15) (2026-05-26) ([b46def4](https://github.com/visulima/visulima/commit/b46def4eef1b152324e9d354aa11feb7013c4a13))
65
+ * **release:** @visulima/html@1.0.0-alpha.16 [skip ci]\n\n## @visulima/html [1.0.0-alpha.16](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.15...@visulima/html@1.0.0-alpha.16) (2026-05-26) ([d040eb4](https://github.com/visulima/visulima/commit/d040eb439827aa6b17c1c91936ec4148131bb5fb))
66
+ * **release:** @visulima/html@1.0.0-alpha.17 [skip ci]\n\n## @visulima/html [1.0.0-alpha.17](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.16...@visulima/html@1.0.0-alpha.17) (2026-05-27) ([bcb8c8c](https://github.com/visulima/visulima/commit/bcb8c8c9476b3a9392a2378d82f3f81b5cb3b145))
67
+ * **release:** @visulima/html@1.0.0-alpha.18 [skip ci]\n\n## @visulima/html [1.0.0-alpha.18](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.17...@visulima/html@1.0.0-alpha.18) (2026-05-27) ([62bb71a](https://github.com/visulima/visulima/commit/62bb71a39e7c5e84dc22005c3d7ba4db16716956))
68
+ * **release:** @visulima/html@1.0.0-alpha.19 [skip ci]\n\n## @visulima/html [1.0.0-alpha.19](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.18...@visulima/html@1.0.0-alpha.19) (2026-06-04) ([8ffc478](https://github.com/visulima/visulima/commit/8ffc478b454e319a1583151c20fc75752a408c57))
69
+ * **release:** @visulima/html@1.0.0-alpha.2 [skip ci]\n\n## @visulima/html [1.0.0-alpha.2](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.1...@visulima/html@1.0.0-alpha.2) (2025-12-12) ([9b5f4c5](https://github.com/visulima/visulima/commit/9b5f4c5f1e157431d6d2c155491f089499b531ee))
70
+ * **release:** @visulima/html@1.0.0-alpha.20 [skip ci]\n\n## @visulima/html [1.0.0-alpha.20](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.19...@visulima/html@1.0.0-alpha.20) (2026-06-13) ([5f87752](https://github.com/visulima/visulima/commit/5f877526b9dac074c58dba239a6ed3fc5774fd8e))
71
+ * **release:** @visulima/html@1.0.0-alpha.3 [skip ci]\n\n## @visulima/html [1.0.0-alpha.3](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.2...@visulima/html@1.0.0-alpha.3) (2025-12-27) ([dec4b4f](https://github.com/visulima/visulima/commit/dec4b4f6c3411ee45df19198f88c487a4cf0748a))
72
+ * **release:** @visulima/html@1.0.0-alpha.4 [skip ci]\n\n## @visulima/html [1.0.0-alpha.4](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.3...@visulima/html@1.0.0-alpha.4) (2026-03-06) ([7e21707](https://github.com/visulima/visulima/commit/7e217071211d2aff66f761fc6cf752bb2e85dce0))
73
+ * **release:** @visulima/html@1.0.0-alpha.5 [skip ci]\n\n## @visulima/html [1.0.0-alpha.5](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.4...@visulima/html@1.0.0-alpha.5) (2026-03-26) ([c7ae21f](https://github.com/visulima/visulima/commit/c7ae21f80c04c54f8970d314a8bf5138074f47c7))
74
+ * **release:** @visulima/html@1.0.0-alpha.6 [skip ci]\n\n## @visulima/html [1.0.0-alpha.6](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.5...@visulima/html@1.0.0-alpha.6) (2026-03-26) ([9610c9b](https://github.com/visulima/visulima/commit/9610c9b4592800529d0f74c6301bc1b316be9b8c))
75
+ * **release:** @visulima/html@1.0.0-alpha.7 [skip ci]\n\n## @visulima/html [1.0.0-alpha.7](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.6...@visulima/html@1.0.0-alpha.7) (2026-04-08) ([7d9eeb2](https://github.com/visulima/visulima/commit/7d9eeb2cd67d85d2de4af419279d67390182e3b1))
76
+ * **release:** @visulima/html@1.0.0-alpha.8 [skip ci]\n\n## @visulima/html [1.0.0-alpha.8](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.7...@visulima/html@1.0.0-alpha.8) (2026-04-15) ([5db7ba8](https://github.com/visulima/visulima/commit/5db7ba8e37db2a79a8ba42d608a3ef5c0baaa242))
77
+ * **release:** @visulima/html@1.0.0-alpha.9 [skip ci]\n\n## @visulima/html [1.0.0-alpha.9](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.8...@visulima/html@1.0.0-alpha.9) (2026-04-21) ([95d6e02](https://github.com/visulima/visulima/commit/95d6e024d63049ea4ac8fc6b1f4443976107cfc5))
78
+ * **repo:** sort package.json keys across all packages ([e1fd9ab](https://github.com/visulima/visulima/commit/e1fd9ab467ef96a98c777da1572ff6a50fcf7e71))
79
+ * sorted package.json ([b47c545](https://github.com/visulima/visulima/commit/b47c545591600fdab17d5cd3a3fbc68b61e199da))
80
+ * update lock file maintenance ([d83e716](https://github.com/visulima/visulima/commit/d83e71697b75d24704185b66bb521a934d2db02d))
81
+ * update the jsr.json ([864ab7e](https://github.com/visulima/visulima/commit/864ab7e71c4b5ae82f64792d1ae8debfea2c539b))
82
+ * visulima website ([#591](https://github.com/visulima/visulima/issues/591)) ([59ab2e2](https://github.com/visulima/visulima/commit/59ab2e2befb03e51cd2088956f83d9b87de6d033))
83
+ * year update ([47f4105](https://github.com/visulima/visulima/commit/47f410596ce7190cfea36a073db32e0cec50bbcd))
84
+
85
+ ### Tests
86
+
87
+ * fix failing and flaky package tests ([3f2894e](https://github.com/visulima/visulima/commit/3f2894e816e99f465abb0d3b7d5161af69bbb4ec))
88
+ * **html:** cover vendor-prefix and tagged-template fallback branches ([8db69d5](https://github.com/visulima/visulima/commit/8db69d5da388a55e2550ed5bb5ef4ae651bc21f8))
89
+ * **html:** restore tagged-template inputs mangled by eslint --fix ([430260d](https://github.com/visulima/visulima/commit/430260def28f9dce7d84086f58e7bba2657e098a))
90
+ * **repo:** add dist runtime + types integration tests ([32ee300](https://github.com/visulima/visulima/commit/32ee300b7184117a0ddf9f9d390f75f8932d5ed9))
91
+
92
+ ### Build System
93
+
94
+ * regenerate bundled-license manifests and types ordering ([af26588](https://github.com/visulima/visulima/commit/af26588d75aaa937fd4862800560bd4070a4878c))
95
+
96
+ ### Continuous Integration
97
+
98
+ * **fallow:** make fallow:health advisory (--report-only) ([d57148e](https://github.com/visulima/visulima/commit/d57148ea0e3556b4c24d8d336b9fa14987f5dc7d))
99
+ * **lint:** raise eslint job timeout and cache slow per-package eslint runs ([#717](https://github.com/visulima/visulima/issues/717)) ([c93878d](https://github.com/visulima/visulima/commit/c93878dbfa1888cc834704448ae6eefd3098597e)), closes [#713](https://github.com/visulima/visulima/issues/713)
100
+
101
+ ## @visulima/html [1.0.0-alpha.20](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.19...@visulima/html@1.0.0-alpha.20) (2026-06-13)
102
+
103
+ ### Features
104
+
105
+ * **html:** add subpaths, html fragment composition, css quote-safe minify ([4e13cc9](https://github.com/visulima/visulima/commit/4e13cc90c79ed9629141d12251b5050bf29946a4))
106
+
107
+ ### Bug Fixes
108
+
109
+ * **html:** escape by default in html overload ([3a3cbe2](https://github.com/visulima/visulima/commit/3a3cbe29f448782a64580d05d81f26b4a5632aad))
110
+
111
+ ### Miscellaneous Chores
112
+
113
+ * **html:** apply safe eslint formatting ([f12769c](https://github.com/visulima/visulima/commit/f12769c6ae6328499d933a00dd2a91d882cdb2dd))
114
+
115
+ ### Tests
116
+
117
+ * **html:** restore tagged-template inputs mangled by eslint --fix ([430260d](https://github.com/visulima/visulima/commit/430260def28f9dce7d84086f58e7bba2657e098a))
118
+
119
+ ### Build System
120
+
121
+ * regenerate bundled-license manifests and types ordering ([af26588](https://github.com/visulima/visulima/commit/af26588d75aaa937fd4862800560bd4070a4878c))
122
+
123
+ ## @visulima/html [1.0.0-alpha.19](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.18...@visulima/html@1.0.0-alpha.19) (2026-06-04)
124
+
125
+ ### Bug Fixes
126
+
127
+ * **html:** 1 bug fix ([a300939](https://github.com/visulima/visulima/commit/a300939fb1689808be2dd972364740d925d3789b))
128
+
129
+ ### Miscellaneous Chores
130
+
131
+ * apply eslint + prettier autofixes across packages ([c1bb784](https://github.com/visulima/visulima/commit/c1bb7848a0d93d0dfe2960c77e3cda22239c79a0))
132
+
133
+ ### Tests
134
+
135
+ * **html:** cover vendor-prefix and tagged-template fallback branches ([8db69d5](https://github.com/visulima/visulima/commit/8db69d5da388a55e2550ed5bb5ef4ae651bc21f8))
136
+
137
+ ## @visulima/html [1.0.0-alpha.18](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.17...@visulima/html@1.0.0-alpha.18) (2026-05-27)
138
+
139
+ ### Bug Fixes
140
+
141
+ * **storage-client:** percent-encode user fields in defaultFingerprint ([7c78a0f](https://github.com/visulima/visulima/commit/7c78a0f9512e2a673b941d80839e9f1e86b7b5d0))
142
+
143
+ ## @visulima/html [1.0.0-alpha.17](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.16...@visulima/html@1.0.0-alpha.17) (2026-05-27)
144
+
145
+ ## @visulima/html [1.0.0-alpha.16](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.15...@visulima/html@1.0.0-alpha.16) (2026-05-26)
146
+
147
+ ### Miscellaneous Chores
148
+
149
+ * sorted package.json ([b47c545](https://github.com/visulima/visulima/commit/b47c545591600fdab17d5cd3a3fbc68b61e199da))
150
+
151
+ ## @visulima/html [1.0.0-alpha.15](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.14...@visulima/html@1.0.0-alpha.15) (2026-05-26)
152
+
153
+ ### Miscellaneous Chores
154
+
155
+ * **ci-stability:** green CI across vis, native, lint, tests, attw ([#651](https://github.com/visulima/visulima/issues/651)) ([d4eb684](https://github.com/visulima/visulima/commit/d4eb684b5f75c818c9251048c605a0ed54a268e3))
156
+ * **repo:** sort package.json keys across all packages ([e1fd9ab](https://github.com/visulima/visulima/commit/e1fd9ab467ef96a98c777da1572ff6a50fcf7e71))
157
+
158
+ ### Tests
159
+
160
+ * **repo:** add dist runtime + types integration tests ([32ee300](https://github.com/visulima/visulima/commit/32ee300b7184117a0ddf9f9d390f75f8932d5ed9))
161
+
162
+ ## @visulima/html [1.0.0-alpha.14](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.13...@visulima/html@1.0.0-alpha.14) (2026-05-20)
163
+
164
+ ## @visulima/html [1.0.0-alpha.13](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.12...@visulima/html@1.0.0-alpha.13) (2026-05-19)
165
+
166
+ ### Miscellaneous Chores
167
+
168
+ * **html:** housekeeping cleanup ([2582bc2](https://github.com/visulima/visulima/commit/2582bc220b2eec56acf441dee4654d4b4721381e))
169
+ * **html:** upgrade packem to 2.0.0-alpha.76 ([6de95f0](https://github.com/visulima/visulima/commit/6de95f036c3277d6b65be6728406897b1ffc13ac))
170
+ * re-sort workspace package.json files via vis sort-package-json ([f625696](https://github.com/visulima/visulima/commit/f625696cfac974325774b3243e1a83c3d23acbd7))
171
+
172
+ ## @visulima/html [1.0.0-alpha.12](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.11...@visulima/html@1.0.0-alpha.12) (2026-04-22)
173
+
174
+ ### Bug Fixes
175
+
176
+ * Remove JSR configuration generation script and generated jsr.json files ([#616](https://github.com/visulima/visulima/issues/616)) ([533744b](https://github.com/visulima/visulima/commit/533744b103b74896941db5b727173e617a27a63b))
177
+
178
+ ## @visulima/html [1.0.0-alpha.11](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.10...@visulima/html@1.0.0-alpha.11) (2026-04-21)
179
+
180
+ ### Miscellaneous Chores
181
+
182
+ * jsr.json update and lock file ([73fce38](https://github.com/visulima/visulima/commit/73fce38c7cb4603f3fffb88609b1b18e2feb4937))
183
+
184
+ ## @visulima/html [1.0.0-alpha.10](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.9...@visulima/html@1.0.0-alpha.10) (2026-04-21)
185
+
186
+ ### Miscellaneous Chores
187
+
188
+ * update the jsr.json ([864ab7e](https://github.com/visulima/visulima/commit/864ab7e71c4b5ae82f64792d1ae8debfea2c539b))
189
+
1
190
  ## @visulima/html [1.0.0-alpha.9](https://github.com/visulima/visulima/compare/@visulima/html@1.0.0-alpha.8...@visulima/html@1.0.0-alpha.9) (2026-04-21)
2
191
 
3
192
  ### Miscellaneous Chores
package/LICENSE.md CHANGED
@@ -127,6 +127,23 @@ Repository: sindresorhus/html-tags
127
127
 
128
128
  ---------------------------------------
129
129
 
130
+ ## is-html
131
+ License: MIT
132
+ By: Sindre Sorhus
133
+ Repository: sindresorhus/is-html
134
+
135
+ > MIT License
136
+ >
137
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
138
+ >
139
+ > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
140
+ >
141
+ > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
142
+ >
143
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
144
+
145
+ ---------------------------------------
146
+
130
147
  ## lodash-es
131
148
  License: MIT
132
149
  By: John-David Dalton, Mathias Bynens
@@ -447,40 +464,11 @@ Repository: https://github.com/alexreardon/tiny-invariant.git
447
464
  <!-- TYPE_DEPENDENCIES -->
448
465
 
449
466
  # Licenses of bundled types
450
-
451
467
  The published @visulima/html artifact additionally contains code with the following licenses:
452
468
  MIT
453
469
 
454
470
  # Bundled types:
455
-
456
- ## @jsr/std\_\_html
457
-
458
- > MIT License
459
- >
460
- > Copyright 2018-2022 the Deno authors.
461
- >
462
- > Permission is hereby granted, free of charge, to any person obtaining a copy
463
- > of this software and associated documentation files (the "Software"), to deal
464
- > in the Software without restriction, including without limitation the rights
465
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
466
- > copies of the Software, and to permit persons to whom the Software is
467
- > furnished to do so, subject to the following conditions:
468
- >
469
- > The above copyright notice and this permission notice shall be included in all
470
- > copies or substantial portions of the Software.
471
- >
472
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
473
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
474
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
475
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
476
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
477
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
478
- > SOFTWARE.
479
-
480
- ---
481
-
482
471
  ## html-entities
483
-
484
472
  License: MIT
485
473
  By: Marat Dulin
486
474
  Repository: https://github.com/mdevils/html-entities.git
@@ -505,10 +493,9 @@ Repository: https://github.com/mdevils/html-entities.git
505
493
  > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
506
494
  > THE SOFTWARE.
507
495
 
508
- ---
496
+ ---------------------------------------
509
497
 
510
498
  ## html-tags
511
-
512
499
  License: MIT
513
500
  By: Sindre Sorhus
514
501
  Repository: sindresorhus/html-tags
@@ -523,41 +510,26 @@ Repository: sindresorhus/html-tags
523
510
  >
524
511
  > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
525
512
 
526
- ---
527
-
528
- ## ranges-push
513
+ ---------------------------------------
529
514
 
515
+ ## is-html
530
516
  License: MIT
531
- By: Roy Revelt
532
- Repository: git+https://github.com/codsen/codsen.git
517
+ By: Sindre Sorhus
518
+ Repository: sindresorhus/is-html
533
519
 
534
520
  > MIT License
535
521
  >
536
- > Copyright © 2010-2025 Roy Revelt and other contributors
522
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
537
523
  >
538
- > Permission is hereby granted, free of charge, to any person obtaining
539
- > a copy of this software and associated documentation files (the
540
- > "Software"), to deal in the Software without restriction, including
541
- > without limitation the rights to use, copy, modify, merge, publish,
542
- > distribute, sublicense, and/or sell copies of the Software, and to
543
- > permit persons to whom the Software is furnished to do so, subject to
544
- > the following conditions:
524
+ > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
545
525
  >
546
- > The above copyright notice and this permission notice shall be
547
- > included in all copies or substantial portions of the Software.
526
+ > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
548
527
  >
549
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
550
- > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
551
- > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
552
- > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
553
- > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
554
- > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
555
- > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
528
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
556
529
 
557
- ---
530
+ ---------------------------------------
558
531
 
559
532
  ## string-strip-html
560
-
561
533
  License: MIT
562
534
  By: Roy Revelt
563
535
  Repository: git+https://github.com/codsen/codsen.git
package/README.md CHANGED
@@ -120,6 +120,25 @@ pnpm add @visulima/html
120
120
 
121
121
  ## Usage
122
122
 
123
+ ### Entry Points
124
+
125
+ `@visulima/html` exposes focused subpath exports so you only pay for what you import. The aggregate `@visulima/html` entry re-exports everything (including `sanitize-html`, which pulls in `htmlparser2`/`parse5`/`postcss`). If you only need escaping, import the lighter, browser-friendly subpaths instead:
126
+
127
+ | Import | Contents |
128
+ | ------------------------- | ---------------------------------------------------------- |
129
+ | `@visulima/html` | Everything (escaping, `html`/`css` tags, sanitize, strip…) |
130
+ | `@visulima/html/escape` | `escapeHtml`, `escapeCss`, `escapeJs` (no `sanitize-html`) |
131
+ | `@visulima/html/html` | `html` tag + `html.raw` / `isRawHtml` |
132
+ | `@visulima/html/css` | `css` tag + `CSSProperties` / `FlexibleCSSProperties` |
133
+ | `@visulima/html/sanitize` | `sanitizeHtml` |
134
+ | `@visulima/html/strip` | `stripHtml` + types |
135
+
136
+ ```typescript
137
+ // Lightweight, browser-safe — does not load sanitize-html
138
+ import { escapeHtml, escapeCss, escapeJs } from "@visulima/html/escape";
139
+ import { html } from "@visulima/html/html";
140
+ ```
141
+
123
142
  ### When to Use Escaping vs Sanitization vs Stripping
124
143
 
125
144
  Understanding when to use **escaping**, **sanitization**, or **stripping** is crucial for web security:
@@ -255,29 +274,54 @@ const safe = html`<div>${userInput}</div>`;
255
274
  // Result: '<div>&lt;script>alert("xss")&lt;/script></div>'
256
275
  ```
257
276
 
258
- #### Function Usage with Escaping Control
277
+ #### Composing Fragments (arrays and `html.raw`)
278
+
279
+ Interpolated **arrays** are flattened and joined with an empty string (not commas), and each element is escaped. Values wrapped with **`html.raw`** are inlined verbatim, so you can compose already-rendered fragments without double-escaping:
259
280
 
260
281
  ```typescript
261
282
  import { html } from "@visulima/html";
262
283
 
263
- // Return HTML as-is (XSS-safe, no escaping)
264
- const safeHtml = html("<div></div>", false);
265
- // Result: '<div></div>'
284
+ // Arrays are joined with "" and each element is escaped
285
+ html`<p>${["<a>", "<b>"]}</p>`;
286
+ // Result: '<p>&lt;a>&lt;b></p>'
266
287
 
267
- // Escape HTML for attributes (escapes &, <, and ")
268
- const escapedHtml = html('<script>alert("xss")</script>', true);
288
+ // Build a list: wrap each nested fragment with html.raw so it is not re-escaped
289
+ const items = ["Apples", "<script>"];
290
+ html`<ul>
291
+ ${items.map((item) => html.raw(html`<li>${item}</li>`))}
292
+ </ul>`;
293
+ // Result: '<ul><li>Apples</li><li>&lt;script></li></ul>'
294
+
295
+ // Inline trusted, pre-sanitized HTML verbatim
296
+ const trusted = html.raw("<em>bold</em>");
297
+ html`<p>${trusted}</p>`;
298
+ // Result: '<p><em>bold</em></p>'
299
+ ```
300
+
301
+ > **Security Note:** `html.raw` bypasses escaping entirely. Only ever wrap HTML you fully control or have already sanitized — wrapping untrusted input reintroduces XSS. Use `isRawHtml(value)` to detect a raw marker.
302
+
303
+ #### Function Usage with Escaping Control
304
+
305
+ ```typescript
306
+ import { html } from "@visulima/html";
307
+
308
+ // Escapes by default (escapes &, <, and ") — safe for untrusted input
309
+ const escapedHtml = html('<script>alert("xss")</script>');
269
310
  // Result: '&lt;script>alert(&quot;xss&quot;)&lt;/script>'
270
311
 
271
- // Default behavior: return as-is (XSS-safe)
272
- const defaultHtml = html("<div>Content</div>");
273
- // Result: '<div>Content</div>'
312
+ // Opt out explicitly for HTML you already trust / have sanitized
313
+ const passthrough = html("<div></div>", false);
314
+ // Result: '<div></div>'
274
315
  ```
275
316
 
317
+ > **Security note:** The `html(string)` function-call form **escapes by default**, matching the template-tag form. Pass `false` as the second argument only for HTML you fully control or have already sanitized — that disables XSS protection. For trusted fragments inside the template tag, use `html.raw(...)` instead.
318
+
276
319
  #### Use Cases
277
320
 
278
321
  - **Template Literals**: Use the template tag for HTML with automatic escaping of interpolated values
322
+ - **Fragment Composition**: Use arrays and `html.raw` to build lists and compose partials safely
279
323
  - **Dynamic Content**: Interpolated values are automatically escaped, making it safe for user-generated content
280
- - **Trusted HTML**: Use the function with `false` when you need to insert trusted HTML without escaping
324
+ - **Trusted HTML**: Use `html.raw(...)` (or the function form with `false` as the second argument) when you need to insert trusted HTML without escaping
281
325
  - **Performance**: Template tag has minimal overhead, perfect for HTML generation with automatic XSS protection
282
326
 
283
327
  ### CSS Escaping
@@ -340,6 +384,8 @@ const result = css`
340
384
  `;
341
385
  ```
342
386
 
387
+ > **Note:** The template tag collapses whitespace into single spaces to produce a one-line string, but it is quote-aware: whitespace inside single- or double-quoted values (e.g. `content: "a b"`) is preserved verbatim.
388
+
343
389
  #### Function Usage with String Input
344
390
 
345
391
  ```typescript
@@ -498,6 +544,19 @@ According to the HTML specification, a valid custom element name must:
498
544
 
499
545
  > **Note:** Custom element names are case-sensitive and must follow the naming conventions defined in the HTML specification to ensure proper browser support.
500
546
 
547
+ ### HTML Detection
548
+
549
+ The `isHtml` function checks whether a string contains HTML markup. It is a thin re-export of [`is-html`](https://github.com/sindresorhus/is-html).
550
+
551
+ ```typescript
552
+ import { isHtml } from "@visulima/html";
553
+
554
+ isHtml("<p>hello</p>"); // true
555
+ isHtml("<br/>"); // true
556
+ isHtml("just plain text"); // false
557
+ isHtml("1 < 2 and 3 > 2"); // false
558
+ ```
559
+
501
560
  ### HTML Entity Encoding & Decoding
502
561
 
503
562
  The package exports all functions from `html-entities` for encoding and decoding HTML entities.
package/dist/css.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ import { Properties } from 'csstype';
2
+ /**
3
+ * The standard CSS properties type from `csstype`.
4
+ */
5
+ type CSSProperties = Properties;
6
+ /**
7
+ * Flexible CSS properties type that allows autocomplete for property names
8
+ * while accepting string, number, null, or undefined values.
9
+ */
10
+ type FlexibleCSSProperties = { [K in keyof Properties]?: Properties[K] | string | number | null | undefined };
11
+ /**
12
+ * Template tag function for CSS that returns a minified one-line CSS string.
13
+ * Template strings are used as-is, but interpolated values are escaped by default.
14
+ * Whitespace and newlines outside of quoted strings are collapsed into single spaces;
15
+ * whitespace inside single-/double-quoted values (e.g. `content: "a b"`) is preserved.
16
+ * @param strings Template literal strings
17
+ * @param values Template literal values (escaped by default)
18
+ * @returns A minified one-line CSS string
19
+ * @example
20
+ * css`:where(.UnderlineNav-actions ul) { animation: 1ms rgh-selector-observer; }`
21
+ * // Returns: ":where(.UnderlineNav-actions ul) { animation: 1ms rgh-selector-observer; }"
22
+ */
23
+ declare function css(strings: TemplateStringsArray, ...values: unknown[]): string;
24
+ /**
25
+ * Function overload for CSS with escaping control.
26
+ * Supports both string and object inputs.
27
+ * @param value The CSS string or object to process
28
+ * @param shouldEscape If true, escapes CSS. If false, returns CSS as-is.
29
+ * @returns The processed CSS string
30
+ * @example
31
+ * css(':where(.UnderlineNav-actions ul) { animation: 1ms rgh-selector-observer; }', true)
32
+ * @example
33
+ * css({ padding: "1px" }, true)
34
+ * @example
35
+ * css({ margin: 20, padding: 10 }, false)
36
+ */
37
+ declare function css(value: string | FlexibleCSSProperties | Properties, shouldEscape?: boolean): string;
38
+ export { type CSSProperties, type FlexibleCSSProperties, css as default };
package/dist/css.js ADDED
@@ -0,0 +1,2 @@
1
+ import{escapeCss as f}from"./packem_shared/escapeCss-BtzOEJZW.js";const l=new Map,u=t=>{const e=l.get(t);if(e!==void 0)return e;let r;if(t.startsWith("--"))r=t;else{const n=t.replaceAll(/([A-Z])/g,"-$1").toLowerCase();r=n.startsWith("ms-")?`-ms-${n.slice(3)}`:n}return l.set(t,r),r},g=t=>{const e=[];return Object.entries(t).forEach(([r,n])=>{n!=null&&e.push(`${u(r)}: ${String(n)};`)}),e.join(" ")},p=new Set([" "," ",`
2
+ `,"\r","\f","\v"]),h=t=>{let e="",r,n=!1;for(let i=0;i<t.length;i+=1){const s=t[i];if(r!==void 0){e+=s,s==="\\"&&i+1<t.length?(i+=1,e+=t[i]):s===r&&(r=void 0);continue}if(s==='"'||s==="'")r=s,n=!1;else if(p.has(s)){if(n)continue;n=!0,e+=" ";continue}else n=!1;e+=s}return e.trim()};function m(t,...e){if(Array.isArray(t)&&"raw"in t){const s=t;let o=s[0]??"";for(const[c,a]of e.entries())o+=f(String(a??"")),o+=s[c+1]??"";return h(o)}const r=t,n=e[0],i=typeof r=="string"?r:g(r);return n===!0?f(i):i}export{m as default};
@@ -0,0 +1,20 @@
1
+ export { escapeCss } from '@std/html/unstable-escape-css';
2
+ export { escapeJs } from '@std/html/unstable-escape-js';
3
+ /**
4
+ * Escapes HTML special characters in a string.
5
+ * Optimized for performance with minimal allocations.
6
+ * @param value The value to escape. Will be converted to string.
7
+ * @param isAttribute If true, also escapes double quotes (for HTML attributes).
8
+ * @returns The escaped string.
9
+ * @example
10
+ * escapeHtml('<script>alert("xss")<\/script>');
11
+ * // => '&lt;script>alert("xss")&lt;/script>'
12
+ * @example
13
+ * escapeHtml('<div>', true);
14
+ * // => '&lt;div>'
15
+ * @example
16
+ * escapeHtml('value="test"', true);
17
+ * // => 'value=&quot;test&quot;'
18
+ */
19
+ declare const escapeHtml: (value: unknown, isAttribute?: boolean) => string;
20
+ export { escapeHtml };
package/dist/escape.js ADDED
@@ -0,0 +1 @@
1
+ import{default as o}from"./packem_shared/escapeHtml-CiWsYlrs.js";import{escapeCss as r}from"./packem_shared/escapeCss-BtzOEJZW.js";import{escapeJs as t}from"./packem_shared/escapeJs-C4cWI12i.js";export{r as escapeCss,o as escapeHtml,t as escapeJs};
package/dist/html.d.ts ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Branded wrapper produced by {@link html.raw}. Values wrapped in this marker are
3
+ * interpolated into the `html` tagged template (or composed via arrays) verbatim,
4
+ * without escaping. Use it only for HTML you already trust.
5
+ */
6
+ interface RawHtml {
7
+ /** Internal brand used to detect trusted fragments. */
8
+ readonly __isRawHtml: true;
9
+ /** The trusted HTML payload. */
10
+ readonly value: string;
11
+ }
12
+ /**
13
+ * Type guard that detects a {@link RawHtml} marker (including nested fragments
14
+ * produced by the `html` tag, which are themselves marked as raw).
15
+ * @param value The value to test.
16
+ * @returns `true` when the value is a trusted raw HTML fragment.
17
+ */
18
+ declare const isRawHtml: (value: unknown) => value is RawHtml;
19
+ /**
20
+ * Template tag function for HTML that escapes interpolated values to prevent XSS.
21
+ * Template strings are used as-is, but all interpolated values are HTML-escaped.
22
+ *
23
+ * Interpolated arrays are flattened and joined with an empty string (no commas), and
24
+ * values wrapped with {@link html.raw} are inlined without escaping, enabling fragment
25
+ * composition. Because the tag returns a plain string, nested fragments must be wrapped
26
+ * with `html.raw` to avoid double-escaping.
27
+ * @param strings Template literal strings
28
+ * @param values Template literal values (escaped unless wrapped with {@link html.raw})
29
+ * @returns The HTML string with interpolated values escaped
30
+ * @example
31
+ * html`<div>Hello</div>`
32
+ * // => '<div>Hello</div>'
33
+ * @example
34
+ * html`<div>${'<script>alert("xss")<\/script>'}</div>`
35
+ * // => '<div>&lt;script>alert("xss")&lt;/script></div>'
36
+ * @example
37
+ * html`<ul>${items.map((i) => html.raw(html`<li>${i}</li>`))}</ul>`
38
+ * // => '<ul><li>a</li><li>b</li></ul>'
39
+ */
40
+ declare function html(strings: TemplateStringsArray, ...values: unknown[]): string;
41
+ /**
42
+ * Function overload for HTML with explicit escaping control.
43
+ *
44
+ * Escapes by default (attribute-safe), matching the template-tag form. Pass
45
+ * `shouldEscape: false` to opt out and return the input verbatim — only do this
46
+ * for HTML you already trust or have sanitized, since it disables XSS protection.
47
+ * @param value The HTML string to process
48
+ * @param shouldEscape When `true`/omitted, escapes HTML. When `false`, returns the input as-is (unsafe for untrusted input).
49
+ * @returns The processed HTML string
50
+ * @example
51
+ * html('<script>alert("xss")<\/script>')
52
+ * // => '&lt;script>alert(&quot;xss&quot;)&lt;/script>'
53
+ * @example
54
+ * html('<div></div>', false)
55
+ * // => '<div></div>'
56
+ */
57
+ declare function html(value: string, shouldEscape?: boolean): string;
58
+ export { type RawHtml, html as default, isRawHtml };
package/dist/html.js ADDED
@@ -0,0 +1 @@
1
+ import o from"./packem_shared/escapeHtml-CiWsYlrs.js";const u="__isRawHtml",l=r=>typeof r=="object"&&r!==null&&r[u]===!0,s=r=>{if(l(r))return r.value;if(Array.isArray(r)){let e="";for(const t of r)e+=s(t);return e}return o(r,!0)};function c(r,...e){if(Array.isArray(r)&&"raw"in r){const n=r;let a=n[0]??"";for(const[f,i]of e.entries())a+=s(i),a+=n[f+1]??"";return a}const t=r;return e[0]===!1?t:o(t,!0)}c.raw=r=>({[u]:!0,value:r});export{c as default,l as isRawHtml};