yuyeon 0.0.17 → 0.0.19

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,194 @@
1
+ import { computed, getCurrentInstance, inject, onBeforeUnmount, onMounted, provide, reactive, toRef, watch } from 'vue';
2
+ import { wrapInArray } from "../util/array.mjs";
3
+ import { deepEqual } from "../util/common.mjs";
4
+ import { getUid, propsFactory } from "../util/vue-component.mjs";
5
+ import { useModelDuplex } from "./communication.mjs";
6
+ export const pressGroupPropsOptions = propsFactory({
7
+ modelValue: {
8
+ type: null,
9
+ default: undefined
10
+ },
11
+ multiple: Boolean,
12
+ mandatory: [Boolean, String],
13
+ max: Number,
14
+ selectedClass: String,
15
+ disabled: Boolean
16
+ }, 'group');
17
+ export const pressGroupItemPropsOptions = propsFactory({
18
+ value: null,
19
+ disabled: Boolean,
20
+ selectedClass: String
21
+ }, 'group-item');
22
+ export function useGroupItem(props, injectKey) {
23
+ let required = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
24
+ const vm = getCurrentInstance();
25
+ if (!vm) {
26
+ throw new Error('useGroupItem composable must be used inside a component setup function');
27
+ }
28
+ const id = getUid();
29
+ provide(Symbol.for(`${injectKey.description}:id`), id);
30
+ const group = inject(injectKey, null);
31
+ if (!group) {
32
+ if (!required) return group;
33
+ throw new Error(`[Vuetify] Could not find useGroup injection with symbol ${injectKey.description}`);
34
+ }
35
+ const value = toRef(props, 'value');
36
+ const disabled = computed(() => !!(group.disabled.value || props.disabled));
37
+ group.register({
38
+ id,
39
+ value,
40
+ disabled
41
+ }, vm);
42
+ onBeforeUnmount(() => {
43
+ group.unregister(id);
44
+ });
45
+ const isSelected = computed(() => {
46
+ return group.isSelected(id);
47
+ });
48
+ const selectedClass = computed(() => isSelected.value && [group.selectedClass.value, props.selectedClass]);
49
+ watch(isSelected, value => {
50
+ vm.emit('group:selected', {
51
+ value
52
+ });
53
+ });
54
+ return {
55
+ id,
56
+ isSelected,
57
+ toggle: () => group.select(id, !isSelected.value),
58
+ select: value => group.select(id, value),
59
+ selectedClass,
60
+ value,
61
+ disabled,
62
+ group
63
+ };
64
+ }
65
+ export function useGroup(props, injectKey) {
66
+ let isUnmounted = false;
67
+ const items = reactive([]);
68
+ const selected = useModelDuplex(props, 'modelValue', [], v => {
69
+ if (v == null) return [];
70
+ return getIds(items, wrapInArray(v));
71
+ }, v => {
72
+ const arr = getValues(items, v);
73
+ return props.multiple ? arr : arr[0];
74
+ });
75
+ const groupVm = getCurrentInstance();
76
+ function register(item, vm) {
77
+ // Is there a better way to fix this typing?
78
+ const unwrapped = item;
79
+ const key = Symbol.for(`${injectKey.description}:id`);
80
+ const children = findChildrenWithProvide(key, groupVm?.vnode);
81
+ const index = children.indexOf(vm);
82
+ if (index > -1) {
83
+ items.splice(index, 0, unwrapped);
84
+ } else {
85
+ items.push(unwrapped);
86
+ }
87
+ }
88
+ function unregister(id) {
89
+ if (isUnmounted) return;
90
+ forceMandatoryValue();
91
+ const index = items.findIndex(item => item.id === id);
92
+ items.splice(index, 1);
93
+ }
94
+ function forceMandatoryValue() {
95
+ const item = items.find(item => !item.disabled);
96
+ if (item && props.mandatory === 'force' && !selected.value.length) {
97
+ selected.value = [item.id];
98
+ }
99
+ }
100
+ onMounted(() => {
101
+ forceMandatoryValue();
102
+ });
103
+ onBeforeUnmount(() => {
104
+ isUnmounted = true;
105
+ });
106
+ function select(id, value) {
107
+ const item = items.find(item => item.id === id);
108
+ if (value && item?.disabled) return;
109
+ if (props.multiple) {
110
+ const internalValue = selected.value.slice();
111
+ const index = internalValue.findIndex(v => v === id);
112
+ const isSelected = ~index;
113
+ value = value ?? !isSelected;
114
+
115
+ // We can't remove value if group is
116
+ // mandatory, value already exists,
117
+ // and it is the only value
118
+ if (isSelected && props.mandatory && internalValue.length <= 1) return;
119
+
120
+ // We can't add value if it would
121
+ // cause max limit to be exceeded
122
+ if (!isSelected && props.max != null && internalValue.length + 1 > props.max) return;
123
+ if (index < 0 && value) internalValue.push(id);else if (index >= 0 && !value) internalValue.splice(index, 1);
124
+ selected.value = internalValue;
125
+ } else {
126
+ const isSelected = selected.value.includes(id);
127
+ if (props.mandatory && isSelected) return;
128
+ selected.value = value ?? !isSelected ? [id] : [];
129
+ }
130
+ }
131
+ function step(offset) {
132
+ if (props.multiple) {}
133
+ if (!selected.value.length) {
134
+ const item = items.find(item => !item.disabled);
135
+ item && (selected.value = [item.id]);
136
+ } else {
137
+ const currentId = selected.value[0];
138
+ const currentIndex = items.findIndex(i => i.id === currentId);
139
+ let newIndex = (currentIndex + offset) % items.length;
140
+ let newItem = items[newIndex];
141
+ while (newItem.disabled && newIndex !== currentIndex) {
142
+ newIndex = (newIndex + offset) % items.length;
143
+ newItem = items[newIndex];
144
+ }
145
+ if (newItem.disabled) return;
146
+ selected.value = [items[newIndex].id];
147
+ }
148
+ }
149
+ const state = {
150
+ register,
151
+ unregister,
152
+ selected,
153
+ select,
154
+ disabled: toRef(props, 'disabled'),
155
+ prev: () => step(items.length - 1),
156
+ next: () => step(1),
157
+ isSelected: id => selected.value.includes(id),
158
+ selectedClass: computed(() => props.selectedClass),
159
+ items: computed(() => items),
160
+ getItemIndex: value => getItemIndex(items, value)
161
+ };
162
+ provide(injectKey, state);
163
+ return state;
164
+ }
165
+ function getItemIndex(items, value) {
166
+ const ids = getIds(items, [value]);
167
+ if (!ids.length) return -1;
168
+ return items.findIndex(item => item.id === ids[0]);
169
+ }
170
+ function getIds(items, modelValue) {
171
+ const ids = [];
172
+ modelValue.forEach(value => {
173
+ const item = items.find(item => deepEqual(value, item.value));
174
+ const itemByIndex = items[value];
175
+ if (item?.value != null) {
176
+ ids.push(item.id);
177
+ } else if (itemByIndex != null) {
178
+ ids.push(itemByIndex.id);
179
+ }
180
+ });
181
+ return ids;
182
+ }
183
+ function getValues(items, ids) {
184
+ const values = [];
185
+ ids.forEach(id => {
186
+ const itemIndex = items.findIndex(item => item.id === id);
187
+ if (~itemIndex) {
188
+ const item = items[itemIndex];
189
+ values.push(item.value != null ? item.value : itemIndex);
190
+ }
191
+ });
192
+ return values;
193
+ }
194
+ //# sourceMappingURL=group.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.mjs","names":["computed","getCurrentInstance","inject","onBeforeUnmount","onMounted","provide","reactive","toRef","watch","wrapInArray","deepEqual","getUid","propsFactory","useModelDuplex","pressGroupPropsOptions","modelValue","type","default","undefined","multiple","Boolean","mandatory","String","max","Number","selectedClass","disabled","pressGroupItemPropsOptions","value","useGroupItem","props","injectKey","required","arguments","length","vm","Error","id","Symbol","for","description","group","register","unregister","isSelected","emit","toggle","select","useGroup","isUnmounted","items","selected","v","getIds","arr","getValues","groupVm","item","unwrapped","key","children","findChildrenWithProvide","vnode","index","indexOf","splice","push","forceMandatoryValue","findIndex","find","internalValue","slice","includes","step","offset","currentId","currentIndex","i","newIndex","newItem","state","prev","next","getItemIndex","ids","forEach","itemByIndex","values","itemIndex"],"sources":["../../src/composables/group.ts"],"sourcesContent":["import type {\n ComponentInternalInstance,\n ComputedRef,\n ExtractPropTypes,\n InjectionKey,\n PropType,\n Ref,\n UnwrapRef,\n} from 'vue';\nimport {\n computed,\n getCurrentInstance,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n reactive,\n toRef,\n watch,\n} from 'vue';\n\nimport { wrapInArray } from '../util/array';\nimport { deepEqual } from '../util/common';\nimport { getUid, propsFactory } from '../util/vue-component';\nimport { useModelDuplex } from './communication';\n\nexport interface GroupItem {\n id: number;\n value: Ref<unknown>;\n disabled: Ref<boolean | undefined>;\n}\n\nexport interface GroupProps {\n disabled: boolean;\n modelValue: unknown;\n multiple?: boolean;\n mandatory?: boolean | 'force' | undefined;\n max?: number | undefined;\n selectedClass: string | undefined;\n 'onUpdate:modelValue': ((value: unknown) => void) | undefined;\n}\n\nexport interface GroupProvide {\n register: (item: GroupItem, instance: ComponentInternalInstance) => void;\n unregister: (id: number) => void;\n select: (id: number, value: boolean) => void;\n selected: Ref<Readonly<number[]>>;\n selectedClass: Ref<string | undefined>;\n isSelected: (id: number) => boolean;\n disabled: Ref<boolean | undefined>;\n getItemIndex: (value: unknown) => number;\n prev: () => void;\n next: () => void;\n items: ComputedRef<\n { id: number; value: unknown; disabled: boolean | undefined }[]\n >;\n}\n\nexport interface GroupItemProvide {\n id: number;\n isSelected: Ref<boolean>;\n toggle: () => void;\n select: (value: boolean) => void;\n selectedClass: Ref<(string | undefined)[] | false>;\n value: Ref<unknown>;\n disabled: Ref<boolean | undefined>;\n group: GroupProvide;\n}\n\nexport const pressGroupPropsOptions = propsFactory(\n {\n modelValue: {\n type: null,\n default: undefined,\n },\n multiple: Boolean,\n mandatory: [Boolean, String] as PropType<boolean | 'force'>,\n max: Number,\n selectedClass: String,\n disabled: Boolean,\n },\n 'group',\n);\n\nexport const pressGroupItemPropsOptions = propsFactory(\n {\n value: null,\n disabled: Boolean,\n selectedClass: String,\n },\n 'group-item',\n);\n\nexport interface GroupItemProps\n extends ExtractPropTypes<ReturnType<typeof pressGroupItemPropsOptions>> {\n 'onGroup:selected': ((val: { value: boolean }) => void) | undefined;\n}\n\nexport function useGroupItem(\n props: GroupItemProps,\n injectKey: InjectionKey<GroupProvide>,\n required?: true,\n): GroupItemProvide;\nexport function useGroupItem(\n props: GroupItemProps,\n injectKey: InjectionKey<GroupProvide>,\n required: false,\n): GroupItemProvide | null;\nexport function useGroupItem(\n props: GroupItemProps,\n injectKey: InjectionKey<GroupProvide>,\n required = true,\n): GroupItemProvide | null {\n const vm = getCurrentInstance();\n\n if (!vm) {\n throw new Error(\n 'useGroupItem composable must be used inside a component setup function',\n );\n }\n\n const id = getUid();\n\n provide(Symbol.for(`${injectKey.description}:id`), id);\n\n const group = inject(injectKey, null);\n\n if (!group) {\n if (!required) return group;\n\n throw new Error(\n `[Vuetify] Could not find useGroup injection with symbol ${injectKey.description}`,\n );\n }\n\n const value = toRef(props, 'value');\n const disabled = computed(() => !!(group.disabled.value || props.disabled));\n\n group.register(\n {\n id,\n value,\n disabled,\n },\n vm,\n );\n\n onBeforeUnmount(() => {\n group.unregister(id);\n });\n\n const isSelected = computed(() => {\n return group.isSelected(id);\n });\n\n const selectedClass = computed(\n () => isSelected.value && [group.selectedClass.value, props.selectedClass],\n );\n\n watch(isSelected, (value) => {\n vm.emit('group:selected', { value });\n });\n\n return {\n id,\n isSelected,\n toggle: () => group.select(id, !isSelected.value),\n select: (value: boolean) => group.select(id, value),\n selectedClass,\n value,\n disabled,\n group,\n };\n}\n\nexport function useGroup(\n props: GroupProps,\n injectKey: InjectionKey<GroupProvide>,\n) {\n let isUnmounted = false;\n const items = reactive<GroupItem[]>([]);\n const selected = useModelDuplex(\n props,\n 'modelValue',\n [],\n (v) => {\n if (v == null) return [];\n\n return getIds(items, wrapInArray(v));\n },\n (v) => {\n const arr = getValues(items, v);\n\n return props.multiple ? arr : arr[0];\n },\n );\n\n const groupVm = getCurrentInstance();\n\n function register(item: GroupItem, vm: ComponentInternalInstance) {\n // Is there a better way to fix this typing?\n const unwrapped = item as unknown as UnwrapRef<GroupItem>;\n\n const key = Symbol.for(`${injectKey.description}:id`);\n const children = findChildrenWithProvide(key, groupVm?.vnode);\n const index = children.indexOf(vm);\n\n if (index > -1) {\n items.splice(index, 0, unwrapped);\n } else {\n items.push(unwrapped);\n }\n }\n\n function unregister(id: number) {\n if (isUnmounted) return;\n forceMandatoryValue();\n const index = items.findIndex((item) => item.id === id);\n items.splice(index, 1);\n }\n\n function forceMandatoryValue() {\n const item = items.find((item) => !item.disabled);\n if (item && props.mandatory === 'force' && !selected.value.length) {\n selected.value = [item.id];\n }\n }\n\n onMounted(() => {\n forceMandatoryValue();\n });\n\n onBeforeUnmount(() => {\n isUnmounted = true;\n });\n\n function select(id: number, value?: boolean) {\n const item = items.find((item) => item.id === id);\n if (value && item?.disabled) return;\n\n if (props.multiple) {\n const internalValue = selected.value.slice();\n const index = internalValue.findIndex((v) => v === id);\n const isSelected = ~index;\n value = value ?? !isSelected;\n\n // We can't remove value if group is\n // mandatory, value already exists,\n // and it is the only value\n if (isSelected && props.mandatory && internalValue.length <= 1) return;\n\n // We can't add value if it would\n // cause max limit to be exceeded\n if (\n !isSelected &&\n props.max != null &&\n internalValue.length + 1 > props.max\n )\n return;\n\n if (index < 0 && value) internalValue.push(id);\n else if (index >= 0 && !value) internalValue.splice(index, 1);\n\n selected.value = internalValue;\n } else {\n const isSelected = selected.value.includes(id);\n if (props.mandatory && isSelected) return;\n\n selected.value = value ?? !isSelected ? [id] : [];\n }\n }\n\n function step(offset: number) {\n if (props.multiple) {\n }\n\n if (!selected.value.length) {\n const item = items.find((item) => !item.disabled);\n item && (selected.value = [item.id]);\n } else {\n const currentId = selected.value[0];\n const currentIndex = items.findIndex((i) => i.id === currentId);\n\n let newIndex = (currentIndex + offset) % items.length;\n let newItem = items[newIndex];\n\n while (newItem.disabled && newIndex !== currentIndex) {\n newIndex = (newIndex + offset) % items.length;\n newItem = items[newIndex];\n }\n\n if (newItem.disabled) return;\n\n selected.value = [items[newIndex].id];\n }\n }\n\n const state: GroupProvide = {\n register,\n unregister,\n selected,\n select,\n disabled: toRef(props, 'disabled'),\n prev: () => step(items.length - 1),\n next: () => step(1),\n isSelected: (id: number) => selected.value.includes(id),\n selectedClass: computed(() => props.selectedClass),\n items: computed(() => items),\n getItemIndex: (value: unknown) => getItemIndex(items, value),\n };\n\n provide(injectKey, state);\n\n return state;\n}\n\nfunction getItemIndex(items: UnwrapRef<GroupItem[]>, value: unknown) {\n const ids = getIds(items, [value]);\n\n if (!ids.length) return -1;\n\n return items.findIndex((item) => item.id === ids[0]);\n}\n\nfunction getIds(items: UnwrapRef<GroupItem[]>, modelValue: any[]) {\n const ids: number[] = [];\n\n modelValue.forEach((value) => {\n const item = items.find((item) => deepEqual(value, item.value));\n const itemByIndex = items[value];\n\n if (item?.value != null) {\n ids.push(item.id);\n } else if (itemByIndex != null) {\n ids.push(itemByIndex.id);\n }\n });\n\n return ids;\n}\n\nfunction getValues(items: UnwrapRef<GroupItem[]>, ids: any[]) {\n const values: unknown[] = [];\n\n ids.forEach((id) => {\n const itemIndex = items.findIndex((item) => item.id === id);\n if (~itemIndex) {\n const item = items[itemIndex];\n values.push(item.value != null ? item.value : itemIndex);\n }\n });\n\n return values;\n}\n"],"mappings":"AASA,SACEA,QAAQ,EACRC,kBAAkB,EAClBC,MAAM,EACNC,eAAe,EACfC,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,KAAK,EACLC,KAAK,QACA,KAAK;AAAC,SAEJC,WAAW;AAAA,SACXC,SAAS;AAAA,SACTC,MAAM,EAAEC,YAAY;AAAA,SACpBC,cAAc;AA6CvB,OAAO,MAAMC,sBAAsB,GAAGF,YAAY,CAChD;EACEG,UAAU,EAAE;IACVC,IAAI,EAAE,IAAI;IACVC,OAAO,EAAEC;EACX,CAAC;EACDC,QAAQ,EAAEC,OAAO;EACjBC,SAAS,EAAE,CAACD,OAAO,EAAEE,MAAM,CAAgC;EAC3DC,GAAG,EAAEC,MAAM;EACXC,aAAa,EAAEH,MAAM;EACrBI,QAAQ,EAAEN;AACZ,CAAC,EACD,OACF,CAAC;AAED,OAAO,MAAMO,0BAA0B,GAAGf,YAAY,CACpD;EACEgB,KAAK,EAAE,IAAI;EACXF,QAAQ,EAAEN,OAAO;EACjBK,aAAa,EAAEH;AACjB,CAAC,EACD,YACF,CAAC;AAiBD,OAAO,SAASO,YAAYA,CAC1BC,KAAqB,EACrBC,SAAqC,EAEZ;EAAA,IADzBC,QAAQ,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAf,SAAA,GAAAe,SAAA,MAAG,IAAI;EAEf,MAAME,EAAE,GAAGlC,kBAAkB,CAAC,CAAC;EAE/B,IAAI,CAACkC,EAAE,EAAE;IACP,MAAM,IAAIC,KAAK,CACb,wEACF,CAAC;EACH;EAEA,MAAMC,EAAE,GAAG1B,MAAM,CAAC,CAAC;EAEnBN,OAAO,CAACiC,MAAM,CAACC,GAAG,CAAE,GAAER,SAAS,CAACS,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KAAK,IAAI,IAAI,GAAG6B,IAAI,CAAC7B,KAAK,GAAG4D,SAAS,CAAC;IAC1D;EACF,CAAC,CAAC;EAEF,OAAOD,MAAM;AACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuyeon",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "keywords": [
5
5
  "UI Library",
