combo-ui-vue 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -0
- package/dist/index.d.mts +62 -20
- package/dist/index.mjs +657 -530
- package/package.json +9 -5
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# COMBO-UI VUE
|
|
2
|
+
|
|
3
|
+
Paquete para utilizar los temas de [COMBO-UI Editor](https://github.com/masweb/combo-ui-editor) en aplicaciones Vue 3.
|
|
4
|
+
|
|
5
|
+
#### npm
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install combo-ui-vue
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
#### pnpm
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm install combo-ui-vue
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// main.ts
|
|
21
|
+
import { createApp } from "vue";
|
|
22
|
+
import { ComboUIPlugin } from "combo-ui-vue";
|
|
23
|
+
import theme from "./theme.json";
|
|
24
|
+
|
|
25
|
+
const app = createApp(App);
|
|
26
|
+
app.use(ComboUIPlugin, { theme });
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Composable
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { useComboUI } from "combo-ui-vue";
|
|
33
|
+
|
|
34
|
+
const { isDark, toggleDarkMode, setDarkMode } = useComboUI();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Components
|
|
38
|
+
|
|
39
|
+
### ThemeToggler
|
|
40
|
+
|
|
41
|
+
Componente para toggle dark/light. Botón con iconos sol/luna por defecto, totalmente configurable via slots.
|
|
42
|
+
|
|
43
|
+
#### Uso básico
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<script setup>
|
|
47
|
+
import { ThemeToggler } from "combo-ui-vue";
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<ThemeToggler />
|
|
52
|
+
</template>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### Iconos personalizados via props
|
|
56
|
+
|
|
57
|
+
```vue
|
|
58
|
+
<ThemeToggler
|
|
59
|
+
icon-light="<svg>...</svg>"
|
|
60
|
+
icon-dark="<svg>...</svg>"
|
|
61
|
+
/>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Iconos personalizados via slots
|
|
65
|
+
|
|
66
|
+
```vue
|
|
67
|
+
<ThemeToggler>
|
|
68
|
+
<template #light>🌙</template>
|
|
69
|
+
<template #dark>☀️</template>
|
|
70
|
+
</ThemeToggler>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### Trigger completamente custom via slot default
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<ThemeToggler v-slot="{ isDark, toggleDarkMode }">
|
|
77
|
+
<button class="cui-button --primary" @click="toggleDarkMode">
|
|
78
|
+
{{ isDark ? "☀️" : "🌙" }}
|
|
79
|
+
</button>
|
|
80
|
+
</ThemeToggler>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```vue
|
|
84
|
+
<ThemeToggler v-slot="{ isDark, toggleDarkMode }">
|
|
85
|
+
<button class="cui-button --primary" @click="toggleDarkMode">
|
|
86
|
+
<IconSun v-if="isDark" />
|
|
87
|
+
<IconMoon v-else />
|
|
88
|
+
</button>
|
|
89
|
+
</ThemeToggler>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Props
|
|
93
|
+
|
|
94
|
+
| Prop | Type | Default | Description |
|
|
95
|
+
| ----------- | ------ | -------- | ---------------------------------------- |
|
|
96
|
+
| `iconLight` | String | Sun SVG | SVG para modo light (se muestra en dark) |
|
|
97
|
+
| `iconDark` | String | Moon SVG | SVG para modo dark (se muestra en light) |
|
|
98
|
+
|
|
99
|
+
#### Slots
|
|
100
|
+
|
|
101
|
+
| Slot | Props | Description |
|
|
102
|
+
| --------- | ------------------------------------- | --------------------------------------------- |
|
|
103
|
+
| `default` | `{ isDark: boolean, toggleDarkMode }` | Reemplaza el botón completo |
|
|
104
|
+
| `light` | — | Contenido/icono mostrado cuando está en dark |
|
|
105
|
+
| `dark` | — | Contenido/icono mostrado cuando está en light |
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,37 @@
|
|
|
1
|
+
import * as vue from "vue";
|
|
1
2
|
import { App, DeepReadonly, Ref } from "vue";
|
|
2
3
|
|
|
4
|
+
//#region src/components/ThemeToggler.d.ts
|
|
5
|
+
declare const ThemeToggler: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
6
|
+
iconLight: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
iconDark: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}>[] | vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
19
|
+
iconLight: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
iconDark: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
}>> & Readonly<{}>, {
|
|
28
|
+
iconLight: string;
|
|
29
|
+
iconDark: string;
|
|
30
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
31
|
+
//#endregion
|
|
3
32
|
//#region src/types.d.ts
|
|
4
33
|
/**
|
|
5
|
-
* Types for @combo-
|
|
34
|
+
* Types for @combo-ui/vanilla
|
|
6
35
|
*/
|
|
7
36
|
interface BorderValue {
|
|
8
37
|
style: string;
|
|
@@ -435,7 +464,7 @@ interface ThemeSyncOptions {
|
|
|
435
464
|
/** Callback when theme is updated */
|
|
436
465
|
onThemeUpdate?: (theme: ThemeData) => void;
|
|
437
466
|
}
|
|
438
|
-
interface
|
|
467
|
+
interface ComboUIOptions {
|
|
439
468
|
/** Theme data object or URL to JSON file */
|
|
440
469
|
theme: ThemeData | string;
|
|
441
470
|
/** Dark mode setting: 'auto' (follows system), 'light', or 'dark' */
|
|
@@ -464,15 +493,15 @@ interface ControlsOptions {
|
|
|
464
493
|
type DarkModeChangeCallback = (isDark: boolean) => void;
|
|
465
494
|
type ThemeLoadCallback = (theme: ThemeData) => void;
|
|
466
495
|
//#endregion
|
|
467
|
-
//#region src/combo-
|
|
468
|
-
declare class
|
|
496
|
+
//#region src/combo-ui.d.ts
|
|
497
|
+
declare class ComboUI {
|
|
469
498
|
private options;
|
|
470
499
|
private darkMode;
|
|
471
500
|
private cssInjector;
|
|
472
501
|
private themeLoader;
|
|
473
502
|
private themeSync;
|
|
474
503
|
private currentTheme;
|
|
475
|
-
constructor(options:
|
|
504
|
+
constructor(options: ComboUIOptions);
|
|
476
505
|
/**
|
|
477
506
|
* Initialize the library (must be called manually or via composable)
|
|
478
507
|
*/
|
|
@@ -525,40 +554,53 @@ declare class ComboUX {
|
|
|
525
554
|
destroy(): void;
|
|
526
555
|
}
|
|
527
556
|
//#endregion
|
|
528
|
-
//#region src/
|
|
529
|
-
|
|
557
|
+
//#region src/reset/index.d.ts
|
|
558
|
+
/**
|
|
559
|
+
* App Reset by Ben Frain
|
|
560
|
+
* https://github.com/benfrain/app-reset
|
|
561
|
+
*/
|
|
562
|
+
declare const RESET_CSS = ":root{interpolate-size:allow-keywords;color-scheme:light dark}html{box-sizing:border-box;--fontStack:-apple-system,BlinkMacSystemFont,\"Helvetica Neue\",\"Segoe UI\",Tahoma,Roboto,Oxygen,Ubuntu,Cantarell,\"Fira Sans\",\"Open Sans\",sans-serif;font-family:var(--fontStack);-webkit-tap-highlight-color:transparent}*{user-select:none;box-sizing:inherit}*:before,*:after{box-sizing:inherit}body,h1,h2,h3,h4,h5,h6,p{margin:0;font-size:1rem;font-weight:400}a{text-decoration:none;color:inherit}b{font-weight:400}em,i{font-style:normal}a:focus,button:focus{outline:0}button{appearance:none;background-color:transparent;border:0;padding:0;text-align:inherit;font-family:inherit;font-weight:inherit;font-size:inherit;margin:0}button:hover{cursor:pointer}input,fieldset{appearance:none;border:0;padding:0;margin:0;min-width:0;font-size:inherit;font-family:inherit}input:focus{outline:0}input[type=\"number\"]::-webkit-inner-spin-button,input[type=\"number\"]::-webkit-outer-spin-button{appearance:none}svg{display:block}img{max-width:100%;display:block}body{box-sizing:border-box}";
|
|
563
|
+
/**
|
|
564
|
+
* Inject CSS Reset into the page
|
|
565
|
+
*/
|
|
566
|
+
declare function injectReset(): void;
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/composables/useComboUI.d.ts
|
|
569
|
+
interface UseComboUIReturn {
|
|
530
570
|
isInitialized: DeepReadonly<Ref<boolean>>;
|
|
531
571
|
isDark: DeepReadonly<Ref<boolean>>;
|
|
532
|
-
instance:
|
|
572
|
+
instance: ComboUI | null;
|
|
533
573
|
toggleDarkMode: () => void;
|
|
534
574
|
setDarkMode: (value: boolean | 'auto') => void;
|
|
535
575
|
updateTheme: (theme: ThemeData) => void;
|
|
536
576
|
}
|
|
537
577
|
/**
|
|
538
|
-
* Initialize
|
|
578
|
+
* Initialize ComboUI with options
|
|
539
579
|
* Should be called once in your app entry point
|
|
540
580
|
*/
|
|
541
|
-
declare function
|
|
581
|
+
declare function initComboUI(options: ComboUIOptions): Promise<ComboUI>;
|
|
542
582
|
/**
|
|
543
|
-
* Get the current
|
|
583
|
+
* Get the current ComboUI instance
|
|
544
584
|
*/
|
|
545
|
-
declare function
|
|
585
|
+
declare function getComboUI(): ComboUI | null;
|
|
546
586
|
/**
|
|
547
|
-
* Vue composable to use
|
|
587
|
+
* Vue composable to use ComboUI in components
|
|
548
588
|
*/
|
|
549
|
-
declare function
|
|
589
|
+
declare function useComboUI(): UseComboUIReturn;
|
|
550
590
|
/**
|
|
551
|
-
* Destroy the
|
|
591
|
+
* Destroy the ComboUI instance
|
|
552
592
|
*/
|
|
553
|
-
declare function
|
|
593
|
+
declare function destroyComboUI(): void;
|
|
554
594
|
//#endregion
|
|
555
595
|
//#region src/index.d.ts
|
|
556
|
-
interface
|
|
596
|
+
interface ComboUIPluginOptions extends ComboUIOptions {
|
|
557
597
|
/** Auto initialize on install */
|
|
558
598
|
autoInit?: boolean;
|
|
599
|
+
/** Inject CSS reset on install (default: true) */
|
|
600
|
+
reset?: boolean;
|
|
559
601
|
}
|
|
560
|
-
declare const
|
|
561
|
-
install(app: App<any>, options:
|
|
602
|
+
declare const ComboUIPlugin: {
|
|
603
|
+
install(app: App<any>, options: ComboUIPluginOptions): Promise<void>;
|
|
562
604
|
};
|
|
563
605
|
//#endregion
|
|
564
|
-
export { AlertComponentData, AlertVariant, AvatarComponentData, AvatarVariant, BadgeComponentData, BadgeVariant, BorderRadiusValue, BorderValue, ButtonComponentData, ButtonVariant, CardComponentData, CardVariant, ChipComponentData, ChipVariant,
|
|
606
|
+
export { AlertComponentData, AlertVariant, AvatarComponentData, AvatarVariant, BadgeComponentData, BadgeVariant, BorderRadiusValue, BorderValue, ButtonComponentData, ButtonVariant, CardComponentData, CardVariant, ChipComponentData, ChipVariant, ComboUI, type ComboUIOptions, ComboUIPlugin, ComboUIPlugin as default, ComboUIPluginOptions, ComponentShadows, ControlsOptions, DarkModeChangeCallback, DarkModeSetting, DarkToggleOptions, FormsData, FormsGlobalConfig, FormsVariant, PaddingValue, Position, ProgressComponentData, ProgressType, ProgressVariant, RESET_CSS, ShadowValue, SpinnerComponentData, SpinnerType, SpinnerVariant, ThemeButtonOptions, type ThemeData, ThemeLoadCallback, ThemeSyncOptions, ThemeToggler, TypographyData, TypographyGlobalConfig, TypographyVariant, UnitNumber, type UseComboUIReturn, destroyComboUI, getComboUI, initComboUI, injectReset, useComboUI };
|