@visulima/html 1.0.0-alpha.12 → 1.0.0-alpha.14

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 CHANGED
@@ -1,3 +1,13 @@
1
+ ## @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)
2
+
3
+ ## @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)
4
+
5
+ ### Miscellaneous Chores
6
+
7
+ * **html:** housekeeping cleanup ([2582bc2](https://github.com/visulima/visulima/commit/2582bc220b2eec56acf441dee4654d4b4721381e))
8
+ * **html:** upgrade packem to 2.0.0-alpha.76 ([6de95f0](https://github.com/visulima/visulima/commit/6de95f036c3277d6b65be6728406897b1ffc13ac))
9
+ * re-sort workspace package.json files via vis sort-package-json ([f625696](https://github.com/visulima/visulima/commit/f625696cfac974325774b3243e1a83c3d23acbd7))
10
+
1
11
  ## @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)
2
12
 
3
13
  ### Bug Fixes
package/LICENSE.md CHANGED
@@ -447,40 +447,11 @@ Repository: https://github.com/alexreardon/tiny-invariant.git
447
447
  <!-- TYPE_DEPENDENCIES -->
448
448
 
449
449
  # Licenses of bundled types
450
-
451
450
  The published @visulima/html artifact additionally contains code with the following licenses:
452
451
  MIT
453
452
 
454
453
  # 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
454
  ## html-entities
483
-
484
455
  License: MIT
485
456
  By: Marat Dulin
486
457
  Repository: https://github.com/mdevils/html-entities.git
@@ -505,10 +476,9 @@ Repository: https://github.com/mdevils/html-entities.git
505
476
  > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
506
477
  > THE SOFTWARE.
507
478
 
508
- ---
479
+ ---------------------------------------
509
480
 
510
481
  ## html-tags
511
-
512
482
  License: MIT
513
483
  By: Sindre Sorhus
514
484
  Repository: sindresorhus/html-tags
@@ -523,41 +493,9 @@ Repository: sindresorhus/html-tags
523
493
  >
524
494
  > 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
495
 
526
- ---
527
-
528
- ## ranges-push
529
-
530
- License: MIT
531
- By: Roy Revelt
532
- Repository: git+https://github.com/codsen/codsen.git
533
-
534
- > MIT License
535
- >
536
- > Copyright © 2010-2025 Roy Revelt and other contributors
537
- >
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:
545
- >
546
- > The above copyright notice and this permission notice shall be
547
- > included in all copies or substantial portions of the Software.
548
- >
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.
556
-
557
- ---
496
+ ---------------------------------------
558
497
 
559
498
  ## string-strip-html
560
-
561
499
  License: MIT
562
500
  By: Roy Revelt
563
501
  Repository: git+https://github.com/codsen/codsen.git
package/dist/index.d.ts CHANGED
@@ -3,15 +3,205 @@ export { type Properties as CSSProperties } from 'csstype';
3
3
  export { escapeCss } from '@std/html/unstable-escape-css';
4
4
  export { escapeJs } from '@std/html/unstable-escape-js';
5
5
  export { isValidCustomElementName } from '@std/html/unstable-is-valid-custom-element-name';
6
- export * from 'html-entities';
7
- export { default as htmlTags, voidHtmlTags } from 'html-tags';
8
6
  export { default as sanitizeHtml } from 'sanitize-html';
9
- export { type Attribute as StripHtmlAttribute, type CbObj as StripHtmlCbObj, type Opts as StripHtmlOptions, type Res as StripHtmlResult, type Tag as StripHtmlTag, stripHtml, defaults as stripHtmlDefaultOptions } from 'string-strip-html';
7
+ import { Ranges as Ranges$1 } from 'ranges-push';
8
+ /**
9
+ * Flexible CSS properties type that allows autocomplete for property names
10
+ * while accepting string, number, null, or undefined values.
11
+ */
10
12
  type FlexibleCSSProperties$1 = { [K in keyof Properties]?: Properties[K] | string | number | null | undefined };
13
+ /**
14
+ * Template tag function for CSS that returns a minified one-line CSS string.
15
+ * Template strings are used as-is, but interpolated values are escaped by default.
16
+ * All whitespace and newlines are collapsed into single spaces.
17
+ * @param strings Template literal strings
18
+ * @param values Template literal values (escaped by default)
19
+ * @returns A minified one-line CSS string
20
+ * @example
21
+ * css`:where(.UnderlineNav-actions ul) { animation: 1ms rgh-selector-observer; }`
22
+ * // Returns: ":where(.UnderlineNav-actions ul) { animation: 1ms rgh-selector-observer; }"
23
+ */
11
24
  declare function css(strings: TemplateStringsArray, ...values: unknown[]): string;
25
+ /**
26
+ * Function overload for CSS with escaping control.
27
+ * Supports both string and object inputs.
28
+ * @param value The CSS string or object to process
29
+ * @param shouldEscape If true, escapes CSS. If false, returns CSS as-is.
30
+ * @returns The processed CSS string
31
+ * @example
32
+ * css(':where(.UnderlineNav-actions ul) { animation: 1ms rgh-selector-observer; }', true)
33
+ * @example
34
+ * css({ padding: "1px" }, true)
35
+ * @example
36
+ * css({ margin: 20, padding: 10 }, false)
37
+ */
12
38
  declare function css(value: string | FlexibleCSSProperties$1 | Properties, shouldEscape?: boolean): string;
39
+ /**
40
+ * Escapes HTML special characters in a string.
41
+ * Optimized for performance with minimal allocations.
42
+ * @param value The value to escape. Will be converted to string.
43
+ * @param isAttribute If true, also escapes double quotes (for HTML attributes).
44
+ * @returns The escaped string.
45
+ * @example
46
+ * escapeHtml('<script>alert("xss")<\/script>');
47
+ * // => '&lt;script>alert("xss")&lt;/script>'
48
+ * @example
49
+ * escapeHtml('<div>', true);
50
+ * // => '&lt;div>'
51
+ * @example
52
+ * escapeHtml('value="test"', true);
53
+ * // => 'value=&quot;test&quot;'
54
+ */
13
55
  declare const escapeHtml: (value: unknown, isAttribute?: boolean) => string;
56
+ /**
57
+ * Template tag function for HTML that escapes interpolated values to prevent XSS.
58
+ * Template strings are used as-is, but all interpolated values are HTML-escaped.
59
+ * @param strings Template literal strings
60
+ * @param values Template literal values (will be escaped)
61
+ * @returns The HTML string with interpolated values escaped
62
+ * @example
63
+ * html`<div>Hello</div>`
64
+ * // => '<div>Hello</div>'
65
+ * @example
66
+ * html`<div>${'<script>alert("xss")<\/script>'}</div>`
67
+ * // => '<div>&lt;script>alert("xss")&lt;/script></div>'
68
+ */
14
69
  declare function html(strings: TemplateStringsArray, ...values: unknown[]): string;
70
+ /**
71
+ * Function overload for HTML with escaping control.
72
+ * @param value The HTML string to process
73
+ * @param shouldEscape If false/undefined, returns HTML as-is (unsafe for untrusted input). If true, escapes HTML.
74
+ * @returns The processed HTML string
75
+ * @example
76
+ * html('<div></div>', false)
77
+ * // => '<div></div>'
78
+ * @example
79
+ * html('<script>alert("xss")<\/script>', true)
80
+ * // => '&lt;script>alert("xss")&lt;/script>'
81
+ */
15
82
  declare function html(value: string, shouldEscape?: boolean): string;
83
+ type Level = 'xml' | 'html4' | 'html5' | 'all';
84
+ interface CommonOptions {
85
+ level?: Level;
86
+ }
87
+ type EncodeMode = 'specialChars' | 'nonAscii' | 'nonAsciiPrintable' | 'nonAsciiPrintableOnly' | 'extensive';
88
+ interface EncodeOptions extends CommonOptions {
89
+ mode?: EncodeMode;
90
+ numeric?: 'decimal' | 'hexadecimal';
91
+ }
92
+ type DecodeScope = 'strict' | 'body' | 'attribute';
93
+ interface DecodeOptions extends CommonOptions {
94
+ scope?: DecodeScope;
95
+ }
96
+ /** Encodes all the necessary (specified by `level`) characters in the text */
97
+ declare function encode(text: string | undefined | null, {
98
+ mode,
99
+ numeric,
100
+ level
101
+ }?: EncodeOptions): string;
102
+ /** Decodes a single entity */
103
+ declare function decodeEntity(entity: string | undefined | null, {
104
+ level
105
+ }?: CommonOptions): string;
106
+ /** Decodes all entities in the text */
107
+ declare function decode(text: string | undefined | null, {
108
+ level,
109
+ scope
110
+ }?: DecodeOptions): string;
111
+ type HtmlTags = 'a' | 'abbr' | 'address' | 'area' | 'article' | 'aside' | 'audio' | 'b' | 'base' | 'bdi' | 'bdo' | 'blockquote' | 'body' | 'br' | 'button' | 'canvas' | 'caption' | 'cite' | 'code' | 'col' | 'colgroup' | 'data' | 'datalist' | 'dd' | 'del' | 'details' | 'dfn' | 'dialog' | 'div' | 'dl' | 'dt' | 'em' | 'embed' | 'fieldset' | 'figcaption' | 'figure' | 'footer' | 'form' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'head' | 'header' | 'hgroup' | 'hr' | 'html' | 'i' | 'iframe' | 'img' | 'input' | 'ins' | 'kbd' | 'label' | 'legend' | 'li' | 'link' | 'main' | 'map' | 'mark' | 'math' | 'menu' | 'meta' | 'meter' | 'nav' | 'noscript' | 'object' | 'ol' | 'optgroup' | 'option' | 'output' | 'p' | 'picture' | 'pre' | 'progress' | 'q' | 'rp' | 'rt' | 'ruby' | 's' | 'samp' | 'script' | 'search' | 'section' | 'select' | 'selectedcontent' | 'slot' | 'small' | 'source' | 'span' | 'strong' | 'style' | 'sub' | 'summary' | 'sup' | 'svg' | 'table' | 'tbody' | 'td' | 'template' | 'textarea' | 'tfoot' | 'th' | 'thead' | 'time' | 'title' | 'tr' | 'track' | 'u' | 'ul' | 'var' | 'video' | 'wbr';
112
+ type VoidHtmlTags = 'area' | 'base' | 'br' | 'col' | 'embed' | 'hr' | 'img' | 'input' | 'link' | 'meta' | 'source' | 'track' | 'wbr';
113
+ /**
114
+ List of standard HTML tags.
115
+
116
+ @example
117
+ ```
118
+ import htmlTags from 'html-tags';
119
+
120
+ console.log(htmlTags);
121
+ //=> ['a', 'abbr', 'acronym', …]
122
+ ```
123
+ */
124
+ declare const htmlTags: readonly HtmlTags[];
125
+ /**
126
+ List of standard, self-closing HTML tags.
127
+
128
+ @example
129
+ ```
130
+ import {voidHtmlTags} from 'html-tags';
131
+
132
+ console.log(voidHtmlTags);
133
+ //=> ['area', 'base', 'br', …]
134
+ ```
135
+ */
136
+ declare const voidHtmlTags: readonly VoidHtmlTags[];
137
+ type Range = [from: number, to: number] | [from: number, to: number, whatToInsert: string | null | undefined];
138
+ type Ranges = Range[] | null;
139
+ interface Attribute {
140
+ nameStarts: number;
141
+ nameEnds: number;
142
+ equalsAt?: number;
143
+ name: string;
144
+ valueStarts?: number;
145
+ valueEnds?: number;
146
+ value?: string;
147
+ }
148
+ interface Tag {
149
+ attributes: Attribute[];
150
+ lastClosingBracketAt: number;
151
+ lastOpeningBracketAt: number;
152
+ slashPresent: number;
153
+ leftOuterWhitespace: number;
154
+ onlyPlausible: boolean;
155
+ nameStarts: number;
156
+ nameContainsLetters: boolean;
157
+ nameEnds: number;
158
+ name: string;
159
+ }
160
+ interface CbObj {
161
+ tag: Tag;
162
+ deleteFrom: null | number;
163
+ deleteTo: null | number;
164
+ insert: null | undefined | string;
165
+ rangesArr: Ranges$1;
166
+ proposedReturn: Range | null;
167
+ }
168
+ interface Opts {
169
+ ignoreTags: string[];
170
+ ignoreTagsWithTheirContents: string[];
171
+ onlyStripTags: string[];
172
+ stripTogetherWithTheirContents: string[];
173
+ skipHtmlDecoding: boolean;
174
+ trimOnlySpaces: boolean;
175
+ stripRecognisedHTMLOnly: boolean;
176
+ dumpLinkHrefsNearby: {
177
+ enabled?: boolean;
178
+ putOnNewLine?: boolean;
179
+ wrapHeads?: string;
180
+ wrapTails?: string;
181
+ };
182
+ ignoreIndentations: boolean;
183
+ cb: null | ((cbObj: CbObj) => void);
184
+ reportProgressFunc: null | ((percDone: number) => void);
185
+ reportProgressFuncFrom: number;
186
+ reportProgressFuncTo: number;
187
+ }
188
+ declare const defaults: Opts;
189
+ interface Res {
190
+ log: {
191
+ timeTakenInMilliseconds: number;
192
+ };
193
+ result: string;
194
+ ranges: Ranges;
195
+ allTagLocations: [number, number][];
196
+ filteredTagLocations: [number, number][];
197
+ }
198
+ /**
199
+ * Strips HTML tags from strings. No parser, accepts mixed sources.
200
+ */
201
+ declare function stripHtml(str: string, opts?: Partial<Opts>): Res;
202
+ /**
203
+ * Flexible CSS properties type that allows autocomplete for property names
204
+ * while accepting string, number, null, or undefined values.
205
+ */
16
206
  type FlexibleCSSProperties = { [K in keyof Properties]?: Properties[K] | string | number | null | undefined };
17
- export { FlexibleCSSProperties, css, escapeHtml, html };
207
+ export { DecodeOptions, DecodeScope, EncodeMode, EncodeOptions, FlexibleCSSProperties, Level, type Attribute as StripHtmlAttribute, type CbObj as StripHtmlCbObj, type Opts as StripHtmlOptions, type Res as StripHtmlResult, type Tag as StripHtmlTag, css, decode, decodeEntity, encode, escapeHtml, html, htmlTags, stripHtml, defaults as stripHtmlDefaultOptions, voidHtmlTags };
package/package.json CHANGED
@@ -1,37 +1,42 @@
1
1
  {
2
2
  "name": "@visulima/html",
3
- "version": "1.0.0-alpha.12",
3
+ "version": "1.0.0-alpha.14",
4
4
  "description": "Functions for HTML, such as escaping or unescaping HTML entities",
5
5
  "keywords": [
6
- "visulima",
7
- "html",
6
+ "css",
7
+ "custom-element",
8
+ "entities",
8
9
  "escape",
9
- "escaping",
10
- "escape-html",
11
10
  "escape-css",
11
+ "escape-html",
12
12
  "escape-js",
13
- "sanitize",
13
+ "escaping",
14
+ "html",
15
+ "html-entities",
16
+ "javascript",
17
+ "js",
14
18
  "sanitization",
19
+ "sanitize",
15
20
  "sanitize-html",
21
+ "security",
16
22
  "strip",
17
23
  "strip-html",
18
- "xss",
19
- "security",
20
- "entities",
21
- "html-entities",
22
- "css",
23
- "javascript",
24
- "js",
25
24
  "template",
26
25
  "template-tag",
26
+ "typescript",
27
27
  "validation",
28
- "custom-element",
29
- "typescript"
28
+ "visulima",
29
+ "xss"
30
30
  ],
31
31
  "homepage": "https://visulima.com/packages/html",
32
32
  "bugs": {
33
33
  "url": "https://github.com/visulima/visulima/issues"
34
34
  },
35
+ "license": "MIT",
36
+ "author": {
37
+ "name": "Daniel Bannert",
38
+ "email": "d.bannert@anolilab.de"
39
+ },
35
40
  "repository": {
36
41
  "type": "git",
37
42
  "url": "git+https://github.com/visulima/visulima.git",
@@ -47,13 +52,13 @@
47
52
  "url": "https://anolilab.com/support"
48
53
  }
49
54
  ],
50
- "license": "MIT",
51
- "author": {
52
- "name": "Daniel Bannert",
53
- "email": "d.bannert@anolilab.de"
54
- },
55
- "sideEffects": false,
55
+ "files": [
56
+ "dist",
57
+ "README.md",
58
+ "CHANGELOG.md"
59
+ ],
56
60
  "type": "module",
61
+ "sideEffects": false,
57
62
  "exports": {
58
63
  ".": {
59
64
  "types": "./dist/index.d.ts",
@@ -61,20 +66,15 @@
61
66
  },
62
67
  "./package.json": "./package.json"
63
68
  },
64
- "files": [
65
- "dist",
66
- "README.md",
67
- "CHANGELOG.md"
68
- ],
69
+ "publishConfig": {
70
+ "access": "public",
71
+ "provenance": true
72
+ },
69
73
  "dependencies": {
70
74
  "csstype": "3.2.3",
71
- "sanitize-html": "2.17.3"
75
+ "sanitize-html": "2.17.4"
72
76
  },
73
77
  "engines": {
74
78
  "node": "^22.14.0 || >=24.10.0"
75
- },
76
- "publishConfig": {
77
- "access": "public",
78
- "provenance": true
79
79
  }
80
80
  }