Skip to content

Commit c825cb9

Browse files
Merge pull request #38 from webdevnerdstuff/dev
v2.30.
2 parents 3d76d93 + 6fdb184 commit c825cb9

24 files changed

+314
-229
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Change Log
22
All notable changes to the "vue-code-block" plugin will be documented in this file.
33

4+
## v2.3.0
5+
12-02-2023
6+
[main] (@webdevnerdstuff)
7+
* Improve/Fix TypeScript support
8+
49
## v2.2.15
510
11-13-2023
611
[main] (@webdevnerdstuff)

dist/plugin/VCodeBlock.vue.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Props } from '../types';
1+
import { Props } from '../plugin/types';
22
declare function copyCode(): void;
33
declare function runCode(): void;
44
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
@@ -70,16 +70,16 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
7070
codeBlockRadius: string;
7171
runTab: boolean;
7272
tabs: boolean;
73-
code: string | number | object | [];
74-
label: string;
7573
browserWindow: boolean;
7674
cssPath: string;
75+
code: string | number | object | [];
7776
copyButton: boolean;
7877
copyIcons: boolean;
7978
copyFailedText: string;
8079
copyText: string;
8180
copySuccessText: string;
8281
indent: number;
82+
label: string;
8383
lang: string;
8484
prismjs: boolean;
8585
prismPlugin: boolean;

dist/plugin/composables/classes.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UseCodeBlockClasses, UseCopyButtonClasses, UseIconClasses, UseLabelClasses, UseTabClasses } from '../../types';
1+
import { UseCodeBlockClasses, UseCopyButtonClasses, UseIconClasses, UseLabelClasses, UseTabClasses } from '../../plugin/types';
22
export declare const useCodeBlockClasses: UseCodeBlockClasses;
33
export declare const useCopyButtonClasses: UseCopyButtonClasses;
44
export declare const useIconClasses: UseIconClasses;

dist/plugin/composables/styles.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UseCodeTagStyles, UseHeaderStyles, UsePreTagStyles, UseTabGroupStyles } from '../../types';
1+
import { UseCodeTagStyles, UseHeaderStyles, UsePreTagStyles, UseTabGroupStyles } from '../../plugin/types';
22
export declare const useCodeTagStyles: UseCodeTagStyles;
33
export declare const useHeaderStyles: UseHeaderStyles;
44
export declare const usePreTagStyles: UsePreTagStyles;

dist/plugin/index.d.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
export { default as VCodeBlock } from './VCodeBlock.vue';
1+
import type { App } from 'vue';
2+
import type { Props } from './types';
3+
import VCodeBlock from './VCodeBlock.vue';
4+
export declare const codeBlockOptions: unique symbol;
5+
export declare function createVCodeBlock(options?: Props): (app: App) => void;
6+
export { VCodeBlock, };

dist/types/index.d.ts renamed to dist/plugin/types/index.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { CSSProperties, MaybeRef } from 'vue';
2+
import VCodeBlock from '../VCodeBlock.vue';
3+
export * from '../index';
24
export type UseTheme = MaybeRef<string | boolean>;
35
export interface Props {
46
browserWindow?: boolean;
@@ -88,3 +90,10 @@ export interface UseTabGroupStyles {
8890
tabGap: MaybeRef<Props['tabGap']>;
8991
}): CSSProperties;
9092
}
93+
declare module "vue" {
94+
interface ComponentCustomProperties {
95+
}
96+
interface GlobalComponents {
97+
VCodeBlock: typeof VCodeBlock;
98+
}
99+
}

dist/vue-code-block.cjs.js

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-code-block.es.js

