-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
120 additions
and
110 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"private": true, | ||
"version": "0.0.0-beta.1", | ||
"scripts": { | ||
"dev": "vite-slides", | ||
"build": "vite-slides build" | ||
}, | ||
"dependencies": { | ||
"vite-slides": "workspace:*" | ||
}, | ||
"version": "0.0.0-beta.1" | ||
} | ||
} |
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
<template> | ||
<div class="master center"> | ||
<div class="layout-master center"> | ||
<div class="my-auto"> | ||
<slot /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="postcss"> | ||
.master.center { | ||
@apply h-full grid place-content-center; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,7 @@ | ||
<template> | ||
<div class="master cover"> | ||
<div class="layout-master cover"> | ||
<div class="my-auto"> | ||
<slot /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="postcss"> | ||
.master.cover { | ||
@apply h-full flex; | ||
h1 { | ||
@apply text-6xl leading-20; | ||
} | ||
h1 ~ p { | ||
@apply opacity-40 mb-10 text-2xl; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
import 'virtual:windi-base.css' | ||
import 'virtual:windi-components.css' | ||
import './main.css' | ||
import './layout.css' | ||
import './code.css' | ||
import 'virtual:windi-utilities.css' | ||
import 'virtual:windi-devtools' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<main class="layout-master default"> | ||
<slot /> | ||
</main> | ||
</template> |
4 changes: 2 additions & 2 deletions
4
packages/theme-default/layouts/end.vue → packages/vite-slides/client/layouts/end.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<template> | ||
<main class="master end"> | ||
<main class="layout-master end"> | ||
END | ||
</main> | ||
</template> | ||
|
||
<style lang="postcss"> | ||
.master.end { | ||
.layout-master.end { | ||
@apply text-white text-opacity-85 text-xl tracking-widest bg-black h-full text-center grid place-content-center select-none; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { existsSync } from 'fs' | ||
import { join, resolve, basename } from 'path' | ||
import { Plugin } from 'vite' | ||
import fg from 'fast-glob' | ||
import { getPackageRoot, getThemeRoot } from '../env' | ||
|
||
export function createEntryPlugin(): Plugin { | ||
const packageRoot = getPackageRoot() | ||
const themeRoot = getThemeRoot() | ||
const mainEntry = resolve(packageRoot, 'client/main.ts') | ||
const userRoot = process.cwd() | ||
|
||
return { | ||
name: 'vite-slides:entry', | ||
enforce: 'pre', | ||
async transform(code, id) { | ||
if (id === mainEntry) { | ||
const imports: string[] = [] | ||
const layouts: Record<string, string> = {} | ||
|
||
async function scanStyle(root: string) { | ||
const styles = [ | ||
join(root, 'styles/index.ts'), | ||
join(root, 'styles/index.js'), | ||
join(root, 'styles/index.css'), | ||
join(root, 'styles.css'), | ||
join(root, 'style.css'), | ||
] | ||
|
||
for (const style of styles) { | ||
if (existsSync(style)) { | ||
imports.push(`import "/@fs${style}"`) | ||
return | ||
} | ||
} | ||
} | ||
|
||
async function scanLayouts(root: string) { | ||
const layoutPaths = await fg('layouts/*.{vue,ts}', { | ||
cwd: root, | ||
absolute: true, | ||
}) | ||
|
||
for (const layoutPath of layoutPaths) { | ||
const layout = basename(layoutPath).replace(/\.\w+$/, '') | ||
if (layouts[layout]) | ||
continue | ||
imports.push(`import __layout_${layout} from "/@fs${layoutPath}"`) | ||
layouts[layout] = `__layout_${layout}` | ||
} | ||
} | ||
|
||
await scanStyle(themeRoot) | ||
await scanStyle(userRoot) | ||
|
||
await scanLayouts(join(packageRoot, 'client')) | ||
await scanLayouts(themeRoot) | ||
await scanLayouts(userRoot) | ||
|
||
code = code.replace('/* __imports__ */', imports.join('\n')) | ||
code = code.replace('/* __layouts__ */', `{${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(',\n')}}`) | ||
return code | ||
} | ||
|
||
return null | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
packages: | ||
- packages/* | ||
- demo |