yuyeon 0.3.0 → 0.3.1-rc.2
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/dist/style.css +1 -1
- package/dist/yuyeon.js +2836 -2826
- package/dist/yuyeon.umd.cjs +3 -3
- package/lib/components/badge/YBadge.mjs +8 -3
- package/lib/components/badge/YBadge.mjs.map +1 -1
- package/lib/components/badge/YBadge.scss +8 -3
- package/lib/components/chip/YChip.mjs +6 -44
- package/lib/components/chip/YChip.mjs.map +1 -1
- package/lib/components/tree-view/YTreeView.mjs +5 -0
- package/lib/components/tree-view/YTreeView.mjs.map +1 -1
- package/lib/composables/style-color.mjs +37 -0
- package/lib/composables/style-color.mjs.map +1 -0
- package/lib/index.mjs +2 -1
- package/lib/index.mjs.map +1 -1
- package/lib/util/color/index.mjs +16 -0
- package/lib/util/color/index.mjs.map +1 -1
- package/package.json +1 -1
- package/types/components/badge/YBadge.d.ts +27 -6
- package/types/components/chip/YChip.d.ts +6 -6
- package/types/components/date-picker/YDatePicker.d.ts +11 -11
- package/types/components/date-picker/YDatePickerControl.d.ts +5 -5
- package/types/components/dialog/YDialog.d.ts +15 -15
- package/types/composables/style-color.d.ts +15 -0
- package/types/util/color/index.d.ts +1 -0
|
@@ -3,6 +3,7 @@ import { vShow, withDirectives } from 'vue';
|
|
|
3
3
|
import { useRender } from "../../composables/component.mjs";
|
|
4
4
|
import { useI18n } from "../../composables/i18n/index.mjs";
|
|
5
5
|
import { IconValue } from "../../composables/icon.mjs";
|
|
6
|
+
import { styleColorPropsOptions, useStyleColor } from "../../composables/style-color.mjs";
|
|
6
7
|
import { PolyTransition } from "../../composables/transition.mjs";
|
|
7
8
|
import { defineComponent, propsFactory } from "../../util/component/index.mjs";
|
|
8
9
|
import { YIcon } from "../icon/YIcon.mjs";
|
|
@@ -17,7 +18,6 @@ export const pressYBadgePropsOptions = propsFactory({
|
|
|
17
18
|
floating: Boolean,
|
|
18
19
|
inline: Boolean,
|
|
19
20
|
icon: IconValue,
|
|
20
|
-
color: String,
|
|
21
21
|
hide: Boolean,
|
|
22
22
|
label: {
|
|
23
23
|
type: String,
|
|
@@ -28,7 +28,8 @@ export const pressYBadgePropsOptions = propsFactory({
|
|
|
28
28
|
transition: {
|
|
29
29
|
type: String,
|
|
30
30
|
default: 'fade'
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
|
+
...styleColorPropsOptions
|
|
32
33
|
}, 'YBadge');
|
|
33
34
|
export const YBadge = defineComponent({
|
|
34
35
|
name: 'YBadge',
|
|
@@ -41,6 +42,9 @@ export const YBadge = defineComponent({
|
|
|
41
42
|
const {
|
|
42
43
|
t
|
|
43
44
|
} = useI18n();
|
|
45
|
+
const {
|
|
46
|
+
colorVars
|
|
47
|
+
} = useStyleColor(props, 'badge');
|
|
44
48
|
useRender(() => {
|
|
45
49
|
const ElTag = props.tag;
|
|
46
50
|
const value = Number(props.content);
|
|
@@ -51,7 +55,8 @@ export const YBadge = defineComponent({
|
|
|
51
55
|
'y-badge--dot': props.dot,
|
|
52
56
|
'y-badge--floating': props.floating,
|
|
53
57
|
'y-badge--inline': props.inline
|
|
54
|
-
}]
|
|
58
|
+
}],
|
|
59
|
+
"style": colorVars.value
|
|
55
60
|
}, {
|
|
56
61
|
default: () => [_createVNode("div", {
|
|
57
62
|
"class": "y-badge__base"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YBadge.mjs","names":["vShow","withDirectives","useRender","useI18n","IconValue","PolyTransition","defineComponent","propsFactory","YIcon","pressYBadgePropsOptions","tag","type","String","default","dot","Boolean","bordered","floating","inline","icon","
|
|
1
|
+
{"version":3,"file":"YBadge.mjs","names":["vShow","withDirectives","useRender","useI18n","IconValue","styleColorPropsOptions","useStyleColor","PolyTransition","defineComponent","propsFactory","YIcon","pressYBadgePropsOptions","tag","type","String","default","dot","Boolean","bordered","floating","inline","icon","hide","label","content","Number","max","transition","YBadge","name","props","slots","Object","setup","_ref","t","colorVars","ElTag","value","isNaN","_createVNode","undefined","badge"],"sources":["../../../src/components/badge/YBadge.tsx"],"sourcesContent":["import {\n type PropType,\n type SlotsType,\n computed,\n vShow,\n withDirectives,\n} from 'vue';\n\nimport { useRender } from '@/composables/component';\nimport { useI18n } from '@/composables/i18n';\nimport { IconValue } from '@/composables/icon';\nimport {\n styleColorPropsOptions,\n useStyleColor,\n} from '@/composables/style-color';\nimport { PolyTransition } from '@/composables/transition';\nimport { defineComponent, propsFactory } from '@/util/component';\n\nimport { YIcon } from '../icon/YIcon';\n\nimport './YBadge.scss';\n\nexport const pressYBadgePropsOptions = propsFactory(\n {\n tag: {\n type: String as PropType<string>,\n default: 'div',\n },\n dot: Boolean,\n bordered: Boolean,\n floating: Boolean,\n inline: Boolean,\n icon: IconValue,\n hide: Boolean,\n label: {\n type: String,\n default: '$yuyeon.badge',\n },\n content: [Number, String],\n max: Number,\n transition: {\n type: String,\n default: 'fade',\n },\n ...styleColorPropsOptions,\n },\n 'YBadge',\n);\n\nexport const YBadge = defineComponent({\n name: 'YBadge',\n props: pressYBadgePropsOptions(),\n slots: Object as SlotsType<{\n default: any;\n badge: any;\n }>,\n setup(props, { slots }) {\n const { t } = useI18n();\n\n const { colorVars } = useStyleColor(props, 'badge');\n\n useRender(() => {\n const ElTag = props.tag as keyof HTMLElementTagNameMap;\n const value = Number(props.content);\n const content =\n !props.max || isNaN(value)\n ? props.content\n : value <= +props.max\n ? value\n : `${props.max}+`;\n return (\n <ElTag\n class={[\n 'y-badge',\n {\n 'y-badge--bordered': props.bordered,\n 'y-badge--dot': props.dot,\n 'y-badge--floating': props.floating,\n 'y-badge--inline': props.inline,\n },\n ]}\n style={colorVars.value}\n >\n <div class=\"y-badge__base\">\n {slots.default?.()}\n <PolyTransition\n is={props.transition}\n transitionProps={{ name: props.transition }}\n >\n {withDirectives(\n <span\n class={['y-badge__badge']}\n aria-atomic=\"true\"\n aria-label={t(props.label, value)}\n aria-live=\"polite\"\n role=\"status\"\n >\n {props.dot ? undefined : slots.badge ? (\n slots.badge?.()\n ) : props.icon ? (\n <YIcon icon={props.icon} />\n ) : (\n content\n )}\n </span>,\n [[vShow, !props.hide]],\n )}\n </PolyTransition>\n </div>\n </ElTag>\n );\n });\n },\n});\n\nexport type YBadge = InstanceType<typeof YBadge>;\n"],"mappings":";AAAA,SAIEA,KAAK,EACLC,cAAc,QACT,KAAK;AAAC,SAEJC,SAAS;AAAA,SACTC,OAAO;AAAA,SACPC,SAAS;AAAA,SAEhBC,sBAAsB,EACtBC,aAAa;AAAA,SAENC,cAAc;AAAA,SACdC,eAAe,EAAEC,YAAY;AAAA,SAE7BC,KAAK;AAEd;AAEA,OAAO,MAAMC,uBAAuB,GAAGF,YAAY,CACjD;EACEG,GAAG,EAAE;IACHC,IAAI,EAAEC,MAA0B;IAChCC,OAAO,EAAE;EACX,CAAC;EACDC,GAAG,EAAEC,OAAO;EACZC,QAAQ,EAAED,OAAO;EACjBE,QAAQ,EAAEF,OAAO;EACjBG,MAAM,EAAEH,OAAO;EACfI,IAAI,EAAEjB,SAAS;EACfkB,IAAI,EAAEL,OAAO;EACbM,KAAK,EAAE;IACLV,IAAI,EAAEC,MAAM;IACZC,OAAO,EAAE;EACX,CAAC;EACDS,OAAO,EAAE,CAACC,MAAM,EAAEX,MAAM,CAAC;EACzBY,GAAG,EAAED,MAAM;EACXE,UAAU,EAAE;IACVd,IAAI,EAAEC,MAAM;IACZC,OAAO,EAAE;EACX,CAAC;EACD,GAAGV;AACL,CAAC,EACD,QACF,CAAC;AAED,OAAO,MAAMuB,MAAM,GAAGpB,eAAe,CAAC;EACpCqB,IAAI,EAAE,QAAQ;EACdC,KAAK,EAAEnB,uBAAuB,CAAC,CAAC;EAChCoB,KAAK,EAAEC,MAGL;EACFC,KAAKA,CAACH,KAAK,EAAAI,IAAA,EAAa;IAAA,IAAX;MAAEH;IAAM,CAAC,GAAAG,IAAA;IACpB,MAAM;MAAEC;IAAE,CAAC,GAAGhC,OAAO,CAAC,CAAC;IAE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CoB,KAAK,CAACT;UAAI,WAEvBG,OACD,IAEH,CAAC,CAACxB,KAAK,EAAE,CAAC8B,KAAK,CAACR,IAAI,CAAC,CACvB,CAAC;QAAA;MAAA;IAKX,CAAC,CAAC;EACJ;AACF,CAAC,CAAC"}
|
|
@@ -7,8 +7,12 @@
|
|
|
7
7
|
--y-badge__border-width: 2px;
|
|
8
8
|
--y-badge__border-transform: scale(1.0413);
|
|
9
9
|
--y-badge__inline-margin: 0 4px;
|
|
10
|
-
--y-
|
|
11
|
-
--y-
|
|
10
|
+
--y-badge__background-opacity: 1;
|
|
11
|
+
--y-badge__background: rgba(
|
|
12
|
+
var(--y-theme-surface-variant-rgb),
|
|
13
|
+
var(--y-badge__background-opacity, 1)
|
|
14
|
+
);
|
|
15
|
+
--y-badge__color: var(--y-theme-on-surface-variant);
|
|
12
16
|
|
|
13
17
|
display: inline-block;
|
|
14
18
|
|
|
@@ -29,7 +33,8 @@
|
|
|
29
33
|
text-indent: 0;
|
|
30
34
|
white-space: nowrap;
|
|
31
35
|
padding: var(--y-badge__padding);
|
|
32
|
-
|
|
36
|
+
color: var(--y-badge__color);
|
|
37
|
+
background: var(--y-badge__background);
|
|
33
38
|
bottom: calc(100% - var(--y-badge__height) / 2);
|
|
34
39
|
left: calc(100% - var(--y-badge__min-width));
|
|
35
40
|
}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
|
2
2
|
import { computed } from 'vue';
|
|
3
3
|
import { useRender } from "../../composables/index.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { styleColorPropsOptions, useStyleColor } from "../../composables/style-color.mjs";
|
|
5
5
|
import { defineComponent, hasEventProp, propsFactory } from "../../util/component/index.mjs";
|
|
6
6
|
import "./YChip.scss";
|
|
7
7
|
export const pressYChipPropsOptions = propsFactory({
|
|
8
|
-
|
|
9
|
-
background: String,
|
|
10
|
-
backgroundOpacity: {
|
|
11
|
-
type: Number,
|
|
12
|
-
default: 0.14
|
|
13
|
-
},
|
|
8
|
+
...styleColorPropsOptions,
|
|
14
9
|
small: Boolean
|
|
15
10
|
}, 'YChip');
|
|
16
11
|
export const YChip = defineComponent({
|
|
@@ -26,48 +21,15 @@ export const YChip = defineComponent({
|
|
|
26
21
|
const clickable = computed(() => {
|
|
27
22
|
return hasEventProp(props, 'click');
|
|
28
23
|
});
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
background
|
|
33
|
-
} = props;
|
|
34
|
-
if (!background) background = color;
|
|
35
|
-
if (color && !isColorValue(color)) {
|
|
36
|
-
color = `var(--y-theme-${color})`;
|
|
37
|
-
}
|
|
38
|
-
if (background) {
|
|
39
|
-
if (isColorValue(background)) {
|
|
40
|
-
background = `rgba(${colorRgb(background)}, ${props.backgroundOpacity})`;
|
|
41
|
-
} else if (!background.startsWith('var(')) {
|
|
42
|
-
background = `rgba(${`var(--y-theme-${background}-rgb)`}, ${props.backgroundOpacity})`;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
'--y-chip__color': color,
|
|
47
|
-
'--y-chip__background': background
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
function colorRgb(color) {
|
|
51
|
-
if (color?.startsWith('#')) {
|
|
52
|
-
return rgbFromHex(color)?.join(',') || '';
|
|
53
|
-
}
|
|
54
|
-
const RGBA_REGEX = /rgb(a?)\((?<v>.*)\)/;
|
|
55
|
-
if (RGBA_REGEX.test(color)) {
|
|
56
|
-
const value = RGBA_REGEX.exec(color)?.[2] || '';
|
|
57
|
-
if (value) {
|
|
58
|
-
const valueArray = value.trim().split(',');
|
|
59
|
-
valueArray.splice(3, 1);
|
|
60
|
-
return valueArray.join(',');
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return '';
|
|
64
|
-
}
|
|
24
|
+
const {
|
|
25
|
+
colorVars
|
|
26
|
+
} = useStyleColor(props, 'chip');
|
|
65
27
|
useRender(() => _createVNode("span", {
|
|
66
28
|
"class": ['y-chip', {
|
|
67
29
|
'y-chip--small': props.small,
|
|
68
30
|
'y-chip--clickable': clickable.value
|
|
69
31
|
}],
|
|
70
|
-
"style":
|
|
32
|
+
"style": colorVars.value
|
|
71
33
|
}, [_createVNode("span", {
|
|
72
34
|
"class": "y-chip__content"
|
|
73
35
|
}, [slots.default?.()])]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YChip.mjs","names":["computed","useRender","
|
|
1
|
+
{"version":3,"file":"YChip.mjs","names":["computed","useRender","styleColorPropsOptions","useStyleColor","defineComponent","hasEventProp","propsFactory","pressYChipPropsOptions","small","Boolean","YChip","name","props","setup","_ref","slots","emit","clickable","colorVars","_createVNode","value","default"],"sources":["../../../src/components/chip/YChip.tsx"],"sourcesContent":["import { computed } from 'vue';\n\nimport { useRender } from '@/composables';\nimport {\n styleColorPropsOptions,\n useStyleColor,\n} from '@/composables/style-color';\nimport { defineComponent, hasEventProp, propsFactory } from '@/util/component';\n\nimport './YChip.scss';\n\nexport const pressYChipPropsOptions = propsFactory(\n {\n ...styleColorPropsOptions,\n small: Boolean,\n },\n 'YChip',\n);\n\nexport const YChip = defineComponent({\n name: 'YChip',\n props: {\n ...pressYChipPropsOptions(),\n },\n setup(props, { slots, emit }) {\n const clickable = computed(() => {\n return hasEventProp(props, 'click');\n });\n const { colorVars } = useStyleColor(props, 'chip');\n\n useRender(() => (\n <span\n class={[\n 'y-chip',\n {\n 'y-chip--small': props.small,\n 'y-chip--clickable': clickable.value,\n },\n ]}\n style={colorVars.value}\n >\n <span class=\"y-chip__content\">{slots.default?.()}</span>\n </span>\n ));\n\n return {};\n },\n});\n\nexport type YChip = InstanceType<typeof YChip>;\n"],"mappings":";AAAA,SAASA,QAAQ,QAAQ,KAAK;AAAC,SAEtBC,SAAS;AAAA,SAEhBC,sBAAsB,EACtBC,aAAa;AAAA,SAENC,eAAe,EAAEC,YAAY,EAAEC,YAAY;AAEpD;AAEA,OAAO,MAAMC,sBAAsB,GAAGD,YAAY,CAChD;EACE,GAAGJ,sBAAsB;EACzBM,KAAK,EAAEC;AACT,CAAC,EACD,OACF,CAAC;AAED,OAAO,MAAMC,KAAK,GAAGN,eAAe,CAAC;EACnCO,IAAI,EAAE,OAAO;EACbC,KAAK,EAAE;IACL,GAAGL,sBAAsB,CAAC;EAC5B,CAAC;EACDM,KAAKA,CAACD,KAAK,EAAAE,IAAA,EAAmB;IAAA,IAAjB;MAAEC,KAAK;MAAEC;IAAK,CAAC,GAAAF,IAAA;IAC1B,MAAMG,SAAS,GAAGjB,QAAQ,CAAC,MAAM;MAC/B,OAAOK,YAAY,CAACO,KAAK,EAAE,OAAO,CAAC;IACrC,CAAC,CAAC;IACF,MAAM;MAAEM;IAAU,CAAC,GAAGf,aAAa,CAACS,KAAK,EAAE,MAAM,CAAC;IAElDX,SAAS,CAAC,MAAAkB,YAAA;MAAA,SAEC,CACL,QAAQ,EACR;QACE,eAAe,EAAEP,KAAK,CAACJ,KAAK;QAC5B,mBAAmB,EAAES,SAAS,CAACG;MACjC,CAAC,CACF;MAAA,SACMF,SAAS,CAACE;IAAK,IAAAD,YAAA;MAAA;IAAA,IAESJ,KAAK,CAACM,OAAO,GAAG,CAAC,IAEnD,CAAC;IAEF,OAAO,CAAC,CAAC;EACX;AACF,CAAC,CAAC"}
|
|
@@ -207,6 +207,7 @@ export const YTreeView = defineComponent({
|
|
|
207
207
|
if (!deepEqual(oldActive, [...activeSet.value])) {
|
|
208
208
|
emitActive();
|
|
209
209
|
}
|
|
210
|
+
filterItemsFn.value(neo, props.search, props.filter);
|
|
210
211
|
}, {
|
|
211
212
|
deep: true,
|
|
212
213
|
flush: 'sync'
|
|
@@ -235,6 +236,10 @@ export const YTreeView = defineComponent({
|
|
|
235
236
|
};
|
|
236
237
|
});
|
|
237
238
|
onMounted(() => {
|
|
239
|
+
if (props.search) {
|
|
240
|
+
searchLoading.value = true;
|
|
241
|
+
excludeItem(props.items, props.search, props.filter);
|
|
242
|
+
}
|
|
238
243
|
if (props.defaultExpand != null && props.defaultExpand !== false) {
|
|
239
244
|
expandedCache.value = [...expand(props.defaultExpand)];
|
|
240
245
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YTreeView.mjs","names":["computed","defineComponent","onMounted","ref","shallowRef","watch","provideTreeView","useRender","differenceBetween","isColorValue","deepEqual","getObjectValueByPath","hasOwnProperty","chooseProps","debounce","YProgressBar","YTreeViewNode","pressYTreeViewNodeProps","filterTreeItem","filterTreeItems","getKeys","treeViewNodeProps","YTreeView","name","props","expanded","type","Array","default","active","multipleActive","Boolean","activeStrategy","String","selected","selectStrategy","returnItem","defaultExpand","Number","filter","Function","searchDebounceWait","emits","setup","_ref","slots","emit","expose","filterItemsFn","excludeItem","expandedCache","nodes","expandedSet","selectedSet","activeSet","searchLoading","excludedSet","issueVnodeState","updateExpanded","updateActive","updateSelected","emitExpanded","emitActive","emitSelected","isExcluded","items","search","arguments","length","undefined","excluded","Set","value","diff","forEach","key","item","itemKey","itemText","itemChildren","expand","getNodeKey","itemOrKey","updateNodes","parentKey","level","children","exist","existNode","vnode","includes","indeterminate","node","childKeys","map","child","add","neo","deep","until","Object","entries","_ref2","stateWatcher","stateSet","updater","emitter","valuesOfKey","v","old","oldKeys","keys","nodeKey","neoKeys","k","oldSelected","oldActive","clear","flush","renderLeaves","slice","leaf","classes","styles","color","activeColor","activeValue","selectedValue","_createVNode","_Fragment","_mergeProps","_createTextVNode"],"sources":["../../../src/components/tree-view/YTreeView.tsx"],"sourcesContent":["import {\n type PropType,\n type Ref,\n computed,\n defineComponent,\n onMounted,\n ref,\n shallowRef,\n watch,\n} from 'vue';\n\nimport { provideTreeView } from '@/components/tree-view/tree-view';\nimport { useRender } from '@/composables/component';\nimport { CandidateKey } from '@/types';\nimport { differenceBetween } from '@/util/array';\nimport { isColorValue } from '@/util/color';\nimport { deepEqual, getObjectValueByPath, hasOwnProperty } from '@/util/common';\nimport { chooseProps } from '@/util/component';\nimport { debounce } from '@/util/debounce';\n\nimport { YProgressBar } from '../progress-bar';\nimport { YTreeViewNode, pressYTreeViewNodeProps } from './YTreeViewNode';\nimport { NodeState, TreeviewFilterFn } from './types';\nimport { filterTreeItem, filterTreeItems, getKeys } from './util';\n\nimport './YTreeView.scss';\n\nconst treeViewNodeProps = pressYTreeViewNodeProps();\n\nexport const YTreeView = defineComponent({\n name: 'YTreeView',\n props: {\n expanded: {\n type: [Array] as PropType<CandidateKey[]>,\n default: () => [],\n },\n active: {\n type: [Array] as PropType<CandidateKey[]>,\n default: () => [],\n },\n multipleActive: Boolean,\n activeStrategy: {\n type: String as PropType<'independent' | 'cascade'>, // TODO: 'leaf'\n default: 'independent',\n },\n selected: {\n type: [Array] as PropType<CandidateKey[]>,\n default: () => [],\n },\n selectStrategy: {\n type: String as PropType<'independent' | 'cascade'>, // TODO: 'leaf'\n default: 'leaf',\n },\n returnItem: Boolean,\n defaultExpand: [Boolean, String, Number],\n filter: Function as PropType<TreeviewFilterFn>,\n searchDebounceWait: {\n type: Number as PropType<number>,\n default: 700,\n },\n ...treeViewNodeProps,\n },\n emits: ['update:expanded', 'update:active', 'update:selected'],\n setup(props, { slots, emit, expose }) {\n const filterItemsFn = shallowRef(\n debounce(excludeItem, props.searchDebounceWait),\n );\n const expandedCache = ref<CandidateKey[]>([]);\n\n const {\n nodes,\n expanded,\n active,\n selected,\n expandedSet,\n selectedSet,\n activeSet,\n searchLoading,\n excludedSet,\n issueVnodeState,\n updateExpanded,\n updateActive,\n updateSelected,\n emitExpanded,\n emitActive,\n emitSelected,\n isExcluded,\n } = provideTreeView(props);\n\n function excludeItem(items: any[], search = '', filter = filterTreeItem) {\n const excluded = new Set<CandidateKey>();\n if (!search) {\n searchLoading.value = false;\n excludedSet.value = excluded;\n const diff = differenceBetween(expandedCache.value, [\n ...expandedSet.value,\n ]);\n diff.forEach((key) => {\n updateExpanded(key, false);\n });\n expandedCache.value.forEach((key) => {\n updateExpanded(key, true);\n });\n return;\n }\n for (const item of items) {\n filterTreeItems(\n filter,\n item,\n search ?? '',\n props.itemKey,\n props.itemText,\n props.itemChildren as string,\n excluded,\n );\n }\n excludedSet.value = excluded;\n searchLoading.value = false;\n expand();\n }\n\n watch(\n () => props.search,\n () => {\n searchLoading.value = true;\n filterItemsFn.value(props.items, props.search, props.filter);\n },\n );\n\n // Util Methods\n function getNodeKey(itemOrKey: any) {\n return props.returnItem\n ? getObjectValueByPath(itemOrKey, props.itemKey)\n : itemOrKey;\n }\n\n // State Methods\n function updateNodes(\n items: any[],\n parentKey: CandidateKey | null = null,\n level = 0,\n ) {\n for (const item of items) {\n const key = getObjectValueByPath(item, props.itemKey);\n const children =\n getObjectValueByPath(item, props.itemChildren as string) ?? [];\n const exist = hasOwnProperty(nodes.value, key);\n const existNode = exist\n ? nodes.value[key]\n : {\n vnode: null,\n selected: selected.value?.includes(key) ?? false,\n indeterminate: false,\n active: active.value?.includes(key) ?? false,\n expanded: expanded.value?.includes(key) ?? false,\n };\n const node: NodeState = {\n vnode: existNode.vnode,\n item,\n level,\n parentKey,\n childKeys: children.map((child: any) =>\n getObjectValueByPath(child, props.itemKey),\n ),\n expanded: children.length > 0 && existNode.expanded,\n active: existNode.active,\n indeterminate: existNode.indeterminate,\n selected: existNode.selected,\n };\n\n updateNodes(children, key, level + 1);\n\n nodes.value[key] = node;\n if (nodes.value[key].expanded) {\n expandedSet.value.add(key);\n }\n if (nodes.value[key].selected) {\n selectedSet.value.add(key);\n }\n if (nodes.value[key].active) {\n activeSet.value.add(key);\n }\n issueVnodeState(key);\n }\n }\n\n watch(\n expandedSet,\n (neo) => {\n if (!props.search) {\n expandedCache.value = [...neo];\n }\n },\n { deep: true },\n );\n\n function expand(until: boolean | string | number = true) {\n Object.entries(nodes.value).forEach(([key, node]) => {\n if (until === true || until >= node.level) {\n updateExpanded(key, true);\n }\n });\n emitExpanded();\n return expandedSet.value;\n }\n\n function stateWatcher(\n value: any[],\n stateSet: Ref<Set<CandidateKey>>,\n updater: (key: CandidateKey, to: boolean) => void,\n emitter: () => void,\n ) {\n const valuesOfKey = props.returnItem\n ? value.map((v) => getObjectValueByPath(v, props.itemKey))\n : value;\n const old = [...stateSet.value];\n if (deepEqual(old, valuesOfKey)) {\n return;\n }\n old.forEach((key) => updater(key, false));\n valuesOfKey.forEach((key) => updater(key, true));\n emitter();\n }\n\n watch(expanded, (neo) => {\n stateWatcher(neo, expandedSet, updateExpanded, emitExpanded);\n });\n\n watch(active, (neo) => {\n stateWatcher(neo, activeSet, updateActive, emitActive);\n });\n\n watch(selected, (neo) => {\n stateWatcher(neo, selectedSet, updateSelected, emitSelected);\n });\n\n watch(\n () => props.items,\n (neo: any[]) => {\n const oldKeys = Object.keys(nodes.value).map((nodeKey) =>\n getObjectValueByPath(nodes.value[nodeKey].item, props.itemKey),\n );\n const neoKeys = getKeys(\n neo,\n props.itemKey,\n props.itemChildren as string,\n );\n const diff = differenceBetween(oldKeys, neoKeys);\n if (diff.length < 1 && neoKeys.length < oldKeys.length) {\n return;\n }\n diff.forEach((k) => delete nodes.value[k]);\n\n // init\n const oldSelected = [...selectedSet.value];\n const oldActive = [...activeSet.value];\n selectedSet.value.clear();\n expandedSet.value.clear();\n activeSet.value.clear();\n updateNodes(neo);\n if (!deepEqual(oldSelected, [...selectedSet.value])) {\n emitSelected();\n }\n if (!deepEqual(oldActive, [...activeSet.value])) {\n emitActive();\n }\n },\n { deep: true, flush: 'sync' },\n );\n\n // Provide & Issue\n\n updateNodes(props.items);\n\n const renderLeaves = computed(() => {\n return props.items.slice().filter((leaf) => {\n return !isExcluded(getObjectValueByPath(leaf, props.itemKey));\n });\n });\n\n const classes = computed(() => {\n return {\n 'y-tree-view': true,\n };\n });\n\n const styles = computed(() => {\n let color = props.activeColor;\n if (props.activeColor && !isColorValue(props.activeColor)) {\n color = `var(--y-theme-${props.activeColor})`;\n }\n return {\n [`--y-tree-view__active-color`]: color,\n };\n });\n\n onMounted(() => {\n if (props.defaultExpand != null && props.defaultExpand !== false) {\n expandedCache.value = [...expand(props.defaultExpand)];\n } else {\n expanded.value.forEach((v: any) => updateExpanded(getNodeKey(v), true));\n emitExpanded();\n }\n\n for (const activeValue of props.active.map(getNodeKey)) {\n updateActive(activeValue, true);\n }\n\n for (const selectedValue of props.selected.map(getNodeKey)) {\n updateSelected(selectedValue, true);\n }\n });\n\n expose({\n expand,\n });\n\n useRender(() => {\n return (\n <>\n <div class={classes.value} style={styles.value} role=\"tree\">\n {searchLoading.value && <YProgressBar indeterminate />}\n {renderLeaves.value.length > 0 ? (\n renderLeaves.value.slice().map((leaf) => {\n return (\n <YTreeViewNode\n v-slots={slots}\n key={getObjectValueByPath(leaf, props.itemKey)}\n {...{\n ...chooseProps(props, treeViewNodeProps),\n item: leaf,\n level: 0,\n }}\n ></YTreeViewNode>\n );\n })\n ) : (\n <div class=\"y-tree-view__no-data\">\n {slots['no-data'] ? slots['no-data']() : <span>No Data</span>}\n </div>\n )}\n </div>\n </>\n );\n });\n\n return {\n nodes,\n expandedSet,\n selectedSet,\n activeSet,\n excludedSet,\n searchLoading,\n expandedCache,\n };\n },\n});\n\nexport type YTreeView = InstanceType<typeof YTreeView>;\n"],"mappings":";AAAA,SAGEA,QAAQ,EACRC,eAAe,EACfC,SAAS,EACTC,GAAG,EACHC,UAAU,EACVC,KAAK,QACA,KAAK;AAAC,SAEJC,eAAe;AAAA,SACfC,SAAS;AAAA,SAETC,iBAAiB;AAAA,SACjBC,YAAY;AAAA,SACZC,SAAS,EAAEC,oBAAoB,EAAEC,cAAc;AAAA,SAC/CC,WAAW;AAAA,SACXC,QAAQ;AAAA,SAERC,YAAY;AAAA,SACZC,aAAa,EAAEC,uBAAuB;AAAA,SAEtCC,cAAc,EAAEC,eAAe,EAAEC,OAAO;AAEjD;AAEA,MAAMC,iBAAiB,GAAGJ,uBAAuB,CAAC,CAAC;AAEnD,OAAO,MAAMK,SAAS,GAAGrB,eAAe,CAAC;EACvCsB,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE;IACLC,QAAQ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GhE,WAAW,CAACW,KAAK,EAAEH,iBAAiB,CAAC;UACxCuD,IAAI,EAAE6C,IAAI;UACVpC,KAAK,EAAE;QAAC,IALDxC,KAAK;MASpB,CAAC,CAAC,GAAAmF,YAAA;QAAA;MAAA,IAGCnF,KAAK,CAAC,SAAS,CAAC,GAAGA,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAAmF,YAAA,gBAAAG,gBAAA,aAAuB,EAEhE;IAIT,CAAC,CAAC;IAEF,OAAO;MACLhF,KAAK;MACLC,WAAW;MACXC,WAAW;MACXC,SAAS;MACTE,WAAW;MACXD,aAAa;MACbL;IACF,CAAC;EACH;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"YTreeView.mjs","names":["computed","defineComponent","onMounted","ref","shallowRef","watch","provideTreeView","useRender","differenceBetween","isColorValue","deepEqual","getObjectValueByPath","hasOwnProperty","chooseProps","debounce","YProgressBar","YTreeViewNode","pressYTreeViewNodeProps","filterTreeItem","filterTreeItems","getKeys","treeViewNodeProps","YTreeView","name","props","expanded","type","Array","default","active","multipleActive","Boolean","activeStrategy","String","selected","selectStrategy","returnItem","defaultExpand","Number","filter","Function","searchDebounceWait","emits","setup","_ref","slots","emit","expose","filterItemsFn","excludeItem","expandedCache","nodes","expandedSet","selectedSet","activeSet","searchLoading","excludedSet","issueVnodeState","updateExpanded","updateActive","updateSelected","emitExpanded","emitActive","emitSelected","isExcluded","items","search","arguments","length","undefined","excluded","Set","value","diff","forEach","key","item","itemKey","itemText","itemChildren","expand","getNodeKey","itemOrKey","updateNodes","parentKey","level","children","exist","existNode","vnode","includes","indeterminate","node","childKeys","map","child","add","neo","deep","until","Object","entries","_ref2","stateWatcher","stateSet","updater","emitter","valuesOfKey","v","old","oldKeys","keys","nodeKey","neoKeys","k","oldSelected","oldActive","clear","flush","renderLeaves","slice","leaf","classes","styles","color","activeColor","activeValue","selectedValue","_createVNode","_Fragment","_mergeProps","_createTextVNode"],"sources":["../../../src/components/tree-view/YTreeView.tsx"],"sourcesContent":["import {\n type PropType,\n type Ref,\n computed,\n defineComponent,\n onMounted,\n ref,\n shallowRef,\n watch,\n} from 'vue';\n\nimport { provideTreeView } from '@/components/tree-view/tree-view';\nimport { useRender } from '@/composables/component';\nimport { CandidateKey } from '@/types';\nimport { differenceBetween } from '@/util/array';\nimport { isColorValue } from '@/util/color';\nimport { deepEqual, getObjectValueByPath, hasOwnProperty } from '@/util/common';\nimport { chooseProps } from '@/util/component';\nimport { debounce } from '@/util/debounce';\n\nimport { YProgressBar } from '../progress-bar';\nimport { YTreeViewNode, pressYTreeViewNodeProps } from './YTreeViewNode';\nimport { NodeState, TreeviewFilterFn } from './types';\nimport { filterTreeItem, filterTreeItems, getKeys } from './util';\n\nimport './YTreeView.scss';\n\nconst treeViewNodeProps = pressYTreeViewNodeProps();\n\nexport const YTreeView = defineComponent({\n name: 'YTreeView',\n props: {\n expanded: {\n type: [Array] as PropType<CandidateKey[]>,\n default: () => [],\n },\n active: {\n type: [Array] as PropType<CandidateKey[]>,\n default: () => [],\n },\n multipleActive: Boolean,\n activeStrategy: {\n type: String as PropType<'independent' | 'cascade'>, // TODO: 'leaf'\n default: 'independent',\n },\n selected: {\n type: [Array] as PropType<CandidateKey[]>,\n default: () => [],\n },\n selectStrategy: {\n type: String as PropType<'independent' | 'cascade'>, // TODO: 'leaf'\n default: 'leaf',\n },\n returnItem: Boolean,\n defaultExpand: [Boolean, String, Number],\n filter: Function as PropType<TreeviewFilterFn>,\n searchDebounceWait: {\n type: Number as PropType<number>,\n default: 700,\n },\n ...treeViewNodeProps,\n },\n emits: ['update:expanded', 'update:active', 'update:selected'],\n setup(props, { slots, emit, expose }) {\n const filterItemsFn = shallowRef(\n debounce(excludeItem, props.searchDebounceWait),\n );\n const expandedCache = ref<CandidateKey[]>([]);\n\n const {\n nodes,\n expanded,\n active,\n selected,\n expandedSet,\n selectedSet,\n activeSet,\n searchLoading,\n excludedSet,\n issueVnodeState,\n updateExpanded,\n updateActive,\n updateSelected,\n emitExpanded,\n emitActive,\n emitSelected,\n isExcluded,\n } = provideTreeView(props);\n\n function excludeItem(items: any[], search = '', filter = filterTreeItem) {\n const excluded = new Set<CandidateKey>();\n if (!search) {\n searchLoading.value = false;\n excludedSet.value = excluded;\n const diff = differenceBetween(expandedCache.value, [\n ...expandedSet.value,\n ]);\n diff.forEach((key) => {\n updateExpanded(key, false);\n });\n expandedCache.value.forEach((key) => {\n updateExpanded(key, true);\n });\n return;\n }\n for (const item of items) {\n filterTreeItems(\n filter,\n item,\n search ?? '',\n props.itemKey,\n props.itemText,\n props.itemChildren as string,\n excluded,\n );\n }\n excludedSet.value = excluded;\n searchLoading.value = false;\n expand();\n }\n\n watch(\n () => props.search,\n () => {\n searchLoading.value = true;\n filterItemsFn.value(props.items, props.search, props.filter);\n },\n );\n\n // Util Methods\n function getNodeKey(itemOrKey: any) {\n return props.returnItem\n ? getObjectValueByPath(itemOrKey, props.itemKey)\n : itemOrKey;\n }\n\n // State Methods\n function updateNodes(\n items: any[],\n parentKey: CandidateKey | null = null,\n level = 0,\n ) {\n for (const item of items) {\n const key = getObjectValueByPath(item, props.itemKey);\n const children =\n getObjectValueByPath(item, props.itemChildren as string) ?? [];\n const exist = hasOwnProperty(nodes.value, key);\n const existNode = exist\n ? nodes.value[key]\n : {\n vnode: null,\n selected: selected.value?.includes(key) ?? false,\n indeterminate: false,\n active: active.value?.includes(key) ?? false,\n expanded: expanded.value?.includes(key) ?? false,\n };\n const node: NodeState = {\n vnode: existNode.vnode,\n item,\n level,\n parentKey,\n childKeys: children.map((child: any) =>\n getObjectValueByPath(child, props.itemKey),\n ),\n expanded: children.length > 0 && existNode.expanded,\n active: existNode.active,\n indeterminate: existNode.indeterminate,\n selected: existNode.selected,\n };\n\n updateNodes(children, key, level + 1);\n\n nodes.value[key] = node;\n if (nodes.value[key].expanded) {\n expandedSet.value.add(key);\n }\n if (nodes.value[key].selected) {\n selectedSet.value.add(key);\n }\n if (nodes.value[key].active) {\n activeSet.value.add(key);\n }\n issueVnodeState(key);\n }\n }\n\n watch(\n expandedSet,\n (neo) => {\n if (!props.search) {\n expandedCache.value = [...neo];\n }\n },\n { deep: true },\n );\n\n function expand(until: boolean | string | number = true) {\n Object.entries(nodes.value).forEach(([key, node]) => {\n if (until === true || until >= node.level) {\n updateExpanded(key, true);\n }\n });\n emitExpanded();\n return expandedSet.value;\n }\n\n function stateWatcher(\n value: any[],\n stateSet: Ref<Set<CandidateKey>>,\n updater: (key: CandidateKey, to: boolean) => void,\n emitter: () => void,\n ) {\n const valuesOfKey = props.returnItem\n ? value.map((v) => getObjectValueByPath(v, props.itemKey))\n : value;\n const old = [...stateSet.value];\n if (deepEqual(old, valuesOfKey)) {\n return;\n }\n old.forEach((key) => updater(key, false));\n valuesOfKey.forEach((key) => updater(key, true));\n emitter();\n }\n\n watch(expanded, (neo) => {\n stateWatcher(neo, expandedSet, updateExpanded, emitExpanded);\n });\n\n watch(active, (neo) => {\n stateWatcher(neo, activeSet, updateActive, emitActive);\n });\n\n watch(selected, (neo) => {\n stateWatcher(neo, selectedSet, updateSelected, emitSelected);\n });\n\n watch(\n () => props.items,\n (neo: any[]) => {\n const oldKeys = Object.keys(nodes.value).map((nodeKey) =>\n getObjectValueByPath(nodes.value[nodeKey].item, props.itemKey),\n );\n const neoKeys = getKeys(\n neo,\n props.itemKey,\n props.itemChildren as string,\n );\n const diff = differenceBetween(oldKeys, neoKeys);\n if (diff.length < 1 && neoKeys.length < oldKeys.length) {\n return;\n }\n diff.forEach((k) => delete nodes.value[k]);\n\n // init\n const oldSelected = [...selectedSet.value];\n const oldActive = [...activeSet.value];\n selectedSet.value.clear();\n expandedSet.value.clear();\n activeSet.value.clear();\n updateNodes(neo);\n if (!deepEqual(oldSelected, [...selectedSet.value])) {\n emitSelected();\n }\n if (!deepEqual(oldActive, [...activeSet.value])) {\n emitActive();\n }\n filterItemsFn.value(neo, props.search, props.filter);\n },\n { deep: true, flush: 'sync' },\n );\n\n // Provide & Issue\n\n updateNodes(props.items);\n\n const renderLeaves = computed(() => {\n return props.items.slice().filter((leaf) => {\n return !isExcluded(getObjectValueByPath(leaf, props.itemKey));\n });\n });\n\n const classes = computed(() => {\n return {\n 'y-tree-view': true,\n };\n });\n\n const styles = computed(() => {\n let color = props.activeColor;\n if (props.activeColor && !isColorValue(props.activeColor)) {\n color = `var(--y-theme-${props.activeColor})`;\n }\n return {\n [`--y-tree-view__active-color`]: color,\n };\n });\n\n onMounted(() => {\n if (props.search) {\n searchLoading.value = true;\n excludeItem(props.items, props.search, props.filter);\n }\n\n if (props.defaultExpand != null && props.defaultExpand !== false) {\n expandedCache.value = [...expand(props.defaultExpand)];\n } else {\n expanded.value.forEach((v: any) => updateExpanded(getNodeKey(v), true));\n emitExpanded();\n }\n\n for (const activeValue of props.active.map(getNodeKey)) {\n updateActive(activeValue, true);\n }\n\n for (const selectedValue of props.selected.map(getNodeKey)) {\n updateSelected(selectedValue, true);\n }\n });\n\n expose({\n expand,\n });\n\n useRender(() => {\n return (\n <>\n <div class={classes.value} style={styles.value} role=\"tree\">\n {searchLoading.value && <YProgressBar indeterminate />}\n {renderLeaves.value.length > 0 ? (\n renderLeaves.value.slice().map((leaf) => {\n return (\n <YTreeViewNode\n v-slots={slots}\n key={getObjectValueByPath(leaf, props.itemKey)}\n {...{\n ...chooseProps(props, treeViewNodeProps),\n item: leaf,\n level: 0,\n }}\n ></YTreeViewNode>\n );\n })\n ) : (\n <div class=\"y-tree-view__no-data\">\n {slots['no-data'] ? slots['no-data']() : <span>No Data</span>}\n </div>\n )}\n </div>\n </>\n );\n });\n\n return {\n nodes,\n expandedSet,\n selectedSet,\n activeSet,\n excludedSet,\n searchLoading,\n expandedCache,\n };\n },\n});\n\nexport type YTreeView = InstanceType<typeof YTreeView>;\n"],"mappings":";AAAA,SAGEA,QAAQ,EACRC,eAAe,EACfC,SAAS,EACTC,GAAG,EACHC,UAAU,EACVC,KAAK,QACA,KAAK;AAAC,SAEJC,eAAe;AAAA,SACfC,SAA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vG,KAAK,CAACU,QAAQ,CAAC4D,GAAG,CAACb,UAAU,CAAC,EAAE;QAC1DrB,cAAc,CAACmE,aAAa,EAAE,IAAI,CAAC;MACrC;IACF,CAAC,CAAC;IAEFhF,MAAM,CAAC;MACLiC;IACF,CAAC,CAAC;IAEFzE,SAAS,CAAC,MAAM;MACd,OAAAyH,YAAA,CAAAC,SAAA,SAAAD,YAAA;QAAA,SAEgBN,OAAO,CAAClD,KAAK;QAAA,SAASmD,MAAM,CAACnD,KAAK;QAAA;MAAA,IAC3CjB,aAAa,CAACiB,KAAK,IAAAwD,YAAA,CAAAjH,YAAA;QAAA;MAAA,QAAkC,EACrDwG,YAAY,CAAC/C,KAAK,CAACJ,MAAM,GAAG,CAAC,GAC5BmD,YAAY,CAAC/C,KAAK,CAACgD,KAAK,CAAC,CAAC,CAAC1B,GAAG,CAAE2B,IAAI,IAAK;QACvC,OAAAO,YAAA,CAAAhH,aAAA,EAAAkH,WAAA;UAAA,OAGSvH,oBAAoB,CAAC8G,IAAI,EAAEjG,KAAK,CAACqD,OAAO;QAAC;UAE5C,GAAGhE,WAAW,CAACW,KAAK,EAAEH,iBAAiB,CAAC;UACxCuD,IAAI,EAAE6C,IAAI;UACVpC,KAAK,EAAE;QAAC,IALDxC,KAAK;MASpB,CAAC,CAAC,GAAAmF,YAAA;QAAA;MAAA,IAGCnF,KAAK,CAAC,SAAS,CAAC,GAAGA,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAAmF,YAAA,gBAAAG,gBAAA,aAAuB,EAEhE;IAIT,CAAC,CAAC;IAEF,OAAO;MACLhF,KAAK;MACLC,WAAW;MACXC,WAAW;MACXC,SAAS;MACTE,WAAW;MACXD,aAAa;MACbL;IACF,CAAC;EACH;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { colorRgb, isColorValue } from "../util/index.mjs";
|
|
3
|
+
export const styleColorPropsOptions = {
|
|
4
|
+
color: String,
|
|
5
|
+
background: String,
|
|
6
|
+
backgroundOpacity: {
|
|
7
|
+
type: Number,
|
|
8
|
+
default: 1
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export function useStyleColor(props, name) {
|
|
12
|
+
const colorVars = computed(() => {
|
|
13
|
+
let {
|
|
14
|
+
color,
|
|
15
|
+
background
|
|
16
|
+
} = props;
|
|
17
|
+
if (!background) background = color;
|
|
18
|
+
if (color && !isColorValue(color)) {
|
|
19
|
+
color = `var(--y-theme-${color})`;
|
|
20
|
+
}
|
|
21
|
+
if (background) {
|
|
22
|
+
if (isColorValue(background)) {
|
|
23
|
+
background = `rgba(${colorRgb(background)}, ${props.backgroundOpacity})`;
|
|
24
|
+
} else if (!background.startsWith('var(')) {
|
|
25
|
+
background = `rgba(${`var(--y-theme-${background}-rgb)`}, ${props.backgroundOpacity})`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
[`--y-${name}__color`]: color,
|
|
30
|
+
[`--y-${name}__background`]: background
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
colorVars
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=style-color.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-color.mjs","names":["computed","colorRgb","isColorValue","styleColorPropsOptions","color","String","background","backgroundOpacity","type","Number","default","useStyleColor","props","name","colorVars","startsWith"],"sources":["../../src/composables/style-color.ts"],"sourcesContent":["import { ExtractPropTypes, computed } from 'vue';\n\nimport { colorRgb, isColorValue } from '@/util';\n\nexport const styleColorPropsOptions = {\n color: String,\n background: String,\n backgroundOpacity: {\n type: Number,\n default: 1,\n },\n};\n\nexport function useStyleColor(\n props: ExtractPropTypes<typeof styleColorPropsOptions>,\n name: string,\n) {\n const colorVars = computed(() => {\n let { color, background } = props;\n if (!background) background = color;\n\n if (color && !isColorValue(color)) {\n color = `var(--y-theme-${color})`;\n }\n\n if (background) {\n if (isColorValue(background)) {\n background = `rgba(${colorRgb(background)}, ${props.backgroundOpacity})`;\n } else if (!background.startsWith('var(')) {\n background = `rgba(${`var(--y-theme-${background}-rgb)`}, ${props.backgroundOpacity})`;\n }\n }\n\n return {\n [`--y-${name}__color`]: color,\n [`--y-${name}__background`]: background,\n };\n });\n\n return {\n colorVars,\n };\n}\n"],"mappings":"AAAA,SAA2BA,QAAQ,QAAQ,KAAK;AAAC,SAExCC,QAAQ,EAAEC,YAAY;AAE/B,OAAO,MAAMC,sBAAsB,GAAG;EACpCC,KAAK,EAAEC,MAAM;EACbC,UAAU,EAAED,MAAM;EAClBE,iBAAiB,EAAE;IACjBC,IAAI,EAAEC,MAAM;IACZC,OAAO,EAAE;EACX;AACF,CAAC;AAED,OAAO,SAASC,aAAaA,CAC3BC,KAAsD,EACtDC,IAAY,EACZ;EACA,MAAMC,SAAS,GAAGd,QAAQ,CAAC,MAAM;IAC/B,IAAI;MAAEI,KAAK;MAAEE;IAAW,CAAC,GAAGM,KAAK;IACjC,IAAI,CAACN,UAAU,EAAEA,UAAU,GAAGF,KAAK;IAEnC,IAAIA,KAAK,IAAI,CAACF,YAAY,CAACE,KAAK,CAAC,EAAE;MACjCA,KAAK,GAAI,iBAAgBA,KAAM,GAAE;IACnC;IAEA,IAAIE,UAAU,EAAE;MACd,IAAIJ,YAAY,CAACI,UAAU,CAAC,EAAE;QAC5BA,UAAU,GAAI,QAAOL,QAAQ,CAACK,UAAU,CAAE,KAAIM,KAAK,CAACL,iBAAkB,GAAE;MAC1E,CAAC,MAAM,IAAI,CAACD,UAAU,CAACS,UAAU,CAAC,MAAM,CAAC,EAAE;QACzCT,UAAU,GAAI,QAAQ,iBAAgBA,UAAW,OAAO,KAAIM,KAAK,CAACL,iBAAkB,GAAE;MACxF;IACF;IAEA,OAAO;MACL,CAAE,OAAMM,IAAK,SAAQ,GAAGT,KAAK;MAC7B,CAAE,OAAMS,IAAK,cAAa,GAAGP;IAC/B,CAAC;EACH,CAAC,CAAC;EAEF,OAAO;IACLQ;EACF,CAAC;AACH"}
|
package/lib/index.mjs
CHANGED
|
@@ -32,7 +32,8 @@ export function init() {
|
|
|
32
32
|
...i18nModule.rtlModule
|
|
33
33
|
},
|
|
34
34
|
date: dateModule,
|
|
35
|
-
defaults: defaultsModule
|
|
35
|
+
defaults: defaultsModule,
|
|
36
|
+
icon: iconModule
|
|
36
37
|
});
|
|
37
38
|
Object.keys(components).forEach(componentName => {
|
|
38
39
|
const comp = components[componentName];
|
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["getCurrentInstance","nextTick","reactive","allComponents","YUYEON_DATE_KEY","YUYEON_DATE_OPTIONS_KEY","createDateModule","createDefaultsModule","YUYEON_DEFAULTS_KEY","createI18nModule","YUYEON_I18N_KEY","YUYEON_ICON_KEY","createIconModule","YUYEON_THEME_KEY","createThemeModule","useTheme","PlateWave","YUYEON_LOGO","defaultOptions","credit","init","options","arguments","length","undefined","defaultsModule","defaults","themeModule","theme","i18nModule","i18n","dateModule","date","localeModule","iconModule","icon","components","install","app","yuyeon","root","instance","rtlModule","Object","keys","forEach","componentName","comp","component","directive","provide","config","globalProperties","$yuyeon","_container","_instance","classList","add","setAttribute","console","log","unmount","mount","vm","scope","stop","useYuyeon","Error","appContext"],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Component, ComponentInternalInstance } from 'vue';\r\nimport { getCurrentInstance, nextTick, reactive } from 'vue';\r\n\r\nimport * as allComponents from '@/components/';\r\nimport {\r\n YUYEON_DATE_KEY,\r\n YUYEON_DATE_OPTIONS_KEY,\r\n createDateModule,\r\n} from '@/composables/date';\r\nimport { createDefaultsModule } from '@/composables/defaults';\r\nimport { YUYEON_DEFAULTS_KEY } from '@/composables/defaults/share';\r\nimport { createI18nModule } from '@/composables/i18n';\r\nimport { YUYEON_I18N_KEY } from '@/composables/i18n/share';\r\nimport { YUYEON_ICON_KEY, createIconModule } from '@/composables/icon';\r\nimport {\r\n YUYEON_THEME_KEY,\r\n createThemeModule,\r\n useTheme,\r\n} from '@/composables/theme';\r\nimport PlateWave from '@/directives/plate-wave';\r\nimport { YUYEON_LOGO } from '@/etc';\r\n\r\nimport './styles/base.scss';\r\n\r\nconst defaultOptions = {\r\n credit: true,\r\n};\r\n\r\ndeclare module 'vue' {\r\n interface ComponentCustomProperties {\r\n $yuyeon: any;\r\n }\r\n}\r\n\r\nexport function init(options: any = defaultOptions) {\r\n const defaultsModule = createDefaultsModule(options?.defaults);\r\n const themeModule = createThemeModule(options?.theme);\r\n const i18nModule = createI18nModule(options?.i18n);\r\n const dateModule = createDateModule(options?.date, i18nModule.localeModule);\r\n const iconModule = createIconModule(options?.icon);\r\n const components = options?.components ?? allComponents;\r\n\r\n const install = (app: App) => {\r\n themeModule.install(app);\r\n\r\n const yuyeon = reactive({\r\n app: null as ComponentInternalInstance | null,\r\n root: null as HTMLElement | null,\r\n theme: themeModule.instance,\r\n i18n: {\r\n ...i18nModule.localeModule,\r\n ...i18nModule.rtlModule,\r\n },\r\n date: dateModule,\r\n defaults: defaultsModule,\r\n });\r\n\r\n Object.keys(components).forEach((componentName) => {\r\n const comp = components[componentName as keyof typeof components];\r\n if (typeof comp === 'object' && 'name' in comp)\r\n app.component(componentName, comp as Component);\r\n });\r\n\r\n app.directive('plate-wave', PlateWave);\r\n\r\n app.provide(YUYEON_DEFAULTS_KEY, defaultsModule);\r\n app.provide(YUYEON_THEME_KEY, themeModule.instance);\r\n app.provide(YUYEON_ICON_KEY, iconModule);\r\n app.provide(YUYEON_I18N_KEY, {\r\n ...i18nModule.localeModule,\r\n ...i18nModule.rtlModule,\r\n });\r\n app.provide(YUYEON_DATE_OPTIONS_KEY, dateModule.options);\r\n app.provide(YUYEON_DATE_KEY, dateModule.instance);\r\n\r\n app.config.globalProperties.$yuyeon = yuyeon;\r\n\r\n nextTick(() => {\r\n yuyeon.root = app._container;\r\n yuyeon.app = app._instance as any;\r\n if (yuyeon.root) {\r\n yuyeon.root.classList.add('y-root');\r\n yuyeon.root.setAttribute('data-y-root', '');\r\n themeModule.init(yuyeon);\r\n }\r\n });\r\n\r\n if (options?.credit) {\r\n console.log(YUYEON_LOGO);\r\n }\r\n const { unmount, mount } = app;\r\n app.mount = (...args) => {\r\n const vm = mount(...args);\r\n if (!yuyeon.app) {\r\n yuyeon.app = app._instance as any;\r\n }\r\n if (!yuyeon.root) {\r\n nextTick(() => {\r\n yuyeon.root = app._container;\r\n if (yuyeon.root) {\r\n yuyeon.root.classList.add('y-root');\r\n yuyeon.root.setAttribute('data-y-root', '');\r\n themeModule.init(yuyeon);\r\n }\r\n });\r\n }\r\n app.mount = mount;\r\n return vm;\r\n };\r\n app.unmount = () => {\r\n unmount();\r\n themeModule.scope.stop();\r\n app.unmount = unmount;\r\n };\r\n };\r\n\r\n return {\r\n install,\r\n };\r\n}\r\n\r\nexport function useYuyeon() {\r\n const vm = getCurrentInstance();\r\n if (!vm) throw new Error('[yuyeon] Called outside of setup context');\r\n\r\n return vm.appContext.config.globalProperties.$yuyeon;\r\n}\r\n\r\nexport { useTheme };\r\n"],"mappings":"AACA,SAASA,kBAAkB,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,KAAK;AAAC,OAEtD,KAAKC,aAAa;AAAA,SAEvBC,eAAe,EACfC,uBAAuB,EACvBC,gBAAgB;AAAA,SAETC,oBAAoB;AAAA,SACpBC,mBAAmB;AAAA,SACnBC,gBAAgB;AAAA,SAChBC,eAAe;AAAA,SACfC,eAAe,EAAEC,gBAAgB;AAAA,SAExCC,gBAAgB,EAChBC,iBAAiB,EACjBC,QAAQ;AAAA,OAEHC,SAAS;AAAA,SACPC,WAAW;AAEpB;AAEA,MAAMC,cAAc,GAAG;EACrBC,MAAM,EAAE;AACV,CAAC;AAQD,OAAO,SAASC,IAAIA,CAAA,EAAgC;EAAA,IAA/BC,OAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGJ,cAAc;EAChD,MAAMO,cAAc,GAAGlB,oBAAoB,CAACc,OAAO,EAAEK,QAAQ,CAAC;EAC9D,MAAMC,WAAW,GAAGb,iBAAiB,CAACO,OAAO,EAAEO,KAAK,CAAC;EACrD,MAAMC,UAAU,GAAGpB,gBAAgB,CAACY,OAAO,EAAES,IAAI,CAAC;EAClD,MAAMC,UAAU,GAAGzB,gBAAgB,CAACe,OAAO,EAAEW,IAAI,EAAEH,UAAU,CAACI,YAAY,CAAC;EAC3E,MAAMC,UAAU,GAAGtB,gBAAgB,CAACS,OAAO,EAAEc,IAAI,CAAC;EAClD,MAAMC,UAAU,GAAGf,OAAO,EAAEe,UAAU,IAAIjC,aAAa;EAEvD,MAAMkC,OAAO,GAAIC,GAAQ,IAAK;IAC5BX,WAAW,CAACU,OAAO,CAACC,GAAG,CAAC;IAExB,MAAMC,MAAM,GAAGrC,QAAQ,CAAC;MACtBoC,GAAG,EAAE,IAAwC;MAC7CE,IAAI,EAAE,IAA0B;MAChCZ,KAAK,EAAED,WAAW,CAACc,QAAQ;MAC3BX,IAAI,EAAE;QACJ,GAAGD,UAAU,CAACI,YAAY;QAC1B,GAAGJ,UAAU,CAACa;MAChB,CAAC;MACDV,IAAI,EAAED,UAAU;MAChBL,QAAQ,EAAED;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["getCurrentInstance","nextTick","reactive","allComponents","YUYEON_DATE_KEY","YUYEON_DATE_OPTIONS_KEY","createDateModule","createDefaultsModule","YUYEON_DEFAULTS_KEY","createI18nModule","YUYEON_I18N_KEY","YUYEON_ICON_KEY","createIconModule","YUYEON_THEME_KEY","createThemeModule","useTheme","PlateWave","YUYEON_LOGO","defaultOptions","credit","init","options","arguments","length","undefined","defaultsModule","defaults","themeModule","theme","i18nModule","i18n","dateModule","date","localeModule","iconModule","icon","components","install","app","yuyeon","root","instance","rtlModule","Object","keys","forEach","componentName","comp","component","directive","provide","config","globalProperties","$yuyeon","_container","_instance","classList","add","setAttribute","console","log","unmount","mount","vm","scope","stop","useYuyeon","Error","appContext"],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Component, ComponentInternalInstance } from 'vue';\r\nimport { getCurrentInstance, nextTick, reactive } from 'vue';\r\n\r\nimport * as allComponents from '@/components/';\r\nimport {\r\n YUYEON_DATE_KEY,\r\n YUYEON_DATE_OPTIONS_KEY,\r\n createDateModule,\r\n} from '@/composables/date';\r\nimport { createDefaultsModule } from '@/composables/defaults';\r\nimport { YUYEON_DEFAULTS_KEY } from '@/composables/defaults/share';\r\nimport { createI18nModule } from '@/composables/i18n';\r\nimport { YUYEON_I18N_KEY } from '@/composables/i18n/share';\r\nimport { YUYEON_ICON_KEY, createIconModule } from '@/composables/icon';\r\nimport {\r\n YUYEON_THEME_KEY,\r\n createThemeModule,\r\n useTheme,\r\n} from '@/composables/theme';\r\nimport PlateWave from '@/directives/plate-wave';\r\nimport { YUYEON_LOGO } from '@/etc';\r\n\r\nimport './styles/base.scss';\r\n\r\nconst defaultOptions = {\r\n credit: true,\r\n};\r\n\r\ndeclare module 'vue' {\r\n interface ComponentCustomProperties {\r\n $yuyeon: any;\r\n }\r\n}\r\n\r\nexport function init(options: any = defaultOptions) {\r\n const defaultsModule = createDefaultsModule(options?.defaults);\r\n const themeModule = createThemeModule(options?.theme);\r\n const i18nModule = createI18nModule(options?.i18n);\r\n const dateModule = createDateModule(options?.date, i18nModule.localeModule);\r\n const iconModule = createIconModule(options?.icon);\r\n const components = options?.components ?? allComponents;\r\n\r\n const install = (app: App) => {\r\n themeModule.install(app);\r\n\r\n const yuyeon = reactive({\r\n app: null as ComponentInternalInstance | null,\r\n root: null as HTMLElement | null,\r\n theme: themeModule.instance,\r\n i18n: {\r\n ...i18nModule.localeModule,\r\n ...i18nModule.rtlModule,\r\n },\r\n date: dateModule,\r\n defaults: defaultsModule,\r\n icon: iconModule,\r\n });\r\n\r\n Object.keys(components).forEach((componentName) => {\r\n const comp = components[componentName as keyof typeof components];\r\n if (typeof comp === 'object' && 'name' in comp)\r\n app.component(componentName, comp as Component);\r\n });\r\n\r\n app.directive('plate-wave', PlateWave);\r\n\r\n app.provide(YUYEON_DEFAULTS_KEY, defaultsModule);\r\n app.provide(YUYEON_THEME_KEY, themeModule.instance);\r\n app.provide(YUYEON_ICON_KEY, iconModule);\r\n app.provide(YUYEON_I18N_KEY, {\r\n ...i18nModule.localeModule,\r\n ...i18nModule.rtlModule,\r\n });\r\n app.provide(YUYEON_DATE_OPTIONS_KEY, dateModule.options);\r\n app.provide(YUYEON_DATE_KEY, dateModule.instance);\r\n\r\n app.config.globalProperties.$yuyeon = yuyeon;\r\n\r\n nextTick(() => {\r\n yuyeon.root = app._container;\r\n yuyeon.app = app._instance as any;\r\n if (yuyeon.root) {\r\n yuyeon.root.classList.add('y-root');\r\n yuyeon.root.setAttribute('data-y-root', '');\r\n themeModule.init(yuyeon);\r\n }\r\n });\r\n\r\n if (options?.credit) {\r\n console.log(YUYEON_LOGO);\r\n }\r\n const { unmount, mount } = app;\r\n app.mount = (...args) => {\r\n const vm = mount(...args);\r\n if (!yuyeon.app) {\r\n yuyeon.app = app._instance as any;\r\n }\r\n if (!yuyeon.root) {\r\n nextTick(() => {\r\n yuyeon.root = app._container;\r\n if (yuyeon.root) {\r\n yuyeon.root.classList.add('y-root');\r\n yuyeon.root.setAttribute('data-y-root', '');\r\n themeModule.init(yuyeon);\r\n }\r\n });\r\n }\r\n app.mount = mount;\r\n return vm;\r\n };\r\n app.unmount = () => {\r\n unmount();\r\n themeModule.scope.stop();\r\n app.unmount = unmount;\r\n };\r\n };\r\n\r\n return {\r\n install,\r\n };\r\n}\r\n\r\nexport function useYuyeon() {\r\n const vm = getCurrentInstance();\r\n if (!vm) throw new Error('[yuyeon] Called outside of setup context');\r\n\r\n return vm.appContext.config.globalProperties.$yuyeon;\r\n}\r\n\r\nexport { useTheme };\r\n"],"mappings":"AACA,SAASA,kBAAkB,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,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AII,KAAK,CAAC,0CAA0C,CAAC;EAEpE,OAAOJ,EAAE,CAACK,UAAU,CAACjB,MAAM,CAACC,gBAAgB,CAACC,OAAO;AACtD;AAEA,SAAStC,QAAQ"}
|
package/lib/util/color/index.mjs
CHANGED
|
@@ -12,9 +12,25 @@
|
|
|
12
12
|
* https://github.com/vuetifyjs/vuetify
|
|
13
13
|
* */
|
|
14
14
|
import { HEX_COLOR_REGEX, RGBA_REGEX } from "./const.mjs";
|
|
15
|
+
import { rgbFromHex } from "./../index.mjs";
|
|
15
16
|
export function isColorValue(value) {
|
|
16
17
|
return RGBA_REGEX.test(value) || HEX_COLOR_REGEX.test(value);
|
|
17
18
|
}
|
|
19
|
+
export function colorRgb(color) {
|
|
20
|
+
if (color?.startsWith('#')) {
|
|
21
|
+
return rgbFromHex(color)?.join(',') || '';
|
|
22
|
+
}
|
|
23
|
+
const RGBA_REGEX = /rgb(a?)\((?<v>.*)\)/;
|
|
24
|
+
if (RGBA_REGEX.test(color)) {
|
|
25
|
+
const value = RGBA_REGEX.exec(color)?.[2] || '';
|
|
26
|
+
if (value) {
|
|
27
|
+
const valueArray = value.trim().split(',');
|
|
28
|
+
valueArray.splice(3, 1);
|
|
29
|
+
return valueArray.join(',');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return '';
|
|
33
|
+
}
|
|
18
34
|
export function isTextColorIsLight(r, g, b) {
|
|
19
35
|
const luminance = 1 - (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
20
36
|
return luminance < 0.5;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["HEX_COLOR_REGEX","RGBA_REGEX","isColorValue","value","test","isTextColorIsLight","r","g","b","luminance"],"sources":["../../../src/util/color/index.ts"],"sourcesContent":["/*\r\n* yuyeon\r\n* Apache-2.0 license (Copyright 2023 yeonyew)\r\n*\r\n* Used Libs\r\n* - material-color-utilities\r\n* Apache-2.0 license (Copyright 2021 Google LLC)\r\n* https://github.com/material-foundation/material-color-utilities\r\n*\r\n* - Vuetify\r\n* MIT license (Copyright (c) 2016-2023 John Jeremy Leider)\r\n* https://github.com/vuetifyjs/vuetify\r\n* */\r\n\r\nimport { HEX_COLOR_REGEX, RGBA_REGEX } from \"./const\";\r\n\r\nexport function isColorValue(value: string): boolean {\r\n return RGBA_REGEX.test(value) || HEX_COLOR_REGEX.test(value);\r\n}\r\n\r\nexport function isTextColorIsLight(r: number, g: number, b: number): boolean {\r\n const luminance = 1 - (0.299 * r + 0.587 * g + 0.114 * b) / 255;\r\n return luminance < 0.5;\r\n}\r\n\r\nexport * from './const';\r\nexport * from \"./conversion\";\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA,SAcSA,eAAe,EAAEC,UAAU;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["HEX_COLOR_REGEX","RGBA_REGEX","rgbFromHex","isColorValue","value","test","colorRgb","color","startsWith","join","exec","valueArray","trim","split","splice","isTextColorIsLight","r","g","b","luminance"],"sources":["../../../src/util/color/index.ts"],"sourcesContent":["/*\r\n* yuyeon\r\n* Apache-2.0 license (Copyright 2023 yeonyew)\r\n*\r\n* Used Libs\r\n* - material-color-utilities\r\n* Apache-2.0 license (Copyright 2021 Google LLC)\r\n* https://github.com/material-foundation/material-color-utilities\r\n*\r\n* - Vuetify\r\n* MIT license (Copyright (c) 2016-2023 John Jeremy Leider)\r\n* https://github.com/vuetifyjs/vuetify\r\n* */\r\n\r\nimport { HEX_COLOR_REGEX, RGBA_REGEX } from \"./const\";\r\nimport { rgbFromHex } from '@/util';\r\n\r\nexport function isColorValue(value: string): boolean {\r\n return RGBA_REGEX.test(value) || HEX_COLOR_REGEX.test(value);\r\n}\r\n\r\nexport function colorRgb(color: string): string {\r\n if (color?.startsWith('#')) {\r\n return rgbFromHex(color)?.join(',') || '';\r\n }\r\n const RGBA_REGEX = /rgb(a?)\\((?<v>.*)\\)/;\r\n if (RGBA_REGEX.test(color)) {\r\n const value = RGBA_REGEX.exec(color)?.[2] || '';\r\n if (value) {\r\n const valueArray = value.trim().split(',');\r\n valueArray.splice(3, 1);\r\n return valueArray.join(',');\r\n }\r\n }\r\n return '';\r\n}\r\n\r\nexport function isTextColorIsLight(r: number, g: number, b: number): boolean {\r\n const luminance = 1 - (0.299 * r + 0.587 * g + 0.114 * b) / 255;\r\n return luminance < 0.5;\r\n}\r\n\r\nexport * from './const';\r\nexport * from \"./conversion\";\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA,SAcSA,eAAe,EAAEC,UAAU;AAAA,SAC3BC,UAAU;AAEnB,OAAO,SAASC,YAAYA,CAACC,KAAa,EAAW;EACnD,OAAOH,UAAU,CAACI,IAAI,CAACD,KAAK,CAAC,IAAIJ,eAAe,CAACK,IAAI,CAACD,KAAK,CAAC;AAC9D;AAEA,OAAO,SAASE,QAAQA,CAACC,KAAa,EAAU;EAC9C,IAAIA,KAAK,EAAEC,UAAU,CAAC,GAAG,CAAC,EAAE;IAC1B,OAAON,UAAU,CAACK,KAAK,CAAC,EAAEE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;EAC3C;EACA,MAAMR,UAAU,GAAG,qBAAqB;EACxC,IAAIA,UAAU,CAACI,IAAI,CAACE,KAAK,CAAC,EAAE;IAC1B,MAAMH,KAAK,GAAGH,UAAU,CAACS,IAAI,CAACH,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;IAC/C,IAAIH,KAAK,EAAE;MACT,MAAMO,UAAU,GAAGP,KAAK,CAACQ,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC;MAC1CF,UAAU,CAACG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;MACvB,OAAOH,UAAU,CAACF,IAAI,CAAC,GAAG,CAAC;IAC7B;EACF;EACA,OAAO,EAAE;AACX;AAEA,OAAO,SAASM,kBAAkBA,CAACC,CAAS,EAAEC,CAAS,EAAEC,CAAS,EAAW;EAC3E,MAAMC,SAAS,GAAG,CAAC,GAAG,CAAC,KAAK,GAAGH,CAAC,GAAG,KAAK,GAAGC,CAAC,GAAG,KAAK,GAAGC,CAAC,IAAI,GAAG;EAC/D,OAAOC,SAAS,GAAG,GAAG;AACxB;AAAC;AAAA"}
|
package/package.json
CHANGED
|
@@ -2,19 +2,39 @@ import { PropType } from 'vue';
|
|
|
2
2
|
import { IconValue } from '../../composables/icon';
|
|
3
3
|
|
|
4
4
|
export declare const pressYBadgePropsOptions: <Defaults extends {
|
|
5
|
+
color?: unknown;
|
|
6
|
+
background?: unknown;
|
|
7
|
+
backgroundOpacity?: unknown;
|
|
5
8
|
tag?: unknown;
|
|
6
9
|
dot?: unknown;
|
|
7
10
|
bordered?: unknown;
|
|
8
11
|
floating?: unknown;
|
|
9
12
|
inline?: unknown;
|
|
10
13
|
icon?: unknown;
|
|
11
|
-
color?: unknown;
|
|
12
14
|
hide?: unknown;
|
|
13
15
|
label?: unknown;
|
|
14
16
|
content?: unknown;
|
|
15
17
|
max?: unknown;
|
|
16
18
|
transition?: unknown;
|
|
17
19
|
} = {}>(defaults?: Defaults | undefined) => {
|
|
20
|
+
color: unknown extends Defaults["color"] ? StringConstructor : {
|
|
21
|
+
type: PropType<unknown extends Defaults["color"] ? string : string | Defaults["color"]>;
|
|
22
|
+
default: unknown extends Defaults["color"] ? string : string | Defaults["color"];
|
|
23
|
+
};
|
|
24
|
+
background: unknown extends Defaults["background"] ? StringConstructor : {
|
|
25
|
+
type: PropType<unknown extends Defaults["background"] ? string : string | Defaults["background"]>;
|
|
26
|
+
default: unknown extends Defaults["background"] ? string : string | Defaults["background"];
|
|
27
|
+
};
|
|
28
|
+
backgroundOpacity: unknown extends Defaults["backgroundOpacity"] ? {
|
|
29
|
+
type: NumberConstructor;
|
|
30
|
+
default: number;
|
|
31
|
+
} : Omit<{
|
|
32
|
+
type: NumberConstructor;
|
|
33
|
+
default: number;
|
|
34
|
+
}, "type" | "default"> & {
|
|
35
|
+
type: PropType<unknown extends Defaults["backgroundOpacity"] ? number : number | Defaults["backgroundOpacity"]>;
|
|
36
|
+
default: unknown extends Defaults["backgroundOpacity"] ? number : number | Defaults["backgroundOpacity"];
|
|
37
|
+
};
|
|
18
38
|
tag: unknown extends Defaults["tag"] ? {
|
|
19
39
|
type: PropType<string>;
|
|
20
40
|
default: string;
|
|
@@ -45,10 +65,6 @@ export declare const pressYBadgePropsOptions: <Defaults extends {
|
|
|
45
65
|
type: PropType<unknown extends Defaults["icon"] ? IconValue : NonNullable<IconValue> | Defaults["icon"]>;
|
|
46
66
|
default: unknown extends Defaults["icon"] ? IconValue : NonNullable<IconValue> | Defaults["icon"];
|
|
47
67
|
};
|
|
48
|
-
color: unknown extends Defaults["color"] ? StringConstructor : {
|
|
49
|
-
type: PropType<unknown extends Defaults["color"] ? string : string | Defaults["color"]>;
|
|
50
|
-
default: unknown extends Defaults["color"] ? string : string | Defaults["color"];
|
|
51
|
-
};
|
|
52
68
|
hide: unknown extends Defaults["hide"] ? BooleanConstructor : {
|
|
53
69
|
type: PropType<unknown extends Defaults["hide"] ? boolean : boolean | Defaults["hide"]>;
|
|
54
70
|
default: unknown extends Defaults["hide"] ? boolean : boolean | Defaults["hide"];
|
|
@@ -83,6 +99,12 @@ export declare const pressYBadgePropsOptions: <Defaults extends {
|
|
|
83
99
|
};
|
|
84
100
|
};
|
|
85
101
|
export declare const YBadge: import('vue').DefineComponent<{
|
|
102
|
+
color: StringConstructor;
|
|
103
|
+
background: StringConstructor;
|
|
104
|
+
backgroundOpacity: {
|
|
105
|
+
type: NumberConstructor;
|
|
106
|
+
default: number;
|
|
107
|
+
};
|
|
86
108
|
tag: {
|
|
87
109
|
type: PropType<string>;
|
|
88
110
|
default: string;
|
|
@@ -92,7 +114,6 @@ export declare const YBadge: import('vue').DefineComponent<{
|
|
|
92
114
|
floating: BooleanConstructor;
|
|
93
115
|
inline: BooleanConstructor;
|
|
94
116
|
icon: PropType<IconValue>;
|
|
95
|
-
color: StringConstructor;
|
|
96
117
|
hide: BooleanConstructor;
|
|
97
118
|
label: {
|
|
98
119
|
type: StringConstructor;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
export declare const pressYChipPropsOptions: <Defaults extends {
|
|
3
|
+
small?: unknown;
|
|
3
4
|
color?: unknown;
|
|
4
5
|
background?: unknown;
|
|
5
6
|
backgroundOpacity?: unknown;
|
|
6
|
-
small?: unknown;
|
|
7
7
|
} = {}>(defaults?: Defaults | undefined) => {
|
|
8
|
+
small: unknown extends Defaults["small"] ? BooleanConstructor : {
|
|
9
|
+
type: import('vue').PropType<unknown extends Defaults["small"] ? boolean : boolean | Defaults["small"]>;
|
|
10
|
+
default: unknown extends Defaults["small"] ? boolean : boolean | Defaults["small"];
|
|
11
|
+
};
|
|
8
12
|
color: unknown extends Defaults["color"] ? StringConstructor : {
|
|
9
13
|
type: import('vue').PropType<unknown extends Defaults["color"] ? string : string | Defaults["color"]>;
|
|
10
14
|
default: unknown extends Defaults["color"] ? string : string | Defaults["color"];
|
|
@@ -23,18 +27,14 @@ export declare const pressYChipPropsOptions: <Defaults extends {
|
|
|
23
27
|
type: import('vue').PropType<unknown extends Defaults["backgroundOpacity"] ? number : number | Defaults["backgroundOpacity"]>;
|
|
24
28
|
default: unknown extends Defaults["backgroundOpacity"] ? number : number | Defaults["backgroundOpacity"];
|
|
25
29
|
};
|
|
26
|
-
small: unknown extends Defaults["small"] ? BooleanConstructor : {
|
|
27
|
-
type: import('vue').PropType<unknown extends Defaults["small"] ? boolean : boolean | Defaults["small"]>;
|
|
28
|
-
default: unknown extends Defaults["small"] ? boolean : boolean | Defaults["small"];
|
|
29
|
-
};
|
|
30
30
|
};
|
|
31
31
|
export declare const YChip: import('vue').DefineComponent<{
|
|
32
|
+
small: BooleanConstructor;
|
|
32
33
|
color: StringConstructor;
|
|
33
34
|
background: StringConstructor;
|
|
34
35
|
backgroundOpacity: {
|
|
35
36
|
type: NumberConstructor;
|
|
36
37
|
default: number;
|
|
37
38
|
};
|
|
38
|
-
small: BooleanConstructor;
|
|
39
39
|
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string>;
|
|
40
40
|
export type YChip = InstanceType<typeof YChip>;
|