@vyriy/html 0.1.9
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/LICENSE +21 -0
- package/README.md +75 -0
- package/html.d.ts +2 -0
- package/html.js +20 -0
- package/index.d.ts +2 -0
- package/index.js +1 -0
- package/package.json +36 -0
- package/types.d.ts +13 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vyriy contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# HTML
|
|
2
|
+
|
|
3
|
+
This utility builds a complete HTML document string from a small set of optional sections.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
With npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @vyriy/html
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
With Yarn:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn add @vyriy/html
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## What it does
|
|
20
|
+
|
|
21
|
+
The function returns a full `<!DOCTYPE html>` page and lets you inject common document pieces:
|
|
22
|
+
|
|
23
|
+
- attributes for the `<html>` tag
|
|
24
|
+
- tags inside `<head>`
|
|
25
|
+
- attributes for the `<body>` tag
|
|
26
|
+
- body markup and footer-like script sections
|
|
27
|
+
|
|
28
|
+
Missing sections default to empty strings, so the function always returns the same document shape.
|
|
29
|
+
|
|
30
|
+
## Signature
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
type HtmlProps = {
|
|
34
|
+
htmlAttributes?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
meta?: string;
|
|
37
|
+
base?: string;
|
|
38
|
+
link?: string;
|
|
39
|
+
style?: string;
|
|
40
|
+
bodyAttributes?: string;
|
|
41
|
+
body?: string;
|
|
42
|
+
noscript?: string;
|
|
43
|
+
script?: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
type Html = (props?: HtmlProps) => string;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Example
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { html } from '@vyriy/html';
|
|
53
|
+
|
|
54
|
+
const page = html({
|
|
55
|
+
htmlAttributes: 'lang="en"',
|
|
56
|
+
title: '<title>Vyriy</title>',
|
|
57
|
+
meta: '<meta charset="utf-8" />',
|
|
58
|
+
bodyAttributes: 'class="app"',
|
|
59
|
+
body: '<div id="root"></div>',
|
|
60
|
+
script: '<script src="/main.js"></script>',
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Exports
|
|
65
|
+
|
|
66
|
+
The package exposes both the root entry and the direct utility module:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { html } from '@vyriy/html';
|
|
70
|
+
import { html as htmlDocument } from '@vyriy/html/html';
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## When to use it
|
|
74
|
+
|
|
75
|
+
`html` is useful in server-side rendering or static document generation when you want a lightweight document wrapper without bringing in a full templating layer.
|
package/html.d.ts
ADDED
package/html.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const html = (props = {}) => {
|
|
2
|
+
const { htmlAttributes = '', title = '', meta = '', base = '', link = '', style = '', bodyAttributes = '', body = '', noscript = '', script = '', } = props;
|
|
3
|
+
return `
|
|
4
|
+
<!DOCTYPE html>
|
|
5
|
+
<html ${htmlAttributes}>
|
|
6
|
+
<head>
|
|
7
|
+
${title}
|
|
8
|
+
${base}
|
|
9
|
+
${meta}
|
|
10
|
+
${link}
|
|
11
|
+
${style}
|
|
12
|
+
</head>
|
|
13
|
+
<body ${bodyAttributes}>
|
|
14
|
+
${body}
|
|
15
|
+
${noscript}
|
|
16
|
+
${script}
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
19
|
+
`;
|
|
20
|
+
};
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './html.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vyriy/html",
|
|
3
|
+
"version": "0.1.9",
|
|
4
|
+
"description": "HTML document utility for Vyriy projects",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./index.d.ts",
|
|
12
|
+
"import": "./index.js",
|
|
13
|
+
"default": "./index.js"
|
|
14
|
+
},
|
|
15
|
+
"./html": {
|
|
16
|
+
"types": "./html.d.ts",
|
|
17
|
+
"import": "./html.js",
|
|
18
|
+
"default": "./html.js"
|
|
19
|
+
},
|
|
20
|
+
"./html.js": {
|
|
21
|
+
"types": "./html.d.ts",
|
|
22
|
+
"import": "./html.js",
|
|
23
|
+
"default": "./html.js"
|
|
24
|
+
},
|
|
25
|
+
"./index": {
|
|
26
|
+
"types": "./index.d.ts",
|
|
27
|
+
"import": "./index.js",
|
|
28
|
+
"default": "./index.js"
|
|
29
|
+
},
|
|
30
|
+
"./index.js": {
|
|
31
|
+
"types": "./index.d.ts",
|
|
32
|
+
"import": "./index.js",
|
|
33
|
+
"default": "./index.js"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type HtmlProps = {
|
|
2
|
+
htmlAttributes?: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
meta?: string;
|
|
5
|
+
base?: string;
|
|
6
|
+
link?: string;
|
|
7
|
+
style?: string;
|
|
8
|
+
bodyAttributes?: string;
|
|
9
|
+
body?: string;
|
|
10
|
+
noscript?: string;
|
|
11
|
+
script?: string;
|
|
12
|
+
};
|
|
13
|
+
export type Html = (props?: HtmlProps) => string;
|