yuyeon 0.0.41 → 0.0.42-rc10
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 +5157 -3010
- package/dist/yuyeon.umd.cjs +8 -4
- package/lib/components/button/YButton.scss +2 -1
- package/lib/components/date-picker/YDateCalendar.mjs +235 -5
- package/lib/components/date-picker/YDateCalendar.mjs.map +1 -1
- package/lib/components/date-picker/YDateCalendar.scss +82 -0
- package/lib/components/date-picker/YDatePicker.mjs.map +1 -1
- package/lib/components/date-picker/YDatePickerControl.mjs +29 -0
- package/lib/components/date-picker/YDatePickerControl.mjs.map +1 -0
- package/lib/components/date-picker/YDatePickerControl.scss +3 -0
- package/lib/components/date-picker/index.mjs +1 -1
- package/lib/components/date-picker/index.mjs.map +1 -1
- package/lib/components/divider/YDivider.mjs +4 -2
- package/lib/components/divider/YDivider.mjs.map +1 -1
- package/lib/components/dropdown/YDropdown.mjs +11 -5
- package/lib/components/dropdown/YDropdown.mjs.map +1 -1
- package/lib/components/dropdown/YDropdown.scss +3 -8
- package/lib/components/field-input/YFieldInput.mjs +10 -10
- package/lib/components/field-input/YFieldInput.mjs.map +1 -1
- package/lib/components/icon/YIcon.mjs +62 -0
- package/lib/components/icon/YIcon.mjs.map +1 -0
- package/lib/components/icon/YIcon.scss +18 -0
- package/lib/components/icon/index.mjs +2 -0
- package/lib/components/icon/index.mjs.map +1 -0
- package/lib/components/icon/poly.mjs +57 -0
- package/lib/components/icon/poly.mjs.map +1 -0
- package/lib/components/icons/index.mjs +14 -0
- package/lib/components/icons/index.mjs.map +1 -1
- package/lib/components/index.mjs +3 -0
- package/lib/components/index.mjs.map +1 -1
- package/lib/components/input/YInput.mjs +1 -0
- package/lib/components/input/YInput.mjs.map +1 -1
- package/lib/components/input/index.mjs.map +1 -1
- package/lib/components/layer/YLayer.mjs +2 -0
- package/lib/components/layer/YLayer.mjs.map +1 -1
- package/lib/components/layer/active-stack.mjs.map +1 -1
- package/lib/components/list/YList.mjs.map +1 -1
- package/lib/components/menu/YMenu.mjs +14 -2
- package/lib/components/menu/YMenu.mjs.map +1 -1
- package/lib/components/select/YSelect.mjs +9 -6
- package/lib/components/select/YSelect.mjs.map +1 -1
- package/lib/components/select/YSelect.scss +3 -8
- package/lib/components/switch/YSwitch.mjs +2 -0
- package/lib/components/switch/YSwitch.mjs.map +1 -1
- package/lib/components/tab/types.mjs.map +1 -1
- package/lib/components/table/composibles/pagination.mjs.map +1 -1
- package/lib/components/textarea/YTextarea.mjs +159 -0
- package/lib/components/textarea/YTextarea.mjs.map +1 -0
- package/lib/components/textarea/YTextarea.scss +25 -0
- package/lib/components/textarea/index.mjs +2 -0
- package/lib/components/textarea/index.mjs.map +1 -0
- package/lib/components/tooltip/YTooltip.mjs +2 -2
- package/lib/components/tooltip/YTooltip.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/components/tree-view/YTreeViewNode.mjs +1 -0
- package/lib/components/tree-view/YTreeViewNode.mjs.map +1 -1
- package/lib/composables/communication.mjs +9 -0
- package/lib/composables/communication.mjs.map +1 -1
- package/lib/composables/date/factory.mjs +12 -0
- package/lib/composables/date/factory.mjs.map +1 -0
- package/lib/composables/date/index.mjs +19 -1
- package/lib/composables/date/index.mjs.map +1 -1
- package/lib/composables/date/setting.mjs +11 -0
- package/lib/composables/date/setting.mjs.map +1 -0
- package/lib/composables/date/types.mjs +1 -1
- package/lib/composables/date/types.mjs.map +1 -1
- package/lib/composables/i18n/index.mjs +30 -0
- package/lib/composables/i18n/index.mjs.map +1 -0
- package/lib/composables/i18n/locale.mjs +5 -0
- package/lib/composables/i18n/locale.mjs.map +1 -0
- package/lib/composables/i18n/rtl.mjs +34 -0
- package/lib/composables/i18n/rtl.mjs.map +1 -0
- package/lib/composables/i18n/share.mjs +2 -0
- package/lib/composables/i18n/share.mjs.map +1 -0
- package/lib/composables/icon.mjs +141 -0
- package/lib/composables/icon.mjs.map +1 -1
- package/lib/composables/index.mjs +1 -0
- package/lib/composables/index.mjs.map +1 -1
- package/lib/composables/theme/index.mjs.map +1 -1
- package/lib/composables/transition.mjs.map +1 -1
- package/lib/i18n/built-in.mjs +77 -0
- package/lib/i18n/built-in.mjs.map +1 -0
- package/lib/i18n/config.mjs +82 -0
- package/lib/i18n/config.mjs.map +1 -0
- package/lib/i18n/types.mjs +2 -0
- package/lib/i18n/types.mjs.map +1 -0
- package/lib/index.mjs +24 -5
- package/lib/index.mjs.map +1 -1
- package/lib/locales/en.mjs +4 -0
- package/lib/locales/en.mjs.map +1 -0
- package/lib/locales/index.mjs +3 -0
- package/lib/locales/index.mjs.map +1 -0
- package/lib/locales/ko.mjs +4 -0
- package/lib/locales/ko.mjs.map +1 -0
- package/lib/styles/util/_mixin.scss +34 -0
- package/lib/types/index.mjs.map +1 -1
- package/lib/util/date/adapters/yuyeon-date-adapter.mjs +99 -0
- package/lib/util/date/adapters/yuyeon-date-adapter.mjs.map +1 -0
- package/lib/util/date/built-in.mjs +18 -104
- package/lib/util/date/built-in.mjs.map +1 -1
- package/lib/util/date/index.mjs +1 -0
- package/lib/util/date/index.mjs.map +1 -1
- package/lib/util/date/types.mjs.map +1 -1
- package/lib/util/index.mjs +1 -0
- package/lib/util/index.mjs.map +1 -1
- package/package.json +7 -5
- package/types/abstract/items.d.ts +4 -4
- package/types/components/button/YButton.d.ts +10 -10
- package/types/components/checkbox/YInputCheckbox.d.ts +2 -2
- package/types/components/date-picker/YDateCalendar.d.ts +136 -0
- package/types/components/date-picker/index.d.ts +1 -0
- package/types/components/dialog/YDialog.d.ts +3 -2
- package/types/components/dropdown/YDropdown.d.ts +34 -13
- package/types/components/field-input/YFieldInput.d.ts +10 -10
- package/types/components/form/YForm.d.ts +1 -1
- package/types/components/icon/YIcon.d.ts +81 -0
- package/types/components/icon/index.d.ts +1 -0
- package/types/components/icons/YIconCheckbox.d.ts +2 -2
- package/types/components/icons/YIconSort.d.ts +2 -2
- package/types/components/icons/index.d.ts +48 -0
- package/types/components/index.d.ts +3 -0
- package/types/components/input/YInput.d.ts +28 -11
- package/types/components/layer/YLayer.d.ts +23 -22
- package/types/components/layer/active-stack.d.ts +1 -2
- package/types/components/list/YList.d.ts +3 -3
- package/types/components/list/YListItem.d.ts +5 -5
- package/types/components/menu/YMenu.d.ts +13 -8
- package/types/components/pagination/YPagination.d.ts +5 -5
- package/types/components/progress-bar/YProgressBar.d.ts +1 -1
- package/types/components/select/YSelect.d.ts +80 -64
- package/types/components/switch/YSwitch.d.ts +1 -1
- package/types/components/tab/YTab.d.ts +15 -15
- package/types/components/tab/YTabs.d.ts +5 -5
- package/types/components/tab/types.d.ts +1 -0
- package/types/components/table/YDataTable.d.ts +18 -18
- package/types/components/table/YDataTableBody.d.ts +5 -5
- package/types/components/table/YDataTableControl.d.ts +2 -2
- package/types/components/table/YDataTableHead.d.ts +2 -2
- package/types/components/table/YDataTableServer.d.ts +21 -21
- package/types/components/table/YTable.d.ts +4 -4
- package/types/components/table/composibles/header.d.ts +1 -1
- package/types/components/table/composibles/items.d.ts +3 -3
- package/types/components/table/composibles/pagination.d.ts +2 -2
- package/types/components/table/composibles/selection.d.ts +2 -2
- package/types/components/table/composibles/sorting.d.ts +1 -1
- package/types/components/textarea/YTextarea.d.ts +737 -0
- package/types/components/textarea/index.d.ts +1 -0
- package/types/components/tooltip/YTooltip.d.ts +13 -12
- package/types/components/tree-view/YTreeView.d.ts +7 -4
- package/types/components/tree-view/YTreeViewNode.d.ts +17 -9
- package/types/composables/choice.d.ts +1 -1
- package/types/composables/communication.d.ts +2 -0
- package/types/composables/coordinate/index.d.ts +6 -6
- package/types/composables/date/factory.d.ts +2 -0
- package/types/composables/date/index.d.ts +11 -0
- package/types/composables/date/setting.d.ts +4 -0
- package/types/composables/date/types.d.ts +12 -0
- package/types/composables/i18n/index.d.ts +8 -0
- package/types/composables/i18n/locale.d.ts +2 -0
- package/types/composables/i18n/rtl.d.ts +20 -0
- package/types/composables/i18n/share.d.ts +1 -0
- package/types/composables/icon.d.ts +96 -0
- package/types/composables/index.d.ts +2 -0
- package/types/composables/list-items.d.ts +10 -10
- package/types/composables/theme/index.d.ts +5 -5
- package/types/globals.d.ts +12 -7
- package/types/i18n/built-in.d.ts +2 -0
- package/types/i18n/config.d.ts +81 -0
- package/types/i18n/types.d.ts +19 -0
- package/types/locales/en.d.ts +4 -0
- package/types/shims.d.ts +88 -83
- package/types/types/index.d.ts +5 -0
- package/types/util/date/adapters/yuyeon-date-adapter.d.ts +38 -0
- package/types/util/date/built-in.d.ts +35 -0
- package/types/util/date/index.d.ts +3 -0
- package/types/util/date/types.d.ts +163 -0
- package/types/util/index.d.ts +1 -0
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import { inject } from '@vue/runtime-core';
|
|
2
|
+
import { useI18n } from "../i18n/index.mjs";
|
|
3
|
+
import { constructAdapter } from "./factory.mjs";
|
|
4
|
+
import { configureOptions } from "./setting.mjs";
|
|
5
|
+
export const YUYEON_DATE_KEY = Symbol.for('yuyeon.date');
|
|
6
|
+
export const YUYEON_DATE_OPTIONS_KEY = Symbol.for('yuyeon.date-options');
|
|
7
|
+
export function createDateModule(options, locale) {
|
|
8
|
+
const _options = configureOptions(options);
|
|
9
|
+
return {
|
|
10
|
+
options: _options,
|
|
11
|
+
instance: constructAdapter(_options, locale)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function useDate() {
|
|
15
|
+
const options = inject(YUYEON_DATE_OPTIONS_KEY);
|
|
16
|
+
if (!options) throw new Error('Not found provided "DateModule" for options');
|
|
17
|
+
const i18n = useI18n();
|
|
18
|
+
return constructAdapter(options, i18n);
|
|
19
|
+
}
|
|
2
20
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["createDateModule","options"],"sources":["../../../src/composables/date/index.ts"],"sourcesContent":["\r\n\r\nexport function createDateModule(options: DateOptions) {\r\n\r\n}\r\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["inject","useI18n","constructAdapter","configureOptions","YUYEON_DATE_KEY","Symbol","for","YUYEON_DATE_OPTIONS_KEY","createDateModule","options","locale","_options","instance","useDate","Error","i18n"],"sources":["../../../src/composables/date/index.ts"],"sourcesContent":["import { inject } from '@vue/runtime-core';\r\n\r\nimport { LocaleModule } from '../../i18n/types';\r\nimport { useI18n } from '../i18n';\r\nimport { constructAdapter } from './factory';\r\nimport { configureOptions } from './setting';\r\nimport {DateInstance, DateOptions} from './types';\r\n\r\nexport const YUYEON_DATE_KEY = Symbol.for('yuyeon.date');\r\nexport const YUYEON_DATE_OPTIONS_KEY = Symbol.for('yuyeon.date-options');\r\n\r\nexport function createDateModule(options: DateOptions, locale: LocaleModule) {\r\n const _options = configureOptions(options);\r\n return {\r\n options: _options,\r\n instance: constructAdapter(_options, locale),\r\n };\r\n}\r\n\r\nexport function useDate(): DateInstance {\r\n const options = inject<any>(YUYEON_DATE_OPTIONS_KEY);\r\n if (!options) throw new Error('Not found provided \"DateModule\" for options');\r\n\r\n const i18n = useI18n();\r\n\r\n return constructAdapter(options, i18n);\r\n}\r\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAAC,SAGlCC,OAAO;AAAA,SACPC,gBAAgB;AAAA,SAChBC,gBAAgB;AAGzB,OAAO,MAAMC,eAAe,GAAGC,MAAM,CAACC,GAAG,CAAC,aAAa,CAAC;AACxD,OAAO,MAAMC,uBAAuB,GAAGF,MAAM,CAACC,GAAG,CAAC,qBAAqB,CAAC;AAExE,OAAO,SAASE,gBAAgBA,CAACC,OAAoB,EAAEC,MAAoB,EAAE;EAC3E,MAAMC,QAAQ,GAAGR,gBAAgB,CAACM,OAAO,CAAC;EAC1C,OAAO;IACLA,OAAO,EAAEE,QAAQ;IACjBC,QAAQ,EAAEV,gBAAgB,CAACS,QAAQ,EAAED,MAAM;EAC7C,CAAC;AACH;AAEA,OAAO,SAASG,OAAOA,CAAA,EAAiB;EACtC,MAAMJ,OAAO,GAAGT,MAAM,CAAMO,uBAAuB,CAAC;EACpD,IAAI,CAACE,OAAO,EAAE,MAAM,IAAIK,KAAK,CAAC,6CAA6C,CAAC;EAE5E,MAAMC,IAAI,GAAGd,OAAO,CAAC,CAAC;EAEtB,OAAOC,gBAAgB,CAACO,OAAO,EAAEM,IAAI,CAAC;AACxC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { localeCodesMap } from "../../i18n/config.mjs";
|
|
2
|
+
import { mergeDeep } from "../../util/common.mjs";
|
|
3
|
+
import { YuyeonDateAdapter } from "../../util/date/index.mjs";
|
|
4
|
+
export function configureOptions(options) {
|
|
5
|
+
const _options = mergeDeep({
|
|
6
|
+
adapter: YuyeonDateAdapter,
|
|
7
|
+
locale: localeCodesMap
|
|
8
|
+
}, options);
|
|
9
|
+
return _options;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=setting.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting.mjs","names":["localeCodesMap","mergeDeep","YuyeonDateAdapter","configureOptions","options","_options","adapter","locale"],"sources":["../../../src/composables/date/setting.ts"],"sourcesContent":["import { localeCodesMap } from '../../i18n/config';\r\nimport { mergeDeep } from '../../util/common';\r\nimport { YuyeonDateAdapter } from '../../util/date';\r\nimport type { DateOptions } from './types';\r\n\r\nexport function configureOptions(options?: DateOptions) {\r\n const _options = mergeDeep(\r\n {\r\n adapter: YuyeonDateAdapter,\r\n locale: localeCodesMap,\r\n },\r\n options,\r\n );\r\n\r\n return _options;\r\n}\r\n"],"mappings":"SAASA,cAAc;AAAA,SACdC,SAAS;AAAA,SACTC,iBAAiB;AAG1B,OAAO,SAASC,gBAAgBA,CAACC,OAAqB,EAAE;EACtD,MAAMC,QAAQ,GAAGJ,SAAS,CACxB;IACEK,OAAO,EAAEJ,iBAAiB;IAC1BK,MAAM,EAAEP;EACV,CAAC,EACDI,OACF,CAAC;EAED,OAAOC,QAAQ;AACjB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=types.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":[],"sources":["../../../src/composables/date/types.ts"],"sourcesContent":["interface DateOptions {\r\n
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../../../src/composables/date/types.ts"],"sourcesContent":["import type { DateAdapter } from '../../util/date/types';\r\n\r\nexport interface DateOptions {\r\n adapter: any;\r\n locale: Record<string, any>;\r\n formats?: Record<string, any>;\r\n}\r\n\r\nexport interface DateInstanceType {\r\n instanceType: unknown;\r\n}\r\n\r\nexport interface DateInstance<T = DateInstanceType['instanceType']>\r\n extends DateAdapter<T> {\r\n locale?: any;\r\n}\r\n"],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { inject, provide } from 'vue';
|
|
2
|
+
import { createLocaleModule } from "./locale.mjs";
|
|
3
|
+
import { createRtlModule, createRtlProvideValue } from "./rtl.mjs";
|
|
4
|
+
import { YUYEON_I18N_KEY } from "./share.mjs";
|
|
5
|
+
export function createI18nModule(options) {
|
|
6
|
+
const localeModule = createLocaleModule(options);
|
|
7
|
+
const rtlModule = createRtlModule(localeModule, options);
|
|
8
|
+
return {
|
|
9
|
+
localeModule,
|
|
10
|
+
rtlModule
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function useI18n() {
|
|
14
|
+
const i18n = inject(YUYEON_I18N_KEY);
|
|
15
|
+
if (!i18n) throw new Error('Not found provided "I18nModule"');
|
|
16
|
+
return i18n;
|
|
17
|
+
}
|
|
18
|
+
export function provideI18n(props) {
|
|
19
|
+
const i18n = inject(YUYEON_I18N_KEY);
|
|
20
|
+
if (!i18n) throw new Error('Not found provided "I18nModule"');
|
|
21
|
+
const locale = i18n.getContext(props);
|
|
22
|
+
const rtl = createRtlProvideValue(locale, i18n.rtl, props);
|
|
23
|
+
const state = {
|
|
24
|
+
...locale,
|
|
25
|
+
...rtl
|
|
26
|
+
};
|
|
27
|
+
provide(YUYEON_I18N_KEY, state);
|
|
28
|
+
return state;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["inject","provide","createLocaleModule","createRtlModule","createRtlProvideValue","YUYEON_I18N_KEY","createI18nModule","options","localeModule","rtlModule","useI18n","i18n","Error","provideI18n","props","locale","getContext","rtl","state"],"sources":["../../../src/composables/i18n/index.ts"],"sourcesContent":["import {inject, provide} from 'vue';\r\n\r\nimport { LocaleModule, LocaleOptions } from '../../i18n/types';\r\nimport { createLocaleModule } from './locale';\r\nimport {\r\n RtlModule,\r\n RtlOptions,\r\n RtlProps,\r\n createRtlModule,\r\n createRtlProvideValue,\r\n} from './rtl';\r\nimport { YUYEON_I18N_KEY } from './share';\r\n\r\nexport function createI18nModule(options?: LocaleOptions & RtlOptions) {\r\n const localeModule = createLocaleModule(options);\r\n const rtlModule = createRtlModule(localeModule, options);\r\n\r\n return {\r\n localeModule,\r\n rtlModule,\r\n };\r\n}\r\n\r\nexport function useI18n(): LocaleModule & RtlModule {\r\n const i18n = inject<any>(YUYEON_I18N_KEY);\r\n if (!i18n) throw new Error('Not found provided \"I18nModule\"');\r\n\r\n return i18n;\r\n}\r\n\r\nexport function provideI18n(props: LocaleOptions & RtlProps) {\r\n const i18n = inject<any>(YUYEON_I18N_KEY);\r\n if (!i18n) throw new Error('Not found provided \"I18nModule\"');\r\n\r\n const locale = i18n.getContext(props);\r\n const rtl = createRtlProvideValue(locale, i18n.rtl, props);\r\n\r\n const state = {\r\n ...locale,\r\n ...rtl,\r\n };\r\n provide(YUYEON_I18N_KEY, state);\r\n\r\n return state;\r\n}\r\n"],"mappings":"AAAA,SAAQA,MAAM,EAAEC,OAAO,QAAO,KAAK;AAAC,SAG3BC,kBAAkB;AAAA,SAKzBC,eAAe,EACfC,qBAAqB;AAAA,SAEdC,eAAe;AAExB,OAAO,SAASC,gBAAgBA,CAACC,OAAoC,EAAE;EACrE,MAAMC,YAAY,GAAGN,kBAAkB,CAACK,OAAO,CAAC;EAChD,MAAME,SAAS,GAAGN,eAAe,CAACK,YAAY,EAAED,OAAO,CAAC;EAExD,OAAO;IACLC,YAAY;IACZC;EACF,CAAC;AACH;AAEA,OAAO,SAASC,OAAOA,CAAA,EAA6B;EAClD,MAAMC,IAAI,GAAGX,MAAM,CAAMK,eAAe,CAAC;EACzC,IAAI,CAACM,IAAI,EAAE,MAAM,IAAIC,KAAK,CAAC,iCAAiC,CAAC;EAE7D,OAAOD,IAAI;AACb;AAEA,OAAO,SAASE,WAAWA,CAACC,KAA+B,EAAE;EAC3D,MAAMH,IAAI,GAAGX,MAAM,CAAMK,eAAe,CAAC;EACzC,IAAI,CAACM,IAAI,EAAE,MAAM,IAAIC,KAAK,CAAC,iCAAiC,CAAC;EAE7D,MAAMG,MAAM,GAAGJ,IAAI,CAACK,UAAU,CAACF,KAAK,CAAC;EACrC,MAAMG,GAAG,GAAGb,qBAAqB,CAACW,MAAM,EAAEJ,IAAI,CAACM,GAAG,EAAEH,KAAK,CAAC;EAE1D,MAAMI,KAAK,GAAG;IACZ,GAAGH,MAAM;IACT,GAAGE;EACL,CAAC;EACDhB,OAAO,CAACI,eAAe,EAAEa,KAAK,CAAC;EAE/B,OAAOA,KAAK;AACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale.mjs","names":["constructYuyeonI18nAdapter","createLocaleModule","options","adapter","name"],"sources":["../../../src/composables/i18n/locale.ts"],"sourcesContent":["import { constructYuyeonI18nAdapter } from '../../i18n/built-in';\r\nimport { LocaleOptions } from '../../i18n/types';\r\n\r\nexport function createLocaleModule(options?: LocaleOptions) {\r\n return options?.adapter && options.adapter?.name\r\n ? options.adapter\r\n : constructYuyeonI18nAdapter(options);\r\n}\r\n"],"mappings":"SAASA,0BAA0B;AAGnC,OAAO,SAASC,kBAAkBA,CAACC,OAAuB,EAAE;EAC1D,OAAOA,OAAO,EAAEC,OAAO,IAAID,OAAO,CAACC,OAAO,EAAEC,IAAI,GAC5CF,OAAO,CAACC,OAAO,GACfH,0BAA0B,CAACE,OAAO,CAAC;AACzC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { computed, inject, ref } from 'vue';
|
|
2
|
+
import { defaultRtl } from "../../i18n/config.mjs";
|
|
3
|
+
import { YUYEON_I18N_KEY } from "./share.mjs";
|
|
4
|
+
export const YUYEON_RTL_KEY = Symbol.for('yuyeon.rtl');
|
|
5
|
+
export function createRtlModule(localeModule, options) {
|
|
6
|
+
const rtlOptions = ref(options?.rtlOptions ?? defaultRtl);
|
|
7
|
+
const rtl = computed(() => {
|
|
8
|
+
return rtlOptions.value[localeModule.locale.value] ?? false;
|
|
9
|
+
});
|
|
10
|
+
const rtlClasses = computed(() => `y-i18n--${rtl.value ? 'rtl' : 'ltr'}`);
|
|
11
|
+
return {
|
|
12
|
+
rtlOptions,
|
|
13
|
+
rtl,
|
|
14
|
+
rtlClasses
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function createRtlProvideValue(localeModule, rtlOptions, props) {
|
|
18
|
+
const rtl = computed(() => props.rtl ?? rtlOptions.value[localeModule.locale.value] ?? false);
|
|
19
|
+
const rtlClasses = computed(() => `y-i18n--${rtl.value ? 'rtl' : 'ltr'}`);
|
|
20
|
+
return {
|
|
21
|
+
rtl,
|
|
22
|
+
rtlOptions,
|
|
23
|
+
rtlClasses
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function useRtl() {
|
|
27
|
+
const i18n = inject(YUYEON_I18N_KEY);
|
|
28
|
+
if (!i18n) throw new Error('Not found provided "I18nModule" for rtl');
|
|
29
|
+
return {
|
|
30
|
+
rtl: i18n.rtl,
|
|
31
|
+
rtlClasses: i18n.rtlClasses
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=rtl.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rtl.mjs","names":["computed","inject","ref","defaultRtl","YUYEON_I18N_KEY","YUYEON_RTL_KEY","Symbol","for","createRtlModule","localeModule","options","rtlOptions","rtl","value","locale","rtlClasses","createRtlProvideValue","props","useRtl","i18n","Error"],"sources":["../../../src/composables/i18n/rtl.ts"],"sourcesContent":["import { computed, inject, ref } from 'vue';\r\nimport type { Ref } from 'vue';\r\n\r\nimport { defaultRtl } from '../../i18n/config';\r\nimport { LocaleModule } from '../../i18n/types';\r\nimport { YUYEON_I18N_KEY } from './share';\r\n\r\nexport const YUYEON_RTL_KEY = Symbol.for('yuyeon.rtl');\r\n\r\nexport interface RtlOptions {\r\n rtlOptions: Record<string, boolean>;\r\n}\r\n\r\nexport interface RtlProps {\r\n rtl?: boolean;\r\n}\r\n\r\nexport interface RtlModule {\r\n rtl: Ref<boolean>;\r\n rtlOptions: Ref<Record<string, boolean>>;\r\n rtlClasses: Ref<string>;\r\n}\r\n\r\nexport function createRtlModule(\r\n localeModule: LocaleModule,\r\n options?: RtlOptions,\r\n): RtlModule {\r\n const rtlOptions = ref<Record<string, boolean>>(\r\n options?.rtlOptions ?? defaultRtl,\r\n );\r\n const rtl = computed(() => {\r\n return rtlOptions.value[localeModule.locale.value] ?? false;\r\n });\r\n const rtlClasses = computed(() => `y-i18n--${rtl.value ? 'rtl' : 'ltr'}`);\r\n\r\n return {\r\n rtlOptions,\r\n rtl,\r\n rtlClasses,\r\n };\r\n}\r\n\r\nexport function createRtlProvideValue(\r\n localeModule: LocaleModule,\r\n rtlOptions: RtlModule['rtlOptions'],\r\n props: RtlProps,\r\n): RtlModule {\r\n const rtl = computed(\r\n () => props.rtl ?? rtlOptions.value[localeModule.locale.value] ?? false,\r\n );\r\n const rtlClasses = computed(() => `y-i18n--${rtl.value ? 'rtl' : 'ltr'}`);\r\n\r\n return {\r\n rtl,\r\n rtlOptions,\r\n rtlClasses,\r\n };\r\n}\r\n\r\nexport function useRtl() {\r\n const i18n = inject<any>(YUYEON_I18N_KEY);\r\n if (!i18n) throw new Error('Not found provided \"I18nModule\" for rtl');\r\n return {\r\n rtl: i18n.rtl,\r\n rtlClasses: i18n.rtlClasses,\r\n };\r\n}\r\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,GAAG,QAAQ,KAAK;AAAC,SAGnCC,UAAU;AAAA,SAEVC,eAAe;AAExB,OAAO,MAAMC,cAAc,GAAGC,MAAM,CAACC,GAAG,CAAC,YAAY,CAAC;AAgBtD,OAAO,SAASC,eAAeA,CAC7BC,YAA0B,EAC1BC,OAAoB,EACT;EACX,MAAMC,UAAU,GAAGT,GAAG,CACpBQ,OAAO,EAAEC,UAAU,IAAIR,UACzB,CAAC;EACD,MAAMS,GAAG,GAAGZ,QAAQ,CAAC,MAAM;IACzB,OAAOW,UAAU,CAACE,KAAK,CAACJ,YAAY,CAACK,MAAM,CAACD,KAAK,CAAC,IAAI,KAAK;EAC7D,CAAC,CAAC;EACF,MAAME,UAAU,GAAGf,QAAQ,CAAC,MAAO,WAAUY,GAAG,CAACC,KAAK,GAAG,KAAK,GAAG,KAAM,EAAC,CAAC;EAEzE,OAAO;IACLF,UAAU;IACVC,GAAG;IACHG;EACF,CAAC;AACH;AAEA,OAAO,SAASC,qBAAqBA,CACnCP,YAA0B,EAC1BE,UAAmC,EACnCM,KAAe,EACJ;EACX,MAAML,GAAG,GAAGZ,QAAQ,CAClB,MAAMiB,KAAK,CAACL,GAAG,IAAID,UAAU,CAACE,KAAK,CAACJ,YAAY,CAACK,MAAM,CAACD,KAAK,CAAC,IAAI,KACpE,CAAC;EACD,MAAME,UAAU,GAAGf,QAAQ,CAAC,MAAO,WAAUY,GAAG,CAACC,KAAK,GAAG,KAAK,GAAG,KAAM,EAAC,CAAC;EAEzE,OAAO;IACLD,GAAG;IACHD,UAAU;IACVI;EACF,CAAC;AACH;AAEA,OAAO,SAASG,MAAMA,CAAA,EAAG;EACvB,MAAMC,IAAI,GAAGlB,MAAM,CAAMG,eAAe,CAAC;EACzC,IAAI,CAACe,IAAI,EAAE,MAAM,IAAIC,KAAK,CAAC,yCAAyC,CAAC;EACrE,OAAO;IACLR,GAAG,EAAEO,IAAI,CAACP,GAAG;IACbG,UAAU,EAAEI,IAAI,CAACJ;EACnB,CAAC;AACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.mjs","names":["YUYEON_I18N_KEY","Symbol","for"],"sources":["../../../src/composables/i18n/share.ts"],"sourcesContent":["export const YUYEON_I18N_KEY = Symbol.for('yuyeon.i18n');\r\n"],"mappings":"AAAA,OAAO,MAAMA,eAAe,GAAGC,MAAM,CAACC,GAAG,CAAC,aAAa,CAAC"}
|
package/lib/composables/icon.mjs
CHANGED
|
@@ -1,2 +1,143 @@
|
|
|
1
|
+
import { createVNode as _createVNode, Fragment as _Fragment } from "vue";
|
|
2
|
+
import { computed, defineComponent, inject, mergeProps, unref } from 'vue';
|
|
3
|
+
import { builtSet } from "../components/index.mjs";
|
|
4
|
+
import { mergeDeep, propsFactory } from "../util/index.mjs";
|
|
1
5
|
export const IconPropOption = [String, Function, Object, Array];
|
|
6
|
+
export const IconValue = [String, Object, Array, Function];
|
|
7
|
+
export const pressIconPropsOptions = propsFactory({
|
|
8
|
+
icon: {
|
|
9
|
+
type: IconValue
|
|
10
|
+
},
|
|
11
|
+
tag: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true
|
|
14
|
+
}
|
|
15
|
+
}, 'icon');
|
|
16
|
+
export const YComponentIcon = defineComponent({
|
|
17
|
+
name: 'YComponentIcon',
|
|
18
|
+
props: pressIconPropsOptions(),
|
|
19
|
+
setup(props, _ref) {
|
|
20
|
+
let {
|
|
21
|
+
slots
|
|
22
|
+
} = _ref;
|
|
23
|
+
return () => {
|
|
24
|
+
const icon = props.icon;
|
|
25
|
+
let Icon = () => _createVNode(_Fragment, null, null);
|
|
26
|
+
let iconProps = {};
|
|
27
|
+
if (icon instanceof Object) {
|
|
28
|
+
Icon = icon;
|
|
29
|
+
if ('component' in icon) {
|
|
30
|
+
Icon = icon.component;
|
|
31
|
+
iconProps = icon?.props;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return _createVNode(props.tag, null, {
|
|
35
|
+
default: () => [props.icon ? _createVNode(Icon, mergeProps(iconProps), null) : slots.default?.()]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
export const YSvgIcon = defineComponent({
|
|
41
|
+
name: 'YSvgIcon',
|
|
42
|
+
inheritAttrs: false,
|
|
43
|
+
props: pressIconPropsOptions(),
|
|
44
|
+
setup(props, _ref2) {
|
|
45
|
+
let {
|
|
46
|
+
attrs
|
|
47
|
+
} = _ref2;
|
|
48
|
+
return () => {
|
|
49
|
+
return _createVNode(props.tag, attrs, {
|
|
50
|
+
default: () => [_createVNode("svg", {
|
|
51
|
+
"class": "y-icon__svg",
|
|
52
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
53
|
+
"viewBox": "0 0 24 24",
|
|
54
|
+
"role": "img",
|
|
55
|
+
"aria-hidden": "true"
|
|
56
|
+
}, [Array.isArray(props.icon) ? props.icon.map(path => Array.isArray(path) ? _createVNode("path", {
|
|
57
|
+
"d": path[0],
|
|
58
|
+
"fill-opacity": path[1]
|
|
59
|
+
}, null) : _createVNode("path", {
|
|
60
|
+
"d": path
|
|
61
|
+
}, null)) : _createVNode("path", {
|
|
62
|
+
"d": props.icon
|
|
63
|
+
}, null)])]
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
export const YUYEON_ICON_KEY = Symbol.for('yuyeon.icon');
|
|
69
|
+
export function createIconModule(options) {
|
|
70
|
+
return mergeDeep({
|
|
71
|
+
defaultSet: 'built',
|
|
72
|
+
sets: {
|
|
73
|
+
svg: {
|
|
74
|
+
component: YSvgIcon
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
aliases: {
|
|
78
|
+
...builtSet
|
|
79
|
+
}
|
|
80
|
+
}, options);
|
|
81
|
+
}
|
|
82
|
+
export function useIcon(iconProp) {
|
|
83
|
+
const iconModule = inject(YUYEON_ICON_KEY);
|
|
84
|
+
if (!iconModule) throw new Error('Not found provided "IconModule"');
|
|
85
|
+
const iconData = computed(() => {
|
|
86
|
+
const iconMeta = unref(iconProp);
|
|
87
|
+
if (!iconMeta) return {
|
|
88
|
+
component: YComponentIcon
|
|
89
|
+
};
|
|
90
|
+
let icon = iconMeta;
|
|
91
|
+
if (typeof icon === 'object' && 'alias' in icon && typeof icon.alias === 'string') {
|
|
92
|
+
icon = icon.alias;
|
|
93
|
+
}
|
|
94
|
+
if (typeof icon === 'string') {
|
|
95
|
+
icon = icon.trim();
|
|
96
|
+
if (icon.startsWith('$')) {
|
|
97
|
+
icon = iconModule.aliases?.[icon.slice(1)];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (!icon) throw new Error(`Could not find aliased icon "${iconMeta}"`);
|
|
101
|
+
if (Array.isArray(icon)) {
|
|
102
|
+
return {
|
|
103
|
+
component: YSvgIcon,
|
|
104
|
+
icon
|
|
105
|
+
};
|
|
106
|
+
} else if (typeof icon !== 'string') {
|
|
107
|
+
const iconValue = unref(iconProp);
|
|
108
|
+
console.log(iconValue);
|
|
109
|
+
if (iconValue && typeof iconValue === 'object' && 'iconProps' in iconValue) {
|
|
110
|
+
icon = {
|
|
111
|
+
component: 'component' in icon ? icon.component : icon,
|
|
112
|
+
props: 'props' in icon ? mergeDeep(icon.props, iconValue?.iconProps ?? {}) : iconValue.iconProps
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
component: YComponentIcon,
|
|
117
|
+
icon
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const iconSetName = Object.keys(iconModule.sets).find(setName => typeof icon === 'string' && icon.startsWith(`${setName}:`));
|
|
121
|
+
const iconName = iconSetName ? icon.slice(iconSetName.length + 1) : icon;
|
|
122
|
+
const iconSet = iconModule.sets[iconSetName ?? iconModule.defaultSet];
|
|
123
|
+
if (!iconSet?.component && typeof icon === 'string') {
|
|
124
|
+
const text = new DOMParser().parseFromString(icon, 'text/xml');
|
|
125
|
+
const svgNode = text.querySelector('svg');
|
|
126
|
+
if (svgNode) {
|
|
127
|
+
return {
|
|
128
|
+
component: () => {
|
|
129
|
+
template: svgNode;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
icon: iconName,
|
|
136
|
+
component: iconSet.component
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
iconData
|
|
141
|
+
};
|
|
142
|
+
}
|
|
2
143
|
//# sourceMappingURL=icon.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.mjs","names":["IconPropOption","String","Function","Object","Array"],"sources":["../../src/composables/icon.ts"],"sourcesContent":["\r\nimport type { Component, PropType } from \"vue\";\r\n\r\nexport type IconValue = string | (string | [path: string, opacity: number])[] | Component;\r\n\r\nexport const IconPropOption = [String, Function, Object, Array] as PropType<IconValue>;\r\n\r\ntype IconProps = {\r\n tag: string;\r\n icon?: IconValue,\r\n disabled?: Boolean,\r\n}\r\n\r\ntype IconComponent = Component<IconProps>;\r\n"],"mappings":"AAKA,OAAO,MAAMA,cAAc,GAAG,CAACC,MAAM,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,KAAK,CAAwB"}
|
|
1
|
+
{"version":3,"file":"icon.mjs","names":["computed","defineComponent","inject","mergeProps","unref","builtSet","mergeDeep","propsFactory","IconPropOption","String","Function","Object","Array","IconValue","pressIconPropsOptions","icon","type","tag","required","YComponentIcon","name","props","setup","_ref","slots","Icon","_createVNode","_Fragment","iconProps","component","default","YSvgIcon","inheritAttrs","_ref2","attrs","isArray","map","path","YUYEON_ICON_KEY","Symbol","for","createIconModule","options","defaultSet","sets","svg","aliases","useIcon","iconProp","iconModule","Error","iconData","iconMeta","alias","trim","startsWith","slice","iconValue","console","log","iconSetName","keys","find","setName","iconName","length","iconSet","text","DOMParser","parseFromString","svgNode","querySelector","template"],"sources":["../../src/composables/icon.tsx"],"sourcesContent":["import { HTMLAttributes } from '@vue/runtime-dom';\nimport type { Component, InjectionKey, PropType, Ref } from 'vue';\nimport { computed, defineComponent, inject, mergeProps, unref } from 'vue';\n\nimport { builtSet } from '../components';\nimport { JSXComponent } from '../types';\nimport { mergeDeep, propsFactory } from '../util';\n\ntype IconComponent = JSXComponent<IconProps>;\n\nexport type IconValue =\n | string\n | (string | [path: string, opacity: number])[]\n | IconComponent\n | { component: JSXComponent; props?: any }\n | { alias: string; iconProps?: any };\n\nexport const IconPropOption = [\n String,\n Function,\n Object,\n Array,\n] as PropType<IconValue>;\n\ntype IconProps = {\n tag: string;\n icon?: IconValue;\n disabled?: Boolean;\n};\n\nexport interface IconSet {\n component: IconComponent;\n}\n\nexport const IconValue = [\n String,\n Object,\n Array,\n Function,\n] as PropType<IconValue>;\n\nexport type IconModuleOptions = {\n defaultSet?: string;\n sets?: Record<string, IconSet>;\n aliases?: Partial<Record<string, any>>;\n};\n\nexport const pressIconPropsOptions = propsFactory(\n {\n icon: {\n type: IconValue,\n },\n tag: {\n type: String,\n required: true,\n },\n },\n 'icon',\n);\n\nexport const YComponentIcon = defineComponent({\n name: 'YComponentIcon',\n props: pressIconPropsOptions(),\n setup(props, { slots }) {\n return () => {\n const icon = props.icon as unknown;\n let Icon: JSXComponent = () => <></>;\n let iconProps: any = {};\n if (icon instanceof Object) {\n Icon = icon as JSXComponent;\n if ('component' in icon) {\n Icon = icon.component as JSXComponent;\n iconProps = (icon as any)?.props;\n }\n }\n return (\n <props.tag>\n {props.icon ? <Icon {...mergeProps(iconProps)} /> : slots.default?.()}\n </props.tag>\n );\n };\n },\n});\nexport type YComponentIcon = InstanceType<typeof YComponentIcon>;\n\nexport const YSvgIcon = defineComponent({\n name: 'YSvgIcon',\n inheritAttrs: false,\n props: pressIconPropsOptions(),\n setup(props, { attrs }) {\n return () => {\n return (\n <props.tag {...attrs}>\n <svg\n class=\"y-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n role=\"img\"\n aria-hidden=\"true\"\n >\n {Array.isArray(props.icon) ? (\n props.icon.map((path) =>\n Array.isArray(path) ? (\n <path d={path[0] as string} fill-opacity={path[1]}></path>\n ) : (\n <path d={path as string}></path>\n ),\n )\n ) : (\n <path d={props.icon as string}></path>\n )}\n </svg>\n </props.tag>\n );\n };\n },\n});\nexport type YSvgIcon = InstanceType<typeof YSvgIcon>;\n\nexport const YUYEON_ICON_KEY: InjectionKey<Required<IconModuleOptions>> =\n Symbol.for('yuyeon.icon');\n\nexport function createIconModule(options?: IconModuleOptions) {\n return mergeDeep(\n {\n defaultSet: 'built',\n sets: {\n svg: {\n component: YSvgIcon,\n },\n },\n aliases: {\n ...builtSet,\n },\n },\n options,\n );\n}\n\ntype IconInstance = {\n component: IconComponent;\n icon?: IconValue;\n};\n\nexport function useIcon(iconProp: Ref<IconValue | undefined>) {\n const iconModule = inject(YUYEON_ICON_KEY);\n\n if (!iconModule) throw new Error('Not found provided \"IconModule\"');\n\n const iconData = computed<IconInstance>(() => {\n const iconMeta = unref(iconProp);\n\n if (!iconMeta) return { component: YComponentIcon };\n\n let icon: IconValue | undefined = iconMeta;\n\n if (\n typeof icon === 'object' &&\n 'alias' in icon &&\n typeof icon.alias === 'string'\n ) {\n icon = icon.alias;\n }\n\n if (typeof icon === 'string') {\n icon = icon.trim();\n\n if (icon.startsWith('$')) {\n icon = iconModule.aliases?.[icon.slice(1)];\n }\n }\n\n if (!icon) throw new Error(`Could not find aliased icon \"${iconMeta}\"`);\n\n if (Array.isArray(icon)) {\n return {\n component: YSvgIcon,\n icon,\n };\n } else if (typeof icon !== 'string') {\n const iconValue = unref(iconProp);\n console.log(iconValue);\n if (\n iconValue &&\n typeof iconValue === 'object' &&\n 'iconProps' in iconValue\n ) {\n icon = {\n component:\n 'component' in icon ? icon.component : (icon as JSXComponent),\n props:\n 'props' in icon\n ? mergeDeep(icon.props, iconValue?.iconProps ?? {})\n : iconValue.iconProps,\n };\n }\n\n return {\n component: YComponentIcon,\n icon,\n };\n }\n\n const iconSetName = Object.keys(iconModule.sets).find(\n (setName) => typeof icon === 'string' && icon.startsWith(`${setName}:`),\n );\n\n const iconName = iconSetName ? icon.slice(iconSetName.length + 1) : icon;\n const iconSet = iconModule.sets[iconSetName ?? iconModule.defaultSet];\n\n if (!iconSet?.component && typeof icon === 'string') {\n const text = new DOMParser().parseFromString(icon, 'text/xml');\n const svgNode = text.querySelector('svg');\n if (svgNode) {\n return {\n component: () => { template: svgNode }\n }\n }\n }\n\n return {\n icon: iconName,\n component: iconSet.component,\n };\n });\n\n return {\n iconData,\n };\n}\n"],"mappings":";AAEA,SAASA,QAAQ,EAAEC,eAAe,EAAEC,MAAM,EAAEC,UAAU,EAAEC,KAAK,QAAQ,KAAK;AAAC,SAElEC,QAAQ;AAAA,SAERC,SAAS,EAAEC,YAAY;AAWhC,OAAO,MAAMC,cAAc,GAAG,CAC5BC,MAAM,EACNC,QAAQ,EACRC,MAAM,EACNC,KAAK,CACiB;AAYxB,OAAO,MAAMC,SAAS,GAAG,CACvBJ,MAAM,EACNE,MAAM,EACNC,KAAK,EACLF,QAAQ,CACc;AAQxB,OAAO,MAAMI,qBAAqB,GAAGP,YAAY,CAC/C;EACEQ,IAAI,EAAE;IACJC,IAAI,EAAEH;EACR,CAAC;EACDI,GAAG,EAAE;IACHD,IAAI,EAAEP,MAAM;IACZS,QAAQ,EAAE;EACZ;AACF,CAAC,EACD,MACF,CAAC;AAED,OAAO,MAAMC,cAAc,GAAGlB,eAAe,CAAC;EAC5CmB,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EA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ACI,WAAW,CAACK,MAAM,GAAG,CAAC,CAAC,GAAGlD,IAAI;IACxE,MAAMmD,OAAO,GAAGjB,UAAU,CAACL,IAAI,CAACgB,WAAW,IAAIX,UAAU,CAACN,UAAU,CAAC;IAErE,IAAI,CAACuB,OAAO,EAAErC,SAAS,IAAI,OAAOd,IAAI,KAAK,QAAQ,EAAE;MACnD,MAAMoD,IAAI,GAAG,IAAIC,SAAS,CAAC,CAAC,CAACC,eAAe,CAACtD,IAAI,EAAE,UAAU,CAAC;MAC9D,MAAMuD,OAAO,GAAGH,IAAI,CAACI,aAAa,CAAC,KAAK,CAAC;MACzC,IAAID,OAAO,EAAE;QACX,OAAO;UACLzC,SAAS,EAAEA,CAAA,KAAM;YAAE2C,QAAQ,EAAEF,OAAO;UAAC;QACvC,CAAC;MACH;IACF;IAEA,OAAO;MACLvD,IAAI,EAAEiD,QAAQ;MACdnC,SAAS,EAAEqC,OAAO,CAACrC;IACrB,CAAC;EACH,CAAC,CAAC;EAEF,OAAO;IACLsB;EACF,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/composables/index.ts"],"sourcesContent":["export * from './communication';\r\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/composables/index.ts"],"sourcesContent":["export * from './communication';\r\nexport * from './date';\r\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["computed","effectScope","getCurrentInstance","inject","provide","reactive","readonly","ref","unref","watch","bindThemeClass","propsFactory","createPalette","createThemes","cssClass","cssVariables","configureOptions","Y_THEME_PREFIX","YUYEON_THEME_KEY","Symbol","for","pressThemePropsOptions","theme","String","isDarkMode","window","matchMedia","matches","isSupportAutoScheme","media","createThemeModule","options","appMountedScope","config","scheme","themes","palette","supportedAutoMode","preferColorScheme","darkModeWatcher","mediaQueryList","value","currentColorScheme","currentThemeKey","computedThemes","Array","isArray","computedPalette","styles","lines","push","themeKey","themeDefs","Object","entries","colors","variables","isDark","records","themeScheme","join","install","app","directive","styleEl","document","getElementById","updateStyleEl","immediate","el","createElement","type","id","cspNonce","setAttribute","head","appendChild","innerHTML","bindTheme","yuyeon","mql","addEventListener","neo","lightTheme","darkTheme","root","dataset","init","run","themeClasses","scope","instance","global","useLocalTheme","props","themeModule","Error","newTheme","useTheme"],"sources":["../../../src/composables/theme/index.ts"],"sourcesContent":["import type { App, ComputedRef, Ref } from 'vue';\nimport {\n computed,\n effectScope,\n getCurrentInstance,\n inject,\n provide,\n reactive,\n readonly,\n ref,\n unref,\n watch,\n} from 'vue';\n\nimport bindThemeClass from '../../directives/theme-class';\nimport { propsFactory } from '../../util/vue-component';\nimport { createPalette, createThemes } from './factory';\nimport { cssClass, cssVariables } from './helper';\nimport { ThemeScheme, configureOptions } from './setting';\nimport type { ThemeOptions } from './types';\n\nexport type { ThemeOptions };\n\nexport const Y_THEME_PREFIX = 'y-theme';\n\nexport interface ThemeModuleInstance {\n scheme: keyof typeof ThemeScheme | 'auto';\n theme: Ref<[string, string?]>;\n // theme values(schemes) for colors & variables\n readonly themes: any;\n readonly global: {\n // currentThemeKeys: [lightThemeKey, darkThemeKey]\n // If used manually, fix the scheme to 'light' and have a [lightThemeKey] value.\n // Use the appropriate default theme scheme if it does not match the themeKey\n scheme: keyof typeof ThemeScheme | 'auto';\n theme: Ref<[string, string?]>;\n };\n /* computed */\n readonly currentThemeKey: Readonly<ComputedRef<string>>;\n readonly themeClasses: Readonly<ComputedRef<string | undefined>>;\n readonly computedThemes: Readonly<ComputedRef<any>>;\n readonly computedPalette: Readonly<ComputedRef<any>>;\n /* */\n readonly supportedAutoMode: Readonly<Ref<boolean>>;\n readonly preferColorScheme: Readonly<Ref<'light' | 'dark'>>;\n}\n\nexport const YUYEON_THEME_KEY = Symbol.for('yuyeon.theme');\n\nexport const pressThemePropsOptions = propsFactory(\n {\n theme: String,\n },\n 'theme',\n);\n\nexport function isDarkMode() {\n return window.matchMedia('(prefers-color-scheme: dark)').matches;\n}\n\nexport function isSupportAutoScheme() {\n return window.matchMedia('(prefers-color-scheme)').media !== 'not all';\n}\n\nexport function createThemeModule(options: ThemeOptions) {\n const appMountedScope = effectScope();\n const config = reactive(configureOptions(options));\n const scheme = ref<string>(config.scheme);\n const theme = ref<[string, string]>(config.theme);\n const themes = ref(config.themes);\n const palette = ref(config.palette);\n const supportedAutoMode = ref(true);\n const preferColorScheme = ref('');\n\n function darkModeWatcher(\n mediaQueryList: MediaQueryListEvent | MediaQueryList,\n ) {\n preferColorScheme.value = mediaQueryList.matches ? 'dark' : 'light';\n }\n\n const currentColorScheme = computed<'light' | 'dark'>(() => {\n if (scheme.value === 'auto') {\n return preferColorScheme.value as 'light' | 'dark';\n }\n if (scheme.value === 'dark') {\n return 'dark';\n }\n return 'light';\n });\n\n const currentThemeKey = computed(() => {\n if (typeof theme.value === 'string') {\n if (theme.value in computedThemes) {\n return theme.value;\n }\n }\n if (Array.isArray(theme.value)) {\n return currentColorScheme.value === 'dark'\n ? theme.value?.[1] ?? 'dark'\n : theme.value?.[0] ?? 'light';\n }\n return currentColorScheme.value;\n });\n\n const computedPalette = computed(() => {\n return createPalette(palette.value);\n });\n\n const computedThemes = computed(() => {\n return createThemes(themes.value);\n });\n\n const styles = computed(() => {\n const lines = [];\n lines.push(\n ...cssClass(':root', cssVariables(computedPalette.value, 'palette')),\n );\n for (const [themeKey, themeDefs] of Object.entries(computedThemes.value)) {\n const { colors, variables, isDark } = themeDefs;\n const records: Record<string, string> = {\n ...colors,\n ...variables,\n };\n // if (currentThemeKey.value === themeKey) {\n // lines.push(...cssClass(':root', cssVariables(records, 'theme')));\n // }\n const themeScheme = isDark ? 'dark' : 'light';\n if (scheme.value === 'auto') {\n lines.push(\n ...cssClass(\n `@media (prefers-color-scheme: ${themeScheme})`,\n cssClass(\n `[data-theme-scheme='auto'][data-${themeScheme}-theme='${themeKey}']`,\n cssVariables(records, 'theme'),\n ),\n ),\n );\n } else {\n lines.push(\n ...cssClass(\n `[data-theme-scheme='${themeScheme}'][data-${themeScheme}-theme='${themeKey}']`,\n cssVariables(records, 'theme'),\n ),\n );\n }\n\n lines.push(\n ...cssClass(`.y-theme--${themeKey}`, cssVariables(records, 'theme')),\n );\n }\n return lines.join('');\n });\n\n function install(app: App) {\n app.directive('theme', bindThemeClass);\n\n let styleEl = document.getElementById('yuyeon-theme-palette');\n\n watch(styles, updateStyleEl, { immediate: true });\n\n function updateStyleEl() {\n if (typeof document !== 'undefined' && !styleEl) {\n const el = document.createElement('style');\n el.type = 'text/css';\n el.id = 'yuyeon-theme-palette';\n if (options?.cspNonce) el.setAttribute('nonce', options.cspNonce);\n styleEl = el;\n document.head.appendChild(styleEl);\n }\n if (styleEl) {\n styleEl.innerHTML = styles.value;\n }\n }\n }\n\n function bindTheme(yuyeon: any) {\n supportedAutoMode.value = isSupportAutoScheme();\n if (supportedAutoMode.value) {\n const mql = window.matchMedia('(prefers-color-scheme: dark)');\n darkModeWatcher(mql);\n mql.addEventListener('change' as 'change', darkModeWatcher);\n }\n watch(\n theme,\n (neo) => {\n const [lightTheme, darkTheme] = neo;\n yuyeon.root.dataset.lightTheme = lightTheme;\n yuyeon.root.dataset.darkTheme = darkTheme;\n },\n { immediate: true },\n );\n watch(\n scheme,\n (neo) => {\n yuyeon.root.setAttribute(\n 'data-theme-scheme',\n neo === 'auto' ? 'auto' : currentColorScheme.value,\n );\n },\n { immediate: true },\n );\n }\n\n function init(yuyeon: any) {\n appMountedScope.run(() => {\n bindTheme(yuyeon);\n });\n }\n\n const themeClasses = computed(() => `y-theme--${currentThemeKey.value}`);\n\n return {\n install,\n init,\n scope: appMountedScope,\n instance: {\n global: {\n scheme,\n theme,\n },\n themes,\n scheme,\n theme,\n currentThemeKey,\n themeClasses,\n computedThemes,\n computedPalette,\n supportedAutoMode: readonly(supportedAutoMode),\n preferColorScheme: readonly(preferColorScheme),\n },\n };\n}\n\nexport function useLocalTheme(props: { theme?: string }) {\n getCurrentInstance();\n\n const themeModule = inject<ThemeModuleInstance | null>(\n YUYEON_THEME_KEY,\n null,\n );\n\n if (!themeModule) throw new Error('Not found provided \"ThemeModule\"');\n\n const palette = themeModule.computedPalette;\n\n const currentThemeKey = computed<string>(() => {\n if (props.theme) {\n switch (props.theme) {\n case 'light':\n return themeModule.theme.value?.[0] ?? 'light';\n case 'dark':\n return themeModule.theme.value?.[1] ?? 'dark';\n // TODO: props.theme(themeKey) validation in themes\n default:\n return props.theme;\n }\n }\n return unref(themeModule.currentThemeKey);\n });\n\n const themeClasses = computed(() => `y-theme--${currentThemeKey.value}`);\n\n const newTheme: ThemeModuleInstance = {\n ...themeModule,\n currentThemeKey,\n themeClasses,\n };\n\n provide(YUYEON_THEME_KEY, newTheme);\n\n return newTheme;\n}\n\nexport function useTheme() {\n getCurrentInstance();\n\n const theme = inject<ThemeModuleInstance | null>(YUYEON_THEME_KEY, null);\n\n if (!theme) throw new Error('Not found provided \"ThemeModule\"');\n\n return theme;\n}\n"],"mappings":"AACA,SACEA,QAAQ,EACRC,WAAW,EACXC,kBAAkB,EAClBC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,GAAG,EACHC,KAAK,EACLC,KAAK,QACA,KAAK;AAAC,OAENC,cAAc;AAAA,SACZC,YAAY;AAAA,SACZC,aAAa,EAAEC,YAAY;AAAA,SAC3BC,QAAQ,EAAEC,YAAY;AAAA,SACTC,gBAAgB;AAKtC,OAAO,MAAMC,cAAc,GAAG,SAAS;AAwBvC,OAAO,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,GAAG,CAAC,cAAc,CAAC;AAE1D,OAAO,MAAMC,sBAAsB,GAAGV,YAAY,CAChD;EACEW,KAAK,EAAEC;AACT,CAAC,EACD,OACF,CAAC;AAED,OAAO,SAASC,UAAUA,CAAA,EAAG;EAC3B,OAAOC,MAAM,CAACC,UAAU,CAAC,8BAA8B,CAAC,CAACC,OAAO;AAClE;AAEA,OAAO,SAAS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I,CAACI,KAAK,EAAE,MAAM,IAAI0E,KAAK,CAAC,kCAAkC,CAAC;EAE/D,OAAO1E,KAAK;AACd"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["computed","effectScope","getCurrentInstance","inject","provide","reactive","readonly","ref","unref","watch","bindThemeClass","propsFactory","createPalette","createThemes","cssClass","cssVariables","configureOptions","Y_THEME_PREFIX","YUYEON_THEME_KEY","Symbol","for","pressThemePropsOptions","theme","String","isDarkMode","window","matchMedia","matches","isSupportAutoScheme","media","createThemeModule","options","appMountedScope","config","scheme","themes","palette","supportedAutoMode","preferColorScheme","darkModeWatcher","mediaQueryList","value","currentColorScheme","currentThemeKey","computedThemes","Array","isArray","computedPalette","styles","lines","push","themeKey","themeDefs","Object","entries","colors","variables","isDark","records","themeScheme","join","install","app","directive","styleEl","document","getElementById","updateStyleEl","immediate","el","createElement","type","id","cspNonce","setAttribute","head","appendChild","innerHTML","bindTheme","yuyeon","mql","addEventListener","neo","lightTheme","darkTheme","root","dataset","init","run","themeClasses","scope","instance","global","useLocalTheme","props","themeModule","Error","newTheme","useTheme"],"sources":["../../../src/composables/theme/index.ts"],"sourcesContent":["import type {App, ComputedRef, PropType, Ref} from 'vue';\r\nimport {\r\n computed,\r\n effectScope,\r\n getCurrentInstance,\r\n inject,\r\n provide,\r\n reactive,\r\n readonly,\r\n ref,\r\n unref,\r\n watch,\r\n} from 'vue';\r\n\r\nimport bindThemeClass from '../../directives/theme-class';\r\nimport { propsFactory } from '../../util/vue-component';\r\nimport { createPalette, createThemes } from './factory';\r\nimport { cssClass, cssVariables } from './helper';\r\nimport { ThemeScheme, configureOptions } from './setting';\r\nimport type { ThemeOptions } from './types';\r\n\r\nexport type { ThemeOptions };\r\n\r\nexport const Y_THEME_PREFIX = 'y-theme';\r\n\r\nexport interface ThemeModuleInstance {\r\n scheme: Ref<keyof typeof ThemeScheme | 'auto'>;\r\n theme: Ref<[string, string?]>;\r\n // theme values(schemes) for colors & variables\r\n readonly themes: any;\r\n readonly global: {\r\n // currentThemeKeys: [lightThemeKey, darkThemeKey]\r\n // If used manually, fix the scheme to 'light' and have a [lightThemeKey] value.\r\n // Use the appropriate default theme scheme if it does not match the themeKey\r\n scheme: Ref<keyof typeof ThemeScheme | 'auto'>;\r\n theme: Ref<[string, string?]>;\r\n };\r\n /* computed */\r\n readonly currentThemeKey: Readonly<ComputedRef<string>>;\r\n readonly themeClasses: Readonly<ComputedRef<string | undefined>>;\r\n readonly computedThemes: Readonly<ComputedRef<any>>;\r\n readonly computedPalette: Readonly<ComputedRef<any>>;\r\n /* */\r\n readonly supportedAutoMode: Readonly<Ref<boolean>>;\r\n readonly preferColorScheme: Readonly<Ref<'light' | 'dark'>>;\r\n}\r\n\r\nexport const YUYEON_THEME_KEY = Symbol.for('yuyeon.theme');\r\n\r\nexport const pressThemePropsOptions = propsFactory(\r\n {\r\n theme: String as PropType<string>,\r\n },\r\n 'theme',\r\n);\r\n\r\nexport function isDarkMode() {\r\n return window.matchMedia('(prefers-color-scheme: dark)').matches;\r\n}\r\n\r\nexport function isSupportAutoScheme() {\r\n return window.matchMedia('(prefers-color-scheme)').media !== 'not all';\r\n}\r\n\r\nexport function createThemeModule(options: ThemeOptions) {\r\n const appMountedScope = effectScope();\r\n const config = reactive(configureOptions(options));\r\n const scheme = ref<string>(config.scheme);\r\n const theme = ref<[string, string]>(config.theme);\r\n const themes = ref(config.themes);\r\n const palette = ref(config.palette);\r\n const supportedAutoMode = ref(true);\r\n const preferColorScheme = ref('');\r\n\r\n function darkModeWatcher(\r\n mediaQueryList: MediaQueryListEvent | MediaQueryList,\r\n ) {\r\n preferColorScheme.value = mediaQueryList.matches ? 'dark' : 'light';\r\n }\r\n\r\n const currentColorScheme = computed<'light' | 'dark'>(() => {\r\n if (scheme.value === 'auto') {\r\n return preferColorScheme.value as 'light' | 'dark';\r\n }\r\n if (scheme.value === 'dark') {\r\n return 'dark';\r\n }\r\n return 'light';\r\n });\r\n\r\n const currentThemeKey = computed(() => {\r\n if (typeof theme.value === 'string') {\r\n if (theme.value in computedThemes) {\r\n return theme.value;\r\n }\r\n }\r\n if (Array.isArray(theme.value)) {\r\n return currentColorScheme.value === 'dark'\r\n ? theme.value?.[1] ?? 'dark'\r\n : theme.value?.[0] ?? 'light';\r\n }\r\n return currentColorScheme.value;\r\n });\r\n\r\n const computedPalette = computed(() => {\r\n return createPalette(palette.value);\r\n });\r\n\r\n const computedThemes = computed(() => {\r\n return createThemes(themes.value);\r\n });\r\n\r\n const styles = computed(() => {\r\n const lines = [];\r\n lines.push(\r\n ...cssClass(':root', cssVariables(computedPalette.value, 'palette')),\r\n );\r\n for (const [themeKey, themeDefs] of Object.entries(computedThemes.value)) {\r\n const { colors, variables, isDark } = themeDefs;\r\n const records: Record<string, string> = {\r\n ...colors,\r\n ...variables,\r\n };\r\n // if (currentThemeKey.value === themeKey) {\r\n // lines.push(...cssClass(':root', cssVariables(records, 'theme')));\r\n // }\r\n const themeScheme = isDark ? 'dark' : 'light';\r\n if (scheme.value === 'auto') {\r\n lines.push(\r\n ...cssClass(\r\n `@media (prefers-color-scheme: ${themeScheme})`,\r\n cssClass(\r\n `[data-theme-scheme='auto'][data-${themeScheme}-theme='${themeKey}']`,\r\n cssVariables(records, 'theme'),\r\n ),\r\n ),\r\n );\r\n } else {\r\n lines.push(\r\n ...cssClass(\r\n `[data-theme-scheme='${themeScheme}'][data-${themeScheme}-theme='${themeKey}']`,\r\n cssVariables(records, 'theme'),\r\n ),\r\n );\r\n }\r\n\r\n lines.push(\r\n ...cssClass(`.y-theme--${themeKey}`, cssVariables(records, 'theme')),\r\n );\r\n }\r\n return lines.join('');\r\n });\r\n\r\n function install(app: App) {\r\n app.directive('theme', bindThemeClass);\r\n\r\n let styleEl = document.getElementById('yuyeon-theme-palette');\r\n\r\n watch(styles, updateStyleEl, { immediate: true });\r\n\r\n function updateStyleEl() {\r\n if (typeof document !== 'undefined' && !styleEl) {\r\n const el = document.createElement('style');\r\n el.type = 'text/css';\r\n el.id = 'yuyeon-theme-palette';\r\n if (options?.cspNonce) el.setAttribute('nonce', options.cspNonce);\r\n styleEl = el;\r\n document.head.appendChild(styleEl);\r\n }\r\n if (styleEl) {\r\n styleEl.innerHTML = styles.value;\r\n }\r\n }\r\n }\r\n\r\n function bindTheme(yuyeon: any) {\r\n supportedAutoMode.value = isSupportAutoScheme();\r\n if (supportedAutoMode.value) {\r\n const mql = window.matchMedia('(prefers-color-scheme: dark)');\r\n darkModeWatcher(mql);\r\n mql.addEventListener('change' as 'change', darkModeWatcher);\r\n }\r\n watch(\r\n theme,\r\n (neo) => {\r\n const [lightTheme, darkTheme] = neo;\r\n yuyeon.root.dataset.lightTheme = lightTheme;\r\n yuyeon.root.dataset.darkTheme = darkTheme;\r\n },\r\n { immediate: true },\r\n );\r\n watch(\r\n scheme,\r\n (neo) => {\r\n yuyeon.root.setAttribute(\r\n 'data-theme-scheme',\r\n neo === 'auto' ? 'auto' : currentColorScheme.value,\r\n );\r\n },\r\n { immediate: true },\r\n );\r\n }\r\n\r\n function init(yuyeon: any) {\r\n appMountedScope.run(() => {\r\n bindTheme(yuyeon);\r\n });\r\n }\r\n\r\n const themeClasses = computed(() => `y-theme--${currentThemeKey.value}`);\r\n\r\n return {\r\n install,\r\n init,\r\n scope: appMountedScope,\r\n instance: {\r\n global: {\r\n scheme,\r\n theme,\r\n },\r\n themes,\r\n scheme,\r\n theme,\r\n currentThemeKey,\r\n themeClasses,\r\n computedThemes,\r\n computedPalette,\r\n supportedAutoMode: readonly(supportedAutoMode),\r\n preferColorScheme: readonly(preferColorScheme),\r\n },\r\n };\r\n}\r\n\r\nexport function useLocalTheme(props: { theme?: string }) {\r\n getCurrentInstance();\r\n\r\n const themeModule = inject<ThemeModuleInstance | null>(\r\n YUYEON_THEME_KEY,\r\n null,\r\n );\r\n\r\n if (!themeModule) throw new Error('Not found provided \"ThemeModule\"');\r\n\r\n const palette = themeModule.computedPalette;\r\n\r\n const currentThemeKey = computed<string>(() => {\r\n if (props.theme) {\r\n switch (props.theme) {\r\n case 'light':\r\n return themeModule.theme.value?.[0] ?? 'light';\r\n case 'dark':\r\n return themeModule.theme.value?.[1] ?? 'dark';\r\n // TODO: props.theme(themeKey) validation in themes\r\n default:\r\n return props.theme;\r\n }\r\n }\r\n return unref(themeModule.currentThemeKey);\r\n });\r\n\r\n const themeClasses = computed(() => `y-theme--${currentThemeKey.value}`);\r\n\r\n const newTheme: ThemeModuleInstance = {\r\n ...themeModule,\r\n currentThemeKey,\r\n themeClasses,\r\n };\r\n\r\n provide(YUYEON_THEME_KEY, newTheme);\r\n\r\n return newTheme;\r\n}\r\n\r\nexport function useTheme() {\r\n getCurrentInstance();\r\n\r\n const theme = inject<ThemeModuleInstance | null>(YUYEON_THEME_KEY, null);\r\n\r\n if (!theme) throw new Error('Not found provided \"ThemeModule\"');\r\n\r\n return theme;\r\n}\r\n"],"mappings":"AACA,SACEA,QAAQ,EACRC,WAAW,EACXC,kBAAkB,EAClBC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,GAAG,EACHC,KAAK,EACLC,KAAK,QACA,KAAK;AAAC,OAENC,cAAc;AAAA,SACZC,YAAY;AAAA,SACZC,aAAa,EAAEC,YAAY;AAAA,SAC3BC,QAAQ,EAAEC,YAAY;AAAA,SACTC,gBAAgB;AAKtC,OAAO,MAAMC,cAAc,GAAG,SAAS;AAwBvC,OAAO,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,GAAG,CAAC,cAAc,CAAC;AAE1D,OAAO,MAAMC,sBAAsB,GAAGV,YAAY,CAChD;EACEW,KAAK,EAAEC;AACT,CAAC,EACD,OACF,CAAC;AAED,OAAO,SAASC,UAAUA,CAAA,EAAG;EAC3B,OAAOC,MAAM,CAACC,UAAU,CAAC,8BAA8B,CAAC,CAACC,OAAO;AAClE;AAEA,OAAO,SAASC,mBAAmBA,CAAA,EAAG;EACpC,OAAOH,MAAM,CAACC,UAAU,CAAC,wBAAwB,CAAC,CAACG,KAAK,KAAK,SA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@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition.mjs","names":["Transition","computed","h","polyTransitionPropOptions","transition","type","String","Object","default","usePolyTransition","props","polyTransitionBindProps","is","transitionProps","name","PolyTransition","_ref","slots","forcedProps","component","rest"],"sources":["../../src/composables/transition.ts"],"sourcesContent":["import {\n Component,\n FunctionalComponent,\n PropType,\n Transition,\n TransitionProps,\n computed,\n h,\n} from 'vue';\n\nexport const polyTransitionPropOptions = {\n transition: {\n type: [String, Object] as PropType<\n string | (TransitionProps & { is?: Component })\n >,\n default: 'slide-fade',\n },\n};\n\nexport function usePolyTransition(props: { transition: any }) {\n const polyTransitionBindProps = computed(() => {\n const { is, ...transitionProps } =\n typeof props.transition === 'object'\n ? props.transition\n : { is: props.transition, name: props.transition };\n return {\n is,\n transitionProps,\n };\n });\n\n return {\n polyTransitionBindProps,\n };\n}\n\nexport const PolyTransition: FunctionalComponent<\n TransitionProps & { is: string | Component; transitionProps: TransitionProps }\n> = (props, { slots }) => {\n const { is, transitionProps, ...forcedProps } = props;\n const { component = Transition, ...rest } =\n typeof is === 'object'\n ? { component: is, ...transitionProps }\n : { name: is };\n return h(component, { ...rest, ...transitionProps, ...forcedProps }, slots);\n};\n"],"mappings":"AAAA,SAIEA,UAAU,EAEVC,QAAQ,EACRC,CAAC,QACI,KAAK;AAEZ,OAAO,MAAMC,yBAAyB,GAAG;EACvCC,UAAU,EAAE;IACVC,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAEpB;IACDC,OAAO,EAAE;EACX;AACF,CAAC;AAED,OAAO,SAASC,iBAAiBA,CAACC,KAA0B,EAAE;EAC5D,MAAMC,uBAAuB,GAAGV,QAAQ,CAAC,MAAM;IAC7C,MAAM;MAAEW,EAAE;MAAE,GAAGC;IAAgB,CAAC,GAC9B,OAAOH,KAAK,CAACN,UAAU,KAAK,QAAQ,GAChCM,KAAK,CAACN,UAAU,GAChB;MAAEQ,EAAE,EAAEF,KAAK,CAACN,UAAU;MAAEU,IAAI,EAAEJ,KAAK,CAACN;IAAW,CAAC;IACtD,OAAO;MACLQ,EAAE;MACFC;IACF,CAAC;EACH,CAAC,CAAC;EAEF,OAAO;IACLF;EACF,CAAC;AACH;AAEA,OAAO,MAAMI,cAEZ,GAAGA,CAACL,KAAK,EAAAM,IAAA,KAAgB;EAAA,IAAd;IAAEC;EAAM,CAAC,GAAAD,IAAA;EACnB,MAAM;IAAEJ,EAAE;IAAEC,eAAe;IAAE,GAAGK;EAAY,CAAC,GAAGR,KAAK;EACrD,MAAM;IAAES,SAAS,GAAGnB,UAAU;IAAE,GAAGoB;EAAK,CAAC,GACvC,OAAOR,EAAE,KAAK,QAAQ,GAClB;IAAEO,SAAS,EAAEP,EAAE;IAAE,GAAGC;EAAgB,CAAC,GACrC;IAAEC,IAAI,EAAEF;EAAG,CAAC;EAClB,OAAOV,CAAC,CAACiB,SAAS,EAAE;IAAE,GAAGC,IAAI;IAAE,GAAGP,eAAe;IAAE,GAAGK;EAAY,CAAC,EAAED,KAAK,CAAC;AAC7E,CAAC"}
|
|
1
|
+
{"version":3,"file":"transition.mjs","names":["Transition","computed","h","polyTransitionPropOptions","transition","type","String","Object","default","usePolyTransition","props","polyTransitionBindProps","is","transitionProps","name","PolyTransition","_ref","slots","forcedProps","component","rest"],"sources":["../../src/composables/transition.ts"],"sourcesContent":["import {\r\n Component,\r\n FunctionalComponent,\r\n PropType,\r\n Transition,\r\n TransitionProps,\r\n computed,\r\n h,\r\n} from 'vue';\r\n\r\nexport const polyTransitionPropOptions = {\r\n transition: {\r\n type: [String, Object] as PropType<\r\n string | (TransitionProps & { is?: Component })\r\n >,\r\n default: 'slide-fade',\r\n },\r\n};\r\n\r\nexport function usePolyTransition(props: { transition: any }) {\r\n const polyTransitionBindProps = computed(() => {\r\n const { is, ...transitionProps } =\r\n typeof props.transition === 'object'\r\n ? props.transition\r\n : { is: props.transition, name: props.transition };\r\n return {\r\n is,\r\n transitionProps,\r\n };\r\n });\r\n\r\n return {\r\n polyTransitionBindProps,\r\n };\r\n}\r\n\r\nexport const PolyTransition: FunctionalComponent<\r\n TransitionProps & { is: string | Component; transitionProps: TransitionProps }\r\n> = (props, { slots }) => {\r\n const { is, transitionProps, ...forcedProps } = props;\r\n const { component = Transition, ...rest } =\r\n typeof is === 'object'\r\n ? { component: is, ...transitionProps }\r\n : { name: is };\r\n return h(component, { ...rest, ...transitionProps, ...forcedProps }, slots);\r\n};\r\n"],"mappings":"AAAA,SAIEA,UAAU,EAEVC,QAAQ,EACRC,CAAC,QACI,KAAK;AAEZ,OAAO,MAAMC,yBAAyB,GAAG;EACvCC,UAAU,EAAE;IACVC,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAEpB;IACDC,OAAO,EAAE;EACX;AACF,CAAC;AAED,OAAO,SAASC,iBAAiBA,CAACC,KAA0B,EAAE;EAC5D,MAAMC,uBAAuB,GAAGV,QAAQ,CAAC,MAAM;IAC7C,MAAM;MAAEW,EAAE;MAAE,GAAGC;IAAgB,CAAC,GAC9B,OAAOH,KAAK,CAACN,UAAU,KAAK,QAAQ,GAChCM,KAAK,CAACN,UAAU,GAChB;MAAEQ,EAAE,EAAEF,KAAK,CAACN,UAAU;MAAEU,IAAI,EAAEJ,KAAK,CAACN;IAAW,CAAC;IACtD,OAAO;MACLQ,EAAE;MACFC;IACF,CAAC;EACH,CAAC,CAAC;EAEF,OAAO;IACLF;EACF,CAAC;AACH;AAEA,OAAO,MAAMI,cAEZ,GAAGA,CAACL,KAAK,EAAAM,IAAA,KAAgB;EAAA,IAAd;IAAEC;EAAM,CAAC,GAAAD,IAAA;EACnB,MAAM;IAAEJ,EAAE;IAAEC,eAAe;IAAE,GAAGK;EAAY,CAAC,GAAGR,KAAK;EACrD,MAAM;IAAES,SAAS,GAAGnB,UAAU;IAAE,GAAGoB;EAAK,CAAC,GACvC,OAAOR,EAAE,KAAK,QAAQ,GAClB;IAAEO,SAAS,EAAEP,EAAE;IAAE,GAAGC;EAAgB,CAAC,GACrC;IAAEC,IAAI,EAAEF;EAAG,CAAC;EAClB,OAAOV,CAAC,CAACiB,SAAS,EAAE;IAAE,GAAGC,IAAI;IAAE,GAAGP,eAAe;IAAE,GAAGK;EAAY,CAAC,EAAED,KAAK,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ref, shallowRef } from 'vue';
|
|
2
|
+
import { useProvided } from "../composables/index.mjs";
|
|
3
|
+
import en from "../locales/en.mjs";
|
|
4
|
+
import { getObjectValueByPath } from "../util/index.mjs";
|
|
5
|
+
const LOCALE_PREFIX = '$yuyeon';
|
|
6
|
+
function replaceParams(str, params) {
|
|
7
|
+
return str.replace(/\{(\d+)\}/g, (item, index) => {
|
|
8
|
+
return String(params[+index]);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function generateContext(locale, fallbackLocale, messages) {
|
|
12
|
+
function translate(key) {
|
|
13
|
+
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
14
|
+
params[_key - 1] = arguments[_key];
|
|
15
|
+
}
|
|
16
|
+
if (!key.startsWith(LOCALE_PREFIX)) {
|
|
17
|
+
return replaceParams(key, params);
|
|
18
|
+
}
|
|
19
|
+
const path = key.replace(LOCALE_PREFIX, '');
|
|
20
|
+
const localeMessages = locale.value && messages.value[locale.value];
|
|
21
|
+
const fallbackMessages = fallbackLocale.value && messages.value[fallbackLocale.value];
|
|
22
|
+
let msg = getObjectValueByPath(localeMessages, path, null);
|
|
23
|
+
if (!msg) {
|
|
24
|
+
msg = getObjectValueByPath(fallbackMessages, path, null);
|
|
25
|
+
}
|
|
26
|
+
if (!msg) {
|
|
27
|
+
msg = key;
|
|
28
|
+
}
|
|
29
|
+
if (typeof msg !== 'string') {
|
|
30
|
+
msg = key;
|
|
31
|
+
}
|
|
32
|
+
return replaceParams(msg, params);
|
|
33
|
+
}
|
|
34
|
+
function number(value, options) {
|
|
35
|
+
const numberFormat = new Intl.NumberFormat([locale.value, fallbackLocale.value], options);
|
|
36
|
+
return numberFormat.format(value);
|
|
37
|
+
}
|
|
38
|
+
function getContext(props) {
|
|
39
|
+
const localLocale = useProvided(props, 'locale', locale);
|
|
40
|
+
const localFallbackLocale = useProvided(props, 'fallbackLocale', fallbackLocale);
|
|
41
|
+
const localMessages = useProvided(props, 'messages', messages);
|
|
42
|
+
const ctx = generateContext(localLocale, localFallbackLocale, localMessages);
|
|
43
|
+
return {
|
|
44
|
+
name: 'yuyeon',
|
|
45
|
+
locale,
|
|
46
|
+
fallbackLocale,
|
|
47
|
+
messages,
|
|
48
|
+
t: ctx.translate,
|
|
49
|
+
n: ctx.number,
|
|
50
|
+
getContext: ctx.getContext
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
translate,
|
|
55
|
+
number,
|
|
56
|
+
getContext
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function constructYuyeonI18nAdapter(options) {
|
|
60
|
+
const locale = shallowRef(options?.locale ?? 'en');
|
|
61
|
+
const fallbackLocale = shallowRef(options?.fallbackLocale ?? 'en');
|
|
62
|
+
const messages = ref({
|
|
63
|
+
en,
|
|
64
|
+
...options?.messages
|
|
65
|
+
});
|
|
66
|
+
const ctx = generateContext(locale, fallbackLocale, messages);
|
|
67
|
+
return {
|
|
68
|
+
name: 'yuyeon',
|
|
69
|
+
locale,
|
|
70
|
+
fallbackLocale,
|
|
71
|
+
messages,
|
|
72
|
+
t: ctx.translate,
|
|
73
|
+
n: ctx.number,
|
|
74
|
+
getContext: ctx.getContext
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=built-in.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"built-in.mjs","names":["ref","shallowRef","useProvided","en","getObjectValueByPath","LOCALE_PREFIX","replaceParams","str","params","replace","item","index","String","generateContext","locale","fallbackLocale","messages","translate","key","_len","arguments","length","Array","_key","startsWith","path","localeMessages","value","fallbackMessages","msg","number","options","numberFormat","Intl","NumberFormat","format","getContext","props","localLocale","localFallbackLocale","localMessages","ctx","name","t","n","constructYuyeonI18nAdapter"],"sources":["../../src/i18n/built-in.ts"],"sourcesContent":["import { ref, shallowRef } from 'vue';\r\nimport type { Ref } from 'vue';\r\n\r\nimport { useProvided } from '../composables';\r\nimport en from '../locales/en';\r\nimport { getObjectValueByPath } from '../util';\r\nimport type { LocaleMessages, LocaleModule, LocaleOptions } from './types';\r\n\r\nconst LOCALE_PREFIX = '$yuyeon';\r\n\r\nfunction replaceParams(str: string, params: unknown[]) {\r\n return str.replace(/\\{(\\d+)\\}/g, (item, index) => {\r\n return String(params[+index]);\r\n });\r\n}\r\n\r\nfunction generateContext(\r\n locale: Ref<string>,\r\n fallbackLocale: Ref<string>,\r\n messages: Ref<LocaleMessages>,\r\n) {\r\n function translate(key: string, ...params: unknown[]) {\r\n if (!key.startsWith(LOCALE_PREFIX)) {\r\n return replaceParams(key, params);\r\n }\r\n const path = key.replace(LOCALE_PREFIX, '');\r\n const localeMessages = locale.value && messages.value[locale.value];\r\n const fallbackMessages =\r\n fallbackLocale.value && messages.value[fallbackLocale.value];\r\n\r\n let msg: string = getObjectValueByPath(localeMessages, path, null);\r\n if (!msg) {\r\n msg = getObjectValueByPath(fallbackMessages, path, null);\r\n }\r\n if (!msg) {\r\n msg = key;\r\n }\r\n if (typeof msg !== 'string') {\r\n msg = key;\r\n }\r\n return replaceParams(msg, params);\r\n }\r\n\r\n function number(value: number, options?: Intl.NumberFormatOptions) {\r\n const numberFormat = new Intl.NumberFormat(\r\n [locale.value, fallbackLocale.value],\r\n options,\r\n );\r\n return numberFormat.format(value);\r\n }\r\n\r\n function getContext(props: LocaleOptions) {\r\n const localLocale = useProvided(props, 'locale', locale);\r\n const localFallbackLocale = useProvided(\r\n props,\r\n 'fallbackLocale',\r\n fallbackLocale,\r\n );\r\n const localMessages = useProvided(props, 'messages', messages);\r\n const ctx = generateContext(\r\n localLocale,\r\n localFallbackLocale,\r\n localMessages,\r\n );\r\n return {\r\n name: 'yuyeon',\r\n locale,\r\n fallbackLocale,\r\n messages,\r\n t: ctx.translate,\r\n n: ctx.number,\r\n getContext: ctx.getContext,\r\n };\r\n }\r\n\r\n return {\r\n translate,\r\n number,\r\n getContext,\r\n };\r\n}\r\n\r\nexport function constructYuyeonI18nAdapter(\r\n options?: LocaleOptions,\r\n): LocaleModule {\r\n const locale = shallowRef(options?.locale ?? 'en');\r\n const fallbackLocale = shallowRef(options?.fallbackLocale ?? 'en');\r\n const messages = ref({\r\n en,\r\n ...options?.messages,\r\n });\r\n\r\n const ctx = generateContext(locale, fallbackLocale, messages);\r\n\r\n return {\r\n name: 'yuyeon',\r\n locale,\r\n fallbackLocale,\r\n messages,\r\n t: ctx.translate,\r\n n: ctx.number,\r\n getContext: ctx.getContext,\r\n };\r\n}\r\n"],"mappings":"AAAA,SAASA,GAAG,EAAEC,UAAU,QAAQ,KAAK;AAAC,SAG7BC,WAAW;AAAA,OACbC,EAAE;AAAA,SACAC,oBAAoB;AAG7B,MAAMC,aAAa,GAAG,SAAS;AAE/B,SAASC,aAAaA,CAACC,GAAW,EAAEC,MAAiB,EAAE;EACrD,OAAOD,GAAG,CAACE,OAAO,CAAC,YAAY,EAAE,CAACC,IAAI,EAAEC,KAAK,KAAK;IAChD,OAAOC,MAAM,CAACJ,MAAM,CAAC,CAACG,KAAK,CAAC,CAAC;EAC/B,CAAC,CAAC;AACJ;AAEA,SAASE,eAAeA,CACtBC,MAAmB,EACnBC,cAA2B,EAC3BC,QAA6B,EAC7B;EACA,SAASC,SAASA,CAACC,GAAW,EAAwB;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAnBb,MAAM,OAAAc,KAAA,CAAAH,IAAA,OAAAA,IAAA,WAAAI,IAAA,MAAAA,IAAA,GAAAJ,IAAA,EAAAI,IAAA;MAANf,MAAM,CAAAe,IAAA,QAAAH,SAAA,CAAAG,IAAA;IAAA;IACvC,I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-US',
|
|
9
|
+
et: 'et-EE',
|
|
10
|
+
fa: 'fa-IR',
|
|
11
|
+
fi: 'fi-FI',
|
|
12
|
+
hr: 'hr-HR',
|
|
13
|
+
hu: 'hu-HU',
|
|
14
|
+
he: 'he-IL',
|
|
15
|
+
id: 'id-ID',
|
|
16
|
+
it: 'it-IT',
|
|
17
|
+
ja: 'ja-JP',
|
|
18
|
+
ko: 'ko-KR',
|
|
19
|
+
lv: 'lv-LV',
|
|
20
|
+
lt: 'lt-LT',
|
|
21
|
+
nl: 'nl-NL',
|
|
22
|
+
no: 'no-NO',
|
|
23
|
+
pl: 'pl-PL',
|
|
24
|
+
pt: 'pt-PT',
|
|
25
|
+
ro: 'ro-RO',
|
|
26
|
+
ru: 'ru-RU',
|
|
27
|
+
sk: 'sk-SK',
|
|
28
|
+
sl: 'sl-SI',
|
|
29
|
+
srCyrl: 'sr-SP',
|
|
30
|
+
srLatn: 'sr-SP',
|
|
31
|
+
sv: 'sv-SE',
|
|
32
|
+
th: 'th-TH',
|
|
33
|
+
tr: 'tr-TR',
|
|
34
|
+
az: 'az-AZ',
|
|
35
|
+
uk: 'uk-UA',
|
|
36
|
+
vi: 'vi-VN',
|
|
37
|
+
zhHans: 'zh-CN',
|
|
38
|
+
zhHant: 'zh-TW'
|
|
39
|
+
};
|
|
40
|
+
export const defaultRtl = {
|
|
41
|
+
af: false,
|
|
42
|
+
ar: true,
|
|
43
|
+
bg: false,
|
|
44
|
+
ca: false,
|
|
45
|
+
cs: false,
|
|
46
|
+
de: false,
|
|
47
|
+
el: false,
|
|
48
|
+
en: false,
|
|
49
|
+
es: false,
|
|
50
|
+
et: false,
|
|
51
|
+
fa: true,
|
|
52
|
+
fi: false,
|
|
53
|
+
fr: false,
|
|
54
|
+
hr: false,
|
|
55
|
+
hu: false,
|
|
56
|
+
he: true,
|
|
57
|
+
id: false,
|
|
58
|
+
it: false,
|
|
59
|
+
ja: false,
|
|
60
|
+
ko: false,
|
|
61
|
+
lv: false,
|
|
62
|
+
lt: false,
|
|
63
|
+
nl: false,
|
|
64
|
+
no: false,
|
|
65
|
+
pl: false,
|
|
66
|
+
pt: false,
|
|
67
|
+
ro: false,
|
|
68
|
+
ru: false,
|
|
69
|
+
sk: false,
|
|
70
|
+
sl: false,
|
|
71
|
+
srCyrl: false,
|
|
72
|
+
srLatn: false,
|
|
73
|
+
sv: false,
|
|
74
|
+
th: false,
|
|
75
|
+
tr: false,
|
|
76
|
+
az: false,
|
|
77
|
+
uk: false,
|
|
78
|
+
vi: false,
|
|
79
|
+
zhHans: false,
|
|
80
|
+
zhHant: false
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=config.mjs.map
|