+125-122
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "@wdns/vue-code-block",
3-
"version": "2.2.15",
3+
"version": "2.3.0",
44
"description": "Vue 3 CodeBlock - Highlight your code with ease using this syntax highlighting component powered by PrismJS or Highlight.js.",
55
"private": false,
66
"publishConfig": {
77
"access": "public"
88
},
99
"main": "dist/vue-code-block.cjs.js",
1010
"module": "dist/vue-code-block.es.js",
11-
"types": "dist/types/index.d.ts",
11+
"types": "dist/plugin/types/index.d.ts",
1212
"scripts": {
1313
"dev": "vite",
1414
"watch": "pnpm dev",

src/documentation/sections/UsageSection.vue

+34-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,29 @@
1515
<v-row>
1616
<v-col cols="12">
1717
<VCodeBlock
18-
:code="usageGlobal"
18+
:code="usageGlobalPlugin"
1919
:highlightjs="selectedLibrary.id === 'highlightjs'"
20-
label="Global Registration"
2120
lang="javascript"
2221
:prismjs="selectedLibrary.id === 'prismjs'"
2322
:theme="selectedTheme"
23+
>
24+
<template #label>
25+
Global Plugin Registration
26+
<br>
27+
<i>Global options have a higher precedence and will override local props</i>
28+
</template>
29+
</VCodeBlock>
30+
</v-col>
31+
</v-row>
32+
33+
<v-row>
34+
<v-col cols="12">
35+
<VCodeBlock
36+
:code="usageGlobalComponent"
37+
:highlightjs="selectedLibrary.id === 'highlightjs'"
38+
label="Global Component Registration"
39+
lang="javascript"
40+
:prismjs="selectedLibrary.id === 'prismjs'"
2441
/>
2542
</v-col>
2643
</v-row>
@@ -33,7 +50,6 @@
3350
label="Local Registration"
3451
lang="html"
3552
:prismjs="selectedLibrary.id === 'prismjs'"
36-
:theme="selectedTheme"
3753
/>
3854
</v-col>
3955
</v-row>
@@ -46,7 +62,21 @@ const classes = inject('classes');
4662
const selectedLibrary = inject('selectedLibrary');
4763
const selectedTheme = inject('selectedTheme');
4864
49-
const usageGlobal = `import { createApp } from 'vue';
65+
const usageGlobalPlugin = `import { createApp } from 'vue';
66+
import App from './App.vue';
67+
import { createVCodeBlock } from '@wdns/vue-code-block';
68+
69+
const VCodeBlock = createVCodeBlock({
70+
// options
71+
});
72+
73+
const app = createApp(App);
74+
75+
app.plugin(VCodeBlock);
76+
77+
app.mount('#app');`;
78+
79+
const usageGlobalComponent = `import { createApp } from 'vue';
5080
import App from './App.vue';
5181
import { VCodeBlock } from '@wdns/vue-code-block';
5282

src/index.ts

-20
This file was deleted.

src/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import '@/libraries/fontawesome';
22
import App from './App.vue';
3-
import { VCodeBlock } from './index';
43
import { createApp } from 'vue';
54
import { createPinia } from 'pinia';
65
import { registerPlugins } from './plugins';
76
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
7+
import { createVCodeBlock } from './plugin';
88

99

1010
const app = createApp(App);
1111

12-
app.component('VCodeBlock', VCodeBlock);
12+
app.use(createVCodeBlock());
1313
app.use(createPinia());
1414
app.component('font-awesome-icon', FontAwesomeIcon);
1515
app.component('FaIcon', FontAwesomeIcon);

src/playground/configs/playground.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import { createApp } from 'vue';
44
import { createPinia } from 'pinia';
55
import { registerPlugins } from '../../plugins';
66
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
7-
import VCodeBlock from '../../index';
7+
import { createVCodeBlock } from '../../plugin/index';
8+
89

910
const app = createApp(PlaygroundApp);
11+
12+
app.use(createVCodeBlock());
1013
app.use(createPinia());
1114
app.component('font-awesome-icon', FontAwesomeIcon);
1215
app.component('FaIcon', FontAwesomeIcon);
13-
app.component('VCodeBlock', VCodeBlock);
1416

1517
registerPlugins(app);
1618

src/playground/configs/templates/PlaygroundPage.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
:label="options.label"
1010
:lang="options.lang"
1111
:prismjs="options.prismjs"
12-
:tabs="options.tabs"
1312
:theme="options.theme"
14-
/>
13+
>
14+
</VCodeBlock>
1515
</v-container>
1616
</v-card>
1717
</v-col>

0 commit comments

Comments
 (0)