Skip to content

Commit

Permalink
Merge pull request #38 from webdevnerdstuff/dev
Browse files Browse the repository at this point in the history
v2.30.
  • Loading branch information
webdevnerdstuff authored Dec 2, 2023
2 parents 3d76d93 + 6fdb184 commit c825cb9
Show file tree
Hide file tree
Showing 24 changed files with 314 additions and 229 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log
All notable changes to the "vue-code-block" plugin will be documented in this file.

## v2.3.0
12-02-2023
[main] (@webdevnerdstuff)
* Improve/Fix TypeScript support

## v2.2.15
11-13-2023
[main] (@webdevnerdstuff)
Expand Down
6 changes: 3 additions & 3 deletions dist/plugin/VCodeBlock.vue.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Props } from '../types';
import { Props } from '../plugin/types';
declare function copyCode(): void;
declare function runCode(): void;
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
Expand Down Expand Up @@ -70,16 +70,16 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
codeBlockRadius: string;
runTab: boolean;
tabs: boolean;
code: string | number | object | [];
label: string;
browserWindow: boolean;
cssPath: string;
code: string | number | object | [];
copyButton: boolean;
copyIcons: boolean;
copyFailedText: string;
copyText: string;
copySuccessText: string;
indent: number;
label: string;
lang: string;
prismjs: boolean;
prismPlugin: boolean;
Expand Down
2 changes: 1 addition & 1 deletion dist/plugin/composables/classes.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UseCodeBlockClasses, UseCopyButtonClasses, UseIconClasses, UseLabelClasses, UseTabClasses } from '../../types';
import { UseCodeBlockClasses, UseCopyButtonClasses, UseIconClasses, UseLabelClasses, UseTabClasses } from '../../plugin/types';
export declare const useCodeBlockClasses: UseCodeBlockClasses;
export declare const useCopyButtonClasses: UseCopyButtonClasses;
export declare const useIconClasses: UseIconClasses;
Expand Down
2 changes: 1 addition & 1 deletion dist/plugin/composables/styles.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UseCodeTagStyles, UseHeaderStyles, UsePreTagStyles, UseTabGroupStyles } from '../../types';
import { UseCodeTagStyles, UseHeaderStyles, UsePreTagStyles, UseTabGroupStyles } from '../../plugin/types';
export declare const useCodeTagStyles: UseCodeTagStyles;
export declare const useHeaderStyles: UseHeaderStyles;
export declare const usePreTagStyles: UsePreTagStyles;
Expand Down
7 changes: 6 additions & 1 deletion dist/plugin/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
export { default as VCodeBlock } from './VCodeBlock.vue';
import type { App } from 'vue';
import type { Props } from './types';
import VCodeBlock from './VCodeBlock.vue';
export declare const codeBlockOptions: unique symbol;
export declare function createVCodeBlock(options?: Props): (app: App) => void;
export { VCodeBlock, };
9 changes: 9 additions & 0 deletions dist/types/index.d.ts → dist/plugin/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { CSSProperties, MaybeRef } from 'vue';
import VCodeBlock from '../VCodeBlock.vue';
export * from '../index';
export type UseTheme = MaybeRef<string | boolean>;
export interface Props {
browserWindow?: boolean;
Expand Down Expand Up @@ -88,3 +90,10 @@ export interface UseTabGroupStyles {
tabGap: MaybeRef<Props['tabGap']>;
}): CSSProperties;
}
declare module "vue" {
interface ComponentCustomProperties {
}
interface GlobalComponents {
VCodeBlock: typeof VCodeBlock;
}
}
16 changes: 8 additions & 8 deletions dist/vue-code-block.cjs.js

Large diffs are not rendered by default.

247 changes: 125 additions & 122 deletions dist/vue-code-block.es.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@wdns/vue-code-block",
"version": "2.2.15",
"version": "2.3.0",
"description": "Vue 3 CodeBlock - Highlight your code with ease using this syntax highlighting component powered by PrismJS or Highlight.js.",
"private": false,
"publishConfig": {
"access": "public"
},
"main": "dist/vue-code-block.cjs.js",
"module": "dist/vue-code-block.es.js",
"types": "dist/types/index.d.ts",
"types": "dist/plugin/types/index.d.ts",
"scripts": {
"dev": "vite",
"watch": "pnpm dev",
Expand Down
38 changes: 34 additions & 4 deletions src/documentation/sections/UsageSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,29 @@
<v-row>
<v-col cols="12">
<VCodeBlock
:code="usageGlobal"
:code="usageGlobalPlugin"
:highlightjs="selectedLibrary.id === 'highlightjs'"
label="Global Registration"
lang="javascript"
:prismjs="selectedLibrary.id === 'prismjs'"
:theme="selectedTheme"
>
<template #label>
Global Plugin Registration
<br>
<i>Global options have a higher precedence and will override local props</i>
</template>
</VCodeBlock>
</v-col>
</v-row>

<v-row>
<v-col cols="12">
<VCodeBlock
:code="usageGlobalComponent"
:highlightjs="selectedLibrary.id === 'highlightjs'"
label="Global Component Registration"
lang="javascript"
:prismjs="selectedLibrary.id === 'prismjs'"
/>
</v-col>
</v-row>
Expand All @@ -33,7 +50,6 @@
label="Local Registration"
lang="html"
:prismjs="selectedLibrary.id === 'prismjs'"
:theme="selectedTheme"
/>
</v-col>
</v-row>
Expand All @@ -46,7 +62,21 @@ const classes = inject('classes');
const selectedLibrary = inject('selectedLibrary');
const selectedTheme = inject('selectedTheme');
const usageGlobal = `import { createApp } from 'vue';
const usageGlobalPlugin = `import { createApp } from 'vue';
import App from './App.vue';
import { createVCodeBlock } from '@wdns/vue-code-block';
const VCodeBlock = createVCodeBlock({
// options
});
const app = createApp(App);
app.plugin(VCodeBlock);
app.mount('#app');`;
const usageGlobalComponent = `import { createApp } from 'vue';
import App from './App.vue';
import { VCodeBlock } from '@wdns/vue-code-block';
Expand Down
20 changes: 0 additions & 20 deletions src/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import '@/libraries/fontawesome';
import App from './App.vue';
import { VCodeBlock } from './index';
import { createApp } from 'vue';
import { createPinia } from 'pinia';
import { registerPlugins } from './plugins';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import { createVCodeBlock } from './plugin';


const app = createApp(App);

app.component('VCodeBlock', VCodeBlock);
app.use(createVCodeBlock());
app.use(createPinia());
app.component('font-awesome-icon', FontAwesomeIcon);
app.component('FaIcon', FontAwesomeIcon);
Expand Down
6 changes: 4 additions & 2 deletions src/playground/configs/playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { createApp } from 'vue';
import { createPinia } from 'pinia';
import { registerPlugins } from '../../plugins';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import VCodeBlock from '../../index';
import { createVCodeBlock } from '../../plugin/index';


const app = createApp(PlaygroundApp);

app.use(createVCodeBlock());
app.use(createPinia());
app.component('font-awesome-icon', FontAwesomeIcon);
app.component('FaIcon', FontAwesomeIcon);
app.component('VCodeBlock', VCodeBlock);

registerPlugins(app);

Expand Down
4 changes: 2 additions & 2 deletions src/playground/configs/templates/PlaygroundPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
:label="options.label"
:lang="options.lang"
:prismjs="options.prismjs"
:tabs="options.tabs"
:theme="options.theme"
/>
>
</VCodeBlock>
</v-container>
</v-card>
</v-col>
Expand Down
Loading

0 comments on commit c825cb9

Please sign in to comment.