mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-21 07:45:36 +08:00
Temp
This commit is contained in:
1003
docs-v2/.vitepress/components/CliGenerator.vue
Normal file
1003
docs-v2/.vitepress/components/CliGenerator.vue
Normal file
File diff suppressed because it is too large
Load Diff
219
docs-v2/.vitepress/components/Contributors.vue
Normal file
219
docs-v2/.vitepress/components/Contributors.vue
Normal file
@@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<div class="contributors-container">
|
||||
<div class="contributors-header">
|
||||
<h2>Contributors</h2>
|
||||
<p class="contributors-description">
|
||||
Thanks to all the amazing people who have contributed to this project!
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="loading-state">
|
||||
<div class="spinner"></div>
|
||||
<p>Loading contributors...</p>
|
||||
</div>
|
||||
|
||||
<div v-else-if="error" class="error-state">
|
||||
<p>{{ error }}</p>
|
||||
</div>
|
||||
|
||||
<div v-else class="contributors-grid">
|
||||
<a
|
||||
v-for="contributor in contributors"
|
||||
:key="contributor.id"
|
||||
:href="contributor.html_url"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="contributor-card"
|
||||
:title="contributor.login"
|
||||
>
|
||||
<img
|
||||
:src="contributor.avatar_url"
|
||||
:alt="contributor.login"
|
||||
class="contributor-avatar"
|
||||
loading="lazy"
|
||||
/>
|
||||
<div class="contributor-name">{{ contributor.login }}</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue';
|
||||
|
||||
interface Contributor {
|
||||
id: number;
|
||||
login: string;
|
||||
avatar_url: string;
|
||||
html_url: string;
|
||||
contributions: number;
|
||||
}
|
||||
|
||||
const contributors = ref<Contributor[]>([]);
|
||||
const loading = ref(true);
|
||||
const error = ref('');
|
||||
|
||||
const fetchContributors = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
error.value = '';
|
||||
|
||||
const response = await fetch(
|
||||
'https://api.github.com/repos/crazywhalecc/static-php-cli/contributors?per_page=24'
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch contributors');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
contributors.value = data;
|
||||
} catch (err) {
|
||||
error.value = 'Failed to load contributors. Please try again later.';
|
||||
console.error('Error fetching contributors:', err);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
fetchContributors();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.contributors-container {
|
||||
margin: 48px auto;
|
||||
padding: 32px 24px;
|
||||
max-width: 1152px;
|
||||
background: linear-gradient(135deg, var(--vp-c-bg-soft) 0%, var(--vp-c-bg) 100%);
|
||||
border-radius: 16px;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.contributors-header {
|
||||
text-align: center;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.contributors-header h2 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 8px 0;
|
||||
background: linear-gradient(120deg, var(--vp-c-brand-1), var(--vp-c-brand-2));
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
.contributors-description {
|
||||
font-size: 0.95rem;
|
||||
color: var(--vp-c-text-2);
|
||||
margin: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.loading-state,
|
||||
.error-state {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
color: var(--vp-c-text-2);
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin: 0 auto 16px;
|
||||
border: 4px solid var(--vp-c-divider);
|
||||
border-top-color: var(--vp-c-brand-1);
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.contributors-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.contributor-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 12px;
|
||||
background: var(--vp-c-bg);
|
||||
border-radius: 12px;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
transition: all 0.3s ease;
|
||||
text-decoration: none;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.contributor-card:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
||||
border-color: var(--vp-c-brand-1);
|
||||
}
|
||||
|
||||
.contributor-avatar {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid var(--vp-c-divider);
|
||||
transition: all 0.3s ease;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.contributor-card:hover .contributor-avatar {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.contributor-name {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
word-break: break-word;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.contributors-container {
|
||||
margin: 32px 16px;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.contributors-header h2 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.contributors-description {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.contributors-grid {
|
||||
grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.contributor-card {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.contributor-avatar {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
}
|
||||
|
||||
.contributor-name {
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
193
docs-v2/.vitepress/components/DependencyUtil.js
Normal file
193
docs-v2/.vitepress/components/DependencyUtil.js
Normal file
@@ -0,0 +1,193 @@
|
||||
export function getMetaList(meta, type, name, list_name) {
|
||||
if (meta.os === 'linux') {
|
||||
return meta[type][name][list_name + '-linux'] ?? meta[type][name][list_name + '-unix'] ?? meta[type][name][list_name] ?? [];
|
||||
}
|
||||
if (meta.os === 'macos') {
|
||||
return meta[type][name][list_name + '-macos'] ?? meta[type][name][list_name + '-unix'] ?? meta[type][name][list_name] ?? [];
|
||||
}
|
||||
if (meta.os === 'windows') {
|
||||
return meta[type][name][list_name + '-windows'] ?? meta[type][name][list_name] ?? [];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
export function getExtDepends(meta, ext_name) {
|
||||
return getMetaList(meta, 'ext', ext_name, 'ext-depends');
|
||||
}
|
||||
|
||||
export function getExtSuggests(meta, ext_name) {
|
||||
return getMetaList(meta, 'ext', ext_name, 'ext-suggests');
|
||||
}
|
||||
|
||||
export function getExtLibDepends(meta, ext_name) {
|
||||
const ls = getMetaList(meta, 'ext', ext_name, 'lib-depends');
|
||||
return ls;
|
||||
}
|
||||
|
||||
export function getExtLibSuggests(meta, ext_name) {
|
||||
return getMetaList(meta, 'ext', ext_name, 'lib-suggests');
|
||||
}
|
||||
|
||||
export function getLibDepends(meta, lib_name) {
|
||||
return getMetaList(meta, 'lib', lib_name, 'lib-depends');
|
||||
}
|
||||
|
||||
export function getLibSuggests(meta, lib_name) {
|
||||
return getMetaList(meta, 'lib', lib_name, 'lib-suggests');
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the dependent lib list according to the required ext list, and sort according to the dependency
|
||||
* @param meta
|
||||
* @param exts
|
||||
*/
|
||||
export function getExtLibsByDeps(meta, exts) {
|
||||
const sorted = [];
|
||||
const visited = new Set();
|
||||
const notIncludedExts = [];
|
||||
exts.forEach((ext) => {
|
||||
if (!visited.has(ext)) {
|
||||
visitExtDeps(meta, ext, visited, sorted);
|
||||
}
|
||||
});
|
||||
|
||||
const sortedSuggests = [];
|
||||
const visitedSuggests = new Set();
|
||||
const final = [];
|
||||
exts.forEach((ext) => {
|
||||
if (!visited.has(ext)) {
|
||||
visitExtAllDeps(meta, ext, visitedSuggests, sortedSuggests);
|
||||
}
|
||||
});
|
||||
sortedSuggests.forEach((suggest) => {
|
||||
if (sorted.indexOf(suggest) !== -1) {
|
||||
final.push(suggest);
|
||||
}
|
||||
});
|
||||
const libs = [];
|
||||
final.forEach((ext) => {
|
||||
if (exts.indexOf(ext) === -1) {
|
||||
notIncludedExts.push(ext);
|
||||
}
|
||||
getExtLibDepends(meta, ext).forEach((lib) => {
|
||||
if (libs.indexOf(lib) === -1) {
|
||||
libs.push(lib);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return { exts: final, libs: getLibsByDeps(meta, libs), notIncludedExts: notIncludedExts };
|
||||
}
|
||||
|
||||
export function getAllExtLibsByDeps(meta, exts) {
|
||||
const sorted = [];
|
||||
const visited = new Set();
|
||||
const notIncludedExts = [];
|
||||
exts.forEach((ext) => {
|
||||
if (!visited.has(ext)) {
|
||||
visitExtAllDeps(meta, ext, visited, sorted);
|
||||
}
|
||||
});
|
||||
const libs = [];
|
||||
sorted.forEach((ext) => {
|
||||
if (exts.indexOf(ext) === -1) {
|
||||
notIncludedExts.push(ext);
|
||||
}
|
||||
const allLibs = [...getExtLibDepends(meta, ext), ...getExtLibSuggests(meta, ext)];
|
||||
allLibs.forEach((dep) => {
|
||||
if (libs.indexOf(dep) === -1) {
|
||||
libs.push(dep);
|
||||
}
|
||||
});
|
||||
});
|
||||
return { exts: sorted, libs: getAllLibsByDeps(meta, libs), notIncludedExts: notIncludedExts };
|
||||
}
|
||||
|
||||
export function getAllLibsByDeps(meta, libs) {
|
||||
const sorted = [];
|
||||
const visited = new Set();
|
||||
|
||||
libs.forEach((lib) => {
|
||||
if (!visited.has(lib)) {
|
||||
console.log('before visited');
|
||||
console.log(visited);
|
||||
visitLibAllDeps(meta, lib, visited, sorted);
|
||||
console.log('after visited');
|
||||
console.log(visited);
|
||||
}
|
||||
});
|
||||
return sorted;
|
||||
}
|
||||
|
||||
export function getLibsByDeps(meta, libs) {
|
||||
const sorted = [];
|
||||
const visited = new Set();
|
||||
|
||||
libs.forEach((lib) => {
|
||||
if (!visited.has(lib)) {
|
||||
visitLibDeps(meta, lib, visited, sorted);
|
||||
}
|
||||
});
|
||||
|
||||
const sortedSuggests = [];
|
||||
const visitedSuggests = new Set();
|
||||
const final = [];
|
||||
libs.forEach((lib) => {
|
||||
if (!visitedSuggests.has(lib)) {
|
||||
visitLibAllDeps(meta, lib, visitedSuggests, sortedSuggests);
|
||||
}
|
||||
});
|
||||
sortedSuggests.forEach((suggest) => {
|
||||
if (sorted.indexOf(suggest) !== -1) {
|
||||
final.push(suggest);
|
||||
}
|
||||
});
|
||||
return final;
|
||||
}
|
||||
|
||||
export function visitLibAllDeps(meta, lib_name, visited, sorted) {
|
||||
if (visited.has(lib_name)) {
|
||||
return;
|
||||
}
|
||||
visited.add(lib_name);
|
||||
const allLibs = [...getLibDepends(meta, lib_name), ...getLibSuggests(meta, lib_name)];
|
||||
allLibs.forEach((dep) => {
|
||||
visitLibDeps(meta, dep, visited, sorted);
|
||||
});
|
||||
sorted.push(lib_name);
|
||||
}
|
||||
|
||||
export function visitLibDeps(meta, lib_name, visited, sorted) {
|
||||
if (visited.has(lib_name)) {
|
||||
return;
|
||||
}
|
||||
visited.add(lib_name);
|
||||
getLibDepends(meta, lib_name).forEach((dep) => {
|
||||
visitLibDeps(meta, dep, visited, sorted);
|
||||
});
|
||||
sorted.push(lib_name);
|
||||
}
|
||||
|
||||
export function visitExtDeps(meta, ext_name, visited, sorted) {
|
||||
if (visited.has(visited)) {
|
||||
return;
|
||||
}
|
||||
visited.add(ext_name);
|
||||
getExtDepends(meta, ext_name).forEach((dep) => {
|
||||
visitExtDeps(meta, dep, visited, sorted);
|
||||
});
|
||||
sorted.push(ext_name);
|
||||
}
|
||||
|
||||
export function visitExtAllDeps(meta, ext_name, visited, sorted) {
|
||||
if (visited.has(ext_name)) {
|
||||
return;
|
||||
}
|
||||
visited.add(ext_name);
|
||||
|
||||
const allExts = [...getExtDepends(meta, ext_name), ...getExtSuggests(meta, ext_name)];
|
||||
allExts.forEach((dep) => {
|
||||
visitExtDeps(meta, dep, visited, sorted);
|
||||
});
|
||||
sorted.push(ext_name);
|
||||
}
|
||||
79
docs-v2/.vitepress/components/SearchTable.vue
Normal file
79
docs-v2/.vitepress/components/SearchTable.vue
Normal file
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<div>
|
||||
<header class="DocSearch-SearchBar" style="padding: 0">
|
||||
<form class="DocSearch-Form searchinput">
|
||||
<input class="DocSearch-Input" v-model="filterText" placeholder="Filter name..." @input="doFilter" />
|
||||
</form>
|
||||
</header>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Extension Name</th>
|
||||
<th>Linux</th>
|
||||
<th>macOS</th>
|
||||
<th>FreeBSD</th>
|
||||
<th>Windows</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in filterData">
|
||||
<td v-if="!item.notes">{{ item.name }}</td>
|
||||
<td v-else>
|
||||
<a :href="'./extension-notes.html#' + item.name">{{ item.name }}</a>
|
||||
</td>
|
||||
<td>{{ item.linux }}</td>
|
||||
<td>{{ item.macos }}</td>
|
||||
<td>{{ item.freebsd }}</td>
|
||||
<td>{{ item.windows }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div v-if="filterData.length === 0" style="margin: 0 4px 20px 4px; color: var(--vp-c-text-2); font-size: 14px">
|
||||
No result, please try another keyword.
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "SearchTable"
|
||||
}
|
||||
</script>
|
||||
|
||||
<script setup>
|
||||
import {ref} from "vue";
|
||||
import ext from '../../../config/ext.json';
|
||||
|
||||
// 将 ext 转换为列表,方便后续操作
|
||||
const data = ref([]);
|
||||
for (const [name, item] of Object.entries(ext)) {
|
||||
data.value.push({
|
||||
name,
|
||||
linux: item.support?.Linux === undefined ? 'yes' : (item.support?.Linux === 'wip' ? '' : item.support?.Linux),
|
||||
macos: item.support?.Darwin === undefined ? 'yes' : (item.support?.Darwin === 'wip' ? '' : item.support?.Darwin),
|
||||
freebsd: item.support?.BSD === undefined ? 'yes' : (item.support?.BSD === 'wip' ? '' : item.support?.BSD),
|
||||
windows: item.support?.Windows === undefined ? 'yes' : (item.support?.Windows === 'wip' ? '' : item.support?.Windows),
|
||||
notes: item.notes === true,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const filterData = ref(data.value);
|
||||
const filterText = ref('');
|
||||
|
||||
const doFilter = () => {
|
||||
if (filterText.value === '') {
|
||||
filterData.value = data.value;
|
||||
return;
|
||||
}
|
||||
filterData.value = data.value.filter(item => {
|
||||
return item.name.toLowerCase().includes(filterText.value.toLowerCase());
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.searchinput {
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user