6
6
  "Vue"
@@ -13,15 +13,20 @@
13
13
  "author": "yeonyew",
14
14
  "license": "Apache-2.0",
15
15
  "files": [
16
- "dist",
17
- "lib",
18
- "types"
16
+ "dist/",
17
+ "lib/",
18
+ "types/"
19
19
  ],
20
+ "type": "module",
20
21
  "exports": {
21
22
  ".": {
23
+ "types": "./types/index.d.ts",
22
24
  "default": "./lib/index.mjs"
23
25
  },
24
26
  "./styles/*": "./lib/styles/*",
27
+ "./lib": {
28
+ "types": "./types/index.d.ts"
29
+ },
25
30
  "./components": {
26
31
  "types": "./types/components/index.d.ts",
27
32
  "module": "./lib/components/index.mjs"
@@ -32,7 +37,7 @@
32
37
  },
33
38
  "main": "lib/index.mjs",
34
39
  "module": "lib/index.mjs",
35
- "types": "types",
40
+ "types": "types/index.d.ts",
36
41
  "typesVersions": {
37
42
  "*": {
38
43
  "lib/index.mjs": [
@@ -1,4 +1,4 @@
1
- import type { ExtractPropTypes, PropType } from 'vue';
1
+ import type { PropType } from 'vue';
2
2
  /**
3
3
  * Style
4
4
  */
@@ -146,7 +146,7 @@ export declare const YButton: import("vue").DefineComponent<{
146
146
  [x: string]: string | boolean | undefined;
147
147
  };
148
148
  onClick(e: MouseEvent): void;
149
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
149
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
150
150
  loading: BooleanConstructor;
151
151
  disabled: {
152
152
  type: BooleanConstructor;
@@ -77,8 +77,8 @@ export declare const YMenuPropOptions: {
77
77
  type: PropType<boolean>;
78
78
  default: boolean;
79
79
  };
80
- closeOnClick: {
81
- type: BooleanConstructor;
80
+ closeCondition: {
81
+ type: (BooleanConstructor | FunctionConstructor)[];
82
82
  };
83
83
  preventClip: {
84
84
  type: PropType<boolean>;
@@ -166,8 +166,8 @@ export declare const YMenu: import("vue").DefineComponent<{
166
166
  type: PropType<boolean>;
167
167
  default: boolean;
168
168
  };
169
- closeOnClick: {
170
- type: BooleanConstructor;
169
+ closeCondition: {
170
+ type: (BooleanConstructor | FunctionConstructor)[];
171
171
  };
172
172
  preventClip: {
173
173
  type: PropType<boolean>;
@@ -1981,8 +1981,8 @@ export declare const YMenu: import("vue").DefineComponent<{
1981
1981
  type: PropType<boolean>;
1982
1982
  default: boolean;
1983
1983
  };
1984
- closeOnClick: {
1985
- type: BooleanConstructor;
1984
+ closeCondition: {
1985
+ type: (BooleanConstructor | FunctionConstructor)[];
1986
1986
  };
1987
1987
  preventClip: {
1988
1988
  type: PropType<boolean>;
@@ -2005,6 +2005,5 @@ export declare const YMenu: import("vue").DefineComponent<{
2005
2005
  openOnHover: boolean;
2006
2006
  preventClip: boolean;
2007
2007
  openOnClickBase: boolean;
2008
- closeOnClick: boolean;
2009
2008
  }, {}>;
2010
2009
  export type YMenu = InstanceType<typeof YMenu>;