@theh0n/ui 1.1.0 → 1.1.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.
@@ -0,0 +1,56 @@
1
+ type AccordionId = string | number;
2
+ export type AccordionItem = {
3
+ id: AccordionId;
4
+ title: string;
5
+ body?: string;
6
+ badge?: string;
7
+ disabled?: boolean;
8
+ };
9
+ type __VLS_Props = {
10
+ items?: AccordionItem[];
11
+ modelValue?: AccordionId | AccordionId[] | null;
12
+ multiple?: boolean;
13
+ defaultOpen?: AccordionId | AccordionId[] | null;
14
+ compact?: boolean;
15
+ };
16
+ declare function __VLS_template(): {
17
+ attrs: Partial<{}>;
18
+ slots: {
19
+ header?(_: {
20
+ item: AccordionItem;
21
+ open: boolean;
22
+ }): any;
23
+ body?(_: {
24
+ item: AccordionItem;
25
+ open: boolean;
26
+ }): any;
27
+ };
28
+ refs: {};
29
+ rootEl: HTMLDivElement;
30
+ };
31
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
32
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
33
+ "update:modelValue": (value: AccordionId | AccordionId[] | null) => any;
34
+ toggle: (value: {
35
+ id: AccordionId;
36
+ open: boolean;
37
+ }) => any;
38
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
39
+ "onUpdate:modelValue"?: ((value: AccordionId | AccordionId[] | null) => any) | undefined;
40
+ onToggle?: ((value: {
41
+ id: AccordionId;
42
+ open: boolean;
43
+ }) => any) | undefined;
44
+ }>, {
45
+ items: AccordionItem[];
46
+ multiple: boolean;
47
+ defaultOpen: AccordionId | AccordionId[] | null;
48
+ compact: boolean;
49
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
50
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
51
+ export default _default;
52
+ type __VLS_WithTemplateSlots<T, S> = T & {
53
+ new (): {
54
+ $slots: S;
55
+ };
56
+ };
@@ -0,0 +1,17 @@
1
+ declare function __VLS_template(): {
2
+ attrs: Partial<{}>;
3
+ slots: {
4
+ header?(_: {}): any;
5
+ };
6
+ refs: {};
7
+ rootEl: any;
8
+ };
9
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
+ declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
11
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
12
+ export default _default;
13
+ type __VLS_WithTemplateSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,54 @@
1
+ type Variant = "primary" | "secondary" | "outline" | "ghost";
2
+ type Size = "sm" | "md" | "lg";
3
+ type TextPosition = "center" | "left" | "right";
4
+ type ButtonType = "button" | "submit" | "reset";
5
+ type MaybePromise<T = void> = Promise<T> | T;
6
+ type __VLS_Props = {
7
+ text?: string;
8
+ position?: TextPosition;
9
+ size?: Size;
10
+ variant?: Variant;
11
+ pill?: boolean;
12
+ border?: boolean;
13
+ block?: boolean;
14
+ disabled?: boolean;
15
+ loading?: boolean;
16
+ type?: ButtonType;
17
+ action?: () => MaybePromise;
18
+ };
19
+ declare function __VLS_template(): {
20
+ attrs: Partial<{}>;
21
+ slots: {
22
+ left?(_: {}): any;
23
+ default?(_: {}): any;
24
+ right?(_: {}): any;
25
+ };
26
+ refs: {};
27
+ rootEl: HTMLButtonElement;
28
+ };
29
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
30
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
31
+ done: () => any;
32
+ click: (ev: MouseEvent) => any;
33
+ error: (err: unknown) => any;
34
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
35
+ onDone?: (() => any) | undefined;
36
+ onClick?: ((ev: MouseEvent) => any) | undefined;
37
+ onError?: ((err: unknown) => any) | undefined;
38
+ }>, {
39
+ type: ButtonType;
40
+ disabled: boolean;
41
+ size: Size;
42
+ position: TextPosition;
43
+ variant: Variant;
44
+ pill: boolean;
45
+ border: boolean;
46
+ block: boolean;
47
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLButtonElement>;
48
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
49
+ export default _default;
50
+ type __VLS_WithTemplateSlots<T, S> = T & {
51
+ new (): {
52
+ $slots: S;
53
+ };
54
+ };
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ title?: string;
3
+ };
4
+ declare function __VLS_template(): {
5
+ attrs: Partial<{}>;
6
+ slots: {
7
+ default?(_: {}): any;
8
+ };
9
+ refs: {};
10
+ rootEl: HTMLElement;
11
+ };
12
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
13
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
14
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
15
+ export default _default;
16
+ type __VLS_WithTemplateSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,17 @@
1
+ declare function __VLS_template(): {
2
+ attrs: Partial<{}>;
3
+ slots: {
4
+ dialogHeader?(_: {}): any;
5
+ };
6
+ refs: {};
7
+ rootEl: any;
8
+ };
9
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
+ declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
11
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
12
+ export default _default;
13
+ type __VLS_WithTemplateSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,13 @@
1
+ type __VLS_Props = {
2
+ src: string;
3
+ alt?: string;
4
+ lazy?: boolean;
5
+ fallback?: string;
6
+ fit?: "cover" | "contain" | "fill";
7
+ radius?: number | string;
8
+ };
9
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
10
+ lazy: boolean;
11
+ fit: "cover" | "contain" | "fill";
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
13
+ export default _default;
@@ -0,0 +1,42 @@
1
+ type To = any;
2
+ type __VLS_Props = {
3
+ title?: string;
4
+ description?: string;
5
+ right?: string;
6
+ icon?: string;
7
+ /** Навигация */
8
+ to?: To;
9
+ /** Позволяет интегрировать свой component */
10
+ as?: any;
11
+ /** Поведение */
12
+ disabled?: boolean;
13
+ danger?: boolean;
14
+ /** Визуальные подсказки */
15
+ chevron?: boolean;
16
+ };
17
+ declare function __VLS_template(): {
18
+ attrs: Partial<{}>;
19
+ slots: {
20
+ icon?(_: {}): any;
21
+ title?(_: {}): any;
22
+ description?(_: {}): any;
23
+ right?(_: {}): any;
24
+ };
25
+ refs: {};
26
+ rootEl: any;
27
+ };
28
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
29
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
30
+ click: (ev: MouseEvent) => any;
31
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
32
+ onClick?: ((ev: MouseEvent) => any) | undefined;
33
+ }>, {
34
+ chevron: boolean;
35
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
36
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
37
+ export default _default;
38
+ type __VLS_WithTemplateSlots<T, S> = T & {
39
+ new (): {
40
+ $slots: S;
41
+ };
42
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ size?: "sm" | "md" | "lg";
3
+ color?: string;
4
+ };
5
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
6
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export { useWebAlert } from './useWebAlert';
2
+ export { useWebDialog } from './useWebDialog';
3
+ export { useOverlayStack } from './useOverlayStack';
@@ -0,0 +1,34 @@
1
+ export type OverlayLayer = {
2
+ id?: string;
3
+ showOverlay?: boolean;
4
+ closeOnOverlay?: boolean;
5
+ closeOnEsc?: boolean;
6
+ onRequestClose?: () => void;
7
+ };
8
+ export declare function useOverlayStack(): {
9
+ stack: import('vue').Ref<{
10
+ id?: string | undefined;
11
+ showOverlay?: boolean | undefined;
12
+ closeOnOverlay?: boolean | undefined;
13
+ closeOnEsc?: boolean | undefined;
14
+ onRequestClose?: (() => void) | undefined;
15
+ }[], OverlayLayer[] | {
16
+ id?: string | undefined;
17
+ showOverlay?: boolean | undefined;
18
+ closeOnOverlay?: boolean | undefined;
19
+ closeOnEsc?: boolean | undefined;
20
+ onRequestClose?: (() => void) | undefined;
21
+ }[]>;
22
+ top: import('vue').ComputedRef<{
23
+ id?: string | undefined;
24
+ showOverlay?: boolean | undefined;
25
+ closeOnOverlay?: boolean | undefined;
26
+ closeOnEsc?: boolean | undefined;
27
+ onRequestClose?: (() => void) | undefined;
28
+ } | null>;
29
+ push: (layer: OverlayLayer) => string;
30
+ remove: (id: string) => void;
31
+ requestCloseTop: () => void;
32
+ getBackdropZIndex: (id: string) => number;
33
+ getContentZIndex: (id: string) => number;
34
+ };
@@ -0,0 +1,15 @@
1
+ import { Component } from 'vue';
2
+ export type AlertType = "info" | "action" | "danger";
3
+ export type AlertPayload = {
4
+ id: string;
5
+ title?: string;
6
+ type: AlertType;
7
+ message?: string;
8
+ component?: Component;
9
+ props?: Record<string, any>;
10
+ };
11
+ export declare function useWebAlert(): {
12
+ active: import('vue').ShallowRef<AlertPayload | null, AlertPayload | null>;
13
+ open: (payload: Omit<AlertPayload, "id">) => Promise<boolean>;
14
+ close: (result: boolean) => void;
15
+ };
@@ -0,0 +1,14 @@
1
+ import { Component } from 'vue';
2
+ export type DialogSide = "left" | "right" | "bottom" | "center";
3
+ export type DialogPayload = {
4
+ id: string;
5
+ title?: string;
6
+ side?: DialogSide;
7
+ component: Component;
8
+ props?: Record<string, any>;
9
+ };
10
+ export declare function useWebDialog(): {
11
+ active: import('vue').ShallowRef<DialogPayload | null, DialogPayload | null>;
12
+ open: (payload: Omit<DialogPayload, "id">) => void;
13
+ close: () => void;
14
+ };
@@ -0,0 +1 @@
1
+ export declare function useWebLink(): void;
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),E={colors:{primary:"#171f2a",secondary:"#202a38",tertiary:"#293648",success:"#22c55e",warning:"#ffaa33",danger:"#ff4444",text:"#eaeff6",description:"#6c808c"},borderRadius:{sm:"4px",md:"8px",lg:"16px"},fontFamily:'"Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif',focusRingColor:"rgba(79, 70, 229, 0.4)"};function W(t){if(!t)return V(E);const o=V(E);return w(o,t)}function J(t){if(typeof window>"u"||typeof document>"u")return;const o=document.documentElement,n=K(t);Object.entries(n).forEach(([l,r])=>{o.style.setProperty(l,r)})}function K(t){return{"--h0n-primary":t.colors.primary,"--h0n-secondary":t.colors.secondary,"--h0n-tertiary":t.colors.tertiary,"--h0n-success":t.colors.success,"--h0n-warning":t.colors.warning,"--h0n-danger":t.colors.danger,"--h0n-text-primary":t.colors.text,"--h0n-text-secondary":t.colors.description,"--h0n-radius-sm":t.borderRadius.sm,"--h0n-radius-md":t.borderRadius.md,"--h0n-radius-lg":t.borderRadius.lg,"--h0n-font-family-base":t.fontFamily,"--h0n-focus-ring":t.focusRingColor}}function w(t,o){const n=Array.isArray(t)?[...t]:{...t};return o&&Object.entries(o).forEach(([l,r])=>{if(r===void 0)return;const m=t[l];S(m)&&S(r)?n[l]=w(m,r):n[l]=r}),n}function V(t){return JSON.parse(JSON.stringify(t))}function S(t){return Object.prototype.toString.call(t)==="[object Object]"}const G=["disabled","aria-expanded","aria-controls","onClick"],Q={class:"h0n-ui-accordion__title"},X={class:"h0n-ui-accordion__title-text"},Y={key:0,class:"h0n-ui-accordion__badge"},ee=["id","aria-label"],te={class:"h0n-ui-accordion__body-inner"},ne={key:0},O=e.defineComponent({__name:"Accordion",props:{items:{default:()=>[]},modelValue:{},multiple:{type:Boolean,default:!1},defaultOpen:{default:null},compact:{type:Boolean,default:!1}},emits:["update:modelValue","toggle"],setup(t,{emit:o}){const n=t,l=o;function r(a){return a==null?[]:Array.isArray(a)?n.multiple?a:a.slice(0,1):[a]}const m=e.ref(r(n.defaultOpen)),c=e.computed(()=>n.modelValue!==void 0?r(n.modelValue):m.value),i=e.computed(()=>new Set(c.value));function u(a){return i.value.has(a)}function s(a){n.modelValue===void 0&&(m.value=a),l("update:modelValue",n.multiple?a:a[0]??null)}function f(a){const p=[...c.value];if(n.multiple){const v=new Set(p);v.has(a)?v.delete(a):v.add(a);const Z=Array.from(v);s(Z),l("toggle",{id:a,open:v.has(a)});return}const d=p[0]===a;s(d?[]:[a]),l("toggle",{id:a,open:!d})}function C(a){return`h0n-ui-accordion-body-${String(a)}`}function $(a){return a.querySelector(".h0n-ui-accordion__body-inner")}function M(a){const p=a,d=$(p);d&&(p.style.height="0px",p.style.opacity="0",requestAnimationFrame(()=>{p.style.height=`${d.scrollHeight}px`,p.style.opacity="1"}))}function j(a){const p=a;p.style.height="auto",p.style.opacity=""}function q(a){const p=a,d=$(p);d&&(p.style.height=`${d.scrollHeight}px`,p.style.opacity="1",p.offsetHeight,requestAnimationFrame(()=>{p.style.height="0px",p.style.opacity="0"}))}function F(a){const p=a;p.style.height="",p.style.opacity=""}return(a,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["h0n-ui-accordion",{"is-compact":t.compact}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,d=>(e.openBlock(),e.createElementBlock("div",{key:d.id,class:e.normalizeClass(["h0n-ui-accordion__item",{"is-open":u(d.id),"is-disabled":!!d.disabled}])},[e.createElementVNode("button",{class:"h0n-ui-accordion__header",type:"button",disabled:d.disabled,"aria-expanded":u(d.id)?"true":"false","aria-controls":C(d.id),onClick:U=>f(d.id)},[e.createElementVNode("span",Q,[e.renderSlot(a.$slots,"header",{item:d,open:u(d.id)},()=>[e.createElementVNode("span",X,e.toDisplayString(d.title),1),d.badge?(e.openBlock(),e.createElementBlock("span",Y,e.toDisplayString(d.badge),1)):e.createCommentVNode("",!0)])]),p[0]||(p[0]=e.createElementVNode("svg",{class:"h0n-ui-accordion__chevron",viewBox:"0 0 20 20","aria-hidden":"true"},[e.createElementVNode("path",{d:"M5 7.5L10 12.5L15 7.5",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],8,G),e.createVNode(e.Transition,{name:"h0n-ui-accordion",onEnter:M,onAfterEnter:j,onLeave:q,onAfterLeave:F},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:"h0n-ui-accordion__body",id:C(d.id),role:"region","aria-label":d.title},[e.createElementVNode("div",te,[e.renderSlot(a.$slots,"body",{item:d,open:u(d.id)},()=>[d.body?(e.openBlock(),e.createElementBlock("p",ne,e.toDisplayString(d.body),1)):e.createCommentVNode("",!0)])])],8,ee),[[e.vShow,u(d.id)]])]),_:2},1024)],2))),128))],2))}});function b(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10)}const N=1e4,h=e.ref([]);function y(){const t=e.computed(()=>h.value.at(-1)??null);function o(i){return h.value.findIndex(u=>u.id===i)}function n(i){const u=o(i);return u===-1?N:N+u*2}function l(i){return n(i)+1}function r(i){const u=i.id??b();return m(u),h.value.push({showOverlay:!0,closeOnOverlay:!0,closeOnEsc:!0,...i,id:u}),u}function m(i){const u=o(i);u!==-1&&h.value.splice(u,1)}function c(){t.value?.onRequestClose?.()}return e.watch(()=>h.value.length,i=>{document.documentElement.classList.toggle("no-scroll",i>0)},{immediate:!0}),{stack:h,top:t,push:r,remove:m,requestCloseTop:c,getBackdropZIndex:n,getContentZIndex:l}}const g=e.shallowRef(null);let _=null;function x(){const t=y();function o(l){return new Promise(r=>{const m=b();_=r,g.value={...l,id:m},t.push({id:m,showOverlay:!0,closeOnOverlay:!0,closeOnEsc:!0,onRequestClose:()=>n(!1)})})}function n(l){if(!g.value)return;const r=g.value.id;g.value=null,t.remove(r),_?.(l),_=null}return{active:g,open:o,close:n}}const oe={class:"h0n-alert",role:"dialog","aria-modal":"true"},re={key:0,class:"h0n-alert__header"},le={class:"h0n-alert__title"},ae={class:"h0n-alert__body"},se={key:1},ie=e.defineComponent({__name:"Alert",setup(t){const{active:o,close:n}=x(),{getContentZIndex:l}=y(),r=()=>n(!0),m=()=>n(!1),c=()=>n(!0),i=e.computed(()=>o.value?.type==="info"),u=e.computed(()=>o.value?l(o.value.id):void 0);return(s,f)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"h0n-alert-scale",appear:""},{default:e.withCtx(()=>[e.unref(o)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"h0n-alert-layer",style:e.normalizeStyle({zIndex:u.value})},[e.createElementVNode("section",oe,[e.unref(o).title||s.$slots.header?(e.openBlock(),e.createElementBlock("header",re,[e.renderSlot(s.$slots,"header",{},()=>[e.createElementVNode("h4",le,e.toDisplayString(e.unref(o).title),1)],!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",ae,[e.unref(o).component?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(o).component),e.normalizeProps(e.mergeProps({key:0},e.unref(o).props)),null,16)):e.unref(o).message?(e.openBlock(),e.createElementBlock("p",se,e.toDisplayString(e.unref(o).message),1)):e.createCommentVNode("",!0)]),e.createElementVNode("footer",{class:e.normalizeClass(["h0n-alert__actions",{"is-single":i.value}])},[i.value?(e.openBlock(),e.createElementBlock("button",{key:0,class:"h0n-alert__btn h0n-alert__btn--primary",type:"button",onClick:c}," Ok ")):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{class:"h0n-alert__btn is-danger",type:"button",onClick:m}," Cancel "),e.createElementVNode("button",{class:e.normalizeClass(["h0n-alert__btn h0n-alert__btn--primary",{"is-danger":e.unref(o).type==="danger"}]),type:"button",onClick:r}," Confirm ",2)],64))],2)])],4)):e.createCommentVNode("",!0)]),_:3})]))}}),ce=(t,o)=>{const n=t.__vccOpts||t;for(const[l,r]of o)n[l]=r;return n},z=ce(ie,[["__scopeId","data-v-290cad87"]]),B=e.defineComponent({__name:"Spinner",props:{size:{},color:{}},setup(t){const n=t.size??"md";return(l,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["h0n-ui-spinner",[`h0n-ui-spinner--${e.unref(n)}`,t.color]]),role:"status","aria-label":"Loading"},null,2))}}),ue=["type","disabled","aria-busy"],de={key:0,class:"h0n-ui-btn__icon h0n-ui-btn__icon--left"},me={key:1,class:"h0n-ui-btn__label"},pe={key:2,class:"h0n-ui-btn__spinner","aria-hidden":"true"},fe={key:3,class:"h0n-ui-btn__icon h0n-ui-btn__icon--right"},I=e.defineComponent({__name:"Button",props:{text:{},position:{default:"center"},size:{default:"md"},variant:{default:"primary"},pill:{type:Boolean,default:!1},border:{type:Boolean,default:!0},block:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean},type:{default:"button"},action:{}},emits:["click","done","error"],setup(t,{emit:o}){const n=t,l=o,r=e.ref(!1),m=e.computed(()=>n.loading!==void 0),c=e.computed(()=>m.value?!!n.loading:r.value);function i(s){m.value||(r.value=s)}async function u(s){if(!(n.disabled||c.value)&&(l("click",s),!!n.action))try{i(!0),await n.action(),l("done")}catch(f){l("error",f)}finally{i(!1)}}return(s,f)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["h0n-ui-btn",[`h0n-ui-btn--${t.variant}`,`h0n-ui-btn--${t.size}`,`h0n-ui-btn--text-${t.position}`,{"h0n-ui-btn--loading":c.value,"h0n-ui-btn--pill":t.pill,"h0n-ui-btn--radius":t.border,"h0n-ui-btn--block":t.block}]]),type:t.type,disabled:t.disabled||c.value,"aria-busy":c.value?"true":void 0,onClick:u},[s.$slots.left&&!c.value?(e.openBlock(),e.createElementBlock("span",de,[e.renderSlot(s.$slots,"left")])):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("span",pe,[e.createVNode(B,{size:"sm"})])):(e.openBlock(),e.createElementBlock("span",me,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)])])),s.$slots.right&&!c.value?(e.openBlock(),e.createElementBlock("span",fe,[e.renderSlot(s.$slots,"right")])):e.createCommentVNode("",!0)],10,ue))}}),he={class:"h0n-ui-card"},ye={key:0,class:"h0n-ui-card--title"},D=e.defineComponent({__name:"Card",props:{title:{}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("section",he,[t.title?(e.openBlock(),e.createElementBlock("p",ye,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"default")]))}}),k=e.shallowRef(null);function T(){const t=y();function o(l){const r=b();k.value={...l,id:r},t.push({id:r,showOverlay:!0,closeOnOverlay:!0,closeOnEsc:!0,onRequestClose:n})}function n(){k.value&&(t.remove(k.value.id),k.value=null)}return{active:k,open:o,close:n}}const ve={class:"content-title-dialog"},ge={key:0,class:"title-dialog"},ke={class:"h0n-dialog-content"},A=e.defineComponent({__name:"Dialog",setup(t){const{active:o,close:n}=T(),{getContentZIndex:l}=y(),r=e.ref("bottom");e.watch(()=>o.value?.side,i=>{i&&(r.value=i)},{immediate:!0});const m=e.computed(()=>`h0n-slide-${r.value}`),c=e.computed(()=>o.value?l(o.value.id):void 0);return(i,u)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:m.value,appear:""},{default:e.withCtx(()=>[e.unref(o)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["h0n-dialog-layer",`is-${r.value}`]),style:e.normalizeStyle({zIndex:c.value})},[e.createElementVNode("section",{class:e.normalizeClass(["h0n-dialog-panel",`is-${e.unref(o).side}`])},[e.createElementVNode("header",{class:e.normalizeClass(["h0n-dialog-header",`is-${e.unref(o).side}`])},[e.createElementVNode("div",ve,[e.unref(o).title?(e.openBlock(),e.createElementBlock("p",ge,e.toDisplayString(e.unref(o).title),1)):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"dialogHeader")]),e.createElementVNode("button",{class:"h0n-dialog-close",onClick:u[0]||(u[0]=s=>e.unref(n)())}," x ")],2),e.createElementVNode("div",ke,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(o).component),e.mergeProps(e.unref(o).props,{onClose:e.unref(n)}),null,16,["onClose"]))])],2)],6)):e.createCommentVNode("",!0)]),_:3},8,["name"])]))}}),_e={class:"h0n-ui-menu-item__left"},be={key:0,class:"h0n-ui-menu-item__icon"},Be={class:"h0n-ui-menu-item__text"},Ce={key:0,class:"h0n-ui-menu-item__desc"},$e={key:0,class:"h0n-ui-menu-item__right"},Ee={key:0,class:"h0n-ui-menu-item__right-text"},Ve={key:0,class:"h0n-ui-menu-item__chevron"},H=e.defineComponent({__name:"Menu",props:{title:{},description:{},right:{},icon:{},to:{},as:{},disabled:{type:Boolean},danger:{type:Boolean},chevron:{type:Boolean,default:void 0}},emits:["click"],setup(t,{emit:o}){const n=t,l=o,r=e.computed(()=>!!n.to),m=e.computed(()=>n.as??(r.value?"a":"div")),c=e.computed(()=>n.chevron!==void 0?n.chevron:r.value),i=e.computed(()=>n.disabled?{role:"button",tabindex:-1}:n.as?n.to?{to:n.to}:{}:r.value?{href:"#"}:{role:"button",tabindex:0});function u(s){if(n.disabled){s.preventDefault(),s.stopPropagation();return}!n.as&&r.value&&s.preventDefault(),l("click",s)}return(s,f)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.value),e.mergeProps({class:"h0n-ui-menu-item"},i.value,{"aria-disabled":t.disabled||void 0,onClick:u}),{default:e.withCtx(()=>[e.createElementVNode("div",_e,[s.$slots.icon||t.icon?(e.openBlock(),e.createElementBlock("div",be,[e.renderSlot(s.$slots,"icon",{},()=>[e.createTextVNode(e.toDisplayString(t.icon),1)])])):e.createCommentVNode("",!0),e.createElementVNode("div",Be,[e.createElementVNode("p",{class:e.normalizeClass(["h0n-ui-menu-item__title",{"is-danger":t.danger}])},[e.renderSlot(s.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2),t.description||s.$slots.description?(e.openBlock(),e.createElementBlock("p",Ce,[e.renderSlot(s.$slots,"description",{},()=>[e.createTextVNode(e.toDisplayString(t.description),1)])])):e.createCommentVNode("",!0)])]),t.right||s.$slots.right||c.value?(e.openBlock(),e.createElementBlock("div",$e,[e.renderSlot(s.$slots,"right",{},()=>[t.right?(e.openBlock(),e.createElementBlock("p",Ee,e.toDisplayString(t.right),1)):e.createCommentVNode("",!0)]),c.value?(e.openBlock(),e.createElementBlock("span",Ve,"›")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),_:3},16,["aria-disabled"]))}}),Se={key:0,class:"h0n-ui-image__loader"},Ne={key:1,class:"h0n-ui-image__error"},we=["src"],Oe=["src","alt"],P=e.defineComponent({__name:"Image",props:{src:{},alt:{},lazy:{type:Boolean,default:!0},fallback:{},fit:{default:"cover"},radius:{}},setup(t){const o=t,n=e.ref("loading");function l(){n.value="loading";const c=new Image;c.src=o.src,c.onload=()=>{n.value="loaded"},c.onerror=()=>{n.value="error"}}e.onMounted(()=>{if(o.lazy&&"IntersectionObserver"in window){const c=new IntersectionObserver(([i])=>{i.isIntersecting&&(l(),c.disconnect())});c.observe(document.body)}else l()}),e.watch(()=>o.src,l);const r=e.computed(()=>({borderRadius:typeof o.radius=="number"?`${o.radius}px`:o.radius})),m=e.computed(()=>({objectFit:o.fit}));return(c,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["h0n-ui-image",n.value]),style:e.normalizeStyle(r.value)},[n.value==="loading"?(e.openBlock(),e.createElementBlock("div",Se)):n.value==="error"?(e.openBlock(),e.createElementBlock("div",Ne,[t.fallback?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.fallback},null,8,we)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("img",{key:2,src:t.src,alt:t.alt,style:e.normalizeStyle(m.value),draggable:"false"},null,12,Oe))],6))}}),R=e.defineComponent({__name:"Overlay",setup(t){const{top:o,getBackdropZIndex:n,requestCloseTop:l}=y(),r=e.computed(()=>!!o.value&&o.value.showOverlay!==!1),m=e.computed(()=>{if(o.value?.id)return n(o.value.id)});function c(){}function i(s){const f=o.value;!f||f.closeOnOverlay===!1||l()}function u(s){const f=o.value;!f||f.closeOnEsc===!1||s.key==="Escape"&&l()}return e.onMounted(()=>window.addEventListener("keydown",u)),e.onUnmounted(()=>window.removeEventListener("keydown",u)),(s,f)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"h0n-ui-fade"},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"h0n-ui-overlay",style:e.normalizeStyle({zIndex:m.value}),onPointerdown:e.withModifiers(c,["self","prevent","stop"]),onPointerup:e.withModifiers(c,["self","prevent","stop"]),onClick:e.withModifiers(i,["self","prevent","stop"])},null,36)):e.createCommentVNode("",!0)]),_:1})]))}});function L(t){const o=ze(t);return{install(n){n.component("H0Accordion",O),n.component("H0Alert",z),n.component("H0Button",I),n.component("H0Card",D),n.component("H0Dialog",A),n.component("H0Spinner",B),n.component("H0Menu",H),n.component("H0Image",P),n.component("H0Overlay",R),J(o.theme)}}}const xe=L();function ze(t){return{autoRegisterComponents:t?.autoRegisterComponents??!0,theme:W(t?.theme)}}exports.Accordion=O;exports.Alert=z;exports.Button=I;exports.Card=D;exports.Dialog=A;exports.Image=P;exports.Menu=H;exports.Overlay=R;exports.Spinner=B;exports.createH0NPlugin=L;exports.h0nUi=xe;exports.useOverlayStack=y;exports.useWebAlert=x;exports.useWebDialog=T;
package/dist/index.css ADDED
@@ -0,0 +1 @@
1
+ @charset "UTF-8";.h0n-alert-layer[data-v-290cad87]{position:fixed;inset:0;display:grid;place-items:center;pointer-events:none}.h0n-alert-layer[data-v-290cad87]>*{pointer-events:auto}.h0n-alert-scale-enter-active[data-v-290cad87],.h0n-alert-scale-leave-active[data-v-290cad87]{transition:transform .18s ease,opacity .18s ease}.h0n-alert-scale-enter-from[data-v-290cad87],.h0n-alert-scale-leave-to[data-v-290cad87]{transform:translateY(6px) scale(.98);opacity:0}.h0n-ui-btn{--btn-bg: var(--h0n-btn-primary-bg);--btn-fg: var(--h0n-btn-primary-text);--btn-border: transparent;--btn-bg-hover: var(--h0n-btn-primary-bg-hover);--btn-bg-active: var(--h0n-btn-primary-bg-active);--btn-layer-hover: var(--h0n-layer-hover);--btn-layer-active: var(--h0n-layer-active);--btn-ring: var(--h0n-layer-focus);display:inline-flex;align-items:center;justify-content:center;gap:10px;min-width:0;width:auto;border:none;outline:none;color:var(--btn-fg);background:var(--btn-bg);box-shadow:0 0 0 1px var(--btn-border);font-weight:700;cursor:pointer;-webkit-user-select:none;user-select:none;transition:transform .03s ease,opacity .12s ease,background .12s ease,color .12s ease,box-shadow .12s ease}.h0n-ui-btn:focus-visible{box-shadow:0 0 0 1px var(--btn-border),0 0 0 4px var(--btn-ring)}.h0n-ui-btn:disabled{opacity:.65;cursor:default}@media(hover:hover){.h0n-ui-btn:not(:disabled):hover{background:var(--btn-bg-hover)}}.h0n-ui-btn:not(:disabled):active{transform:scale(.99)}.h0n-ui-btn--block{width:100%}.h0n-ui-btn--sm{height:40px;padding:0 14px;font-size:14px}.h0n-ui-btn--md{height:50px;padding:0 16px;font-size:15px}.h0n-ui-btn--lg{height:56px;padding:0 18px;font-size:16px}.h0n-ui-btn--pill{border-radius:999px}.h0n-ui-btn--radius{border-radius:var(--h0n-radius-16, 16px)}.h0n-ui-btn--secondary{--btn-bg: var(--h0n-btn-secondary-bg);--btn-fg: var(--h0n-btn-secondary-text);--btn-bg-hover: linear-gradient(var(--btn-layer-hover), var(--btn-layer-hover)), var(--btn-bg);--btn-bg-active: linear-gradient(var(--btn-layer-active), var(--btn-layer-active)), var(--btn-bg);--btn-ring: var(--h0n-border-strong)}.h0n-ui-btn--outline{--btn-bg: transparent;--btn-fg: var(--h0n-text-primary);--btn-border: var(--h0n-border-strong);--btn-ring: var(--h0n-border-strong);--btn-bg-hover: linear-gradient(var(--btn-layer-hover), var(--btn-layer-hover)), transparent;--btn-bg-active: linear-gradient(var(--btn-layer-active), var(--btn-layer-active)), transparent}.h0n-ui-btn--ghost{--btn-bg: transparent;--btn-fg: var(--h0n-btn-ghost-text);--btn-border: transparent;--btn-ring: var(--h0n-border-strong);--btn-bg-hover: linear-gradient(var(--btn-layer-hover), var(--btn-layer-hover)), transparent;--btn-bg-active: linear-gradient(var(--btn-layer-active), var(--btn-layer-active)), transparent}.h0n-ui-btn--loading .h0n-ui-btn__label,.h0n-ui-btn--loading .h0n-ui-btn__icon{display:none}.h0n-ui-btn--text-center{justify-content:center}.h0n-ui-btn--text-left{justify-content:flex-start}.h0n-ui-btn--text-right{justify-content:flex-end}.h0n-ui-btn__icon{display:inline-flex}.h0n-ui-btn__label{display:inline-block;font-weight:600}.h0n-ui-btn__spinner{display:inline-flex}.h0n-ui-image{position:relative;overflow:hidden;background:var(--h0n-secondary);width:100%;height:100%}.h0n-ui-image__loader{position:absolute;inset:0;background:linear-gradient(90deg,#1c1c1c 25%,#2a2a2a 37%,#1c1c1c 63%);background-size:400% 100%;animation:shimmer 1.4s ease infinite}.h0n-ui-image img{width:100%;height:100%;display:block}.h0n-ui-image.error{display:flex;align-items:center;justify-content:center;opacity:.6}@keyframes shimmer{0%{background-position:100% 0}to{background-position:-100% 0}}.h0n-ui-spinner{border:2px solid transparent;border-top-color:currentColor;border-radius:50%;animation:h0n-spin 1s linear infinite;display:inline-block}.h0n-ui-spinner--sm{width:16px;height:16px}.h0n-ui-spinner--md{width:24px;height:24px}.h0n-ui-spinner--lg{width:36px;height:36px}@keyframes h0n-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.h0n-ui-menu-item{padding:12px 15px;border-bottom:1px solid var(--h0n-primary);display:flex;align-items:center;justify-content:space-between;cursor:pointer;text-decoration:none;color:inherit;width:100%;min-height:50px}.h0n-ui-menu-item:last-child{border-bottom:0}.h0n-ui-menu-item[aria-disabled=true]{opacity:.55;cursor:default}.h0n-ui-menu-item__left{display:flex;gap:12px;min-width:0}.h0n-ui-menu-item__icon{display:flex;align-items:center;justify-content:center;height:26px;width:26px;flex:0 0 auto}.h0n-ui-menu-item__text{display:flex;flex-direction:column;justify-content:center;min-width:0}.h0n-ui-menu-item__title{font-weight:500;color:var(--h0n-text-primary);margin:0}.h0n-ui-menu-item__title.is-danger{color:var(--h0n-status-danger)}.h0n-ui-menu-item__desc{font-size:14px;color:var(--h0n-text-secondary);margin:0}.h0n-ui-menu-item__right{display:inline-flex;align-items:center;gap:8px;flex:0 0 auto}.h0n-ui-menu-item__right-text{font-weight:500;font-size:14px;color:#73b9fffa;margin:0}.h0n-ui-menu-item__chevron{opacity:.7;transform:translateY(-1px)}.h0n-ui-accordion{--acc-body-padding: 0 14px 12px;display:grid;gap:10px;width:100%}.h0n-ui-accordion.is-compact{--acc-body-padding: 0 12px 10px}.h0n-ui-accordion.is-compact .h0n-ui-accordion__header{padding:10px 12px}.h0n-ui-accordion__item{border-radius:12px;background:var(--h0n-secondary);overflow:hidden}.h0n-ui-accordion__item.is-open .h0n-ui-accordion__chevron{transform:rotate(180deg)}.h0n-ui-accordion__item.is-disabled .h0n-ui-accordion__header{cursor:not-allowed;opacity:.5}.h0n-ui-accordion__header{width:100%;background:transparent;border:none;color:inherit;padding:14px;display:flex;align-items:center;justify-content:space-between;gap:12px;cursor:pointer;text-align:left}.h0n-ui-accordion__title{display:inline-flex;align-items:center;gap:8px;font-size:14px;font-weight:600}.h0n-ui-accordion__badge{font-size:10px;letter-spacing:.12em;text-transform:uppercase;padding:2px 6px;border-radius:999px;color:#ffffffb3;background:#ffffff14}.h0n-ui-accordion__chevron{width:16px;height:16px;transition:transform .2s ease}.h0n-ui-accordion__body{overflow:hidden}.h0n-ui-accordion__body-inner{padding:var(--acc-body-padding);font-size:13px;color:var(--h0n-text-secondary)}.h0n-ui-accordion__body-inner p{margin:0;line-height:1.6}.h0n-ui-accordion-enter-active,.h0n-ui-accordion-leave-active{transition:height .22s ease,opacity .22s ease;will-change:height,opacity}.h0n-ui-overlay{position:fixed;inset:0;background:#00000073;pointer-events:auto;touch-action:none}.h0n-ui-fade-enter-active,.h0n-ui-fade-leave-active{transition:opacity .22s ease}.h0n-ui-fade-enter-from,.h0n-ui-fade-leave-to{opacity:0}.h0n-ui-card{background-color:var(--h0n-secondary);border-radius:12px;overflow:hidden}.h0n-ui-card:not(:last-child){margin-bottom:10px}.h0n-ui-card--title{padding:12px 12px 6px;font-weight:500;font-size:15px;color:#73b9fffa;margin:0}.h0n-alert{width:min(360px,92vw);border-radius:12px;background:var(--h0n-primary);color:var(--h0n-text-primary);overflow:hidden;pointer-events:auto}.h0n-alert .h0n-alert__header{padding:12px 12px 0}.h0n-alert .h0n-alert__header .h0n-alert__title{margin:0;font-size:15px;font-weight:500;color:#11a8fff2}.h0n-alert .h0n-alert__body{padding:12px}.h0n-alert .h0n-alert__actions{padding:0 12px 12px;display:flex;justify-content:right;gap:8px}.h0n-alert .h0n-alert__actions.is-single{justify-content:flex-end}.h0n-alert .h0n-alert__actions .h0n-alert__btn{border:0;background:transparent;color:#91c8fff2;font-weight:500;font-size:14px;padding:10px 12px;border-radius:10px;cursor:pointer;transition:background .15s ease,color .15s ease}.h0n-alert .h0n-alert__actions .h0n-alert__btn:active{background:#ffffff0f}.h0n-alert .h0n-alert__actions .h0n-alert__btn--primary{color:#11a8fff2}.h0n-alert .h0n-alert__actions .is-danger{color:var(--h0n-danger)}.h0n-dialog-layer{position:fixed;inset:0;display:grid;overscroll-behavior:contain;pointer-events:none;place-items:end center}.h0n-dialog-layer.is-center{place-items:center}.h0n-dialog-layer.is-left{place-items:stretch start}.h0n-dialog-layer.is-right{place-items:stretch end}.h0n-dialog-layer .h0n-dialog-panel{background:var(--h0n-primary);color:var(--h0n-text-primary);box-shadow:0 20px 60px #00000059;transform:translateZ(0);backface-visibility:hidden;overflow:hidden;display:flex;flex-direction:column;pointer-events:auto}.h0n-dialog-layer .h0n-dialog-panel.is-left,.h0n-dialog-layer .h0n-dialog-panel.is-right{width:min(420px,85vw - 32px);height:100dvh;border-radius:0;padding-top:var(--tg-safe-top, 10px)}.h0n-dialog-layer .h0n-dialog-panel.is-bottom{margin-inline:auto;width:100%;max-width:min(420px,100%);max-height:85dvh;padding-top:10px;border-radius:0;border-top-left-radius:var(--h0n-radius-12, 12px);border-top-right-radius:var(--h0n-radius-12, 12px)}.h0n-dialog-layer .h0n-dialog-panel.is-center{width:min(400px,92vw);max-height:85dvh;padding-top:10px;border-radius:var(--h0n-radius-12, 12px)}.h0n-dialog-layer .h0n-dialog-panel .h0n-dialog-header{padding:10px 12px;display:flex;justify-content:space-between;align-items:center;width:100%;position:absolute;top:0;padding-top:var(--tg-safe-top, 10px);z-index:2;background:color-mix(in srgb,var(--h0n-primary) 70%,transparent);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}.h0n-dialog-layer .h0n-dialog-panel .h0n-dialog-header.is-center,.h0n-dialog-layer .h0n-dialog-panel .h0n-dialog-header.is-bottom{padding-top:10px}.h0n-dialog-layer .h0n-dialog-panel .h0n-dialog-header .h0n-dialog-close{border:none;outline:none;cursor:pointer;color:inherit;display:inline-flex;align-items:center;gap:6px;border-radius:16px;background:#00000026;-webkit-backdrop-filter:blur(15px);backdrop-filter:blur(15px);padding:6px 16px}.h0n-dialog-layer .h0n-dialog-panel .h0n-dialog-header .h0n-dialog-close:hover{color:var(--h0n-text-primary)}.h0n-dialog-layer .h0n-dialog-panel .h0n-dialog-header .h0n-dialog-close:focus-visible{outline:2px solid rgba(255,255,255,.35);outline-offset:2px}.h0n-dialog-layer .h0n-dialog-panel .h0n-dialog-content{overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding-top:50px}.h0n-slide-left-enter-active,.h0n-slide-right-enter-active,.h0n-slide-bottom-enter-active,.h0n-slide-center-enter-active{transition:transform .26s cubic-bezier(.2,.8,.2,1),opacity .16s ease;will-change:transform,opacity}.h0n-slide-left-leave-active,.h0n-slide-right-leave-active,.h0n-slide-bottom-leave-active,.h0n-slide-center-leave-active{transition:transform .16s cubic-bezier(.4,0,.8,.2),opacity .16s ease;will-change:transform,opacity}.h0n-slide-left-enter-from,.h0n-slide-left-leave-to{transform:translate3d(-105%,0,0)}.h0n-slide-right-enter-from,.h0n-slide-right-leave-to{transform:translate3d(105%,0,0)}.h0n-slide-bottom-enter-from,.h0n-slide-bottom-leave-to{transform:translate3d(0,105%,0)}.h0n-slide-center-enter-from,.h0n-slide-center-leave-to{transform:translate3d(0,10%,0) scale(.98);opacity:0}.h0n-slide-left-enter-to,.h0n-slide-left-leave-from,.h0n-slide-right-enter-to,.h0n-slide-right-leave-from,.h0n-slide-bottom-enter-to,.h0n-slide-bottom-leave-from,.h0n-slide-center-enter-to,.h0n-slide-center-leave-from{transform:translateZ(0);opacity:1}@media(prefers-reduced-motion:reduce){.h0n-slide-left-enter-active,.h0n-slide-left-leave-active,.h0n-slide-right-enter-active,.h0n-slide-right-leave-active,.h0n-slide-bottom-enter-active,.h0n-slide-bottom-leave-active,.h0n-slide-center-enter-active,.h0n-slide-center-leave-active{transition:none!important}}:root{color-scheme:light;--h0n-primary: "#171f2a";--h0n-secondary: "#202a38", --h0n-tertiary: "#293648", --h0n-success: "#22c55e", --h0n-warning: "#ffaa33", --h0n-danger: "#ff4444", --h0n-text-primary: "#eaeff6", --h0n-text-secondary: "#6c808c", --h0n-radius-sm: 8px;--h0n-radius-md: 12px;--h0n-radius-lg: 16px;--h0n-font-family-base: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;--h0n-focus-ring: rgba(79, 70, 229, .4)}[class^=H0],[class*=" H0"]{font-family:inherit}.h0n-focusable:focus-visible{outline:2px solid var(--h0n-focus-ring);outline-offset:2px}
@@ -0,0 +1,30 @@
1
+ import { Plugin } from 'vue';
2
+ import { H0NPluginOptions, H0NTheme } from './types';
3
+ import { default as Accordion } from './components/Accordion';
4
+ import { default as Alert } from './components/Alert';
5
+ import { default as Button } from './components/Button';
6
+ import { default as Card } from './components/Card';
7
+ import { default as Dialog } from './components/Dialog';
8
+ import { default as Spinner } from './components/Spinner';
9
+ import { default as Menu } from './components/Menu';
10
+ import { default as Image } from './components/Image';
11
+ import { default as Overlay } from './components/Overlay';
12
+ export * from './composables';
13
+ export { Accordion, Alert, Button, Card, Dialog, Spinner, Menu, Image, Overlay, };
14
+ export type { H0NPluginOptions, H0NTheme };
15
+ export declare function createH0NPlugin(options?: H0NPluginOptions): Plugin;
16
+ declare const plugin: Plugin;
17
+ declare module "@vue/runtime-core" {
18
+ interface GlobalComponents {
19
+ H0Accordion: typeof Accordion;
20
+ H0Alert: typeof Alert;
21
+ H0Button: typeof Button;
22
+ H0Card: typeof Card;
23
+ H0Dialog: typeof Dialog;
24
+ H0Spinner: typeof Spinner;
25
+ H0Menu: typeof Menu;
26
+ H0Image: typeof Image;
27
+ H0Overlay: typeof Overlay;
28
+ }
29
+ }
30
+ export { plugin as h0nUi };
package/dist/index.js ADDED
@@ -0,0 +1,734 @@
1
+ import { defineComponent as C, ref as z, computed as _, openBlock as i, createElementBlock as c, normalizeClass as k, Fragment as K, renderList as ae, createElementVNode as p, renderSlot as b, toDisplayString as $, createCommentVNode as m, createVNode as A, Transition as R, withCtx as E, withDirectives as re, vShow as le, watch as V, shallowRef as G, createBlock as w, Teleport as P, unref as v, normalizeStyle as B, resolveDynamicComponent as M, normalizeProps as ce, mergeProps as j, createTextVNode as L, onMounted as Q, onUnmounted as ue, withModifiers as D } from "vue";
2
+ import './index.css';const U = {
3
+ colors: {
4
+ primary: "#171f2a",
5
+ secondary: "#202a38",
6
+ tertiary: "#293648",
7
+ success: "#22c55e",
8
+ warning: "#ffaa33",
9
+ danger: "#ff4444",
10
+ text: "#eaeff6",
11
+ description: "#6c808c"
12
+ },
13
+ borderRadius: {
14
+ sm: "4px",
15
+ md: "8px",
16
+ lg: "16px"
17
+ },
18
+ fontFamily: '"Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif',
19
+ focusRingColor: "rgba(79, 70, 229, 0.4)"
20
+ };
21
+ function de(e) {
22
+ if (!e)
23
+ return Z(U);
24
+ const n = Z(U);
25
+ return X(n, e);
26
+ }
27
+ function fe(e) {
28
+ if (typeof window > "u" || typeof document > "u")
29
+ return;
30
+ const n = document.documentElement, t = he(e);
31
+ Object.entries(t).forEach(([s, o]) => {
32
+ n.style.setProperty(s, o);
33
+ });
34
+ }
35
+ function he(e) {
36
+ return {
37
+ "--h0n-primary": e.colors.primary,
38
+ "--h0n-secondary": e.colors.secondary,
39
+ "--h0n-tertiary": e.colors.tertiary,
40
+ "--h0n-success": e.colors.success,
41
+ "--h0n-warning": e.colors.warning,
42
+ "--h0n-danger": e.colors.danger,
43
+ "--h0n-text-primary": e.colors.text,
44
+ "--h0n-text-secondary": e.colors.description,
45
+ "--h0n-radius-sm": e.borderRadius.sm,
46
+ "--h0n-radius-md": e.borderRadius.md,
47
+ "--h0n-radius-lg": e.borderRadius.lg,
48
+ "--h0n-font-family-base": e.fontFamily,
49
+ "--h0n-focus-ring": e.focusRingColor
50
+ };
51
+ }
52
+ function X(e, n) {
53
+ const t = Array.isArray(e) ? [...e] : { ...e };
54
+ return n && Object.entries(n).forEach(([s, o]) => {
55
+ if (o === void 0)
56
+ return;
57
+ const h = e[s];
58
+ J(h) && J(o) ? t[s] = X(
59
+ h,
60
+ o
61
+ ) : t[s] = o;
62
+ }), t;
63
+ }
64
+ function Z(e) {
65
+ return JSON.parse(JSON.stringify(e));
66
+ }
67
+ function J(e) {
68
+ return Object.prototype.toString.call(e) === "[object Object]";
69
+ }
70
+ const ye = ["disabled", "aria-expanded", "aria-controls", "onClick"], pe = { class: "h0n-ui-accordion__title" }, ve = { class: "h0n-ui-accordion__title-text" }, me = {
71
+ key: 0,
72
+ class: "h0n-ui-accordion__badge"
73
+ }, _e = ["id", "aria-label"], ge = { class: "h0n-ui-accordion__body-inner" }, be = { key: 0 }, $e = /* @__PURE__ */ C({
74
+ __name: "Accordion",
75
+ props: {
76
+ items: { default: () => [] },
77
+ modelValue: {},
78
+ multiple: { type: Boolean, default: !1 },
79
+ defaultOpen: { default: null },
80
+ compact: { type: Boolean, default: !1 }
81
+ },
82
+ emits: ["update:modelValue", "toggle"],
83
+ setup(e, { emit: n }) {
84
+ const t = e, s = n;
85
+ function o(a) {
86
+ return a == null ? [] : Array.isArray(a) ? t.multiple ? a : a.slice(0, 1) : [a];
87
+ }
88
+ const h = z(o(t.defaultOpen)), u = _(
89
+ () => t.modelValue !== void 0 ? o(t.modelValue) : h.value
90
+ ), l = _(() => new Set(u.value));
91
+ function d(a) {
92
+ return l.value.has(a);
93
+ }
94
+ function r(a) {
95
+ t.modelValue === void 0 && (h.value = a), s("update:modelValue", t.multiple ? a : a[0] ?? null);
96
+ }
97
+ function g(a) {
98
+ const y = [...u.value];
99
+ if (t.multiple) {
100
+ const x = new Set(y);
101
+ x.has(a) ? x.delete(a) : x.add(a);
102
+ const ie = Array.from(x);
103
+ r(ie), s("toggle", { id: a, open: x.has(a) });
104
+ return;
105
+ }
106
+ const f = y[0] === a;
107
+ r(f ? [] : [a]), s("toggle", { id: a, open: !f });
108
+ }
109
+ function N(a) {
110
+ return `h0n-ui-accordion-body-${String(a)}`;
111
+ }
112
+ function F(a) {
113
+ return a.querySelector(".h0n-ui-accordion__body-inner");
114
+ }
115
+ function ee(a) {
116
+ const y = a, f = F(y);
117
+ f && (y.style.height = "0px", y.style.opacity = "0", requestAnimationFrame(() => {
118
+ y.style.height = `${f.scrollHeight}px`, y.style.opacity = "1";
119
+ }));
120
+ }
121
+ function te(a) {
122
+ const y = a;
123
+ y.style.height = "auto", y.style.opacity = "";
124
+ }
125
+ function ne(a) {
126
+ const y = a, f = F(y);
127
+ f && (y.style.height = `${f.scrollHeight}px`, y.style.opacity = "1", y.offsetHeight, requestAnimationFrame(() => {
128
+ y.style.height = "0px", y.style.opacity = "0";
129
+ }));
130
+ }
131
+ function oe(a) {
132
+ const y = a;
133
+ y.style.height = "", y.style.opacity = "";
134
+ }
135
+ return (a, y) => (i(), c("div", {
136
+ class: k(["h0n-ui-accordion", { "is-compact": e.compact }])
137
+ }, [
138
+ (i(!0), c(K, null, ae(e.items, (f) => (i(), c("div", {
139
+ key: f.id,
140
+ class: k(["h0n-ui-accordion__item", {
141
+ "is-open": d(f.id),
142
+ "is-disabled": !!f.disabled
143
+ }])
144
+ }, [
145
+ p("button", {
146
+ class: "h0n-ui-accordion__header",
147
+ type: "button",
148
+ disabled: f.disabled,
149
+ "aria-expanded": d(f.id) ? "true" : "false",
150
+ "aria-controls": N(f.id),
151
+ onClick: (se) => g(f.id)
152
+ }, [
153
+ p("span", pe, [
154
+ b(a.$slots, "header", {
155
+ item: f,
156
+ open: d(f.id)
157
+ }, () => [
158
+ p("span", ve, $(f.title), 1),
159
+ f.badge ? (i(), c("span", me, $(f.badge), 1)) : m("", !0)
160
+ ])
161
+ ]),
162
+ y[0] || (y[0] = p("svg", {
163
+ class: "h0n-ui-accordion__chevron",
164
+ viewBox: "0 0 20 20",
165
+ "aria-hidden": "true"
166
+ }, [
167
+ p("path", {
168
+ d: "M5 7.5L10 12.5L15 7.5",
169
+ fill: "none",
170
+ stroke: "currentColor",
171
+ "stroke-width": "1.8",
172
+ "stroke-linecap": "round",
173
+ "stroke-linejoin": "round"
174
+ })
175
+ ], -1))
176
+ ], 8, ye),
177
+ A(R, {
178
+ name: "h0n-ui-accordion",
179
+ onEnter: ee,
180
+ onAfterEnter: te,
181
+ onLeave: ne,
182
+ onAfterLeave: oe
183
+ }, {
184
+ default: E(() => [
185
+ re(p("div", {
186
+ class: "h0n-ui-accordion__body",
187
+ id: N(f.id),
188
+ role: "region",
189
+ "aria-label": f.title
190
+ }, [
191
+ p("div", ge, [
192
+ b(a.$slots, "body", {
193
+ item: f,
194
+ open: d(f.id)
195
+ }, () => [
196
+ f.body ? (i(), c("p", be, $(f.body), 1)) : m("", !0)
197
+ ])
198
+ ])
199
+ ], 8, _e), [
200
+ [le, d(f.id)]
201
+ ])
202
+ ]),
203
+ _: 2
204
+ }, 1024)
205
+ ], 2))), 128))
206
+ ], 2));
207
+ }
208
+ });
209
+ function q() {
210
+ return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : Date.now().toString(36) + Math.random().toString(36).slice(2, 10);
211
+ }
212
+ const W = 1e4, O = z([]);
213
+ function H() {
214
+ const e = _(() => O.value.at(-1) ?? null);
215
+ function n(l) {
216
+ return O.value.findIndex((d) => d.id === l);
217
+ }
218
+ function t(l) {
219
+ const d = n(l);
220
+ return d === -1 ? W : W + d * 2;
221
+ }
222
+ function s(l) {
223
+ return t(l) + 1;
224
+ }
225
+ function o(l) {
226
+ const d = l.id ?? q();
227
+ return h(d), O.value.push({
228
+ showOverlay: !0,
229
+ closeOnOverlay: !0,
230
+ closeOnEsc: !0,
231
+ ...l,
232
+ id: d
233
+ }), d;
234
+ }
235
+ function h(l) {
236
+ const d = n(l);
237
+ d !== -1 && O.value.splice(d, 1);
238
+ }
239
+ function u() {
240
+ e.value?.onRequestClose?.();
241
+ }
242
+ return V(
243
+ () => O.value.length,
244
+ (l) => {
245
+ document.documentElement.classList.toggle("no-scroll", l > 0);
246
+ },
247
+ { immediate: !0 }
248
+ ), {
249
+ stack: O,
250
+ top: e,
251
+ push: o,
252
+ remove: h,
253
+ requestCloseTop: u,
254
+ getBackdropZIndex: t,
255
+ getContentZIndex: s
256
+ };
257
+ }
258
+ const I = G(null);
259
+ let T = null;
260
+ function ke() {
261
+ const e = H();
262
+ function n(s) {
263
+ return new Promise((o) => {
264
+ const h = q();
265
+ T = o, I.value = { ...s, id: h }, e.push({
266
+ id: h,
267
+ showOverlay: !0,
268
+ closeOnOverlay: !0,
269
+ closeOnEsc: !0,
270
+ onRequestClose: () => t(!1)
271
+ });
272
+ });
273
+ }
274
+ function t(s) {
275
+ if (!I.value) return;
276
+ const o = I.value.id;
277
+ I.value = null, e.remove(o), T?.(s), T = null;
278
+ }
279
+ return {
280
+ active: I,
281
+ open: n,
282
+ close: t
283
+ };
284
+ }
285
+ const Ce = {
286
+ class: "h0n-alert",
287
+ role: "dialog",
288
+ "aria-modal": "true"
289
+ }, Oe = {
290
+ key: 0,
291
+ class: "h0n-alert__header"
292
+ }, we = { class: "h0n-alert__title" }, xe = { class: "h0n-alert__body" }, Ie = { key: 1 }, Se = /* @__PURE__ */ C({
293
+ __name: "Alert",
294
+ setup(e) {
295
+ const { active: n, close: t } = ke(), { getContentZIndex: s } = H(), o = () => t(!0), h = () => t(!1), u = () => t(!0), l = _(() => n.value?.type === "info"), d = _(
296
+ () => n.value ? s(n.value.id) : void 0
297
+ );
298
+ return (r, g) => (i(), w(P, { to: "body" }, [
299
+ A(R, {
300
+ name: "h0n-alert-scale",
301
+ appear: ""
302
+ }, {
303
+ default: E(() => [
304
+ v(n) ? (i(), c("div", {
305
+ key: 0,
306
+ class: "h0n-alert-layer",
307
+ style: B({ zIndex: d.value })
308
+ }, [
309
+ p("section", Ce, [
310
+ v(n).title || r.$slots.header ? (i(), c("header", Oe, [
311
+ b(r.$slots, "header", {}, () => [
312
+ p("h4", we, $(v(n).title), 1)
313
+ ], !0)
314
+ ])) : m("", !0),
315
+ p("div", xe, [
316
+ v(n).component ? (i(), w(M(v(n).component), ce(j({ key: 0 }, v(n).props)), null, 16)) : v(n).message ? (i(), c("p", Ie, $(v(n).message), 1)) : m("", !0)
317
+ ]),
318
+ p("footer", {
319
+ class: k(["h0n-alert__actions", { "is-single": l.value }])
320
+ }, [
321
+ l.value ? (i(), c("button", {
322
+ key: 0,
323
+ class: "h0n-alert__btn h0n-alert__btn--primary",
324
+ type: "button",
325
+ onClick: u
326
+ }, " Ok ")) : (i(), c(K, { key: 1 }, [
327
+ p("button", {
328
+ class: "h0n-alert__btn is-danger",
329
+ type: "button",
330
+ onClick: h
331
+ }, " Cancel "),
332
+ p("button", {
333
+ class: k(["h0n-alert__btn h0n-alert__btn--primary", {
334
+ "is-danger": v(n).type === "danger"
335
+ }]),
336
+ type: "button",
337
+ onClick: o
338
+ }, " Confirm ", 2)
339
+ ], 64))
340
+ ], 2)
341
+ ])
342
+ ], 4)) : m("", !0)
343
+ ]),
344
+ _: 3
345
+ })
346
+ ]));
347
+ }
348
+ }), Be = (e, n) => {
349
+ const t = e.__vccOpts || e;
350
+ for (const [s, o] of n)
351
+ t[s] = o;
352
+ return t;
353
+ }, ze = /* @__PURE__ */ Be(Se, [["__scopeId", "data-v-290cad87"]]), Y = /* @__PURE__ */ C({
354
+ __name: "Spinner",
355
+ props: {
356
+ size: {},
357
+ color: {}
358
+ },
359
+ setup(e) {
360
+ const t = e.size ?? "md";
361
+ return (s, o) => (i(), c("div", {
362
+ class: k(["h0n-ui-spinner", [`h0n-ui-spinner--${v(t)}`, e.color]]),
363
+ role: "status",
364
+ "aria-label": "Loading"
365
+ }, null, 2));
366
+ }
367
+ }), Ae = ["type", "disabled", "aria-busy"], Ee = {
368
+ key: 0,
369
+ class: "h0n-ui-btn__icon h0n-ui-btn__icon--left"
370
+ }, He = {
371
+ key: 1,
372
+ class: "h0n-ui-btn__label"
373
+ }, Le = {
374
+ key: 2,
375
+ class: "h0n-ui-btn__spinner",
376
+ "aria-hidden": "true"
377
+ }, Re = {
378
+ key: 3,
379
+ class: "h0n-ui-btn__icon h0n-ui-btn__icon--right"
380
+ }, De = /* @__PURE__ */ C({
381
+ __name: "Button",
382
+ props: {
383
+ text: {},
384
+ position: { default: "center" },
385
+ size: { default: "md" },
386
+ variant: { default: "primary" },
387
+ pill: { type: Boolean, default: !1 },
388
+ border: { type: Boolean, default: !0 },
389
+ block: { type: Boolean, default: !1 },
390
+ disabled: { type: Boolean, default: !1 },
391
+ loading: { type: Boolean },
392
+ type: { default: "button" },
393
+ action: {}
394
+ },
395
+ emits: ["click", "done", "error"],
396
+ setup(e, { emit: n }) {
397
+ const t = e, s = n, o = z(!1), h = _(() => t.loading !== void 0), u = _(
398
+ () => h.value ? !!t.loading : o.value
399
+ );
400
+ function l(r) {
401
+ h.value || (o.value = r);
402
+ }
403
+ async function d(r) {
404
+ if (!(t.disabled || u.value) && (s("click", r), !!t.action))
405
+ try {
406
+ l(!0), await t.action(), s("done");
407
+ } catch (g) {
408
+ s("error", g);
409
+ } finally {
410
+ l(!1);
411
+ }
412
+ }
413
+ return (r, g) => (i(), c("button", {
414
+ class: k(["h0n-ui-btn", [
415
+ `h0n-ui-btn--${e.variant}`,
416
+ `h0n-ui-btn--${e.size}`,
417
+ `h0n-ui-btn--text-${e.position}`,
418
+ {
419
+ "h0n-ui-btn--loading": u.value,
420
+ "h0n-ui-btn--pill": e.pill,
421
+ "h0n-ui-btn--radius": e.border,
422
+ "h0n-ui-btn--block": e.block
423
+ }
424
+ ]]),
425
+ type: e.type,
426
+ disabled: e.disabled || u.value,
427
+ "aria-busy": u.value ? "true" : void 0,
428
+ onClick: d
429
+ }, [
430
+ r.$slots.left && !u.value ? (i(), c("span", Ee, [
431
+ b(r.$slots, "left")
432
+ ])) : m("", !0),
433
+ u.value ? (i(), c("span", Le, [
434
+ A(Y, { size: "sm" })
435
+ ])) : (i(), c("span", He, [
436
+ b(r.$slots, "default", {}, () => [
437
+ L($(e.text), 1)
438
+ ])
439
+ ])),
440
+ r.$slots.right && !u.value ? (i(), c("span", Re, [
441
+ b(r.$slots, "right")
442
+ ])) : m("", !0)
443
+ ], 10, Ae));
444
+ }
445
+ }), Te = { class: "h0n-ui-card" }, Ve = {
446
+ key: 0,
447
+ class: "h0n-ui-card--title"
448
+ }, Pe = /* @__PURE__ */ C({
449
+ __name: "Card",
450
+ props: {
451
+ title: {}
452
+ },
453
+ setup(e) {
454
+ return (n, t) => (i(), c("section", Te, [
455
+ e.title ? (i(), c("p", Ve, $(e.title), 1)) : m("", !0),
456
+ b(n.$slots, "default")
457
+ ]));
458
+ }
459
+ }), S = G(null);
460
+ function Me() {
461
+ const e = H();
462
+ function n(s) {
463
+ const o = q();
464
+ S.value = { ...s, id: o }, e.push({
465
+ id: o,
466
+ showOverlay: !0,
467
+ closeOnOverlay: !0,
468
+ closeOnEsc: !0,
469
+ onRequestClose: t
470
+ });
471
+ }
472
+ function t() {
473
+ S.value && (e.remove(S.value.id), S.value = null);
474
+ }
475
+ return {
476
+ active: S,
477
+ open: n,
478
+ close: t
479
+ };
480
+ }
481
+ const je = { class: "content-title-dialog" }, qe = {
482
+ key: 0,
483
+ class: "title-dialog"
484
+ }, Ne = { class: "h0n-dialog-content" }, Fe = /* @__PURE__ */ C({
485
+ __name: "Dialog",
486
+ setup(e) {
487
+ const { active: n, close: t } = Me(), { getContentZIndex: s } = H(), o = z("bottom");
488
+ V(
489
+ () => n.value?.side,
490
+ (l) => {
491
+ l && (o.value = l);
492
+ },
493
+ { immediate: !0 }
494
+ );
495
+ const h = _(() => `h0n-slide-${o.value}`), u = _(
496
+ () => n.value ? s(n.value.id) : void 0
497
+ );
498
+ return (l, d) => (i(), w(P, { to: "body" }, [
499
+ A(R, {
500
+ name: h.value,
501
+ appear: ""
502
+ }, {
503
+ default: E(() => [
504
+ v(n) ? (i(), c("div", {
505
+ key: 0,
506
+ class: k(["h0n-dialog-layer", `is-${o.value}`]),
507
+ style: B({ zIndex: u.value })
508
+ }, [
509
+ p("section", {
510
+ class: k(["h0n-dialog-panel", `is-${v(n).side}`])
511
+ }, [
512
+ p("header", {
513
+ class: k(["h0n-dialog-header", `is-${v(n).side}`])
514
+ }, [
515
+ p("div", je, [
516
+ v(n).title ? (i(), c("p", qe, $(v(n).title), 1)) : m("", !0),
517
+ b(l.$slots, "dialogHeader")
518
+ ]),
519
+ p("button", {
520
+ class: "h0n-dialog-close",
521
+ onClick: d[0] || (d[0] = (r) => v(t)())
522
+ }, " x ")
523
+ ], 2),
524
+ p("div", Ne, [
525
+ (i(), w(M(v(n).component), j(v(n).props, { onClose: v(t) }), null, 16, ["onClose"]))
526
+ ])
527
+ ], 2)
528
+ ], 6)) : m("", !0)
529
+ ]),
530
+ _: 3
531
+ }, 8, ["name"])
532
+ ]));
533
+ }
534
+ }), Ue = { class: "h0n-ui-menu-item__left" }, Ze = {
535
+ key: 0,
536
+ class: "h0n-ui-menu-item__icon"
537
+ }, Je = { class: "h0n-ui-menu-item__text" }, We = {
538
+ key: 0,
539
+ class: "h0n-ui-menu-item__desc"
540
+ }, Ke = {
541
+ key: 0,
542
+ class: "h0n-ui-menu-item__right"
543
+ }, Ge = {
544
+ key: 0,
545
+ class: "h0n-ui-menu-item__right-text"
546
+ }, Qe = {
547
+ key: 0,
548
+ class: "h0n-ui-menu-item__chevron"
549
+ }, Xe = /* @__PURE__ */ C({
550
+ __name: "Menu",
551
+ props: {
552
+ title: {},
553
+ description: {},
554
+ right: {},
555
+ icon: {},
556
+ to: {},
557
+ as: {},
558
+ disabled: { type: Boolean },
559
+ danger: { type: Boolean },
560
+ chevron: { type: Boolean, default: void 0 }
561
+ },
562
+ emits: ["click"],
563
+ setup(e, { emit: n }) {
564
+ const t = e, s = n, o = _(() => !!t.to), h = _(() => t.as ?? (o.value ? "a" : "div")), u = _(() => t.chevron !== void 0 ? t.chevron : o.value), l = _(() => t.disabled ? {
565
+ role: "button",
566
+ tabindex: -1
567
+ } : t.as ? t.to ? { to: t.to } : {} : o.value ? { href: "#" } : { role: "button", tabindex: 0 });
568
+ function d(r) {
569
+ if (t.disabled) {
570
+ r.preventDefault(), r.stopPropagation();
571
+ return;
572
+ }
573
+ !t.as && o.value && r.preventDefault(), s("click", r);
574
+ }
575
+ return (r, g) => (i(), w(M(h.value), j({ class: "h0n-ui-menu-item" }, l.value, {
576
+ "aria-disabled": e.disabled || void 0,
577
+ onClick: d
578
+ }), {
579
+ default: E(() => [
580
+ p("div", Ue, [
581
+ r.$slots.icon || e.icon ? (i(), c("div", Ze, [
582
+ b(r.$slots, "icon", {}, () => [
583
+ L($(e.icon), 1)
584
+ ])
585
+ ])) : m("", !0),
586
+ p("div", Je, [
587
+ p("p", {
588
+ class: k(["h0n-ui-menu-item__title", { "is-danger": e.danger }])
589
+ }, [
590
+ b(r.$slots, "title", {}, () => [
591
+ L($(e.title), 1)
592
+ ])
593
+ ], 2),
594
+ e.description || r.$slots.description ? (i(), c("p", We, [
595
+ b(r.$slots, "description", {}, () => [
596
+ L($(e.description), 1)
597
+ ])
598
+ ])) : m("", !0)
599
+ ])
600
+ ]),
601
+ e.right || r.$slots.right || u.value ? (i(), c("div", Ke, [
602
+ b(r.$slots, "right", {}, () => [
603
+ e.right ? (i(), c("p", Ge, $(e.right), 1)) : m("", !0)
604
+ ]),
605
+ u.value ? (i(), c("span", Qe, "›")) : m("", !0)
606
+ ])) : m("", !0)
607
+ ]),
608
+ _: 3
609
+ }, 16, ["aria-disabled"]));
610
+ }
611
+ }), Ye = {
612
+ key: 0,
613
+ class: "h0n-ui-image__loader"
614
+ }, et = {
615
+ key: 1,
616
+ class: "h0n-ui-image__error"
617
+ }, tt = ["src"], nt = ["src", "alt"], ot = /* @__PURE__ */ C({
618
+ __name: "Image",
619
+ props: {
620
+ src: {},
621
+ alt: {},
622
+ lazy: { type: Boolean, default: !0 },
623
+ fallback: {},
624
+ fit: { default: "cover" },
625
+ radius: {}
626
+ },
627
+ setup(e) {
628
+ const n = e, t = z("loading");
629
+ function s() {
630
+ t.value = "loading";
631
+ const u = new Image();
632
+ u.src = n.src, u.onload = () => {
633
+ t.value = "loaded";
634
+ }, u.onerror = () => {
635
+ t.value = "error";
636
+ };
637
+ }
638
+ Q(() => {
639
+ if (n.lazy && "IntersectionObserver" in window) {
640
+ const u = new IntersectionObserver(([l]) => {
641
+ l.isIntersecting && (s(), u.disconnect());
642
+ });
643
+ u.observe(document.body);
644
+ } else
645
+ s();
646
+ }), V(() => n.src, s);
647
+ const o = _(() => ({
648
+ borderRadius: typeof n.radius == "number" ? `${n.radius}px` : n.radius
649
+ })), h = _(() => ({
650
+ objectFit: n.fit
651
+ }));
652
+ return (u, l) => (i(), c("div", {
653
+ class: k(["h0n-ui-image", t.value]),
654
+ style: B(o.value)
655
+ }, [
656
+ t.value === "loading" ? (i(), c("div", Ye)) : t.value === "error" ? (i(), c("div", et, [
657
+ e.fallback ? (i(), c("img", {
658
+ key: 0,
659
+ src: e.fallback
660
+ }, null, 8, tt)) : m("", !0)
661
+ ])) : (i(), c("img", {
662
+ key: 2,
663
+ src: e.src,
664
+ alt: e.alt,
665
+ style: B(h.value),
666
+ draggable: "false"
667
+ }, null, 12, nt))
668
+ ], 6));
669
+ }
670
+ }), st = /* @__PURE__ */ C({
671
+ __name: "Overlay",
672
+ setup(e) {
673
+ const { top: n, getBackdropZIndex: t, requestCloseTop: s } = H(), o = _(() => !!n.value && n.value.showOverlay !== !1), h = _(() => {
674
+ if (n.value?.id)
675
+ return t(n.value.id);
676
+ });
677
+ function u() {
678
+ }
679
+ function l(r) {
680
+ const g = n.value;
681
+ !g || g.closeOnOverlay === !1 || s();
682
+ }
683
+ function d(r) {
684
+ const g = n.value;
685
+ !g || g.closeOnEsc === !1 || r.key === "Escape" && s();
686
+ }
687
+ return Q(() => window.addEventListener("keydown", d)), ue(() => window.removeEventListener("keydown", d)), (r, g) => (i(), w(P, { to: "body" }, [
688
+ A(R, { name: "h0n-ui-fade" }, {
689
+ default: E(() => [
690
+ o.value ? (i(), c("div", {
691
+ key: 0,
692
+ class: "h0n-ui-overlay",
693
+ style: B({ zIndex: h.value }),
694
+ onPointerdown: D(u, ["self", "prevent", "stop"]),
695
+ onPointerup: D(u, ["self", "prevent", "stop"]),
696
+ onClick: D(l, ["self", "prevent", "stop"])
697
+ }, null, 36)) : m("", !0)
698
+ ]),
699
+ _: 1
700
+ })
701
+ ]));
702
+ }
703
+ });
704
+ function it(e) {
705
+ const n = at(e);
706
+ return {
707
+ install(t) {
708
+ t.component("H0Accordion", $e), t.component("H0Alert", ze), t.component("H0Button", De), t.component("H0Card", Pe), t.component("H0Dialog", Fe), t.component("H0Spinner", Y), t.component("H0Menu", Xe), t.component("H0Image", ot), t.component("H0Overlay", st), fe(n.theme);
709
+ }
710
+ };
711
+ }
712
+ const lt = it();
713
+ function at(e) {
714
+ return {
715
+ autoRegisterComponents: e?.autoRegisterComponents ?? !0,
716
+ theme: de(e?.theme)
717
+ };
718
+ }
719
+ export {
720
+ $e as Accordion,
721
+ ze as Alert,
722
+ De as Button,
723
+ Pe as Card,
724
+ Fe as Dialog,
725
+ ot as Image,
726
+ Xe as Menu,
727
+ st as Overlay,
728
+ Y as Spinner,
729
+ it as createH0NPlugin,
730
+ lt as h0nUi,
731
+ H as useOverlayStack,
732
+ ke as useWebAlert,
733
+ Me as useWebDialog
734
+ };
@@ -0,0 +1,5 @@
1
+ import { DeepPartial, H0NTheme } from '../types';
2
+ export declare const defaultTheme: H0NTheme;
3
+ export declare function resolveTheme(overrides?: DeepPartial<H0NTheme>): H0NTheme;
4
+ export declare function applyTheme(theme: H0NTheme): void;
5
+ export declare function mapThemeToCssVariables(theme: H0NTheme): Record<string, string>;
@@ -0,0 +1,43 @@
1
+ import { Component } from 'vue';
2
+ export type DeepPartial<T> = {
3
+ [K in keyof T]?: T[K] extends Record<string, any> ? DeepPartial<T[K]> : T[K];
4
+ };
5
+ export interface H0nColorPalette {
6
+ primary: string;
7
+ secondary: string;
8
+ tertiary: string;
9
+ success: string;
10
+ warning: string;
11
+ danger: string;
12
+ text: string;
13
+ description: string;
14
+ }
15
+ export interface H0nBorderRadius {
16
+ sm: string;
17
+ md: string;
18
+ lg: string;
19
+ }
20
+ export interface H0NTheme {
21
+ colors: H0nColorPalette;
22
+ borderRadius: H0nBorderRadius;
23
+ fontFamily: string;
24
+ focusRingColor: string;
25
+ }
26
+ export interface H0NPluginOptions {
27
+ /**
28
+ * Toggle automatic global component registration.
29
+ */
30
+ autoRegisterComponents?: boolean;
31
+ /**
32
+ * Theme overrides that will extend the default palette.
33
+ */
34
+ theme?: DeepPartial<H0NTheme>;
35
+ }
36
+ export interface ResolvedH0nOptions {
37
+ autoRegisterComponents: boolean;
38
+ theme: H0NTheme;
39
+ }
40
+ export interface ComponentRegistryItem {
41
+ name: string;
42
+ component: Component;
43
+ }
@@ -0,0 +1 @@
1
+ export declare function createId(): string;
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@theh0n/ui",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "",
5
5
  "author": "blockh0n",
6
6
  "license": "MIT",
7
7
  "keywords": [
8
- "Vue",
9
- "H0N"
8
+ "Vue"
10
9
  ],
11
10
  "files": [
12
11
  "dist",