swico 2.4.0-beta.2 → 2.4.0-beta.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swico",
3
- "version": "2.4.0-beta.2",
3
+ "version": "2.4.0-beta.3",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -6,25 +6,7 @@ export { RouterView as Outlet } from 'vue-router';
6
6
  export { useLocation, useNav } from './project-path/.swico-vue/vue-hooks';
7
7
  export { history } from './mock-history';
8
8
  export type { GlobalSwicoConfigType };
9
- export declare const Link: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
10
- to: {
11
- type: StringConstructor;
12
- };
13
- replace: {
14
- type: BooleanConstructor;
15
- };
16
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
17
- to: {
18
- type: StringConstructor;
19
- };
20
- replace: {
21
- type: BooleanConstructor;
22
- };
23
- }>> & Readonly<{}>, {
24
- replace: boolean;
25
- }, {}, {
26
- RouterLink: import("vue-router")._RouterLinkI;
27
- }, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
9
+ export { default as Link } from './project-path/.swico-vue/Link';
28
10
  export interface DefineSwicoConfigType {
29
11
  (env: 'base', config: CustomConfigType['base']): any;
30
12
  (env: 'dev', config: CustomConfigType['dev']): any;
package/src/index.vue.js CHANGED
@@ -1,29 +1,18 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.defineGlobal = exports.defineConfig = exports.Link = exports.history = exports.useNav = exports.useLocation = exports.Outlet = void 0;
4
- const vue_1 = require("vue");
5
- const vue_router_1 = require("vue-router");
6
- var vue_router_2 = require("vue-router");
7
- Object.defineProperty(exports, "Outlet", { enumerable: true, get: function () { return vue_router_2.RouterView; } });
7
+ var vue_router_1 = require("vue-router");
8
+ Object.defineProperty(exports, "Outlet", { enumerable: true, get: function () { return vue_router_1.RouterView; } });
8
9
  var vue_hooks_1 = require("./project-path/.swico-vue/vue-hooks");
9
10
  Object.defineProperty(exports, "useLocation", { enumerable: true, get: function () { return vue_hooks_1.useLocation; } });
10
11
  Object.defineProperty(exports, "useNav", { enumerable: true, get: function () { return vue_hooks_1.useNav; } });
11
12
  var mock_history_1 = require("./mock-history");
12
13
  Object.defineProperty(exports, "history", { enumerable: true, get: function () { return mock_history_1.history; } });
13
- exports.Link = (0, vue_1.defineComponent)({
14
- components: {
15
- RouterLink: vue_router_1.RouterLink
16
- },
17
- props: {
18
- to: {
19
- type: String
20
- },
21
- replace: {
22
- type: Boolean
23
- }
24
- },
25
- template: '<RouterLink :to="to" :replace="replace" ><slot></slot></RouterLink>'
26
- });
14
+ var Link_1 = require("./project-path/.swico-vue/Link");
15
+ Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return __importDefault(Link_1).default; } });
27
16
  const defineConfig = (env, config) => config;
28
17
  exports.defineConfig = defineConfig;
29
18
  const defineGlobal = (config) => config;
@@ -1,10 +1,11 @@
1
1
  import { CSSProperties, FC, ReactNode } from 'react';
2
- import { UseNavType } from '../../typings/global-type';
3
- declare const Link: FC<{
2
+ import { SwicoHistoryOptionType } from '../../typings/global-type';
3
+ interface PropsType {
4
4
  replace?: boolean;
5
- to: Parameters<ReturnType<UseNavType>>[0];
5
+ to: string | number | SwicoHistoryOptionType;
6
6
  style?: CSSProperties;
7
7
  className?: string;
8
8
  children: ReactNode;
9
- }>;
9
+ }
10
+ declare const Link: FC<PropsType>;
10
11
  export default Link;
@@ -0,0 +1,26 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ to: {
3
+ type: ObjectConstructor;
4
+ required: true;
5
+ };
6
+ replace: {
7
+ type: BooleanConstructor;
8
+ };
9
+ }>, {
10
+ nav: {
11
+ (to: string, options?: import("../../typings/global-type").NavOptionsType): void;
12
+ (to: number): void;
13
+ (to: import("../../typings/global-type").SwicoHistoryOptionType, options?: import("../../typings/global-type").NavOptionsType): void;
14
+ };
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
16
+ to: {
17
+ type: ObjectConstructor;
18
+ required: true;
19
+ };
20
+ replace: {
21
+ type: BooleanConstructor;
22
+ };
23
+ }>> & Readonly<{}>, {
24
+ replace: boolean;
25
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
26
+ export default _default;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vue_1 = require("vue");
4
+ const vue_hooks_1 = require("./vue-hooks");
5
+ exports.default = (0, vue_1.defineComponent)({
6
+ name: 'Link',
7
+ props: {
8
+ to: {
9
+ type: Object,
10
+ required: true
11
+ },
12
+ replace: {
13
+ type: Boolean
14
+ }
15
+ },
16
+ setup(props) {
17
+ const nav = (0, vue_hooks_1.useNav)();
18
+ return { nav };
19
+ },
20
+ template: ` <a
21
+ @click="
22
+ () => {
23
+ nav(to, { replace });
24
+ }
25
+ "
26
+ >
27
+ <slot></slot>
28
+ </a>`
29
+ });
@@ -142,14 +142,6 @@ const initCliIndexFile = (templateType, env) => __awaiter(void 0, void 0, void 0
142
142
  .resolve(projectPath, './.swico/react-hooks')
143
143
  .replaceAll('\\', '/');
144
144
  replaceFileText = replaceFileText.replaceAll('require("./project-path/.swico-react/react-hooks");', `require("${formatHooksPath}");`);
145
- }
146
- if (templateType === 'react') {
147
- const formatHooksPath = path_1.default
148
- .resolve(projectPath, './.swico/react-hooks')
149
- .replaceAll('\\', '/');
150
- replaceFileText = replaceFileText.replaceAll('require("./project-path/.swico-react/react-hooks");', `require("${formatHooksPath}");`);
151
- }
152
- if (templateType === 'react') {
153
145
  const formatLinkComponentPath = path_1.default
154
146
  .resolve(projectPath, './.swico/Link')
155
147
  .replaceAll('\\', '/');
@@ -256,6 +248,7 @@ const initTemplateConfig = (routerConfig, templateType, env) => {
256
248
  'react-hooks.js',
257
249
  'vue-hooks.js',
258
250
  'Link.js',
251
+ 'Link.vue',
259
252
  'loading.js',
260
253
  'Container.vue'
261
254
  ].includes(fileName));