@dvirus-js/utils 0.0.15 → 0.0.16
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 +10 -0
- package/package.json +1 -1
- package/lib/html-text-parser___.d.ts +0 -59
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 0.0.15 (2026-05-31)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- http ([936f51a](https://github.com/Dvirus97/dvirus-js/commit/936f51a))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Dvir Cohen
|
|
10
|
+
|
|
1
11
|
## 0.0.14 (2026-05-31)
|
|
2
12
|
|
|
3
13
|
This was a version bump only for utils to align it with other projects, there were no code changes.
|
package/package.json
CHANGED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a parsed segment of rich text with active style classes.
|
|
3
|
-
*/
|
|
4
|
-
export interface TextSegment {
|
|
5
|
-
/** The text content of the segment (e.g. 'Hello world') */
|
|
6
|
-
text: string;
|
|
7
|
-
/** Comma-separated list of active tag names (e.g. 'b,i') */
|
|
8
|
-
tagNames: string;
|
|
9
|
-
/** Array of active tag names (e.g. ['b', 'i']) */
|
|
10
|
-
tagNamesList: string[];
|
|
11
|
-
/** CSS style string (e.g. 'font-weight: bold; font-style: italic') */
|
|
12
|
-
style: string;
|
|
13
|
-
/** Optional style object for easier programmatic access (e.g. { 'font-weight': 'bold', 'font-style': 'italic' }) */
|
|
14
|
-
styleObject?: Record<string, string>;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Parses a string containing supported inline tags into typed segments.
|
|
18
|
-
* Supports nested tags. All other content is treated as plain text.
|
|
19
|
-
*
|
|
20
|
-
* Supported tags (add more in `RICH_TEXT_TAGS`):
|
|
21
|
-
* `<b>` / `<strong>`, `<i>` / `<em>`, `<u>`, `<s>`, `<mark>`, `<small>`,
|
|
22
|
-
* `<h1>` - `<h6>`, `<code>`, `<p>`, `<div>`
|
|
23
|
-
*
|
|
24
|
-
* Supported self-closing tags (add more in `SELF_CLOSING_TAGS`):
|
|
25
|
-
* `<br/>`
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* parseRichText('Hello <b>world</b>!')
|
|
29
|
-
* // [
|
|
30
|
-
* // { text: 'Hello ', styles: [], cssClass: '' },
|
|
31
|
-
* // { text: 'world', styles: ['bold'] },
|
|
32
|
-
* // { text: '!', styles: [] },
|
|
33
|
-
* // ]
|
|
34
|
-
*/
|
|
35
|
-
export declare function parseRichText(input: string): TextSegment[];
|
|
36
|
-
export declare namespace parseRichText {
|
|
37
|
-
var addTag: typeof addRichTextTag;
|
|
38
|
-
var addSelfClosingTag: typeof import("./html-text-parser___").addSelfClosingTag;
|
|
39
|
-
}
|
|
40
|
-
export declare function addRichTextTag(tag: {
|
|
41
|
-
tag: string;
|
|
42
|
-
tagName?: string;
|
|
43
|
-
style?: Record<string, string>;
|
|
44
|
-
}): void;
|
|
45
|
-
export declare function addRichTextTag(tags: {
|
|
46
|
-
tag: string;
|
|
47
|
-
tagName?: string;
|
|
48
|
-
style?: Record<string, string>;
|
|
49
|
-
}[]): void;
|
|
50
|
-
export declare function addSelfClosingTag(tag: {
|
|
51
|
-
tag: string;
|
|
52
|
-
tagName?: string;
|
|
53
|
-
style?: Record<string, string>;
|
|
54
|
-
}): void;
|
|
55
|
-
export declare function addSelfClosingTag(tags: {
|
|
56
|
-
tag: string;
|
|
57
|
-
tagName?: string;
|
|
58
|
-
style?: Record<string, string>;
|
|
59
|
-
}[]): void;
|