mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-21 07:06:42 +02:00
Add new @manacore/shared-splitscreen package enabling iFrame-based
split-screen functionality across Calendar, Todo, and Contacts apps.
Features:
- SplitPaneContainer with CSS Grid layout
- AppPanel with iFrame sandbox permissions and loading/error states
- ResizeHandle with mouse, touch, and keyboard support (20-80% range)
- PanelControls for swap and close actions
- Svelte 5 runes-based store with Context API
- URL persistence (?panel=todo&split=60)
- localStorage persistence with versioning
- Mobile auto-disable (<1024px breakpoint)
Integration:
- PillNavigation: added onOpenInPanel prop and Ctrl/Cmd+click support
- PillDropdown: added split button per app item
- Calendar, Todo, Contacts layouts wrapped with SplitPaneContainer
Also fixes:
- WeekView.svelte: fixed {@const} placement error
- MultiDayView.svelte: fixed {@const} placement error
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
131 lines
3.5 KiB
TypeScript
131 lines
3.5 KiB
TypeScript
/**
|
|
* Shared Vite Configuration for ManaCore Web Apps
|
|
* Provides consistent SSR and optimization settings.
|
|
*/
|
|
|
|
import type { UserConfig } from 'vite';
|
|
|
|
/**
|
|
* Common ManaCore shared packages that need SSR configuration.
|
|
* These packages contain Svelte 5 runes or other client-side state.
|
|
*/
|
|
export const MANACORE_SHARED_PACKAGES = [
|
|
'@manacore/shared-icons',
|
|
'@manacore/shared-ui',
|
|
'@manacore/shared-tailwind',
|
|
'@manacore/shared-theme',
|
|
'@manacore/shared-theme-ui',
|
|
'@manacore/shared-feedback-ui',
|
|
'@manacore/shared-feedback-service',
|
|
'@manacore/shared-feedback-types',
|
|
'@manacore/shared-auth',
|
|
'@manacore/shared-auth-ui',
|
|
'@manacore/shared-branding',
|
|
'@manacore/shared-subscription-ui',
|
|
'@manacore/shared-profile-ui',
|
|
'@manacore/shared-i18n',
|
|
'@manacore/shared-api-client',
|
|
'@manacore/shared-splitscreen',
|
|
] as const;
|
|
|
|
export interface ViteConfigOptions {
|
|
/** Server port */
|
|
port: number;
|
|
/** Additional packages to include in noExternal (e.g., app-specific shared packages) */
|
|
additionalPackages?: string[];
|
|
/** Additional packages to exclude from optimization */
|
|
additionalExcludes?: string[];
|
|
/** Override default shared packages (if you need a subset) */
|
|
sharedPackages?: string[];
|
|
}
|
|
|
|
/**
|
|
* Get the SSR noExternal configuration for ManaCore apps.
|
|
*/
|
|
export function getSsrNoExternal(additionalPackages: string[] = []): string[] {
|
|
return [...MANACORE_SHARED_PACKAGES, ...additionalPackages];
|
|
}
|
|
|
|
/**
|
|
* Get the optimizeDeps exclude configuration for ManaCore apps.
|
|
*/
|
|
export function getOptimizeDepsExclude(additionalExcludes: string[] = []): string[] {
|
|
return [...MANACORE_SHARED_PACKAGES, ...additionalExcludes];
|
|
}
|
|
|
|
/**
|
|
* Create a base Vite configuration for ManaCore SvelteKit apps.
|
|
* Merge this with your app-specific configuration.
|
|
*/
|
|
export function createViteConfig(options: ViteConfigOptions): Partial<UserConfig> {
|
|
const { port, additionalPackages = [], additionalExcludes = [] } = options;
|
|
|
|
const packages = options.sharedPackages || [...MANACORE_SHARED_PACKAGES];
|
|
const noExternal = [...packages, ...additionalPackages];
|
|
const exclude = [...packages, ...additionalExcludes];
|
|
|
|
return {
|
|
server: {
|
|
port,
|
|
strictPort: true,
|
|
},
|
|
ssr: {
|
|
noExternal,
|
|
},
|
|
optimizeDeps: {
|
|
exclude,
|
|
},
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Merge base config with app-specific plugins and settings.
|
|
* Use this in your vite.config.ts:
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* import { sveltekit } from '@sveltejs/kit/vite';
|
|
* import tailwindcss from '@tailwindcss/vite';
|
|
* import { defineConfig } from 'vite';
|
|
* import { createViteConfig, mergeViteConfig } from '@manacore/shared-vite-config';
|
|
*
|
|
* const baseConfig = createViteConfig({
|
|
* port: 5174,
|
|
* additionalPackages: ['@chat/shared'],
|
|
* });
|
|
*
|
|
* export default defineConfig(mergeViteConfig(baseConfig, {
|
|
* plugins: [tailwindcss(), sveltekit()],
|
|
* }));
|
|
* ```
|
|
*/
|
|
export function mergeViteConfig(
|
|
baseConfig: Partial<UserConfig>,
|
|
appConfig: Partial<UserConfig>
|
|
): UserConfig {
|
|
return {
|
|
...baseConfig,
|
|
...appConfig,
|
|
server: {
|
|
...baseConfig.server,
|
|
...appConfig.server,
|
|
},
|
|
ssr: {
|
|
...baseConfig.ssr,
|
|
...appConfig.ssr,
|
|
noExternal: [
|
|
...((baseConfig.ssr?.noExternal as string[]) || []),
|
|
...((appConfig.ssr?.noExternal as string[]) || []),
|
|
],
|
|
},
|
|
optimizeDeps: {
|
|
...baseConfig.optimizeDeps,
|
|
...appConfig.optimizeDeps,
|
|
exclude: [
|
|
...(baseConfig.optimizeDeps?.exclude || []),
|
|
...(appConfig.optimizeDeps?.exclude || []),
|
|
],
|
|
},
|
|
plugins: [...(baseConfig.plugins || []), ...(appConfig.plugins || [])],
|
|
};
|
|
}
|