1.7.1原版

This commit is contained in:
2026-07-18 15:20:48 +08:00
commit 8b7190ae69
53 changed files with 7962 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
{
"private": true,
"scripts": {
"build": "tsc && vite build",
"dev": "vite",
"lint": "eslint 'src/**/*.ts'",
"prettier": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --ignore-path ./.gitignore --write"
},
"dependencies": {
"@halo-dev/search-widget": "workspace:*"
}
}
+16
View File
@@ -0,0 +1,16 @@
import { SearchModal } from '@halo-dev/search-widget';
import '@halo-dev/search-widget/var.css';
import type { SearchOption } from '@halo-dev/api-client';
export { SearchModal };
const searchModalElement = document.createElement(
'search-modal'
) as SearchModal;
document.body.append(searchModalElement);
export function open(options: SearchOption) {
searchModalElement.options = options;
searchModalElement.open = true;
}
+1
View File
@@ -0,0 +1 @@
/// <reference types="vite/client" />
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["src"]
}
+30
View File
@@ -0,0 +1,30 @@
import path from 'node:path';
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
export default defineConfig({
experimental: {
enableNativePlugin: true,
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
define: { 'process.env.NODE_ENV': "'production'" },
build: {
outDir: fileURLToPath(
new URL('../../src/main/resources/static', import.meta.url)
),
emptyOutDir: true,
cssCodeSplit: false,
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
formats: ['iife'],
name: 'SearchWidget',
fileName: (format) => `search-widget.${format}.js`,
cssFileName: 'style',
},
sourcemap: false,
},
});