chore: improve templates

This commit is contained in:
mathuo 2025-07-20 20:18:46 +01:00
parent 04ae805774
commit 27b9e29077
No known key found for this signature in database
GPG Key ID: C6EEDEFD6CA07281
11 changed files with 28 additions and 10 deletions

View File

@ -87,6 +87,7 @@ function createIndexHTML(options) {
)
.replace('{{app}}', options.app)
.replace('{{githubLink}}', options.githubUrl)
.replace('{{codeSandboxLink}}', options.codeSandboxUrl)
}
const input_dir = path.join(__dirname, '../templates');
@ -98,6 +99,7 @@ const FRAMEWORKS = ['react', 'vue', 'typescript'];
const list = [];
const githubUrl = "https://github.com/mathuo/dockview/tree/master/packages/docs/templates"
const codeSandboxUrl = "https://codesandbox.io/p/sandbox/github/mathuo/dockview/tree/gh-pages/templates"
for (const component of COMPONENTS) {
const componentDir = path.join(input_dir, component);
@ -119,6 +121,7 @@ for (const component of COMPONENTS) {
);
const templateGithubUrl = `${githubUrl}/${component}/${folder}/${framework}/src`
const templateCodeSandboxUrl = `${codeSandboxUrl}/${component}/${folder}/${framework}`
const template = createIndexHTML({
title: `Dockview | ${folder} ${framework}`,
@ -132,7 +135,8 @@ for (const component of COMPONENTS) {
USE_LOCAL_CDN ? 'local' : 'remote'
],
},
githubUrl: templateGithubUrl
githubUrl: templateGithubUrl,
codeSandboxUrl: templateCodeSandboxUrl
});
fs.writeFileSync(
path.join(output, component, folder, framework, 'index.html'),

View File

@ -90,6 +90,11 @@
</button>
</a>
<img id="gh-logo" src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png"/>
<a target="_blank" rel="noopener noreferrer" href="{{codeSandboxLink}}">
<button id="header-btn">
Edit in Sandbox
</button>
</a>
</div>
<div id="app"></div>
</div>

View File

@ -3,6 +3,7 @@ import {
createDockview,
GroupPanelPartInitParameters,
IContentRenderer,
themeAbyss,
} from 'dockview-core';
class Panel implements IContentRenderer {
@ -23,7 +24,7 @@ class Panel implements IContentRenderer {
}
const api = createDockview(document.getElementById('app'), {
className: 'dockview-theme-abyss',
theme: themeAbyss,
createComponent: (options) => {
switch (options.name) {
case 'default':

View File

@ -6,6 +6,7 @@ import {
ITabRenderer,
PanelUpdateEvent,
Parameters,
themeAbyss,
} from 'dockview-core';
class Panel implements IContentRenderer {
@ -97,7 +98,7 @@ class CustomTab implements ITabRenderer {
}
const api = createDockview(document.getElementById('app'), {
className: 'dockview-theme-abyss',
theme: themeAbyss,
createComponent: (options) => {
switch (options.name) {
case 'default':

View File

@ -6,6 +6,7 @@ import {
IContentRenderer,
IGroupHeaderProps,
IHeaderActionsRenderer,
themeAbyss,
} from 'dockview-core';
import './index.css';
@ -133,7 +134,7 @@ class LeftHeaderActions implements IHeaderActionsRenderer {
}
const api = createDockview(document.getElementById('app'), {
className: 'dockview-theme-abyss',
theme: themeAbyss,
createComponent: (options): IContentRenderer => {
switch (options.name) {
case 'default':

View File

@ -6,6 +6,7 @@ import {
ITabRenderer,
PanelUpdateEvent,
Parameters,
themeAbyss,
} from 'dockview-core';
class Panel implements IContentRenderer {
@ -36,7 +37,7 @@ class Panel implements IContentRenderer {
}
const api = createDockview(document.getElementById('app'), {
className: 'dockview-theme-abyss',
theme: themeAbyss,
createComponent: (options) => {
switch (options.name) {
case 'default':

View File

@ -3,6 +3,7 @@ import {
createDockview,
GroupPanelPartInitParameters,
IContentRenderer,
themeAbyss,
} from 'dockview-core';
const TEXT =
@ -74,7 +75,7 @@ class UserDefinedOverflowContainer implements IContentRenderer {
}
const api = createDockview(document.getElementById('app'), {
className: 'dockview-theme-abyss',
theme: themeAbyss,
createComponent: (options) => {
switch (options.name) {
case 'fixedHeightContainer':

View File

@ -3,6 +3,7 @@ import {
createDockview,
GroupPanelPartInitParameters,
IContentRenderer,
themeAbyss,
} from 'dockview-core';
class Panel implements IContentRenderer {
@ -23,7 +24,7 @@ class Panel implements IContentRenderer {
}
const api = createDockview(document.getElementById('app'), {
className: 'dockview-theme-abyss',
theme: themeAbyss,
createComponent: (options) => {
switch (options.name) {
case 'default':

View File

@ -6,6 +6,7 @@ import {
ITabRenderer,
PanelUpdateEvent,
Parameters,
themeAbyss,
} from 'dockview-core';
class Panel implements IContentRenderer {
@ -97,7 +98,7 @@ class CustomTab implements ITabRenderer {
}
const api = createDockview(document.getElementById('app'), {
className: 'dockview-theme-abyss',
theme: themeAbyss,
createComponent: (options) => {
switch (options.name) {
case 'default':

View File

@ -6,6 +6,7 @@ import {
ITabRenderer,
PanelUpdateEvent,
Parameters,
themeAbyss,
} from 'dockview-core';
class Panel implements IContentRenderer {
@ -50,7 +51,7 @@ class Panel implements IContentRenderer {
}
const api = createDockview(document.getElementById('app'), {
className: 'dockview-theme-abyss',
theme: themeAbyss,
createComponent: (options) => {
switch (options.name) {
case 'default':

View File

@ -6,6 +6,7 @@ import {
IContentRenderer,
IDockviewGroupPanel,
IWatermarkRenderer,
themeAbyss,
WatermarkRendererInitParameters,
} from 'dockview-core';
@ -105,7 +106,7 @@ const app = document.getElementById('app');
app.append(root);
const api = createDockview(container, {
className: 'dockview-theme-abyss',
theme: themeAbyss,
createComponent: (options) => {
switch (options.name) {
case 'default':