UNPKG

apple-dev-mcp

Version:

Complete Apple development guidance: Human Interface Guidelines (design) + Technical Documentation for iOS, macOS, watchOS, tvOS, and visionOS

147 lines 6.13 kB
/** * HIG Discovery Service * * Comprehensive discovery service that identifies all Apple HIG sections * across all platforms using known URL patterns and structures. */ export class ContentHIGDiscoveryService { baseUrl = 'https://developer.apple.com/design/human-interface-guidelines'; /** * Discover all HIG sections using comprehensive known structure */ async discoverSections() { console.log('🔍 Discovering HIG sections...'); const discoveredSections = []; // Universal/Cross-platform sections discoveredSections.push(...this.getUniversalSections()); // Platform-specific sections discoveredSections.push(...this.getPlatformSpecificSections()); console.log(`📋 Discovered ${discoveredSections.length} HIG sections`); return discoveredSections; } getUniversalSections() { const sections = []; // Foundations const foundations = [ 'accessibility', 'inclusion', 'privacy', 'branding' ]; this.addSections(sections, 'universal', foundations, 'foundations'); // Layout & Design const layout = [ 'layout', 'spatial-layout', 'typography', 'color', 'icons', 'images', 'motion', 'materials' ]; this.addSections(sections, 'universal', layout, 'layout'); // Interaction const interaction = [ 'inputs', 'gestures', 'feedback', 'loading', 'onboarding', 'launching' ]; this.addSections(sections, 'universal', interaction, 'selection-and-input'); // Navigation const navigation = [ 'navigation-and-search', 'searching', 'modality' ]; this.addSections(sections, 'universal', navigation, 'navigation'); // Presentation const presentation = [ 'alerts', 'action-sheets', 'activity-views', 'sheets', 'popovers' ]; this.addSections(sections, 'universal', presentation, 'presentation'); // Visual Design Components const components = [ 'buttons', 'menus', 'toolbars', 'tab-bars', 'navigation-bars', 'sliders', 'steppers', 'toggles', 'pickers', 'progress-indicators', 'labels', 'text-fields', 'text-views', 'lists-and-tables', 'collections', 'scroll-views', 'split-views', 'boxes', 'gauges', 'charts', 'rating-indicators', 'segmented-controls', 'search-fields', 'sidebars' ]; this.addSections(sections, 'universal', components, 'visual-design'); // Technologies const technologies = [ 'app-clips', 'app-shortcuts', 'apple-pay', 'carplay', 'healthkit', 'homekit', 'icloud', 'in-app-purchase', 'machine-learning', 'maps', 'nfc', 'siri', 'wallet', 'augmented-reality', 'game-center', 'live-activities', 'live-photos', 'notifications', 'shareplay', 'sign-in-with-apple', 'tap-to-pay-on-iphone', 'widgets', 'sf-symbols' ]; this.addSections(sections, 'universal', technologies, 'technologies'); return sections; } getPlatformSpecificSections() { const sections = []; // iOS-specific sections const iosSpecific = [ 'designing-for-ios', 'app-icons', 'home-screen-quick-actions', 'multitasking', 'requesting-permission', 'settings' ]; this.addSections(sections, 'iOS', iosSpecific, 'foundations'); // macOS-specific sections const macosSpecific = [ 'designing-for-macos', 'the-menu-bar', 'dock-menus', 'column-views', 'outline-views', 'combo-boxes', 'disclosure-controls', 'image-wells', 'path-controls', 'pop-up-buttons', 'pull-down-buttons', 'token-fields', 'color-wells', 'panels', 'going-full-screen', 'printing', 'windows' ]; this.addSections(sections, 'macOS', macosSpecific, 'foundations'); // watchOS-specific sections const watchosSpecific = [ 'designing-for-watchos', 'complications', 'watch-faces', 'digital-crown', 'digit-entry-views', 'always-on', 'workouts' ]; this.addSections(sections, 'watchOS', watchosSpecific, 'foundations'); // tvOS-specific sections const tvosSpecific = [ 'designing-for-tvos', 'focus-and-selection', 'remotes', 'top-shelf' ]; this.addSections(sections, 'tvOS', tvosSpecific, 'foundations'); // visionOS-specific sections const visionosSpecific = [ 'designing-for-visionos', 'eyes', 'immersive-experiences', 'spatial-layout', 'materials', 'ornaments' ]; this.addSections(sections, 'visionOS', visionosSpecific, 'foundations'); return sections; } addSections(sections, platform, slugs, category) { for (const slug of slugs) { sections.push({ id: `${platform.toLowerCase()}-${slug}`, title: this.slugToTitle(slug), url: `${this.baseUrl}/${slug}`, platform, category, content: '', // Will be populated during scraping lastUpdated: new Date() }); } } slugToTitle(slug) { return slug .split('-') .map(word => word.charAt(0).toUpperCase() + word.slice(1)) .join(' '); } /** * Get platform-specific content directory path */ getPlatformDirectory(platform) { const platformMap = { 'iOS': 'ios', 'macOS': 'macos', 'watchOS': 'watchos', 'tvOS': 'tvos', 'visionOS': 'visionos', 'universal': 'universal' }; return platformMap[platform] || 'universal'; } /** * Generate filename for a section */ generateFilename(section) { const slug = section.title.toLowerCase() .replace(/[^a-z0-9]+/g, '-') .replace(/^-+|-+$/g, ''); return `${slug}.md`; } } //# sourceMappingURL=hig-discovery.service.js.map