@kong/kongponents 9.28.1 → 9.28.2-pr.2684.3fe2fcabf.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.
@@ -1,273 +1,18 @@
1
- import type { PropType } from 'vue';
2
- import type { CodeBlockEventData, Theme } from '../../../types';
3
- type __VLS_Slots = {
4
- /**
5
- * Additional actions to be displayed in the code block.
6
- */
7
- 'secondary-actions': void;
8
- };
9
- declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
10
- /**
11
- * ID value used for form elements like the search input and its label.
12
- */
13
- id: {
14
- type: StringConstructor;
15
- required: true;
16
- };
17
- /**
18
- * The code that will be rendered as a text node inside of a `<pre><code></code></pre>` fragment.
19
- */
20
- code: {
21
- type: StringConstructor;
22
- required: true;
23
- };
24
- /**
25
- * The syntax language of `props.code` (e.g. `'json'`).
26
- */
27
- language: {
28
- type: StringConstructor;
29
- required: true;
30
- };
31
- /**
32
- * Whether filter mode is initially active. **Default: `false`**.
33
- */
34
- initialFilterMode: {
35
- type: BooleanConstructor;
36
- required: false;
37
- default: boolean;
38
- };
39
- /**
40
- * Whether regular expression mode is initially active. **Default: `false`**.
41
- */
42
- initialRegExpMode: {
43
- type: BooleanConstructor;
44
- required: false;
45
- default: boolean;
46
- };
47
- /**
48
- * Shows an actions bar with a search input and related action buttons. **Default: `false`**.
49
- */
50
- searchable: {
51
- type: BooleanConstructor;
52
- required: false;
53
- default: boolean;
54
- };
55
- /**
56
- * The line numbers for the lines to highlight by default. **Default: `[]`**.
57
- */
58
- highlightedLineNumbers: {
59
- type: PropType<string | (number | [number, number])[]>;
60
- default: () => never[];
61
- validator: (value: string | (number | [number, number])[]) => boolean;
62
- };
63
- /**
64
- * Allows controlling the processing state from outside the component. This allows a parent component to show the processing icon when it’s, for example, currently syntax highlighting the code. **Default: `false`**.
65
- */
66
- processing: {
67
- type: BooleanConstructor;
68
- required: false;
69
- default: boolean;
70
- };
71
- /**
72
- * Used as the initial value of the search input. Can be used to initialize a code block with a query which was read from client storage. **Default: `''`**.
73
- */
74
- query: {
75
- type: StringConstructor;
76
- required: false;
77
- default: string;
78
- };
79
- /**
80
- * Controls whether to show a copy button. It copies the original code (i.e. the value of `props.code`) to the clipboard. **Default: `true`**.
81
- */
82
- showCopyButton: {
83
- type: BooleanConstructor;
84
- required: false;
85
- default: boolean;
86
- };
87
- /**
88
- * Controls whether to show line numbers. **Default: `true`**.
89
- */
90
- showLineNumbers: {
91
- type: BooleanConstructor;
92
- required: false;
93
- default: boolean;
94
- };
95
- /**
96
- * Controls whether to add links to the current line number. **Default: `false`**.
97
- */
98
- showLineNumberLinks: {
99
- type: BooleanConstructor;
100
- required: false;
101
- default: boolean;
102
- };
103
- /**
104
- * Controls the color scheme of the component. **Default: `light`**.
105
- */
106
- theme: {
107
- type: PropType<Theme>;
108
- required: false;
109
- default: string;
110
- };
111
- /**
112
- * Displays the code on a single line. **Default: `false`**.
113
- */
114
- singleLine: {
115
- type: BooleanConstructor;
116
- required: false;
117
- default: boolean;
118
- };
119
- /**
120
- * The max-height of the code block. **Default: `none`**.
121
- */
122
- maxHeight: {
123
- type: StringConstructor;
124
- required: false;
125
- default: string;
126
- };
127
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
128
- "code-block-render": (data: CodeBlockEventData) => any;
129
- "matching-lines-change": (data: CodeBlockEventData) => any;
130
- "query-change": (data: string) => any;
131
- "filter-mode-change": (data: boolean) => any;
132
- "reg-exp-mode-change": (data: boolean) => any;
133
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
134
- /**
135
- * ID value used for form elements like the search input and its label.
136
- */
137
- id: {
138
- type: StringConstructor;
139
- required: true;
140
- };
141
- /**
142
- * The code that will be rendered as a text node inside of a `<pre><code></code></pre>` fragment.
143
- */
144
- code: {
145
- type: StringConstructor;
146
- required: true;
147
- };
148
- /**
149
- * The syntax language of `props.code` (e.g. `'json'`).
150
- */
151
- language: {
152
- type: StringConstructor;
153
- required: true;
154
- };
155
- /**
156
- * Whether filter mode is initially active. **Default: `false`**.
157
- */
158
- initialFilterMode: {
159
- type: BooleanConstructor;
160
- required: false;
161
- default: boolean;
162
- };
163
- /**
164
- * Whether regular expression mode is initially active. **Default: `false`**.
165
- */
166
- initialRegExpMode: {
167
- type: BooleanConstructor;
168
- required: false;
169
- default: boolean;
170
- };
171
- /**
172
- * Shows an actions bar with a search input and related action buttons. **Default: `false`**.
173
- */
174
- searchable: {
175
- type: BooleanConstructor;
176
- required: false;
177
- default: boolean;
178
- };
179
- /**
180
- * The line numbers for the lines to highlight by default. **Default: `[]`**.
181
- */
182
- highlightedLineNumbers: {
183
- type: PropType<string | (number | [number, number])[]>;
184
- default: () => never[];
185
- validator: (value: string | (number | [number, number])[]) => boolean;
186
- };
187
- /**
188
- * Allows controlling the processing state from outside the component. This allows a parent component to show the processing icon when it’s, for example, currently syntax highlighting the code. **Default: `false`**.
189
- */
190
- processing: {
191
- type: BooleanConstructor;
192
- required: false;
193
- default: boolean;
194
- };
195
- /**
196
- * Used as the initial value of the search input. Can be used to initialize a code block with a query which was read from client storage. **Default: `''`**.
197
- */
198
- query: {
199
- type: StringConstructor;
200
- required: false;
201
- default: string;
202
- };
203
- /**
204
- * Controls whether to show a copy button. It copies the original code (i.e. the value of `props.code`) to the clipboard. **Default: `true`**.
205
- */
206
- showCopyButton: {
207
- type: BooleanConstructor;
208
- required: false;
209
- default: boolean;
210
- };
211
- /**
212
- * Controls whether to show line numbers. **Default: `true`**.
213
- */
214
- showLineNumbers: {
215
- type: BooleanConstructor;
216
- required: false;
217
- default: boolean;
218
- };
219
- /**
220
- * Controls whether to add links to the current line number. **Default: `false`**.
221
- */
222
- showLineNumberLinks: {
223
- type: BooleanConstructor;
224
- required: false;
225
- default: boolean;
226
- };
227
- /**
228
- * Controls the color scheme of the component. **Default: `light`**.
229
- */
230
- theme: {
231
- type: PropType<Theme>;
232
- required: false;
233
- default: string;
234
- };
235
- /**
236
- * Displays the code on a single line. **Default: `false`**.
237
- */
238
- singleLine: {
239
- type: BooleanConstructor;
240
- required: false;
241
- default: boolean;
242
- };
243
- /**
244
- * The max-height of the code block. **Default: `none`**.
245
- */
246
- maxHeight: {
247
- type: StringConstructor;
248
- required: false;
249
- default: string;
250
- };
251
- }>> & Readonly<{
252
- "onCode-block-render"?: ((data: CodeBlockEventData) => any) | undefined;
253
- "onMatching-lines-change"?: ((data: CodeBlockEventData) => any) | undefined;
254
- "onQuery-change"?: ((data: string) => any) | undefined;
255
- "onFilter-mode-change"?: ((data: boolean) => any) | undefined;
256
- "onReg-exp-mode-change"?: ((data: boolean) => any) | undefined;
257
- }>, {
258
- maxHeight: string;
259
- theme: Theme;
260
- initialFilterMode: boolean;
261
- initialRegExpMode: boolean;
262
- searchable: boolean;
263
- highlightedLineNumbers: string | (number | [number, number])[];
264
- processing: boolean;
265
- query: string;
266
- showCopyButton: boolean;
267
- showLineNumbers: boolean;
268
- showLineNumberLinks: boolean;
269
- singleLine: boolean;
270
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ import type { CodeBlockProps, CodeBlockSlots, CodeBlockEventData } from '../../../types';
2
+ type __VLS_Slots = CodeBlockSlots;
3
+ declare const __VLS_component: import("vue").DefineComponent<CodeBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
4
+ "code-block-render": (evt: CodeBlockEventData) => any;
5
+ "matching-lines-change": (evt: CodeBlockEventData) => any;
6
+ "query-change": (query: string) => any;
7
+ "filter-mode-change": (on: boolean) => any;
8
+ "reg-exp-mode-change": (on: boolean) => any;
9
+ }, string, import("vue").PublicProps, Readonly<CodeBlockProps> & Readonly<{
10
+ "onCode-block-render"?: ((evt: CodeBlockEventData) => any) | undefined;
11
+ "onMatching-lines-change"?: ((evt: CodeBlockEventData) => any) | undefined;
12
+ "onQuery-change"?: ((query: string) => any) | undefined;
13
+ "onFilter-mode-change"?: ((on: boolean) => any) | undefined;
14
+ "onReg-exp-mode-change"?: ((on: boolean) => any) | undefined;
15
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
271
16
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
272
17
  export default _default;
273
18
  type __VLS_WithSlots<T, S> = T & {
@@ -1,44 +1,25 @@
1
- import { type PropType } from 'vue';
2
- import type { Theme } from '../../../types';
3
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
- theme: {
5
- type: PropType<Theme>;
6
- default: string;
7
- };
8
- active: {
9
- type: BooleanConstructor;
10
- default: boolean;
11
- };
12
- /**
13
- * Only pass tooltip text if it's the copy button
14
- */
15
- copyTooltip: {
16
- type: StringConstructor;
17
- default: string;
18
- };
19
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
- theme: {
21
- type: PropType<Theme>;
22
- default: string;
23
- };
24
- active: {
25
- type: BooleanConstructor;
26
- default: boolean;
27
- };
28
- /**
29
- * Only pass tooltip text if it's the copy button
30
- */
31
- copyTooltip: {
32
- type: StringConstructor;
33
- default: string;
34
- };
35
- }>> & Readonly<{}>, {
36
- active: boolean;
37
- theme: Theme;
38
- copyTooltip: string;
39
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
40
- default?: ((props: {}) => any) | undefined;
1
+ import type { CodeBlockIconButtonProps } from '../../../types';
2
+ import KButton from '../../components/KButton/KButton.vue';
3
+ import KTooltip from '../../components/KTooltip/KTooltip.vue';
4
+ declare const copyTooltipText: import("vue").Ref<string, string>;
5
+ declare const attrs: {
6
+ [x: string]: unknown;
7
+ };
8
+ declare const onClick: () => void;
9
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
10
+ declare var __VLS_12: {};
11
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
12
+ default?: (props: typeof __VLS_12) => any;
41
13
  }>;
14
+ declare const __VLS_self: import("vue").DefineComponent<CodeBlockIconButtonProps, {
15
+ KButton: typeof KButton;
16
+ KTooltip: typeof KTooltip;
17
+ copyTooltipText: typeof copyTooltipText;
18
+ attrs: typeof attrs;
19
+ onClick: typeof onClick;
20
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CodeBlockIconButtonProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ declare const __VLS_component: import("vue").DefineComponent<CodeBlockIconButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CodeBlockIconButtonProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
42
23
  export default _default;
43
24
  type __VLS_WithSlots<T, S> = T & {
44
25
  new (): {
@@ -8,3 +8,117 @@ export interface CodeBlockEventData {
8
8
  }
9
9
  export type Theme = 'light' | 'dark';
10
10
  export type CommandKeywords = 'toggleFilterMode' | 'toggleRegExpMode' | 'jumpToNextMatch' | 'jumpToPreviousMatch' | 'copyCode';
11
+ /**
12
+ * @internal
13
+ */
14
+ export interface CodeBlockIconButtonProps {
15
+ theme?: Theme;
16
+ active?: boolean;
17
+ /**
18
+ * Only pass tooltip text if it's the copy button
19
+ */
20
+ copyTooltip?: string;
21
+ }
22
+ export interface CodeBlockProps {
23
+ /**
24
+ * ID value used for form elements like the search input and its label.
25
+ */
26
+ id: string;
27
+ /**
28
+ * The code that will be rendered as a text node inside of a `<pre><code></code></pre>` fragment.
29
+ */
30
+ code: string;
31
+ /**
32
+ * The syntax language of `props.code` (e.g. `'json'`).
33
+ */
34
+ language: string;
35
+ /**
36
+ * Whether filter mode is initially active.
37
+ * @default false
38
+ */
39
+ initialFilterMode?: boolean;
40
+ /**
41
+ * Whether regular expression mode is initially active.
42
+ * @default false
43
+ */
44
+ initialRegExpMode?: boolean;
45
+ /**
46
+ * Shows an actions bar with a search input and related action buttons.
47
+ * @default false
48
+ */
49
+ searchable?: boolean;
50
+ /**
51
+ * The line numbers for the lines to highlight by default.
52
+ * @default []
53
+ */
54
+ highlightedLineNumbers?: string | (number | [number, number])[];
55
+ /**
56
+ * Allows controlling the processing state from outside the component. This allows a parent component to show the processing icon when it’s, for example, currently syntax highlighting the code.
57
+ * @default false
58
+ */
59
+ processing?: boolean;
60
+ /**
61
+ * Used as the initial value of the search input. Can be used to initialize a code block with a query which was read from client storage.
62
+ * @default ''
63
+ */
64
+ query?: string;
65
+ /**
66
+ * Controls whether to show a copy button. It copies the original code (i.e. the value of `props.code`) to the clipboard.
67
+ * @default true
68
+ */
69
+ showCopyButton?: boolean;
70
+ /**
71
+ * Controls whether to show line numbers.
72
+ * @default true
73
+ */
74
+ showLineNumbers?: boolean;
75
+ /**
76
+ * Controls whether to add links to the current line number.
77
+ * @default false
78
+ */
79
+ showLineNumberLinks?: boolean;
80
+ /**
81
+ * Controls the color scheme of the component.
82
+ * @default light
83
+ */
84
+ theme?: Theme;
85
+ /**
86
+ * Displays the code on a single line.
87
+ * @default false
88
+ */
89
+ singleLine?: boolean;
90
+ /**
91
+ * The max-height of the code block.
92
+ * @default none
93
+ */
94
+ maxHeight?: string;
95
+ }
96
+ export interface CodeBlockEmits {
97
+ /**
98
+ * Fired when the code block is rendered or re-rendered.
99
+ * This happens initially when mounting the component. It also happens when turning *off* filter mode (this renders a line-filtered sub set of the code and can’t be syntax highlighted after the fact). It also happens when the code changes (i.e. `props.code` is updated).
100
+ */
101
+ 'code-block-render': [evt: CodeBlockEventData];
102
+ /**
103
+ * Fired when the matching line numbers are updated in response to a search.
104
+ */
105
+ 'matching-lines-change': [evt: CodeBlockEventData];
106
+ /**
107
+ * Fired when the search query is updated.
108
+ */
109
+ 'query-change': [query: string];
110
+ /**
111
+ * Fired when the filter mode is toggled.
112
+ */
113
+ 'filter-mode-change': [on: boolean];
114
+ /**
115
+ * Fired when the regular expression mode is toggled.
116
+ */
117
+ 'reg-exp-mode-change': [on: boolean];
118
+ }
119
+ export interface CodeBlockSlots {
120
+ /**
121
+ * Additional actions to be displayed in the code block.
122
+ */
123
+ 'secondary-actions'?(): any;
124
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong/kongponents",
3
- "version": "9.28.1",
3
+ "version": "9.28.2-pr.2684.3fe2fcabf.0",
4
4
  "description": "Kong Component library",
5
5
  "type": "module",
6
6
  "repository": {
@@ -26,33 +26,6 @@
26
26
  "./package.json": "./package.json",
27
27
  "./dist/*": "./dist/*"
28
28
  },
29
- "scripts": {
30
- "build:cli": "rimraf ./bin && tsc --project ./cli/tsconfig.json && chmod u+x ./bin/index.js",
31
- "build:docs": "vitepress build docs",
32
- "build:kongponents": "pnpm typecheck && vite build && vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly && tsc-alias -p './tsconfig.build.json'",
33
- "build:visualize": "cross-env-shell BUILD_VISUALIZER=true vite build -m production",
34
- "build": "pnpm build:cli && pnpm stylelint && pnpm lint && pnpm build:kongponents && pnpm build:docs",
35
- "build:ci": "pnpm build:kongponents && pnpm build:docs",
36
- "commit": "cz",
37
- "create-kongponent": "node ./bin/index.js",
38
- "sandbox:dev": "cross-env USE_SANDBOX=true vite",
39
- "sandbox:build": "cross-env USE_SANDBOX=true vite build && shx cp sandbox/dist/index.html sandbox/dist/404.html",
40
- "sandbox:build:netlify": "cross-env USE_SANDBOX=true USE_NETLIFY=true vite build && shx cp sandbox/dist/index.html sandbox/dist/404.html",
41
- "sandbox:preview": "cross-env USE_SANDBOX=true vite preview",
42
- "docs:build": "vitepress build docs",
43
- "docs:dev": "vitepress dev docs",
44
- "docs:serve": "vitepress serve docs",
45
- "docs:preview": "vitepress preview docs --port 8080",
46
- "typecheck": "vue-tsc -p './tsconfig.build.json' --noEmit",
47
- "lint": "eslint",
48
- "lint:fix": "eslint --fix",
49
- "stylelint": "stylelint './src/**/*.{css,scss,sass,vue}'",
50
- "stylelint:fix": "stylelint './src/**/*.{css,scss,sass,vue}' --fix",
51
- "test": "cypress run --component -b chrome",
52
- "test:open": "cypress open --component -b chrome",
53
- "test:spec": "cypress run --component -b chrome --spec",
54
- "semantic-release": "semantic-release"
55
- },
56
29
  "dependencies": {
57
30
  "@floating-ui/vue": "^1.1.6",
58
31
  "@kong/icons": "^1.22.1",
@@ -183,7 +156,6 @@
183
156
  "engines": {
184
157
  "node": ">=v16.20.2 || >=18.12.1 || >=20.14.0"
185
158
  },
186
- "packageManager": "pnpm@9.11.0",
187
159
  "volta": {
188
160
  "node": "20.17.0",
189
161
  "pnpm": "9.11.0"
@@ -197,5 +169,32 @@
197
169
  "jiraPrepend": "[",
198
170
  "jiraAppend": "]"
199
171
  }
172
+ },
173
+ "scripts": {
174
+ "build:cli": "rimraf ./bin && tsc --project ./cli/tsconfig.json && chmod u+x ./bin/index.js",
175
+ "build:docs": "vitepress build docs",
176
+ "build:kongponents": "pnpm typecheck && vite build && vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly && tsc-alias -p './tsconfig.build.json'",
177
+ "build:visualize": "cross-env-shell BUILD_VISUALIZER=true vite build -m production",
178
+ "build": "pnpm build:cli && pnpm stylelint && pnpm lint && pnpm build:kongponents && pnpm build:docs",
179
+ "build:ci": "pnpm build:kongponents && pnpm build:docs",
180
+ "commit": "cz",
181
+ "create-kongponent": "node ./bin/index.js",
182
+ "sandbox:dev": "cross-env USE_SANDBOX=true vite",
183
+ "sandbox:build": "cross-env USE_SANDBOX=true vite build && shx cp sandbox/dist/index.html sandbox/dist/404.html",
184
+ "sandbox:build:netlify": "cross-env USE_SANDBOX=true USE_NETLIFY=true vite build && shx cp sandbox/dist/index.html sandbox/dist/404.html",
185
+ "sandbox:preview": "cross-env USE_SANDBOX=true vite preview",
186
+ "docs:build": "vitepress build docs",
187
+ "docs:dev": "vitepress dev docs",
188
+ "docs:serve": "vitepress serve docs",
189
+ "docs:preview": "vitepress preview docs --port 8080",
190
+ "typecheck": "vue-tsc -p './tsconfig.build.json' --noEmit",
191
+ "lint": "eslint",
192
+ "lint:fix": "eslint --fix",
193
+ "stylelint": "stylelint './src/**/*.{css,scss,sass,vue}'",
194
+ "stylelint:fix": "stylelint './src/**/*.{css,scss,sass,vue}' --fix",
195
+ "test": "cypress run --component -b chrome",
196
+ "test:open": "cypress open --component -b chrome",
197
+ "test:spec": "cypress run --component -b chrome --spec",
198
+ "semantic-release": "semantic-release"
200
199
  }
201
- }
200
+ }