@snowcone-app/canvas 0.8.1 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/CanvasStateV1-D3THl2Zc.js +456 -0
  2. package/dist/CanvasStateV1-D3THl2Zc.js.map +1 -0
  3. package/dist/HybridHistoryManager-DANuzx7G.js.map +1 -1
  4. package/dist/advanced.mjs +2 -2
  5. package/dist/api/embed.d.ts +4 -0
  6. package/dist/api/stable.d.ts +6 -2
  7. package/dist/components/embed/SnowconeCanvas.d.ts +8 -0
  8. package/dist/components/embed-realtime/RealtimeMockup.d.ts +20 -0
  9. package/dist/contexts/CanvasServicesContext.d.ts +9 -2
  10. package/dist/design/design-builder.d.ts +23 -1
  11. package/dist/design/template-fields.d.ts +59 -0
  12. package/dist/embed.mjs +136 -111
  13. package/dist/embed.mjs.map +1 -1
  14. package/dist/fonts/google-fonts.d.ts +1 -6
  15. package/dist/hooks/useArtboards.d.ts +1 -0
  16. package/dist/hooks/useColorBinding.d.ts +21 -0
  17. package/dist/index.mjs +45 -40
  18. package/dist/internals.mjs +1 -1
  19. package/dist/rendering/serialize-for-server.d.ts +1 -0
  20. package/dist/schemas-B4UXytQB.js +3250 -0
  21. package/dist/schemas-B4UXytQB.js.map +1 -0
  22. package/dist/services/imageSearch.d.ts +30 -0
  23. package/dist/style.css +1 -1
  24. package/dist/template-fields-C8Tj67ek.js +1585 -0
  25. package/dist/template-fields-C8Tj67ek.js.map +1 -0
  26. package/dist/utils/UnifiedFontService.d.ts +9 -30
  27. package/dist/{validation-CZ4CZV5B.js → validation-C857Ptxn.js} +5804 -6344
  28. package/dist/validation-C857Ptxn.js.map +1 -0
  29. package/package.json +3 -3
  30. package/dist/CanvasStateV1-D7mGz8FR.js +0 -3692
  31. package/dist/CanvasStateV1-D7mGz8FR.js.map +0 -1
  32. package/dist/components/MonotypeDemoPage.d.ts +0 -2
  33. package/dist/design-builder-CM5wSK5w.js +0 -1467
  34. package/dist/design-builder-CM5wSK5w.js.map +0 -1
  35. package/dist/utils/MonotypeCategoryMapping.d.ts +0 -36
  36. package/dist/utils/MonotypeService.d.ts +0 -148
  37. package/dist/validation-CZ4CZV5B.js.map +0 -1
