@kong/kongponents 9.44.1-pr.2962.c6edd95.0 → 9.45.2-pr.2962.134ff71.0
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/kongponents.css +1 -1
- package/dist/kongponents.es.js +4479 -4479
- package/dist/kongponents.umd.js +16 -16
- package/dist/nuxt/index.js +69 -0
- package/dist/nuxt/runtime/composables/useToast.js +27 -0
- package/dist/types/nuxt/index.d.ts +25 -0
- package/dist/types/nuxt/runtime/composables/useToast.d.ts +4 -0
- package/dist/types/types/table.d.ts +1 -1
- package/package.json +16 -9
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { defineNuxtModule, createResolver, addComponent, useLogger, addImportsDir } from '@nuxt/kit';
|
|
2
|
+
import { components } from '@kong/kongponents';
|
|
3
|
+
// Components that should always be excluded from auto-registration
|
|
4
|
+
const ALWAYS_EXCLUDE_COMPONENTS = ['ToastManager', 'KTable', 'KModalFullscreen', 'KDropdownMenu'];
|
|
5
|
+
export default defineNuxtModule({
|
|
6
|
+
meta: {
|
|
7
|
+
name: '@kong/kongponents',
|
|
8
|
+
configKey: 'kongponents',
|
|
9
|
+
},
|
|
10
|
+
defaults: {
|
|
11
|
+
components: {
|
|
12
|
+
include: [],
|
|
13
|
+
exclude: [],
|
|
14
|
+
},
|
|
15
|
+
composables: true,
|
|
16
|
+
},
|
|
17
|
+
setup(options, nuxt) {
|
|
18
|
+
const { resolve } = createResolver(import.meta.url);
|
|
19
|
+
const logger = useLogger('kongponents');
|
|
20
|
+
// Register the styles
|
|
21
|
+
nuxt.options.css.push('@kong/kongponents/dist/style.css');
|
|
22
|
+
if (options.composables) {
|
|
23
|
+
// Register composables
|
|
24
|
+
addImportsDir(resolve('./runtime/composables'));
|
|
25
|
+
}
|
|
26
|
+
// Define a list of components that should be auto-registered.
|
|
27
|
+
const includeList = options.components?.include || [];
|
|
28
|
+
// Define a list of components that should never be auto-registered.
|
|
29
|
+
const excludeList = [...ALWAYS_EXCLUDE_COMPONENTS, ...(options.components?.exclude || [])];
|
|
30
|
+
const filteredComponents = Object.keys(components).filter((name) =>
|
|
31
|
+
// Only include components that start with 'K' (e.g., KButton)
|
|
32
|
+
name.startsWith('K')
|
|
33
|
+
// If an include list is provided, only keep those in the list
|
|
34
|
+
&& (includeList.length === 0 || includeList.includes(name))
|
|
35
|
+
// Exclude any components explicitly listed in the exclude list
|
|
36
|
+
&& !excludeList.includes(name));
|
|
37
|
+
if (filteredComponents.length === 0) {
|
|
38
|
+
logger.warn('⚠️ No Kongponents components were registered. Check your include/exclude config.');
|
|
39
|
+
}
|
|
40
|
+
filteredComponents.forEach((name) => {
|
|
41
|
+
addComponent({
|
|
42
|
+
name,
|
|
43
|
+
export: name,
|
|
44
|
+
filePath: '@kong/kongponents',
|
|
45
|
+
// we don't need global registration here
|
|
46
|
+
global: false,
|
|
47
|
+
// 'all' means both client and server
|
|
48
|
+
mode: 'all',
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Integrate with Nuxt DevTools by adding a "Kongponents" tab.
|
|
53
|
+
* This gives quick access to documentation within the DevTools UI.
|
|
54
|
+
*/
|
|
55
|
+
// @ts-ignore - nuxt types are missing devtools hook
|
|
56
|
+
nuxt.hook('devtools:customTabs', (tabs) => {
|
|
57
|
+
tabs.push({
|
|
58
|
+
name: 'kongponents',
|
|
59
|
+
title: 'Kongponents',
|
|
60
|
+
icon: 'https://kongponents.konghq.com/img/kong-logomark.png',
|
|
61
|
+
view: {
|
|
62
|
+
type: 'iframe',
|
|
63
|
+
src: 'https://kongponents.konghq.com',
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
logger.success('🚀 Kongponents module has been registered.');
|
|
68
|
+
},
|
|
69
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { onBeforeUnmount } from 'vue';
|
|
2
|
+
import { ToastManager } from '@kong/kongponents';
|
|
3
|
+
/** The default toaster configuration */
|
|
4
|
+
const defaultToastConfig = {
|
|
5
|
+
key: 'kongponents-toast',
|
|
6
|
+
appearance: 'success',
|
|
7
|
+
message: 'Success',
|
|
8
|
+
timeoutMilliseconds: 3000,
|
|
9
|
+
};
|
|
10
|
+
export function useToast() {
|
|
11
|
+
// Initialize the toast manager; stub out the `open` and `destroy` methods on the server
|
|
12
|
+
const toast = import.meta.client ? new ToastManager() : { open: () => { }, destroy: () => { } };
|
|
13
|
+
const showToast = async (notification) => {
|
|
14
|
+
if (import.meta.client) {
|
|
15
|
+
toast.open({
|
|
16
|
+
...defaultToastConfig,
|
|
17
|
+
...notification,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
onBeforeUnmount(() => {
|
|
22
|
+
toast.destroy();
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
showToast,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { components } from '@kong/kongponents';
|
|
2
|
+
type ComponentKeys = keyof typeof components;
|
|
3
|
+
type ExcludedComponentKeys = Exclude<ComponentKeys, 'ToastManager' | 'KTable' | 'KModalFullscreen' | 'KDropdownMenu'>;
|
|
4
|
+
export interface ModuleOptions {
|
|
5
|
+
components?: {
|
|
6
|
+
/**
|
|
7
|
+
* List of component names to include in auto-registration. If unset or empty, all components will be included.
|
|
8
|
+
* @default []
|
|
9
|
+
*/
|
|
10
|
+
include?: ComponentKeys[];
|
|
11
|
+
/**
|
|
12
|
+
* List of component names to exclude from automatic registration
|
|
13
|
+
* @default []
|
|
14
|
+
*/
|
|
15
|
+
exclude?: ExcludedComponentKeys[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Whether to register provided composables.
|
|
19
|
+
* For example, you can access the included `useToast` composable.
|
|
20
|
+
* @default true
|
|
21
|
+
*/
|
|
22
|
+
composables?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const _default: import("nuxt/schema").NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
25
|
+
export default _default;
|
|
@@ -93,7 +93,7 @@ export type TableState = 'loading' | 'error' | 'success' | 'empty';
|
|
|
93
93
|
export interface TableSortPayload<Key extends string = string> {
|
|
94
94
|
prevKey: Key | '';
|
|
95
95
|
sortColumnKey: Key | '';
|
|
96
|
-
sortColumnOrder: SortColumnOrder
|
|
96
|
+
sortColumnOrder: SortColumnOrder;
|
|
97
97
|
}
|
|
98
98
|
export interface TableStatePayload {
|
|
99
99
|
state: TableState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong/kongponents",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.45.2-pr.2962.134ff71.0",
|
|
4
4
|
"description": "Kong Component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"import": "./dist/kongponents.es.js",
|
|
23
23
|
"require": "./dist/kongponents.umd.js"
|
|
24
24
|
},
|
|
25
|
+
"./nuxt": {
|
|
26
|
+
"import": "./dist/nuxt/index.js",
|
|
27
|
+
"types": "./dist/types/nuxt/index.d.ts"
|
|
28
|
+
},
|
|
25
29
|
"./dist/style.css": "./dist/kongponents.css",
|
|
26
30
|
"./package.json": "./package.json",
|
|
27
31
|
"./dist/*": "./dist/*"
|
|
@@ -44,7 +48,7 @@
|
|
|
44
48
|
},
|
|
45
49
|
"peerDependencies": {
|
|
46
50
|
"vue": ">= 3.5.0 < 4",
|
|
47
|
-
"vue-router": "^4.6.
|
|
51
|
+
"vue-router": "^4.6.3"
|
|
48
52
|
},
|
|
49
53
|
"devDependencies": {
|
|
50
54
|
"@babel/types": "^7.28.4",
|
|
@@ -53,15 +57,16 @@
|
|
|
53
57
|
"@cypress/vite-dev-server": "^6.0.3",
|
|
54
58
|
"@digitalroute/cz-conventional-changelog-for-jira": "^8.0.1",
|
|
55
59
|
"@evilmartians/lefthook": "^1.13.6",
|
|
56
|
-
"@kong-ui-public/sandbox-layout": "^2.3.
|
|
60
|
+
"@kong-ui-public/sandbox-layout": "^2.3.6",
|
|
57
61
|
"@kong/design-tokens": "^1.18.1",
|
|
58
62
|
"@kong/eslint-config-kong-ui": "1.5.1",
|
|
63
|
+
"@nuxt/kit": "^4.1.3",
|
|
59
64
|
"@semantic-release/changelog": "^6.0.3",
|
|
60
65
|
"@semantic-release/git": "^10.0.1",
|
|
61
66
|
"@stylistic/stylelint-plugin": "^4.0.0",
|
|
62
67
|
"@types/inquirer": "^9.0.7",
|
|
63
68
|
"@types/lodash-es": "^4.17.12",
|
|
64
|
-
"@types/node": "^22.18.
|
|
69
|
+
"@types/node": "^22.18.11",
|
|
65
70
|
"@types/sortablejs": "^1.15.8",
|
|
66
71
|
"@vitejs/plugin-vue": "^5.2.4",
|
|
67
72
|
"@vue/compiler-core": "^3.5.22",
|
|
@@ -79,12 +84,13 @@
|
|
|
79
84
|
"inquirer": "^9.3.6",
|
|
80
85
|
"nanospinner": "^1.2.2",
|
|
81
86
|
"node-emoji": "^2.2.0",
|
|
87
|
+
"nuxt": "^4.1.3",
|
|
82
88
|
"picocolors": "^1.1.1",
|
|
83
89
|
"postcss-cli": "^11.0.1",
|
|
84
90
|
"postcss-custom-properties": "^14.0.6",
|
|
85
91
|
"postcss-html": "^1.8.0",
|
|
86
92
|
"rimraf": "^6.0.1",
|
|
87
|
-
"rollup-plugin-visualizer": "^6.0.
|
|
93
|
+
"rollup-plugin-visualizer": "^6.0.5",
|
|
88
94
|
"sass": "^1.93.2",
|
|
89
95
|
"semantic-release": "^24.2.9",
|
|
90
96
|
"shiki": "^3.13.0",
|
|
@@ -96,11 +102,11 @@
|
|
|
96
102
|
"stylelint-order": "^7.0.0",
|
|
97
103
|
"tsc-alias": "^1.8.16",
|
|
98
104
|
"typescript": "^5.9.3",
|
|
99
|
-
"vite": "^6.
|
|
105
|
+
"vite": "^6.4.0",
|
|
100
106
|
"vite-plugin-vue-devtools": "^7.7.7",
|
|
101
107
|
"vitepress": "^1.6.4",
|
|
102
108
|
"vue": "^3.5.22",
|
|
103
|
-
"vue-router": "^4.6.
|
|
109
|
+
"vue-router": "^4.6.3",
|
|
104
110
|
"vue-tsc": "^2.2.12"
|
|
105
111
|
},
|
|
106
112
|
"resolutions": {
|
|
@@ -162,7 +168,7 @@
|
|
|
162
168
|
},
|
|
163
169
|
"volta": {
|
|
164
170
|
"node": "24.10.0",
|
|
165
|
-
"pnpm": "10.18.
|
|
171
|
+
"pnpm": "10.18.3"
|
|
166
172
|
},
|
|
167
173
|
"config": {
|
|
168
174
|
"commitizen": {
|
|
@@ -177,7 +183,8 @@
|
|
|
177
183
|
"scripts": {
|
|
178
184
|
"build:cli": "rimraf ./bin && tsc --project ./cli/tsconfig.json && chmod u+x ./bin/index.js",
|
|
179
185
|
"build:docs": "vitepress build docs",
|
|
180
|
-
"build:kongponents": "pnpm typecheck && vite build && vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly && tsc-alias -p './tsconfig.build.json'",
|
|
186
|
+
"build:kongponents": "pnpm typecheck && vite build && vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly && tsc-alias -p './tsconfig.build.json' && pnpm build:nuxt",
|
|
187
|
+
"build:nuxt": "tsc -p ./tsconfig.build.nuxt.json --outDir dist/nuxt",
|
|
181
188
|
"build:visualize": "cross-env-shell BUILD_VISUALIZER=true vite build -m production",
|
|
182
189
|
"build": "pnpm build:cli && pnpm stylelint && pnpm lint && pnpm build:kongponents && pnpm build:docs",
|
|
183
190
|
"build:ci": "pnpm build:kongponents && pnpm build:docs",
|