yuyeon 0.1.1-rc.3 → 0.1.1-rc.4
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/yuyeon.js +805 -803
- package/dist/yuyeon.umd.cjs +5 -5
- package/lib/index.mjs +25 -8
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -44,22 +44,39 @@ export function init() {
|
|
|
44
44
|
app.provide(YUYEON_DATE_KEY, dateModule.instance);
|
|
45
45
|
app.config.globalProperties.$yuyeon = yuyeon;
|
|
46
46
|
nextTick(() => {
|
|
47
|
-
yuyeon.app = app._instance;
|
|
48
47
|
yuyeon.root = app._container;
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
yuyeon.app = app._instance;
|
|
49
|
+
if (yuyeon.root) {
|
|
50
|
+
yuyeon.root.classList.add('y-root');
|
|
51
|
+
yuyeon.root.setAttribute('data-y-root', '');
|
|
52
|
+
themeModule.init(yuyeon);
|
|
51
53
|
}
|
|
52
|
-
const $el = yuyeon.root;
|
|
53
|
-
$el.classList.add('y-root');
|
|
54
|
-
$el.setAttribute('data-y-root', '');
|
|
55
|
-
themeModule.init(yuyeon);
|
|
56
54
|
});
|
|
57
55
|
if (options?.credit) {
|
|
58
56
|
console.log(YUYEON_LOGO);
|
|
59
57
|
}
|
|
60
58
|
const {
|
|
61
|
-
unmount
|
|
59
|
+
unmount,
|
|
60
|
+
mount
|
|
62
61
|
} = app;
|
|
62
|
+
app.mount = function () {
|
|
63
|
+
const vm = mount(...arguments);
|
|
64
|
+
if (!yuyeon.app) {
|
|
65
|
+
yuyeon.app = app._instance;
|
|
66
|
+
}
|
|
67
|
+
if (!yuyeon.root) {
|
|
68
|
+
nextTick(() => {
|
|
69
|
+
yuyeon.root = app._container;
|
|
70
|
+
if (yuyeon.root) {
|
|
71
|
+
yuyeon.root.classList.add('y-root');
|
|
72
|
+
yuyeon.root.setAttribute('data-y-root', '');
|
|
73
|
+
themeModule.init(yuyeon);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
app.mount = mount;
|
|
78
|
+
return vm;
|
|
79
|
+
};
|
|
63
80
|
app.unmount = () => {
|
|
64
81
|
unmount();
|
|
65
82
|
themeModule.scope.stop();
|
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["getCurrentInstance","nextTick","reactive","components","YUYEON_DATE_KEY","YUYEON_DATE_OPTIONS_KEY","createDateModule","createI18nModule","YUYEON_I18N_KEY","YUYEON_ICON_KEY","createIconModule","YUYEON_THEME_KEY","createThemeModule","useTheme","PlateWave","YUYEON_LOGO","defaultOptions","credit","init","options","arguments","length","undefined","themeModule","theme","i18nModule","i18n","dateModule","date","localeModule","iconModule","icon","install","app","yuyeon","root","instance","rtlModule","Object","keys","forEach","componentName","comp","component","directive","provide","config","globalProperties","$yuyeon","
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["getCurrentInstance","nextTick","reactive","components","YUYEON_DATE_KEY","YUYEON_DATE_OPTIONS_KEY","createDateModule","createI18nModule","YUYEON_I18N_KEY","YUYEON_ICON_KEY","createIconModule","YUYEON_THEME_KEY","createThemeModule","useTheme","PlateWave","YUYEON_LOGO","defaultOptions","credit","init","options","arguments","length","undefined","themeModule","theme","i18nModule","i18n","dateModule","date","localeModule","iconModule","icon","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 { Component, ComponentInternalInstance } from '@vue/runtime-core';\r\nimport type { App } from 'vue';\r\nimport { getCurrentInstance, nextTick, reactive } from 'vue';\r\n\r\nimport * as components 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 { 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\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 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 install = (app: App): any => {\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 });\r\n\r\n Object.keys(components).forEach((componentName) => {\r\n const comp = components[componentName as keyof typeof components];\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_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\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":"AAEA,SAASA,kBAAkB,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,KAAK;AAAC,OAEtD,KAAKC,UAAU;AAAA,SAEpBC,eAAe,EACfC,uBAAuB,EACvBC,gBAAgB;AAAA,SAETC,gBAAgB;AAAA,SAChBC,eAAe;AAAA,SACfC,eAAe,EAAEC,gBAAgB;AAAA,SAExCC,gBAAgB,EAChBC,iBAAiB,EACjBC,QAAQ;AAAA,OAEHC,SAAS;AAAA,SACPC,WAAW,2BAEpB;AACA;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,WAAW,GAAGX,iBAAiB,CAACO,OAAO,EAAEK,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