velair-ui 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
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,64 @@
1
+ # velair-ui
2
+
3
+ UI-библиотека на [Web Components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components) с [Lit](https://lit.dev/).
4
+
5
+ ## Установка
6
+
7
+ ```bash
8
+ npm install velair-ui lit
9
+ ```
10
+
11
+ `lit` указан как peer-зависимость: установите совместимую версию **^3** в приложении.
12
+
13
+ ## Использование
14
+
15
+ Импорт регистрирует кастомные элементы (через `@customElement`):
16
+
17
+ ```ts
18
+ import 'velair-ui';
19
+ ```
20
+
21
+ Дальше используйте теги в HTML:
22
+
23
+ ```html
24
+ <nk-button>OK</nk-button>
25
+ <nk-button variant="secondary">Отмена</nk-button>
26
+ <nk-button variant="ghost" type="button">Ещё</nk-button>
27
+ ```
28
+
29
+ Или импортируйте класс для типов и расширения:
30
+
31
+ ```ts
32
+ import { NkButton } from 'velair-ui';
33
+ ```
34
+
35
+ ## Разработка
36
+
37
+ ```bash
38
+ npm install
39
+ npm run dev
40
+ ```
41
+
42
+ Сборка библиотеки (перед публикацией выполняется автоматически через `prepublishOnly`):
43
+
44
+ ```bash
45
+ npm run build
46
+ ```
47
+
48
+ ## Публикация в npm
49
+
50
+ 1. Убедитесь, что имя `velair-ui` свободно на [npmjs.com](https://www.npmjs.com/package/velair-ui), либо смените `name` в `package.json` (например на scoped `@your-scope/velair-ui`).
51
+ 2. Войдите в npm: `npm login`.
52
+ 3. Выполните: `npm publish` (из корня репозитория; сначала соберётся `dist`).
53
+
54
+ Для scoped-пакета с публичным доступом добавьте в `package.json`:
55
+
56
+ ```json
57
+ "publishConfig": {
58
+ "access": "public"
59
+ }
60
+ ```
61
+
62
+ ## Репозиторий на GitHub
63
+
64
+ Чтобы переименовать репозиторий: **Settings → General → Repository name** → `velair-ui`, либо в CLI: `gh repo rename velair-ui` из каталога клона. После переименования обновите локальный `git remote` при необходимости.
@@ -0,0 +1,15 @@
1
+ import { LitElement } from 'lit';
2
+ export type NkButtonVariant = 'primary' | 'secondary' | 'ghost';
3
+ export declare class NkButton extends LitElement {
4
+ static styles: import('lit').CSSResult;
5
+ variant: NkButtonVariant;
6
+ disabled: boolean;
7
+ type: 'button' | 'submit' | 'reset';
8
+ label: string;
9
+ protected render(): import('lit-html').TemplateResult<1>;
10
+ }
11
+ declare global {
12
+ interface HTMLElementTagNameMap {
13
+ 'nk-button': NkButton;
14
+ }
15
+ }
@@ -0,0 +1,2 @@
1
+ export { NkButton } from './components/nk-button.js';
2
+ export type { NkButtonVariant } from './components/nk-button.js';
package/dist/index.js ADDED
@@ -0,0 +1,105 @@
1
+ import { css as b, LitElement as c, nothing as u, html as p } from "lit";
2
+ import { property as a, customElement as h } from "lit/decorators.js";
3
+ var y = Object.defineProperty, f = Object.getOwnPropertyDescriptor, e = (o, s, i, n) => {
4
+ for (var r = n > 1 ? void 0 : n ? f(s, i) : s, l = o.length - 1, d; l >= 0; l--)
5
+ (d = o[l]) && (r = (n ? d(s, i, r) : d(r)) || r);
6
+ return n && r && y(s, i, r), r;
7
+ };
8
+ let t = class extends c {
9
+ constructor() {
10
+ super(...arguments), this.variant = "primary", this.disabled = !1, this.type = "button", this.label = "";
11
+ }
12
+ render() {
13
+ const o = this.variant === "secondary" || this.variant === "ghost" ? this.variant : "primary";
14
+ return p`
15
+ <button
16
+ type=${this.type}
17
+ class=${o}
18
+ ?disabled=${this.disabled}
19
+ aria-disabled=${this.disabled ? "true" : u}
20
+ >
21
+ ${this.label ? p`<span>${this.label}</span>` : p`<slot></slot>`}
22
+ </button>
23
+ `;
24
+ }
25
+ };
26
+ t.styles = b`
27
+ :host {
28
+ display: inline-block;
29
+ }
30
+ :host([hidden]) {
31
+ display: none;
32
+ }
33
+ button {
34
+ box-sizing: border-box;
35
+ display: inline-flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ gap: 0.35em;
39
+ min-height: 2.25rem;
40
+ padding: 0 0.9rem;
41
+ font: inherit;
42
+ line-height: 1.2;
43
+ border-radius: 0.375rem;
44
+ border: 1px solid transparent;
45
+ cursor: pointer;
46
+ transition:
47
+ background 0.12s ease,
48
+ color 0.12s ease,
49
+ border-color 0.12s ease,
50
+ box-shadow 0.12s ease;
51
+ }
52
+ button:focus-visible {
53
+ outline: 2px solid currentColor;
54
+ outline-offset: 2px;
55
+ }
56
+ button:disabled {
57
+ opacity: 0.45;
58
+ cursor: not-allowed;
59
+ }
60
+ .primary {
61
+ color: #fff;
62
+ background: #111;
63
+ border-color: #111;
64
+ }
65
+ .primary:hover:not(:disabled) {
66
+ background: #333;
67
+ border-color: #333;
68
+ }
69
+ .secondary {
70
+ color: #111;
71
+ background: #f4f4f5;
72
+ border-color: #d4d4d8;
73
+ }
74
+ .secondary:hover:not(:disabled) {
75
+ background: #e4e4e7;
76
+ border-color: #a1a1aa;
77
+ }
78
+ .ghost {
79
+ color: #111;
80
+ background: transparent;
81
+ border-color: transparent;
82
+ }
83
+ .ghost:hover:not(:disabled) {
84
+ background: #f4f4f5;
85
+ }
86
+ `;
87
+ e([
88
+ a({ type: String })
89
+ ], t.prototype, "variant", 2);
90
+ e([
91
+ a({ type: Boolean, reflect: !0 })
92
+ ], t.prototype, "disabled", 2);
93
+ e([
94
+ a({ type: String })
95
+ ], t.prototype, "type", 2);
96
+ e([
97
+ a({ type: String })
98
+ ], t.prototype, "label", 2);
99
+ t = e([
100
+ h("nk-button")
101
+ ], t);
102
+ export {
103
+ t as NkButton
104
+ };
105
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/components/nk-button.ts"],"sourcesContent":["import { LitElement, html, css, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nexport type NkButtonVariant = 'primary' | 'secondary' | 'ghost';\n\n@customElement('nk-button')\nexport class NkButton extends LitElement {\n static styles = css`\n :host {\n display: inline-block;\n }\n :host([hidden]) {\n display: none;\n }\n button {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.35em;\n min-height: 2.25rem;\n padding: 0 0.9rem;\n font: inherit;\n line-height: 1.2;\n border-radius: 0.375rem;\n border: 1px solid transparent;\n cursor: pointer;\n transition:\n background 0.12s ease,\n color 0.12s ease,\n border-color 0.12s ease,\n box-shadow 0.12s ease;\n }\n button:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: 2px;\n }\n button:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n }\n .primary {\n color: #fff;\n background: #111;\n border-color: #111;\n }\n .primary:hover:not(:disabled) {\n background: #333;\n border-color: #333;\n }\n .secondary {\n color: #111;\n background: #f4f4f5;\n border-color: #d4d4d8;\n }\n .secondary:hover:not(:disabled) {\n background: #e4e4e7;\n border-color: #a1a1aa;\n }\n .ghost {\n color: #111;\n background: transparent;\n border-color: transparent;\n }\n .ghost:hover:not(:disabled) {\n background: #f4f4f5;\n }\n `;\n\n @property({ type: String }) variant: NkButtonVariant = 'primary';\n\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n @property({ type: String }) type: 'button' | 'submit' | 'reset' = 'button';\n\n @property({ type: String }) label = '';\n\n protected render() {\n const variantClass =\n this.variant === 'secondary' || this.variant === 'ghost' ? this.variant : 'primary';\n\n return html`\n <button\n type=${this.type}\n class=${variantClass}\n ?disabled=${this.disabled}\n aria-disabled=${this.disabled ? 'true' : nothing}\n >\n ${this.label ? html`<span>${this.label}</span>` : html`<slot></slot>`}\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nk-button': NkButton;\n }\n}\n"],"names":["NkButton","LitElement","variantClass","html","nothing","css","__decorateClass","property","customElement"],"mappings":";;;;;;;AAMO,IAAMA,IAAN,cAAuBC,EAAW;AAAA,EAAlC,cAAA;AAAA,UAAA,GAAA,SAAA,GA+DuB,KAAA,UAA2B,WAEX,KAAA,WAAW,IAE3B,KAAA,OAAsC,UAEtC,KAAA,QAAQ;AAAA,EAAA;AAAA,EAE1B,SAAS;AACjB,UAAMC,IACJ,KAAK,YAAY,eAAe,KAAK,YAAY,UAAU,KAAK,UAAU;AAE5E,WAAOC;AAAA;AAAA,eAEI,KAAK,IAAI;AAAA,gBACRD,CAAY;AAAA,oBACR,KAAK,QAAQ;AAAA,wBACT,KAAK,WAAW,SAASE,CAAO;AAAA;AAAA,UAE9C,KAAK,QAAQD,UAAa,KAAK,KAAK,YAAYA,gBAAmB;AAAA;AAAA;AAAA,EAG3E;AACF;AAtFaH,EACJ,SAASK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8DYC,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GA/DfP,EA+DiB,WAAA,WAAA,CAAA;AAEgBM,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAjE/BP,EAiEiC,WAAA,YAAA,CAAA;AAEhBM,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAnEfP,EAmEiB,WAAA,QAAA,CAAA;AAEAM,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GArEfP,EAqEiB,WAAA,SAAA,CAAA;AArEjBA,IAANM,EAAA;AAAA,EADNE,EAAc,WAAW;AAAA,GACbR,CAAA;"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "velair-ui",
3
+ "version": "0.1.0",
4
+ "description": "Velair UI — Web components library built with Lit",
5
+ "license": "MIT",
6
+ "author": "",
7
+ "type": "module",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "main": "./dist/index.js",
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ }
19
+ },
20
+ "scripts": {
21
+ "dev": "vite",
22
+ "build": "vite build",
23
+ "preview": "vite preview",
24
+ "prepublishOnly": "npm run build"
25
+ },
26
+ "peerDependencies": {
27
+ "lit": "^3.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^22.14.0",
31
+ "lit": "^3.2.1",
32
+ "typescript": "~5.8.3",
33
+ "vite": "^6.2.6",
34
+ "vite-plugin-dts": "^4.5.3"
35
+ },
36
+ "keywords": [
37
+ "web-components",
38
+ "lit",
39
+ "ui",
40
+ "components"
41
+ ]
42
+ }