@@ -1,36 +0,0 @@
1
- import { FontCategory } from '../fonts/google-fonts.js';
2
- export interface CategoryRule {
3
- canonical: FontCategory;
4
- monotypeClassifications: string[];
5
- googleCategory?: string;
6
- displayName: string;
7
- description: string;
8
- icon?: string;
9
- }
10
- /**
11
- * Category mapping rules with priority order
12
- * Most specific categories first, general categories last
13
- */
14
- export declare const CATEGORY_MAPPINGS: CategoryRule[];
15
- /**
16
- * Map Monotype classifications to canonical category
17
- * Uses priority order (most specific first)
18
- *
19
- * Example:
20
- * - ["SERIF", "SLAB SERIF"] → 'slab-serif' (most specific wins)
21
- * - ["SERIF", "OLD STYLE SERIF", "DISPLAY"] → 'display' (priority order)
22
- * - ["SANS SERIF", "GEOMETRIC SANS"] → 'sans-serif'
23
- *
24
- * @param classifications - Array of Monotype classifications
25
- * @returns Canonical category
26
- */
27
- export declare function mapMonotypeClassifications(classifications: string[]): FontCategory;
28
- /**
29
- * Get category mapping by canonical name
30
- */
31
- export declare function getCategoryMapping(category: FontCategory): CategoryRule | undefined;
32
- /**
33
- * Get all Monotype classifications for a canonical category
34
- * Useful for API searches
35
- */
36
- export declare function getMonotypeClassifications(category: FontCategory): string[];
@@ -1,148 +0,0 @@
1
- import { FontCategory, FontDefinition } from '../fonts/google-fonts.js';
2
- export interface MonotypeFont {
3
- fontId: string;
4
- name: string;
5
- friendlyName: string;
6
- family: string;
7
- familyId: string;
8
- foundry: string;
9
- classification: string[];
10
- tag: string[];
11
- publicTags: string[];
12
- weightCSS: number;
13
- sample: string;
14
- format?: string;
15
- }
16
- export interface MonotypeSearchParams {
17
- name?: string;
18
- family?: string;
19
- classification?: string[];
20
- foundry?: string;
21
- tag?: string[];
22
- searchSettings?: {
23
- fuzzy?: string[];
24
- partial?: string[];
25
- exact?: string[];
26
- };
27
- pageSize?: number;
28
- pageNumber?: number;
29
- pageId?: string;
30
- }
31
- export interface MonotypeSearchResponse {
32
- fonts: MonotypeFont[];
33
- nextPageId?: string;
34
- totalCount?: number;
35
- }
36
- export interface WebFontKit {
37
- fontFamily: string;
38
- cssUrl: string;
39
- timestamp: number;
40
- }
41
- declare class MonotypeServiceClass {
42
- private accessToken;
43
- private tokenExpiry;
44
- private fonts;
45
- private fontsLoaded;
46
- private webfontKits;
47
- private searchCache;
48
- private readonly API_BASE;
49
- private readonly CACHE_TTL;
50
- private monotypeEnabled;
51
- constructor();
52
- /**
53
- * Check if Monotype credentials are configured
54
- */
55
- private checkMonotypeEnabled;
56
- /**
57
- * Check if Monotype integration is enabled
58
- */
59
- isMonotypeEnabled(): boolean;
60
- /**
61
- * Authenticate with Monotype API using OAuth 2.0
62
- * Token is cached and automatically refreshed when expired
63
- * Returns silently if Monotype is not enabled
64
- */
65
- authenticate(): Promise<void>;
66
- /**
67
- * Check if service is authenticated
68
- */
69
- isAuthenticated(): boolean;
70
- /**
71
- * Fetch all Monotype fonts with pagination and caching
72
- * Strategy: Fetch fonts by category to get classification data
73
- * Returns silently if Monotype is not enabled
74
- */
75
- fetchAllFonts(): Promise<void>;
76
- /**
77
- * Get all Monotype fonts (uses cache if available)
78
- */
79
- getAllFonts(): MonotypeFont[];
80
- /**
81
- * Check if fonts have been loaded
82
- */
83
- isFontsLoaded(): boolean;
84
- /**
85
- * Search Monotype fonts (returns raw API response)
86
- * For internal use - external callers should use searchFonts()
87
- */
88
- private searchFontsRaw;
89
- /**
90
- * Search Monotype fonts and return FontDefinitions
91
- * Supports text search, fuzzy matching, and category filtering
92
- */
93
- searchFonts(params: MonotypeSearchParams): Promise<FontDefinition[]>;
94
- /**
95
- * Search fonts by name with fuzzy matching
96
- */
97
- searchFontsByName(query: string): Promise<FontDefinition[]>;
98
- /**
99
- * Filter fonts by category
100
- */
101
- filterFontsByCategory(category: FontCategory): Promise<FontDefinition[]>;
102
- /**
103
- * Group Monotype fonts by family
104
- * Reduces 492 font variants to ~120 font families
105
- */
106
- groupMonotypeFontsByFamily(fonts: MonotypeFont[]): FontDefinition[];
107
- /**
108
- * Extract font weights from variants
109
- */
110
- private extractWeights;
111
- /**
112
- * Get or generate WebFont kit for a Monotype font
113
- * Kit URLs are persistent and cached forever
114
- */
115
- getWebFontKit(fontId: string, fontFamily: string): Promise<WebFontKit>;
116
- /**
117
- * Load Monotype font by injecting CSS link
118
- */
119
- loadMonotypeFont(fontId: string, fontFamily: string): Promise<void>;
120
- /**
121
- * Load caches from localStorage
122
- */
123
- private loadCachesFromStorage;
124
- /**
125
- * Save caches to localStorage
126
- */
127
- private saveCachesToStorage;
128
- /**
129
- * Clear all caches (including auth state)
130
- */
131
- clearCaches(): void;
132
- /**
133
- * Get service stats for debugging
134
- */
135
- getStats(): {
136
- monotypeEnabled: boolean;
137
- authenticated: boolean;
138
- hasAccessToken: boolean;
139
- tokenExpiry: string | null;
140
- fontsLoaded: boolean;
141
- fontCount: number;
142
- familyCount: number;
143
- webfontKitCount: number;
144
- searchCacheSize: number;
145
- };
146
- }
147
- export declare const MonotypeService: MonotypeServiceClass;
148
- export {};