@vialiq/web-components 0.0.1
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/button/index.d.ts +2 -0
- package/button/index.d.ts.map +1 -0
- package/button/vi-button.d.ts +33 -0
- package/button/vi-button.d.ts.map +1 -0
- package/button/vi-button.js +46 -0
- package/icons/registry.d.ts +25 -0
- package/icons/registry.d.ts.map +1 -0
- package/icons/registry.js +13 -0
- package/icons/vi-icon.d.ts +43 -0
- package/icons/vi-icon.d.ts.map +1 -0
- package/icons/vi-icon.js +327 -0
- package/index.d.ts +7 -0
- package/index.js +11 -0
- package/package.json +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../libs/web-components/src/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { ViElement, type ViVariant } from '../base/vi-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* vi-button
|
|
5
|
+
* Self-styled button component using Flux UI token fallbacks.
|
|
6
|
+
*
|
|
7
|
+
* @element vi-button
|
|
8
|
+
* @attr variant - Button variant: primary, secondary, danger
|
|
9
|
+
* @attr disabled - Disabled state: prevents click events
|
|
10
|
+
*/
|
|
11
|
+
export declare class ViButton extends ViElement {
|
|
12
|
+
static styles: import("lit").CSSResult;
|
|
13
|
+
/**
|
|
14
|
+
* Button variant: primary, secondary, danger.
|
|
15
|
+
* PUBLIC — users set this as <vi-button variant="primary">
|
|
16
|
+
* @attr
|
|
17
|
+
*/
|
|
18
|
+
accessor variant: ViVariant;
|
|
19
|
+
/**
|
|
20
|
+
* Disabled state: prevents click events/opacity.
|
|
21
|
+
* PUBLIC — users set this as <vi-button disabled>
|
|
22
|
+
* @attr
|
|
23
|
+
*/
|
|
24
|
+
accessor disabled: boolean;
|
|
25
|
+
private onClick;
|
|
26
|
+
render(): TemplateResult;
|
|
27
|
+
}
|
|
28
|
+
declare global {
|
|
29
|
+
interface HTMLElementTagNameMap {
|
|
30
|
+
'vi-button': ViButton;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=vi-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vi-button.d.ts","sourceRoot":"","sources":["../../../../../../../libs/web-components/src/button/vi-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlE;;;;;;;GAOG;AACH,qBACa,QAAS,SAAQ,SAAS;IACrC,OAAgB,MAAM,0BAAmC;IAEzD;;;;OAIG;IACwC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAa;IAEnF;;;;OAIG;IACyC,QAAQ,CAAC,QAAQ,UAAS;IAEtE,OAAO,CAAC,OAAO;IAON,MAAM,IAAI,cAAc;CAOlC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { unsafeCSS as H, css as J, html as K } from "lit";
|
|
2
|
+
import { V as L, t as Q, n as E } from "../property-Bgga_R54.js";
|
|
3
|
+
const R = '@charset "UTF-8";@layer reset,components,utilities;:host{display:inline-block;--vi-button-surface-primary-background-color: var(--vi-color-primary, #0066cc);--vi-button-surface-primary-text-color: var(--vi-color-grey-100, #f3f4f6);--vi-button-surface-secondary-background-color: var(--vi-color-secondary, #f0f4f8);--vi-button-surface-secondary-text-color: var(--vi-color-foreground, #111827);--vi-button-surface-danger-background-color: var(--vi-color-error, #ef4444);--vi-button-surface-danger-text-color: var(--vi-color-grey-100, #f3f4f6);--vi-button-shape-border-radius: var(--vi-border-radius-md, 4px);--vi-button-spacing-padding-inline: var(--vi-spacing-md, 24px);--vi-button-spacing-padding-block: var(--vi-spacing-sm, 16px);--vi-button-typography-font-size: var(--vi-font-size-base, 16px);--vi-button-typography-font-weight: var(--vi-font-weight-semibold, 600);--vi-button-effect-transition-duration: .16s}:host([variant=primary]) .button{background-color:var(--vi-button-surface-primary-background-color, var(--vi-color-primary, #0066cc));color:var(--vi-button-surface-primary-text-color, var(--vi-color-grey-100, #f3f4f6))}:host([variant=secondary]) .button{background-color:var(--vi-button-surface-secondary-background-color, var(--vi-color-secondary, #f0f4f8));color:var(--vi-button-surface-secondary-text-color, var(--vi-color-foreground, #111827));border-color:var(--vi-color-border, #e5e7eb)}:host([variant=danger]) .button{background-color:var(--vi-button-surface-danger-background-color, var(--vi-color-error, #ef4444));color:var(--vi-button-surface-danger-text-color, var(--vi-color-grey-100, #f3f4f6))}:host([disabled]) .button,.button:disabled{opacity:.6;cursor:not-allowed}.button:hover:not(:disabled){opacity:.92}';
|
|
4
|
+
var X = Object.create, x = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, $ = (r, t) => (t = Symbol[r]) ? t : /* @__PURE__ */ Symbol.for("Symbol." + r), f = (r) => {
|
|
5
|
+
throw TypeError(r);
|
|
6
|
+
}, A = (r, t, o) => t in r ? x(r, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[t] = o, F = (r, t) => x(r, "name", { value: t, configurable: !0 }), Z = (r) => [, , , X(r?.[$("metadata")] ?? null)], T = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], _ = (r) => r !== void 0 && typeof r != "function" ? f("Function expected") : r, j = (r, t, o, s, a) => ({ kind: T[r], name: t, metadata: s, addInitializer: (i) => o._ ? f("Already initialized") : a.push(_(i || null)) }), rr = (r, t) => A(t, $("metadata"), r[3]), h = (r, t, o, s) => {
|
|
7
|
+
for (var a = 0, i = r[t >> 1], u = i && i.length; a < u; a++) t & 1 ? i[a].call(o) : s = i[a].call(o, s);
|
|
8
|
+
return s;
|
|
9
|
+
}, C = (r, t, o, s, a, i) => {
|
|
10
|
+
var u, c, I, b, g, e = t & 7, y = !!(t & 8), l = !!(t & 16), k = e > 3 ? r.length + 1 : e ? y ? 1 : 2 : 0, V = T[e + 5], B = e > 3 && (r[k - 1] = []), q = r[k] || (r[k] = []), v = e && (!l && !y && (a = a.prototype), e < 5 && (e > 3 || !l) && Y(e < 4 ? a : { get [o]() {
|
|
11
|
+
return M(this, i);
|
|
12
|
+
}, set [o](n) {
|
|
13
|
+
return W(this, i, n);
|
|
14
|
+
} }, o));
|
|
15
|
+
e ? l && e < 4 && F(i, (e > 2 ? "set " : e > 1 ? "get " : "") + o) : F(a, o);
|
|
16
|
+
for (var m = s.length - 1; m >= 0; m--)
|
|
17
|
+
b = j(e, o, I = {}, r[3], q), e && (b.static = y, b.private = l, g = b.access = { has: l ? (n) => or(a, n) : (n) => o in n }, e ^ 3 && (g.get = l ? (n) => (e ^ 1 ? M : er)(n, a, e ^ 4 ? i : v.get) : (n) => n[o]), e > 2 && (g.set = l ? (n, S) => W(n, a, S, e ^ 4 ? i : v.set) : (n, S) => n[o] = S)), c = (0, s[m])(e ? e < 4 ? l ? i : v[V] : e > 4 ? void 0 : { get: v.get, set: v.set } : a, b), I._ = 1, e ^ 4 || c === void 0 ? _(c) && (e > 4 ? B.unshift(c) : e ? l ? i = c : v[V] = c : a = c) : typeof c != "object" || c === null ? f("Object expected") : (_(u = c.get) && (v.get = u), _(u = c.set) && (v.set = u), _(u = c.init) && B.unshift(u));
|
|
18
|
+
return e || rr(r, a), v && x(a, o, v), l ? e ^ 4 ? i : v : a;
|
|
19
|
+
}, tr = (r, t, o) => A(r, t + "", o), z = (r, t, o) => t.has(r) || f("Cannot " + o), or = (r, t) => Object(t) !== t ? f('Cannot use the "in" operator on this value') : r.has(t), M = (r, t, o) => (z(r, t, "read from private field"), o ? o.call(r) : t.get(r)), D = (r, t, o) => t.has(r) ? f("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, o), W = (r, t, o, s) => (z(r, t, "write to private field"), s ? s.call(r, o) : t.set(r, o), o), er = (r, t, o) => (z(r, t, "access private method"), o), G, N, w, U, d, O, P;
|
|
20
|
+
U = [Q("vi-button")];
|
|
21
|
+
class p extends (w = L, N = [E({ type: String, reflect: !0 })], G = [E({ type: Boolean, reflect: !0 })], w) {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments), D(this, O, h(d, 8, this, "primary")), h(d, 11, this), D(this, P, h(d, 12, this, !1)), h(d, 15, this);
|
|
24
|
+
}
|
|
25
|
+
onClick(t) {
|
|
26
|
+
this.disabled && (t.preventDefault(), t.stopImmediatePropagation());
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
return K`
|
|
30
|
+
<button class="button" type="button" ?disabled=${this.disabled} @click=${this.onClick}>
|
|
31
|
+
<slot></slot>
|
|
32
|
+
</button>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
d = Z(w);
|
|
37
|
+
O = /* @__PURE__ */ new WeakMap();
|
|
38
|
+
P = /* @__PURE__ */ new WeakMap();
|
|
39
|
+
C(d, 4, "variant", N, p, O);
|
|
40
|
+
C(d, 4, "disabled", G, p, P);
|
|
41
|
+
p = C(d, 0, "ViButton", U, p);
|
|
42
|
+
tr(p, "styles", J`${H(R)}`);
|
|
43
|
+
h(d, 1, p);
|
|
44
|
+
export {
|
|
45
|
+
p as ViButton
|
|
46
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon Registry
|
|
3
|
+
*
|
|
4
|
+
* A Map-based store for SvgIconDef objects sourced from @vi/icons.
|
|
5
|
+
* Icons must be explicitly registered before <vi-icon> can render them.
|
|
6
|
+
* Only the icons you register end up in your bundle — full tree-shaking.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* import { registerIcons } from '@vi/web-components';
|
|
10
|
+
* import { checkIcon } from '@vi/icons/check';
|
|
11
|
+
*
|
|
12
|
+
* registerIcons([checkIcon]);
|
|
13
|
+
* // <vi-icon name="check"></vi-icon>
|
|
14
|
+
*/
|
|
15
|
+
import type { SvgIconDef } from '@vi/icons';
|
|
16
|
+
export type { SvgIconDef };
|
|
17
|
+
/**
|
|
18
|
+
* Register one or more icons. Call this before using <vi-icon>.
|
|
19
|
+
*/
|
|
20
|
+
export declare function registerIcons(icons: SvgIconDef | SvgIconDef[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* Look up a registered icon by name.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getIcon(name: string): SvgIconDef | undefined;
|
|
25
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../../../../libs/web-components/src/icons/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,YAAY,EAAE,UAAU,EAAE,CAAC;AAI3B;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,EAAE,GAAG,IAAI,CAKpE;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAE5D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import { ViElement } from '../base/vi-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* vi-icon
|
|
5
|
+
*
|
|
6
|
+
* Renders a named SVG icon from the registry. Icons must be registered first
|
|
7
|
+
* by importing their individual modules e.g.:
|
|
8
|
+
* import '@vi/web-components/icons/check';
|
|
9
|
+
*
|
|
10
|
+
* @element vi-icon
|
|
11
|
+
* @attr name - The icon name to render (must be registered)
|
|
12
|
+
* @attr size - Width/height in px (default: 24)
|
|
13
|
+
* @attr label - Accessible label; omit for decorative icons
|
|
14
|
+
*/
|
|
15
|
+
export declare class ViIcon extends ViElement {
|
|
16
|
+
static styles: import("lit").CSSResult;
|
|
17
|
+
/**
|
|
18
|
+
* The registered icon name to render.
|
|
19
|
+
* @attr
|
|
20
|
+
*/
|
|
21
|
+
accessor name: string;
|
|
22
|
+
/**
|
|
23
|
+
* Size in pixels applied as a CSS custom property.
|
|
24
|
+
* @attr
|
|
25
|
+
*/
|
|
26
|
+
accessor size: number;
|
|
27
|
+
/**
|
|
28
|
+
* Accessible label. When set the SVG gets role="img" + aria-label.
|
|
29
|
+
* When omitted the icon is treated as decorative (aria-hidden).
|
|
30
|
+
* @attr
|
|
31
|
+
*/
|
|
32
|
+
accessor label: string;
|
|
33
|
+
private accessor _icon;
|
|
34
|
+
updated(changedProperties: PropertyValues): void;
|
|
35
|
+
firstUpdated(changedProperties: PropertyValues): void;
|
|
36
|
+
render(): TemplateResult;
|
|
37
|
+
}
|
|
38
|
+
declare global {
|
|
39
|
+
interface HTMLElementTagNameMap {
|
|
40
|
+
'vi-icon': ViIcon;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=vi-icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vi-icon.d.ts","sourceRoot":"","sources":["../../../../../../../libs/web-components/src/icons/vi-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGnF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD;;;;;;;;;;;GAWG;AACH,qBACa,MAAO,SAAQ,SAAS;IACnC,OAAgB,MAAM,0BAkBpB;IAEF;;;OAGG;IACwC,QAAQ,CAAC,IAAI,SAAM;IAE9D;;;OAGG;IACyB,QAAQ,CAAC,IAAI,SAAM;IAE/C;;;;OAIG;IACyB,QAAQ,CAAC,KAAK,SAAM;IAEvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqC;IAE3D,OAAO,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;IAUhD,YAAY,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;IAMrD,MAAM,IAAI,cAAc;CAoBlC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
|
package/icons/vi-icon.js
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { nothing as wt, html as L, css as Ct } from "lit";
|
|
2
|
+
import { n as k, V as Mt, t as Tt } from "../property-Bgga_R54.js";
|
|
3
|
+
import { getIcon as et } from "./registry.js";
|
|
4
|
+
function St(i) {
|
|
5
|
+
return k({ ...i, state: !0, attribute: !1 });
|
|
6
|
+
}
|
|
7
|
+
const F = globalThis, it = (i) => i, O = F.trustedTypes, st = O ? O.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, pt = "$lit$", m = `lit$${Math.random().toFixed(9).slice(2)}$`, $t = "?" + m, It = `<${$t}>`, N = document, U = () => N.createComment(""), S = (i) => i === null || typeof i != "object" && typeof i != "function", Z = Array.isArray, zt = (i) => Z(i) || typeof i?.[Symbol.iterator] == "function", R = `[
|
|
8
|
+
\f\r]`, M = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, nt = /-->/g, rt = />/g, x = RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^
|
|
9
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ot = /'/g, ht = /"/g, ut = /^(?:script|style|textarea|title)$/i, b = /* @__PURE__ */ Symbol.for("lit-noChange"), d = /* @__PURE__ */ Symbol.for("lit-nothing"), at = /* @__PURE__ */ new WeakMap(), H = N.createTreeWalker(N, 129);
|
|
10
|
+
function At(i, t) {
|
|
11
|
+
if (!Z(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
12
|
+
return st !== void 0 ? st.createHTML(t) : t;
|
|
13
|
+
}
|
|
14
|
+
const Et = (i, t) => {
|
|
15
|
+
const e = i.length - 1, n = [];
|
|
16
|
+
let s, r = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", h = M;
|
|
17
|
+
for (let l = 0; l < e; l++) {
|
|
18
|
+
const a = i[l];
|
|
19
|
+
let c, _, o = -1, u = 0;
|
|
20
|
+
for (; u < a.length && (h.lastIndex = u, _ = h.exec(a), _ !== null); ) u = h.lastIndex, h === M ? _[1] === "!--" ? h = nt : _[1] !== void 0 ? h = rt : _[2] !== void 0 ? (ut.test(_[2]) && (s = RegExp("</" + _[2], "g")), h = x) : _[3] !== void 0 && (h = x) : h === x ? _[0] === ">" ? (h = s ?? M, o = -1) : _[1] === void 0 ? o = -2 : (o = h.lastIndex - _[2].length, c = _[1], h = _[3] === void 0 ? x : _[3] === '"' ? ht : ot) : h === ht || h === ot ? h = x : h === nt || h === rt ? h = M : (h = x, s = void 0);
|
|
21
|
+
const p = h === x && i[l + 1].startsWith("/>") ? " " : "";
|
|
22
|
+
r += h === M ? a + It : o >= 0 ? (n.push(c), a.slice(0, o) + pt + a.slice(o) + m + p) : a + m + (o === -2 ? l : p);
|
|
23
|
+
}
|
|
24
|
+
return [At(i, r + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), n];
|
|
25
|
+
};
|
|
26
|
+
class I {
|
|
27
|
+
constructor({ strings: t, _$litType$: e }, n) {
|
|
28
|
+
let s;
|
|
29
|
+
this.parts = [];
|
|
30
|
+
let r = 0, h = 0;
|
|
31
|
+
const l = t.length - 1, a = this.parts, [c, _] = Et(t, e);
|
|
32
|
+
if (this.el = I.createElement(c, n), H.currentNode = this.el.content, e === 2 || e === 3) {
|
|
33
|
+
const o = this.el.content.firstChild;
|
|
34
|
+
o.replaceWith(...o.childNodes);
|
|
35
|
+
}
|
|
36
|
+
for (; (s = H.nextNode()) !== null && a.length < l; ) {
|
|
37
|
+
if (s.nodeType === 1) {
|
|
38
|
+
if (s.hasAttributes()) for (const o of s.getAttributeNames()) if (o.endsWith(pt)) {
|
|
39
|
+
const u = _[h++], p = s.getAttribute(o).split(m), g = /([.?@])?(.*)/.exec(u);
|
|
40
|
+
a.push({ type: 1, index: r, name: g[2], strings: p, ctor: g[1] === "." ? Ot : g[1] === "?" ? Ut : g[1] === "@" ? Pt : W }), s.removeAttribute(o);
|
|
41
|
+
} else o.startsWith(m) && (a.push({ type: 6, index: r }), s.removeAttribute(o));
|
|
42
|
+
if (ut.test(s.tagName)) {
|
|
43
|
+
const o = s.textContent.split(m), u = o.length - 1;
|
|
44
|
+
if (u > 0) {
|
|
45
|
+
s.textContent = O ? O.emptyScript : "";
|
|
46
|
+
for (let p = 0; p < u; p++) s.append(o[p], U()), H.nextNode(), a.push({ type: 2, index: ++r });
|
|
47
|
+
s.append(o[u], U());
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
} else if (s.nodeType === 8) if (s.data === $t) a.push({ type: 2, index: r });
|
|
51
|
+
else {
|
|
52
|
+
let o = -1;
|
|
53
|
+
for (; (o = s.data.indexOf(m, o + 1)) !== -1; ) a.push({ type: 7, index: r }), o += m.length - 1;
|
|
54
|
+
}
|
|
55
|
+
r++;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
static createElement(t, e) {
|
|
59
|
+
const n = N.createElement("template");
|
|
60
|
+
return n.innerHTML = t, n;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function w(i, t, e = i, n) {
|
|
64
|
+
if (t === b) return t;
|
|
65
|
+
let s = n !== void 0 ? e._$Co?.[n] : e._$Cl;
|
|
66
|
+
const r = S(t) ? void 0 : t._$litDirective$;
|
|
67
|
+
return s?.constructor !== r && (s?._$AO?.(!1), r === void 0 ? s = void 0 : (s = new r(i), s._$AT(i, e, n)), n !== void 0 ? (e._$Co ??= [])[n] = s : e._$Cl = s), s !== void 0 && (t = w(i, s._$AS(i, t.values), s, n)), t;
|
|
68
|
+
}
|
|
69
|
+
class kt {
|
|
70
|
+
constructor(t, e) {
|
|
71
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
|
|
72
|
+
}
|
|
73
|
+
get parentNode() {
|
|
74
|
+
return this._$AM.parentNode;
|
|
75
|
+
}
|
|
76
|
+
get _$AU() {
|
|
77
|
+
return this._$AM._$AU;
|
|
78
|
+
}
|
|
79
|
+
u(t) {
|
|
80
|
+
const { el: { content: e }, parts: n } = this._$AD, s = (t?.creationScope ?? N).importNode(e, !0);
|
|
81
|
+
H.currentNode = s;
|
|
82
|
+
let r = H.nextNode(), h = 0, l = 0, a = n[0];
|
|
83
|
+
for (; a !== void 0; ) {
|
|
84
|
+
if (h === a.index) {
|
|
85
|
+
let c;
|
|
86
|
+
a.type === 2 ? c = new P(r, r.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(r, a.name, a.strings, this, t) : a.type === 6 && (c = new Wt(r, this, t)), this._$AV.push(c), a = n[++l];
|
|
87
|
+
}
|
|
88
|
+
h !== a?.index && (r = H.nextNode(), h++);
|
|
89
|
+
}
|
|
90
|
+
return H.currentNode = N, s;
|
|
91
|
+
}
|
|
92
|
+
p(t) {
|
|
93
|
+
let e = 0;
|
|
94
|
+
for (const n of this._$AV) n !== void 0 && (n.strings !== void 0 ? (n._$AI(t, n, e), e += n.strings.length - 2) : n._$AI(t[e])), e++;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
class P {
|
|
98
|
+
get _$AU() {
|
|
99
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
100
|
+
}
|
|
101
|
+
constructor(t, e, n, s) {
|
|
102
|
+
this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = n, this.options = s, this._$Cv = s?.isConnected ?? !0;
|
|
103
|
+
}
|
|
104
|
+
get parentNode() {
|
|
105
|
+
let t = this._$AA.parentNode;
|
|
106
|
+
const e = this._$AM;
|
|
107
|
+
return e !== void 0 && t?.nodeType === 11 && (t = e.parentNode), t;
|
|
108
|
+
}
|
|
109
|
+
get startNode() {
|
|
110
|
+
return this._$AA;
|
|
111
|
+
}
|
|
112
|
+
get endNode() {
|
|
113
|
+
return this._$AB;
|
|
114
|
+
}
|
|
115
|
+
_$AI(t, e = this) {
|
|
116
|
+
t = w(this, t, e), S(t) ? t === d || t == null || t === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : t !== this._$AH && t !== b && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : zt(t) ? this.k(t) : this._(t);
|
|
117
|
+
}
|
|
118
|
+
O(t) {
|
|
119
|
+
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
120
|
+
}
|
|
121
|
+
T(t) {
|
|
122
|
+
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
123
|
+
}
|
|
124
|
+
_(t) {
|
|
125
|
+
this._$AH !== d && S(this._$AH) ? this._$AA.nextSibling.data = t : this.T(N.createTextNode(t)), this._$AH = t;
|
|
126
|
+
}
|
|
127
|
+
$(t) {
|
|
128
|
+
const { values: e, _$litType$: n } = t, s = typeof n == "number" ? this._$AC(t) : (n.el === void 0 && (n.el = I.createElement(At(n.h, n.h[0]), this.options)), n);
|
|
129
|
+
if (this._$AH?._$AD === s) this._$AH.p(e);
|
|
130
|
+
else {
|
|
131
|
+
const r = new kt(s, this), h = r.u(this.options);
|
|
132
|
+
r.p(e), this.T(h), this._$AH = r;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
_$AC(t) {
|
|
136
|
+
let e = at.get(t.strings);
|
|
137
|
+
return e === void 0 && at.set(t.strings, e = new I(t)), e;
|
|
138
|
+
}
|
|
139
|
+
k(t) {
|
|
140
|
+
Z(this._$AH) || (this._$AH = [], this._$AR());
|
|
141
|
+
const e = this._$AH;
|
|
142
|
+
let n, s = 0;
|
|
143
|
+
for (const r of t) s === e.length ? e.push(n = new P(this.O(U()), this.O(U()), this, this.options)) : n = e[s], n._$AI(r), s++;
|
|
144
|
+
s < e.length && (this._$AR(n && n._$AB.nextSibling, s), e.length = s);
|
|
145
|
+
}
|
|
146
|
+
_$AR(t = this._$AA.nextSibling, e) {
|
|
147
|
+
for (this._$AP?.(!1, !0, e); t !== this._$AB; ) {
|
|
148
|
+
const n = it(t).nextSibling;
|
|
149
|
+
it(t).remove(), t = n;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
setConnected(t) {
|
|
153
|
+
this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
class W {
|
|
157
|
+
get tagName() {
|
|
158
|
+
return this.element.tagName;
|
|
159
|
+
}
|
|
160
|
+
get _$AU() {
|
|
161
|
+
return this._$AM._$AU;
|
|
162
|
+
}
|
|
163
|
+
constructor(t, e, n, s, r) {
|
|
164
|
+
this.type = 1, this._$AH = d, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = r, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(new String()), this.strings = n) : this._$AH = d;
|
|
165
|
+
}
|
|
166
|
+
_$AI(t, e = this, n, s) {
|
|
167
|
+
const r = this.strings;
|
|
168
|
+
let h = !1;
|
|
169
|
+
if (r === void 0) t = w(this, t, e, 0), h = !S(t) || t !== this._$AH && t !== b, h && (this._$AH = t);
|
|
170
|
+
else {
|
|
171
|
+
const l = t;
|
|
172
|
+
let a, c;
|
|
173
|
+
for (t = r[0], a = 0; a < r.length - 1; a++) c = w(this, l[n + a], e, a), c === b && (c = this._$AH[a]), h ||= !S(c) || c !== this._$AH[a], c === d ? t = d : t !== d && (t += (c ?? "") + r[a + 1]), this._$AH[a] = c;
|
|
174
|
+
}
|
|
175
|
+
h && !s && this.j(t);
|
|
176
|
+
}
|
|
177
|
+
j(t) {
|
|
178
|
+
t === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
class Ot extends W {
|
|
182
|
+
constructor() {
|
|
183
|
+
super(...arguments), this.type = 3;
|
|
184
|
+
}
|
|
185
|
+
j(t) {
|
|
186
|
+
this.element[this.name] = t === d ? void 0 : t;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
class Ut extends W {
|
|
190
|
+
constructor() {
|
|
191
|
+
super(...arguments), this.type = 4;
|
|
192
|
+
}
|
|
193
|
+
j(t) {
|
|
194
|
+
this.element.toggleAttribute(this.name, !!t && t !== d);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
class Pt extends W {
|
|
198
|
+
constructor(t, e, n, s, r) {
|
|
199
|
+
super(t, e, n, s, r), this.type = 5;
|
|
200
|
+
}
|
|
201
|
+
_$AI(t, e = this) {
|
|
202
|
+
if ((t = w(this, t, e, 0) ?? d) === b) return;
|
|
203
|
+
const n = this._$AH, s = t === d && n !== d || t.capture !== n.capture || t.once !== n.once || t.passive !== n.passive, r = t !== d && (n === d || s);
|
|
204
|
+
s && this.element.removeEventListener(this.name, this, n), r && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
205
|
+
}
|
|
206
|
+
handleEvent(t) {
|
|
207
|
+
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
class Wt {
|
|
211
|
+
constructor(t, e, n) {
|
|
212
|
+
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = n;
|
|
213
|
+
}
|
|
214
|
+
get _$AU() {
|
|
215
|
+
return this._$AM._$AU;
|
|
216
|
+
}
|
|
217
|
+
_$AI(t) {
|
|
218
|
+
w(this, t);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const Vt = F.litHtmlPolyfillSupport;
|
|
222
|
+
Vt?.(I, P), (F.litHtmlVersions ??= []).push("3.3.2");
|
|
223
|
+
const Dt = { CHILD: 2 }, Lt = (i) => (...t) => ({ _$litDirective$: i, values: t });
|
|
224
|
+
class Rt {
|
|
225
|
+
constructor(t) {
|
|
226
|
+
}
|
|
227
|
+
get _$AU() {
|
|
228
|
+
return this._$AM._$AU;
|
|
229
|
+
}
|
|
230
|
+
_$AT(t, e, n) {
|
|
231
|
+
this._$Ct = t, this._$AM = e, this._$Ci = n;
|
|
232
|
+
}
|
|
233
|
+
_$AS(t, e) {
|
|
234
|
+
return this.update(t, e);
|
|
235
|
+
}
|
|
236
|
+
update(t, e) {
|
|
237
|
+
return this.render(...e);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
class B extends Rt {
|
|
241
|
+
constructor(t) {
|
|
242
|
+
if (super(t), this.it = d, t.type !== Dt.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
243
|
+
}
|
|
244
|
+
render(t) {
|
|
245
|
+
if (t === d || t == null) return this._t = void 0, this.it = t;
|
|
246
|
+
if (t === b) return t;
|
|
247
|
+
if (typeof t != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
248
|
+
if (t === this.it) return this._t;
|
|
249
|
+
this.it = t;
|
|
250
|
+
const e = [t];
|
|
251
|
+
return e.raw = e, this._t = { _$litType$: this.constructor.resultType, strings: e, values: [] };
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
B.directiveName = "unsafeHTML", B.resultType = 1;
|
|
255
|
+
const lt = Lt(B);
|
|
256
|
+
var Bt = Object.create, G = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, vt = (i, t) => (t = Symbol[i]) ? t : /* @__PURE__ */ Symbol.for("Symbol." + i), C = (i) => {
|
|
257
|
+
throw TypeError(i);
|
|
258
|
+
}, ft = (i, t, e) => t in i ? G(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, ct = (i, t) => G(i, "name", { value: t, configurable: !0 }), Ft = (i) => [, , , Bt(i?.[vt("metadata")] ?? null)], gt = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], T = (i) => i !== void 0 && typeof i != "function" ? C("Function expected") : i, Zt = (i, t, e, n, s) => ({ kind: gt[i], name: t, metadata: n, addInitializer: (r) => e._ ? C("Already initialized") : s.push(T(r || null)) }), Gt = (i, t) => ft(t, vt("metadata"), i[3]), f = (i, t, e, n) => {
|
|
259
|
+
for (var s = 0, r = i[t >> 1], h = r && r.length; s < h; s++) t & 1 ? r[s].call(e) : n = r[s].call(e, n);
|
|
260
|
+
return n;
|
|
261
|
+
}, z = (i, t, e, n, s, r) => {
|
|
262
|
+
var h, l, a, c, _, o = t & 7, u = !!(t & 8), p = !!(t & 16), g = o > 3 ? i.length + 1 : o ? u ? 1 : 2 : 0, Y = gt[o + 5], tt = o > 3 && (i[g - 1] = []), bt = i[g] || (i[g] = []), v = o && (!p && !u && (s = s.prototype), o < 5 && (o > 3 || !p) && jt(o < 4 ? s : { get [e]() {
|
|
263
|
+
return _t(this, r);
|
|
264
|
+
}, set [e](A) {
|
|
265
|
+
return dt(this, r, A);
|
|
266
|
+
} }, e));
|
|
267
|
+
o ? p && o < 4 && ct(r, (o > 2 ? "set " : o > 1 ? "get " : "") + e) : ct(s, e);
|
|
268
|
+
for (var V = n.length - 1; V >= 0; V--)
|
|
269
|
+
c = Zt(o, e, a = {}, i[3], bt), o && (c.static = u, c.private = p, _ = c.access = { has: p ? (A) => Jt(s, A) : (A) => e in A }, o ^ 3 && (_.get = p ? (A) => (o ^ 1 ? _t : Kt)(A, s, o ^ 4 ? r : v.get) : (A) => A[e]), o > 2 && (_.set = p ? (A, D) => dt(A, s, D, o ^ 4 ? r : v.set) : (A, D) => A[e] = D)), l = (0, n[V])(o ? o < 4 ? p ? r : v[Y] : o > 4 ? void 0 : { get: v.get, set: v.set } : s, c), a._ = 1, o ^ 4 || l === void 0 ? T(l) && (o > 4 ? tt.unshift(l) : o ? p ? r = l : v[Y] = l : s = l) : typeof l != "object" || l === null ? C("Object expected") : (T(h = l.get) && (v.get = h), T(h = l.set) && (v.set = h), T(h = l.init) && tt.unshift(h));
|
|
270
|
+
return o || Gt(i, s), v && G(s, e, v), p ? o ^ 4 ? r : v : s;
|
|
271
|
+
}, qt = (i, t, e) => ft(i, t + "", e), q = (i, t, e) => t.has(i) || C("Cannot " + e), Jt = (i, t) => Object(t) !== t ? C('Cannot use the "in" operator on this value') : i.has(t), _t = (i, t, e) => (q(i, t, "read from private field"), e ? e.call(i) : t.get(i)), E = (i, t, e) => t.has(i) ? C("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), dt = (i, t, e, n) => (q(i, t, "write to private field"), n ? n.call(i, e) : t.set(i, e), e), Kt = (i, t, e) => (q(i, t, "access private method"), e), mt, yt, xt, Ht, j, Nt, $, J, K, Q, X;
|
|
272
|
+
Nt = [Tt("vi-icon")];
|
|
273
|
+
class y extends (j = Mt, Ht = [k({ type: String, reflect: !0 })], xt = [k({ type: Number })], yt = [k({ type: String })], mt = [St()], j) {
|
|
274
|
+
constructor() {
|
|
275
|
+
super(...arguments), E(this, J, f($, 8, this, "")), f($, 11, this), E(this, K, f($, 12, this, 24)), f($, 15, this), E(this, Q, f($, 16, this, "")), f($, 19, this), E(this, X, f($, 20, this)), f($, 23, this);
|
|
276
|
+
}
|
|
277
|
+
updated(t) {
|
|
278
|
+
super.updated(t), t.has("name") && (this._icon = et(this.name)), t.has("size") && this.style.setProperty("--vi-icon-size", `${this.size}px`);
|
|
279
|
+
}
|
|
280
|
+
firstUpdated(t) {
|
|
281
|
+
super.firstUpdated(t), this._icon = et(this.name), this.style.setProperty("--vi-icon-size", `${this.size}px`);
|
|
282
|
+
}
|
|
283
|
+
render() {
|
|
284
|
+
return this._icon ? this.label ? L`
|
|
285
|
+
<span role="img" aria-label=${this.label}>
|
|
286
|
+
${lt(this._icon.data)}
|
|
287
|
+
</span>
|
|
288
|
+
` : L`
|
|
289
|
+
<span aria-hidden="true">
|
|
290
|
+
${lt(this._icon.data)}
|
|
291
|
+
</span>
|
|
292
|
+
` : L`${wt}`;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
$ = Ft(j);
|
|
296
|
+
J = /* @__PURE__ */ new WeakMap();
|
|
297
|
+
K = /* @__PURE__ */ new WeakMap();
|
|
298
|
+
Q = /* @__PURE__ */ new WeakMap();
|
|
299
|
+
X = /* @__PURE__ */ new WeakMap();
|
|
300
|
+
z($, 4, "name", Ht, y, J);
|
|
301
|
+
z($, 4, "size", xt, y, K);
|
|
302
|
+
z($, 4, "label", yt, y, Q);
|
|
303
|
+
z($, 4, "_icon", mt, y, X);
|
|
304
|
+
y = z($, 0, "ViIcon", Nt, y);
|
|
305
|
+
qt(y, "styles", Ct`
|
|
306
|
+
:host {
|
|
307
|
+
display: inline-flex;
|
|
308
|
+
align-items: center;
|
|
309
|
+
justify-content: center;
|
|
310
|
+
width: var(--vi-icon-size, 24px);
|
|
311
|
+
height: var(--vi-icon-size, 24px);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
svg {
|
|
315
|
+
width: 100%;
|
|
316
|
+
height: 100%;
|
|
317
|
+
fill: none;
|
|
318
|
+
stroke: currentColor;
|
|
319
|
+
stroke-width: 2;
|
|
320
|
+
stroke-linecap: round;
|
|
321
|
+
stroke-linejoin: round;
|
|
322
|
+
}
|
|
323
|
+
`);
|
|
324
|
+
f($, 1, y);
|
|
325
|
+
export {
|
|
326
|
+
y as ViIcon
|
|
327
|
+
};
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ViElement } from './base/vi-element.js';
|
|
2
|
+
export type { ViVariant } from './base/vi-element.js';
|
|
3
|
+
export { ViButton } from './button/vi-button.js';
|
|
4
|
+
export { ViIcon } from './icons/vi-icon.js';
|
|
5
|
+
export { registerIcons, getIcon } from './icons/registry.js';
|
|
6
|
+
export type { SvgIconDef } from './icons/registry.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { V as e } from "./property-Bgga_R54.js";
|
|
2
|
+
import { ViButton as m } from "./button/vi-button.js";
|
|
3
|
+
import { ViIcon as f } from "./icons/vi-icon.js";
|
|
4
|
+
import { getIcon as p, registerIcons as x } from "./icons/registry.js";
|
|
5
|
+
export {
|
|
6
|
+
m as ViButton,
|
|
7
|
+
e as ViElement,
|
|
8
|
+
f as ViIcon,
|
|
9
|
+
p as getIcon,
|
|
10
|
+
x as registerIcons
|
|
11
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vialiq/web-components",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": true,
|
|
6
|
+
"description": "Lit web component library built on @vi/flux-ui design tokens",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"module": "./index.js",
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./index.js",
|
|
13
|
+
"types": "./index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./button": {
|
|
16
|
+
"import": "./button/vi-button.js",
|
|
17
|
+
"types": "./button/vi-button.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./icons/vi-icon": {
|
|
20
|
+
"import": "./icons/vi-icon.js",
|
|
21
|
+
"types": "./icons/vi-icon.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./icons/registry": {
|
|
24
|
+
"import": "./icons/registry.js",
|
|
25
|
+
"types": "./icons/registry.d.ts"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"lit": "^3.0.0",
|
|
30
|
+
"@vialiq/icons": "^0.0.1"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"web-components",
|
|
34
|
+
"custom-elements",
|
|
35
|
+
"lit",
|
|
36
|
+
"design-system",
|
|
37
|
+
"microfrontend",
|
|
38
|
+
"flux-ui"
|
|
39
|
+
],
|
|
40
|
+
"files": [
|
|
41
|
+
"index.js",
|
|
42
|
+
"index.d.ts",
|
|
43
|
+
"index.js.map",
|
|
44
|
+
"button/",
|
|
45
|
+
"icons/",
|
|
46
|
+
"README.md"
|
|
47
|
+
]
|
|
48
|
+
}
|