@visulima/html 1.0.0-alpha.2 → 1.0.0-alpha.20
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 +166 -0
- package/LICENSE.md +50 -93
- package/README.md +69 -10
- package/dist/css.d.ts +38 -0
- package/dist/css.js +2 -0
- package/dist/escape.d.ts +20 -0
- package/dist/escape.js +1 -0
- package/dist/html.d.ts +58 -0
- package/dist/html.js +1 -0
- package/dist/index.d.ts +33 -383
- package/dist/index.js +1 -11
- package/dist/packem_shared/_commonjsHelpers-CWAkuNXM.js +1 -0
- package/dist/packem_shared/decode-DPHm0sXO.js +1 -0
- package/dist/packem_shared/escapeCss-BtzOEJZW.js +1 -0
- package/dist/packem_shared/escapeHtml-CiWsYlrs.js +1 -0
- package/dist/packem_shared/escapeJs-C4cWI12i.js +1 -0
- package/dist/packem_shared/htmlTags-BWCBwnc_.js +1 -0
- package/dist/packem_shared/isHtml-B7-ANsKf.js +1 -0
- package/dist/packem_shared/isValidCustomElementName-BGH0NihB.js +1 -0
- package/dist/packem_shared/stripHtml-BJMSstzr.js +53 -0
- package/dist/packem_shared/voidHtmlTags-Cb8VOd4K.js +1 -0
- package/dist/sanitize.d.ts +1 -0
- package/dist/sanitize.js +1 -0
- package/dist/strip.d.ts +67 -0
- package/dist/strip.js +1 -0
- package/package.json +39 -67
- package/dist/packem_shared/_commonjsHelpers-B85MJLTf.js +0 -5
- package/dist/packem_shared/css-eLBFmNQq.js +0 -32
- package/dist/packem_shared/encode-jgknlkNE.js +0 -195
- package/dist/packem_shared/escapeCss-gSWL0xVj.js +0 -17
- package/dist/packem_shared/escapeHtml-Cztfu84O.js +0 -18
- package/dist/packem_shared/escapeJs-8hCFOEdN.js +0 -6
- package/dist/packem_shared/html-B-Khp3Xj.js +0 -24
- package/dist/packem_shared/htmlTags-CnZinEi6.js +0 -132
- package/dist/packem_shared/isValidCustomElementName-Czb_BiVq.js +0 -16
- package/dist/packem_shared/stripHtmlDefaultOptions-Dj_FII9M.js +0 -1331
- package/dist/packem_shared/voidHtmlTags-Db3mUI2j.js +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,169 @@
|
|
|
1
|
+
## @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)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **html:** add subpaths, html fragment composition, css quote-safe minify ([4e13cc9](https://github.com/visulima/visulima/commit/4e13cc90c79ed9629141d12251b5050bf29946a4))
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **html:** escape by default in html overload ([3a3cbe2](https://github.com/visulima/visulima/commit/3a3cbe29f448782a64580d05d81f26b4a5632aad))
|
|
10
|
+
|
|
11
|
+
### Miscellaneous Chores
|
|
12
|
+
|
|
13
|
+
* **html:** apply safe eslint formatting ([f12769c](https://github.com/visulima/visulima/commit/f12769c6ae6328499d933a00dd2a91d882cdb2dd))
|
|
14
|
+
|
|
15
|
+
### Tests
|
|
16
|
+
|
|
17
|
+
* **html:** restore tagged-template inputs mangled by eslint --fix ([430260d](https://github.com/visulima/visulima/commit/430260def28f9dce7d84086f58e7bba2657e098a))
|
|
18
|
+
|
|
19
|
+
### Build System
|
|
20
|
+
|
|
21
|
+
* regenerate bundled-license manifests and types ordering ([af26588](https://github.com/visulima/visulima/commit/af26588d75aaa937fd4862800560bd4070a4878c))
|
|
22
|
+
|
|
23
|
+
## @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)
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **html:** 1 bug fix ([a300939](https://github.com/visulima/visulima/commit/a300939fb1689808be2dd972364740d925d3789b))
|
|
28
|
+
|
|
29
|
+
### Miscellaneous Chores
|
|
30
|
+
|
|
31
|
+
* apply eslint + prettier autofixes across packages ([c1bb784](https://github.com/visulima/visulima/commit/c1bb7848a0d93d0dfe2960c77e3cda22239c79a0))
|
|
32
|
+
|
|
33
|
+
### Tests
|
|
34
|
+
|
|
35
|
+
* **html:** cover vendor-prefix and tagged-template fallback branches ([8db69d5](https://github.com/visulima/visulima/commit/8db69d5da388a55e2550ed5bb5ef4ae651bc21f8))
|
|
36
|
+
|
|
37
|
+
## @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)
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **storage-client:** percent-encode user fields in defaultFingerprint ([7c78a0f](https://github.com/visulima/visulima/commit/7c78a0f9512e2a673b941d80839e9f1e86b7b5d0))
|
|
42
|
+
|
|
43
|
+
## @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)
|
|
44
|
+
|
|
45
|
+
## @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)
|
|
46
|
+
|
|
47
|
+
### Miscellaneous Chores
|
|
48
|
+
|
|
49
|
+
* sorted package.json ([b47c545](https://github.com/visulima/visulima/commit/b47c545591600fdab17d5cd3a3fbc68b61e199da))
|
|
50
|
+
|
|
51
|
+
## @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)
|
|
52
|
+
|
|
53
|
+
### Miscellaneous Chores
|
|
54
|
+
|
|
55
|
+
* **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))
|
|
56
|
+
* **repo:** sort package.json keys across all packages ([e1fd9ab](https://github.com/visulima/visulima/commit/e1fd9ab467ef96a98c777da1572ff6a50fcf7e71))
|
|
57
|
+
|
|
58
|
+
### Tests
|
|
59
|
+
|
|
60
|
+
* **repo:** add dist runtime + types integration tests ([32ee300](https://github.com/visulima/visulima/commit/32ee300b7184117a0ddf9f9d390f75f8932d5ed9))
|
|
61
|
+
|
|
62
|
+
## @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)
|
|
63
|
+
|
|
64
|
+
## @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)
|
|
65
|
+
|
|
66
|
+
### Miscellaneous Chores
|
|
67
|
+
|
|
68
|
+
* **html:** housekeeping cleanup ([2582bc2](https://github.com/visulima/visulima/commit/2582bc220b2eec56acf441dee4654d4b4721381e))
|
|
69
|
+
* **html:** upgrade packem to 2.0.0-alpha.76 ([6de95f0](https://github.com/visulima/visulima/commit/6de95f036c3277d6b65be6728406897b1ffc13ac))
|
|
70
|
+
* re-sort workspace package.json files via vis sort-package-json ([f625696](https://github.com/visulima/visulima/commit/f625696cfac974325774b3243e1a83c3d23acbd7))
|
|
71
|
+
|
|
72
|
+
## @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)
|
|
73
|
+
|
|
74
|
+
### Bug Fixes
|
|
75
|
+
|
|
76
|
+
* 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))
|
|
77
|
+
|
|
78
|
+
## @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)
|
|
79
|
+
|
|
80
|
+
### Miscellaneous Chores
|
|
81
|
+
|
|
82
|
+
* jsr.json update and lock file ([73fce38](https://github.com/visulima/visulima/commit/73fce38c7cb4603f3fffb88609b1b18e2feb4937))
|
|
83
|
+
|
|
84
|
+
## @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)
|
|
85
|
+
|
|
86
|
+
### Miscellaneous Chores
|
|
87
|
+
|
|
88
|
+
* update the jsr.json ([864ab7e](https://github.com/visulima/visulima/commit/864ab7e71c4b5ae82f64792d1ae8debfea2c539b))
|
|
89
|
+
|
|
90
|
+
## @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)
|
|
91
|
+
|
|
92
|
+
### Miscellaneous Chores
|
|
93
|
+
|
|
94
|
+
* bump engines.node to ^22.14.0 || >=24.10.0 ([c3d0931](https://github.com/visulima/visulima/commit/c3d0931d1504e4f21ebf50ea680cfa7ce4ba15ce))
|
|
95
|
+
* fixed jsr.json ([5d85e51](https://github.com/visulima/visulima/commit/5d85e5179de38e284ec433b14d77c71a1619c8d6))
|
|
96
|
+
* **html:** apply pending changes ([6a79de6](https://github.com/visulima/visulima/commit/6a79de644efc546fae8d67be6208196ed3fd4ac3))
|
|
97
|
+
* **html:** apply pending lint and source updates ([71d3af2](https://github.com/visulima/visulima/commit/71d3af23f31b5eaac262ac5231a73d9ca82ddc82))
|
|
98
|
+
|
|
99
|
+
## @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)
|
|
100
|
+
|
|
101
|
+
### Bug Fixes
|
|
102
|
+
|
|
103
|
+
* **data-manipulation:** resolve eslint and type-safety issues ([f1682c2](https://github.com/visulima/visulima/commit/f1682c2611cbcc6c85d4bbea520d43464b42e7ee))
|
|
104
|
+
* **html:** resolve eslint and formatting issues ([e455a78](https://github.com/visulima/visulima/commit/e455a78dc8464049c3e557cba096fc3694de8812))
|
|
105
|
+
|
|
106
|
+
## @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)
|
|
107
|
+
|
|
108
|
+
### Bug Fixes
|
|
109
|
+
|
|
110
|
+
* **html:** suppress no-base-to-string for intentional String() coercions ([258b6c0](https://github.com/visulima/visulima/commit/258b6c000d7b06e0c216a0eeb3d729d3009fee3a))
|
|
111
|
+
|
|
112
|
+
### Miscellaneous Chores
|
|
113
|
+
|
|
114
|
+
* **data-manipulation:** remove empty dependency objects from package.json ([c0e8f76](https://github.com/visulima/visulima/commit/c0e8f7689a2da413f771494f6ecb07babc4b5e06))
|
|
115
|
+
* **html:** add tsconfig.eslint.json for type-aware linting ([1661c2c](https://github.com/visulima/visulima/commit/1661c2c215e768e9d814ac00facb41d10d45276e))
|
|
116
|
+
* **html:** apply auto-fix formatting ([9491631](https://github.com/visulima/visulima/commit/9491631e4a188a6ecdb36a9afc9bd31393190390))
|
|
117
|
+
* **html:** apply prettier formatting ([2c8e184](https://github.com/visulima/visulima/commit/2c8e184252d348986e1415f17f3c713f8cbd5ca0))
|
|
118
|
+
* **html:** migrate .prettierrc.cjs to prettier.config.js ([63aa430](https://github.com/visulima/visulima/commit/63aa430c8ad29de43c67a65fc3022834389484f0))
|
|
119
|
+
|
|
120
|
+
## @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)
|
|
121
|
+
|
|
122
|
+
### Features
|
|
123
|
+
|
|
124
|
+
* **web:** auto-generate packages page from workspace metadata ([623e520](https://github.com/visulima/visulima/commit/623e5207693a7fe720f5f2f179593a3654c880e3))
|
|
125
|
+
|
|
126
|
+
## @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)
|
|
127
|
+
|
|
128
|
+
### Bug Fixes
|
|
129
|
+
|
|
130
|
+
* move JSR dependencies from catalog to package.json ([579468b](https://github.com/visulima/visulima/commit/579468bc7c1e0980b8dae413fa44cf56b9073b6f))
|
|
131
|
+
* **web:** improve build setup with incremental stats caching and prod install ([fe33e75](https://github.com/visulima/visulima/commit/fe33e75827586779b4b3a0c6d57b39f889ee6207))
|
|
132
|
+
|
|
133
|
+
### Miscellaneous Chores
|
|
134
|
+
|
|
135
|
+
* **html:** migrate deps to pnpm catalogs ([18e9713](https://github.com/visulima/visulima/commit/18e97133d72cd7f9ca1fb0636790f8f9aa9dbe81))
|
|
136
|
+
* **html:** update dependencies ([2d72396](https://github.com/visulima/visulima/commit/2d72396550bbc39e24624aed55a32e4c93d51aec))
|
|
137
|
+
* visulima website ([#591](https://github.com/visulima/visulima/issues/591)) ([59ab2e2](https://github.com/visulima/visulima/commit/59ab2e2befb03e51cd2088956f83d9b87de6d033))
|
|
138
|
+
|
|
139
|
+
## @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)
|
|
140
|
+
|
|
141
|
+
### Bug Fixes
|
|
142
|
+
|
|
143
|
+
* **html:** update packem to 2.0.0-alpha.54 ([ad2ebac](https://github.com/visulima/visulima/commit/ad2ebac46d076866b9b9653948273935013b5724))
|
|
144
|
+
|
|
145
|
+
### Documentation
|
|
146
|
+
|
|
147
|
+
* **humanizer,html,iso-locale,package,tsconfig:** add comprehensive Fumadocs documentation ([19781ce](https://github.com/visulima/visulima/commit/19781ce5d27605971a9f2fdf0a99863effd98091))
|
|
148
|
+
|
|
149
|
+
### Miscellaneous Chores
|
|
150
|
+
|
|
151
|
+
* **data-manipulation:** update dependencies ([49458ab](https://github.com/visulima/visulima/commit/49458ab8f8e17d875840b1b4fe8b5efe12ff3513))
|
|
152
|
+
* **html:** update dependencies ([bfcd109](https://github.com/visulima/visulima/commit/bfcd1097249502c8a0219a5008941d854bf01c5d))
|
|
153
|
+
* **html:** update dependencies ([2d1ca24](https://github.com/visulima/visulima/commit/2d1ca2493ab702a4210f0f60acd25cbefe6a1699))
|
|
154
|
+
* update lock file maintenance ([d83e716](https://github.com/visulima/visulima/commit/d83e71697b75d24704185b66bb521a934d2db02d))
|
|
155
|
+
* year update ([47f4105](https://github.com/visulima/visulima/commit/47f410596ce7190cfea36a073db32e0cec50bbcd))
|
|
156
|
+
|
|
157
|
+
## @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)
|
|
158
|
+
|
|
159
|
+
### Bug Fixes
|
|
160
|
+
|
|
161
|
+
* **html:** update package files ([6b8982d](https://github.com/visulima/visulima/commit/6b8982d2eb7f3c6998a33f7c70a828ac1d3d85ab))
|
|
162
|
+
|
|
163
|
+
### Styles
|
|
164
|
+
|
|
165
|
+
* cs fix ([dbe0cfd](https://github.com/visulima/visulima/commit/dbe0cfd27507cd145d4635482533bec2bbc42a32))
|
|
166
|
+
|
|
1
167
|
## @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)
|
|
2
168
|
|
|
3
169
|
### Features
|
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 visulima
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -23,13 +23,11 @@ SOFTWARE.
|
|
|
23
23
|
<!-- DEPENDENCIES -->
|
|
24
24
|
|
|
25
25
|
# Licenses of bundled dependencies
|
|
26
|
-
|
|
27
26
|
The published @visulima/html artifact additionally contains code with the following licenses:
|
|
28
27
|
MIT
|
|
29
28
|
|
|
30
29
|
# Bundled dependencies:
|
|
31
|
-
|
|
32
|
-
## @jsr/std\_\_html
|
|
30
|
+
## @jsr/std__html
|
|
33
31
|
|
|
34
32
|
> MIT License
|
|
35
33
|
>
|
|
@@ -53,10 +51,9 @@ MIT
|
|
|
53
51
|
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
54
52
|
> SOFTWARE.
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
---------------------------------------
|
|
57
55
|
|
|
58
56
|
## codsen-utils
|
|
59
|
-
|
|
60
57
|
License: MIT
|
|
61
58
|
By: Roy Revelt
|
|
62
59
|
Repository: git+https://github.com/codsen/codsen.git
|
|
@@ -84,10 +81,9 @@ Repository: git+https://github.com/codsen/codsen.git
|
|
|
84
81
|
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
85
82
|
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
86
83
|
|
|
87
|
-
|
|
84
|
+
---------------------------------------
|
|
88
85
|
|
|
89
86
|
## html-entities
|
|
90
|
-
|
|
91
87
|
License: MIT
|
|
92
88
|
By: Marat Dulin
|
|
93
89
|
Repository: https://github.com/mdevils/html-entities.git
|
|
@@ -112,10 +108,9 @@ Repository: https://github.com/mdevils/html-entities.git
|
|
|
112
108
|
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
113
109
|
> THE SOFTWARE.
|
|
114
110
|
|
|
115
|
-
|
|
111
|
+
---------------------------------------
|
|
116
112
|
|
|
117
113
|
## html-tags
|
|
118
|
-
|
|
119
114
|
License: MIT
|
|
120
115
|
By: Sindre Sorhus
|
|
121
116
|
Repository: sindresorhus/html-tags
|
|
@@ -130,10 +125,26 @@ Repository: sindresorhus/html-tags
|
|
|
130
125
|
>
|
|
131
126
|
> 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.
|
|
132
127
|
|
|
133
|
-
|
|
128
|
+
---------------------------------------
|
|
134
129
|
|
|
135
|
-
##
|
|
130
|
+
## is-html
|
|
131
|
+
License: MIT
|
|
132
|
+
By: Sindre Sorhus
|
|
133
|
+
Repository: sindresorhus/is-html
|
|
136
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
|
+
|
|
147
|
+
## lodash-es
|
|
137
148
|
License: MIT
|
|
138
149
|
By: John-David Dalton, Mathias Bynens
|
|
139
150
|
Repository: lodash/lodash
|
|
@@ -186,10 +197,9 @@ Repository: lodash/lodash
|
|
|
186
197
|
> licenses; we recommend you read them, as their terms may differ from the
|
|
187
198
|
> terms above.
|
|
188
199
|
|
|
189
|
-
|
|
200
|
+
---------------------------------------
|
|
190
201
|
|
|
191
202
|
## ranges-apply
|
|
192
|
-
|
|
193
203
|
License: MIT
|
|
194
204
|
By: Roy Revelt
|
|
195
205
|
Repository: git+https://github.com/codsen/codsen.git
|
|
@@ -217,10 +227,9 @@ Repository: git+https://github.com/codsen/codsen.git
|
|
|
217
227
|
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
218
228
|
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
219
229
|
|
|
220
|
-
|
|
230
|
+
---------------------------------------
|
|
221
231
|
|
|
222
232
|
## ranges-merge
|
|
223
|
-
|
|
224
233
|
License: MIT
|
|
225
234
|
By: Roy Revelt
|
|
226
235
|
Repository: git+https://github.com/codsen/codsen.git
|
|
@@ -248,10 +257,9 @@ Repository: git+https://github.com/codsen/codsen.git
|
|
|
248
257
|
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
249
258
|
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
250
259
|
|
|
251
|
-
|
|
260
|
+
---------------------------------------
|
|
252
261
|
|
|
253
262
|
## ranges-push
|
|
254
|
-
|
|
255
263
|
License: MIT
|
|
256
264
|
By: Roy Revelt
|
|
257
265
|
Repository: git+https://github.com/codsen/codsen.git
|
|
@@ -279,10 +287,9 @@ Repository: git+https://github.com/codsen/codsen.git
|
|
|
279
287
|
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
280
288
|
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
281
289
|
|
|
282
|
-
|
|
290
|
+
---------------------------------------
|
|
283
291
|
|
|
284
292
|
## ranges-sort
|
|
285
|
-
|
|
286
293
|
License: MIT
|
|
287
294
|
By: Roy Revelt
|
|
288
295
|
Repository: git+https://github.com/codsen/codsen.git
|
|
@@ -310,34 +317,32 @@ Repository: git+https://github.com/codsen/codsen.git
|
|
|
310
317
|
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
311
318
|
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
312
319
|
|
|
313
|
-
|
|
320
|
+
---------------------------------------
|
|
314
321
|
|
|
315
322
|
## rfdc
|
|
316
|
-
|
|
317
323
|
License: MIT
|
|
318
324
|
By: David Mark Clements
|
|
319
325
|
Repository: git+https://github.com/davidmarkclements/rfdc.git
|
|
320
326
|
|
|
321
327
|
> Copyright 2019 "David Mark Clements <david.mark.clements@gmail.com>"
|
|
322
328
|
>
|
|
323
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
324
|
-
> documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
325
|
-
> the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
329
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
330
|
+
> documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
331
|
+
> the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
326
332
|
> to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
327
333
|
>
|
|
328
|
-
> The above copyright notice and this permission notice shall be included in all copies or substantial portions
|
|
334
|
+
> The above copyright notice and this permission notice shall be included in all copies or substantial portions
|
|
329
335
|
> of the Software.
|
|
330
336
|
>
|
|
331
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
332
|
-
> TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
333
|
-
> THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
334
|
-
> CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
337
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
338
|
+
> TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
339
|
+
> THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
340
|
+
> CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
335
341
|
> IN THE SOFTWARE.
|
|
336
342
|
|
|
337
|
-
|
|
343
|
+
---------------------------------------
|
|
338
344
|
|
|
339
345
|
## string-collapse-leading-whitespace
|
|
340
|
-
|
|
341
346
|
License: MIT
|
|
342
347
|
By: Roy Revelt
|
|
343
348
|
Repository: git+https://github.com/codsen/codsen.git
|
|
@@ -365,10 +370,9 @@ Repository: git+https://github.com/codsen/codsen.git
|
|
|
365
370
|
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
366
371
|
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
367
372
|
|
|
368
|
-
|
|
373
|
+
---------------------------------------
|
|
369
374
|
|
|
370
375
|
## string-left-right
|
|
371
|
-
|
|
372
376
|
License: MIT
|
|
373
377
|
By: Roy Revelt
|
|
374
378
|
Repository: git+https://github.com/codsen/codsen.git
|
|
@@ -396,10 +400,9 @@ Repository: git+https://github.com/codsen/codsen.git
|
|
|
396
400
|
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
397
401
|
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
398
402
|
|
|
399
|
-
|
|
403
|
+
---------------------------------------
|
|
400
404
|
|
|
401
405
|
## string-strip-html
|
|
402
|
-
|
|
403
406
|
License: MIT
|
|
404
407
|
By: Roy Revelt
|
|
405
408
|
Repository: git+https://github.com/codsen/codsen.git
|
|
@@ -427,10 +430,9 @@ Repository: git+https://github.com/codsen/codsen.git
|
|
|
427
430
|
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
428
431
|
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
429
432
|
|
|
430
|
-
|
|
433
|
+
---------------------------------------
|
|
431
434
|
|
|
432
435
|
## tiny-invariant
|
|
433
|
-
|
|
434
436
|
License: MIT
|
|
435
437
|
By: Alex Reardon
|
|
436
438
|
Repository: https://github.com/alexreardon/tiny-invariant.git
|
|
@@ -462,40 +464,11 @@ Repository: https://github.com/alexreardon/tiny-invariant.git
|
|
|
462
464
|
<!-- TYPE_DEPENDENCIES -->
|
|
463
465
|
|
|
464
466
|
# Licenses of bundled types
|
|
465
|
-
|
|
466
467
|
The published @visulima/html artifact additionally contains code with the following licenses:
|
|
467
468
|
MIT
|
|
468
469
|
|
|
469
470
|
# Bundled types:
|
|
470
|
-
|
|
471
|
-
## @jsr/std\_\_html
|
|
472
|
-
|
|
473
|
-
> MIT License
|
|
474
|
-
>
|
|
475
|
-
> Copyright 2018-2022 the Deno authors.
|
|
476
|
-
>
|
|
477
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
478
|
-
> of this software and associated documentation files (the "Software"), to deal
|
|
479
|
-
> in the Software without restriction, including without limitation the rights
|
|
480
|
-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
481
|
-
> copies of the Software, and to permit persons to whom the Software is
|
|
482
|
-
> furnished to do so, subject to the following conditions:
|
|
483
|
-
>
|
|
484
|
-
> The above copyright notice and this permission notice shall be included in all
|
|
485
|
-
> copies or substantial portions of the Software.
|
|
486
|
-
>
|
|
487
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
488
|
-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
489
|
-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
490
|
-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
491
|
-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
492
|
-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
493
|
-
> SOFTWARE.
|
|
494
|
-
|
|
495
|
-
---
|
|
496
|
-
|
|
497
471
|
## html-entities
|
|
498
|
-
|
|
499
472
|
License: MIT
|
|
500
473
|
By: Marat Dulin
|
|
501
474
|
Repository: https://github.com/mdevils/html-entities.git
|
|
@@ -520,10 +493,9 @@ Repository: https://github.com/mdevils/html-entities.git
|
|
|
520
493
|
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
521
494
|
> THE SOFTWARE.
|
|
522
495
|
|
|
523
|
-
|
|
496
|
+
---------------------------------------
|
|
524
497
|
|
|
525
498
|
## html-tags
|
|
526
|
-
|
|
527
499
|
License: MIT
|
|
528
500
|
By: Sindre Sorhus
|
|
529
501
|
Repository: sindresorhus/html-tags
|
|
@@ -538,41 +510,26 @@ Repository: sindresorhus/html-tags
|
|
|
538
510
|
>
|
|
539
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.
|
|
540
512
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
## ranges-push
|
|
513
|
+
---------------------------------------
|
|
544
514
|
|
|
515
|
+
## is-html
|
|
545
516
|
License: MIT
|
|
546
|
-
By:
|
|
547
|
-
Repository:
|
|
517
|
+
By: Sindre Sorhus
|
|
518
|
+
Repository: sindresorhus/is-html
|
|
548
519
|
|
|
549
520
|
> MIT License
|
|
550
521
|
>
|
|
551
|
-
> Copyright
|
|
522
|
+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
552
523
|
>
|
|
553
|
-
> Permission is hereby granted, free of charge, to any person obtaining
|
|
554
|
-
> a copy of this software and associated documentation files (the
|
|
555
|
-
> "Software"), to deal in the Software without restriction, including
|
|
556
|
-
> without limitation the rights to use, copy, modify, merge, publish,
|
|
557
|
-
> distribute, sublicense, and/or sell copies of the Software, and to
|
|
558
|
-
> permit persons to whom the Software is furnished to do so, subject to
|
|
559
|
-
> 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:
|
|
560
525
|
>
|
|
561
|
-
> The above copyright notice and this permission notice shall be
|
|
562
|
-
> 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.
|
|
563
527
|
>
|
|
564
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
565
|
-
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
566
|
-
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
567
|
-
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
568
|
-
> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
569
|
-
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
570
|
-
> 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.
|
|
571
529
|
|
|
572
|
-
|
|
530
|
+
---------------------------------------
|
|
573
531
|
|
|
574
532
|
## string-strip-html
|
|
575
|
-
|
|
576
533
|
License: MIT
|
|
577
534
|
By: Roy Revelt
|
|
578
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><script>alert("xss")</script></div>'
|
|
256
275
|
```
|
|
257
276
|
|
|
258
|
-
####
|
|
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
|
-
//
|
|
264
|
-
|
|
265
|
-
// Result: '<
|
|
284
|
+
// Arrays are joined with "" and each element is escaped
|
|
285
|
+
html`<p>${["<a>", "<b>"]}</p>`;
|
|
286
|
+
// Result: '<p><a><b></p>'
|
|
266
287
|
|
|
267
|
-
//
|
|
268
|
-
const
|
|
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><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: '<script>alert("xss")</script>'
|
|
270
311
|
|
|
271
|
-
//
|
|
272
|
-
const
|
|
273
|
-
// Result: '<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};
|