@widgetic/creator 0.4.33 → 0.4.35

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.
@@ -1,581 +0,0 @@
1
- <script lang="ts">
2
- import { writable } from 'svelte/store';
3
- import { DropdownMenu, Portal } from '@widgetic/design-system';
4
- import { FontInputController } from '@widgetic/editor';
5
- import FileUrlSourceControl from './FileUrlSourceControl.svelte';
6
- import HoverTooltip from './HoverTooltip.svelte';
7
- import { eventPathMatches } from '../host/creatorHost.js';
8
- import { useCreatorLanguage } from '../i18n/index.js';
9
- import { useTextDirection } from '@widgetic/design-system/components/textDirection';
10
- import { popUpLeftFromAnchor } from '../utils/directionPlacement.js';
11
-
12
- const { t } = useCreatorLanguage();
13
- // The direction of the screen the panel is on (a panel with no screen around it reads left to right).
14
- const textDirection = useTextDirection();
15
-
16
- interface FontModel {
17
- family: string;
18
- weight: string;
19
- category: string;
20
- }
21
-
22
- interface Props {
23
- class?: string;
24
- style?: string;
25
- part?: 'checks' | 'panel';
26
- brandKitEnabled?: boolean;
27
- librariesEnabled?: boolean;
28
- showPresetLibraries?: boolean;
29
- suspendPickers?: boolean;
30
- primary?: string;
31
- secondary?: string;
32
- title?: string;
33
- sub?: string;
34
- fonts?: string[];
35
- libraries?: string[];
36
- libraryGitUrl?: string;
37
- libraryFileName?: string;
38
- libraryUploads?: { name: string; content: string; encoding: string }[];
39
- fontUploads?: { name: string; content: string; encoding: string }[];
40
- showLanguage?: boolean;
41
- language?: string;
42
- languageLocked?: boolean;
43
- }
44
-
45
- const maxFonts = 3;
46
-
47
- let {
48
- class: className = '',
49
- style = '',
50
- part = 'checks',
51
- brandKitEnabled = $bindable(false),
52
- librariesEnabled = $bindable(false),
53
- showPresetLibraries = false,
54
- suspendPickers = false,
55
- primary = $bindable('#314F2F'),
56
- secondary = $bindable('#7BA668'),
57
- title = $bindable('#0F2010'),
58
- sub = $bindable('#5C6B58'),
59
- fonts = $bindable(['Inter']),
60
- libraries = $bindable([] as string[]),
61
- libraryGitUrl = $bindable(''),
62
- libraryFileName = $bindable(''),
63
- libraryUploads = $bindable([] as { name: string; content: string; encoding: string }[]),
64
- fontUploads = $bindable([] as { name: string; content: string; encoding: string }[]),
65
- showLanguage = false,
66
- language = $bindable('react'),
67
- languageLocked = false,
68
- }: Props = $props();
69
-
70
- const libraryChoices = [
71
- { id: 'chart.js/auto', label: 'Chart.js' },
72
- { id: 'd3', label: 'D3' },
73
- { id: 'gsap', label: 'GSAP' },
74
- { id: 'three', label: 'Three.js' },
75
- ];
76
-
77
- // FontInputController requires a store for its open-dropdown contract.
78
- const openDropdowns = writable(new Set<string>());
79
-
80
- let fontModels = $state<FontModel[]>(
81
- (fonts.length ? fonts : ['Inter']).slice(0, maxFonts).map((family) => ({
82
- family,
83
- weight: '400',
84
- category: 'sans-serif',
85
- })),
86
- );
87
-
88
- function publishFonts() {
89
- fonts = fontModels.map((model) => model.family);
90
- }
91
-
92
- function toggleDropdown(id: string) {
93
- openDropdowns.update((current) => {
94
- const next = new Set(current);
95
- if (next.has(id)) next.delete(id);
96
- else {
97
- next.clear();
98
- next.add(id);
99
- }
100
- return next;
101
- });
102
- }
103
-
104
- function updateFont(index: number, next: { family?: string } | null) {
105
- const family = next?.family?.trim() || 'Inter';
106
- if (fontModels[index]?.family === family) return;
107
- fontModels[index] = { family, weight: '400', category: 'sans-serif' };
108
- publishFonts();
109
- }
110
-
111
- function addFont() {
112
- if (fontModels.length >= maxFonts) return;
113
- fontModels = [...fontModels, { family: 'Inter', weight: '400', category: 'sans-serif' }];
114
- publishFonts();
115
- }
116
-
117
- function removeFont(index: number) {
118
- if (fontModels.length <= 1) return;
119
- fontModels = fontModels.filter((_, entryIndex) => entryIndex !== index);
120
- publishFonts();
121
- }
122
-
123
- function toggleLibrary(id: string) {
124
- const next = libraries.includes(id)
125
- ? libraries.filter((entry) => entry !== id)
126
- : [...libraries, id];
127
- libraries = next;
128
- if (next.length > 0) librariesEnabled = true;
129
- }
130
-
131
- let iconFileName = $state('');
132
- let iconUrl = $state('');
133
-
134
- type SourceRow = { id: string; fileName: string; url: string; content: string; encoding: string };
135
- const emptySource = (): SourceRow => ({
136
- id: crypto.randomUUID(),
137
- fileName: '',
138
- url: '',
139
- content: '',
140
- encoding: 'utf8',
141
- });
142
- let libraryRows = $state<SourceRow[]>([emptySource()]);
143
- let iconRows = $state<SourceRow[]>([emptySource()]);
144
-
145
- function addSourceRow(kind: 'library' | 'icon') {
146
- const rows = kind === 'library' ? libraryRows : iconRows;
147
- if (rows.length >= 4) return;
148
- const next = [emptySource(), ...rows];
149
- if (kind === 'library') libraryRows = next;
150
- else iconRows = next;
151
- }
152
-
153
- function removeSourceRow(kind: 'library' | 'icon', id: string) {
154
- const rows = kind === 'library' ? libraryRows : iconRows;
155
- const next = rows.filter((row) => row.id !== id);
156
- const kept = next.length > 0 ? next : [emptySource()];
157
- if (kind === 'library') libraryRows = kept;
158
- else iconRows = kept;
159
- }
160
-
161
- let fontFileName = $state('');
162
- let fontFileContent = $state('');
163
- let fontFileEncoding = $state('base64');
164
- let fontFileUrl = $state('');
165
-
166
- function clearFontUpload() {
167
- fontFileName = '';
168
- fontFileContent = '';
169
- fontFileEncoding = 'base64';
170
- fontFileUrl = '';
171
- }
172
-
173
- $effect(() => {
174
- libraryFileName = libraryRows[0]?.fileName || '';
175
- libraryGitUrl = libraryRows[0]?.url || '';
176
- iconFileName = iconRows[0]?.fileName || '';
177
- iconUrl = iconRows[0]?.url || '';
178
- libraryUploads = [...libraryRows, ...iconRows]
179
- .filter((row) => row.fileName && row.content)
180
- .map((row) => ({ name: row.fileName, content: row.content, encoding: row.encoding }));
181
- fontUploads = fontFileName && fontFileContent
182
- ? [{ name: fontFileName, content: fontFileContent, encoding: fontFileEncoding || 'base64' }]
183
- : [];
184
- });
185
-
186
- let brandPanelOpen = $state(false);
187
- let brandPanelMaxHeight = $state(0);
188
- let brandButtonEl = $state<HTMLLabelElement | null>(null);
189
- let brandPopoverEl = $state<HTMLDivElement | null>(null);
190
- let brandPanelTop = $state(0);
191
- let brandPanelLeft = $state(0);
192
-
193
- function placePopover(anchor: HTMLElement | null, panel: HTMLElement | null, width: number) {
194
- if (!anchor) return { top: 0, left: 8 };
195
- const rect = anchor.getBoundingClientRect();
196
- const height = panel?.offsetHeight || 320;
197
- // Its start edge is lined up with the start edge of the button: the left one on a left to right screen, the right one on a right to left screen.
198
- const left = popUpLeftFromAnchor($textDirection, rect, width, window.innerWidth, 8);
199
- const below = rect.bottom + 6;
200
- const fitsBelow = below + height <= window.innerHeight - 8;
201
- const top = fitsBelow ? below : Math.max(8, rect.top - height - 6);
202
- return { top, left };
203
- }
204
-
205
- function closeFontPickers() {
206
- openDropdowns.set(new Set());
207
- }
208
-
209
- function onBrandKitChange(event: Event) {
210
- brandKitEnabled = (event.currentTarget as HTMLInputElement).checked;
211
- closeFontPickers();
212
- brandPanelOpen = brandKitEnabled;
213
- if (!brandKitEnabled) brandPanelMaxHeight = 0;
214
- }
215
-
216
- function onLibrariesChange(event: Event) {
217
- librariesEnabled = (event.currentTarget as HTMLInputElement).checked;
218
- }
219
-
220
- function componentExtension() {
221
- return language === 'react' ? '.jsx' : '.svelte';
222
- }
223
-
224
- function sourceAccept(includeSvg: boolean) {
225
- const extensions = ['.js', '.ts', componentExtension(), '.zip', '.tar', '.tgz', '.gz'];
226
- if (includeSvg) extensions.unshift('.svg');
227
- return extensions.join(',');
228
- }
229
-
230
- // Words a visitor reads, in the page's language: the function reads `$t`, so a language the page sets later is read on the next draw.
231
- function uploadTooltip(includeSvg: boolean) {
232
- return includeSvg ? $t('creator.brandKit.uploadIconLibraryTooltip') : $t('creator.brandKit.uploadCustomLibraryTooltip');
233
- }
234
-
235
- function urlPlaceholder(includeSvg: boolean) {
236
- const extension = componentExtension();
237
- return includeSvg
238
- ? $t('creator.brandKit.urlIcons', { extension })
239
- : $t('creator.brandKit.urlLibraries', { extension });
240
- }
241
-
242
- $effect(() => {
243
- if (!brandPanelOpen) return;
244
-
245
- function place() {
246
- const brandPlace = placePopover(brandButtonEl, brandPopoverEl, 320);
247
- brandPanelTop = brandPlace.top;
248
- brandPanelLeft = brandPlace.left;
249
- const openHeight = brandPopoverEl?.offsetHeight || 0;
250
- if (openHeight > 0 && brandPanelMaxHeight === 0) brandPanelMaxHeight = openHeight;
251
- }
252
-
253
- function onPointerDown(event: PointerEvent) {
254
- // The whole path is looked at, not `event.target`: from `window` the target of a press inside a shadow root is
255
- // the shadow's host element, so every press, the popover's own included, would count as outside it.
256
- if (brandButtonEl && event.composedPath().includes(brandButtonEl)) return;
257
- if (eventPathMatches(event, '.generation-brand-kit-popover, .font-input-popover, #widgetic-font-picker-portal')) return;
258
- closeFontPickers();
259
- brandPanelOpen = false;
260
- brandPanelMaxHeight = 0;
261
- }
262
-
263
- place();
264
- const frame = requestAnimationFrame(place);
265
- window.addEventListener('pointerdown', onPointerDown, true);
266
- window.addEventListener('resize', place);
267
- window.addEventListener('scroll', place, true);
268
- return () => {
269
- cancelAnimationFrame(frame);
270
- window.removeEventListener('pointerdown', onPointerDown, true);
271
- window.removeEventListener('resize', place);
272
- window.removeEventListener('scroll', place, true);
273
- };
274
- });
275
- </script>
276
-
277
- {#if part === 'checks'}
278
- <div class="generation-options-checks contents {className}" {style}>
279
- <label
280
- class="generation-brand-kit-toggle ms-auto flex h-10 shrink-0 cursor-pointer items-center gap-1.5 rounded-lg border px-2 text-sm {brandKitEnabled ? 'border-[#314F2F] bg-[#314F2F] text-white' : 'border-gray-300 bg-white text-gray-800'}"
281
- bind:this={brandButtonEl}
282
- >
283
- <input
284
- class="generation-option-check cursor-pointer"
285
- type="checkbox"
286
- checked={brandKitEnabled}
287
- onchange={onBrandKitChange}
288
- />
289
- {$t('creator.brandKit.brandKit')}
290
- </label>
291
- {#if showLanguage || showPresetLibraries}
292
- <div class="generation-libraries-row flex w-full flex-col gap-2">
293
- <div class="generation-libraries-checks flex flex-nowrap items-center gap-1">
294
- {#if showLanguage}
295
- {#if languageLocked}
296
- <HoverTooltip class="inline-flex shrink-0" text={$t('creator.brandKit.languageIsFixedAfterThe')}>
297
- <span
298
- class="generation-language-select flex h-10 w-[4.75rem] shrink-0 cursor-default items-center justify-between gap-0.5 rounded-lg border border-gray-300 bg-white px-1.5 text-sm text-gray-900 opacity-60"
299
- aria-disabled="true"
300
- >
301
- <span class="truncate">{language === 'react' ? 'React' : 'Svelte'}</span>
302
- </span>
303
- </HoverTooltip>
304
- {:else}
305
- <HoverTooltip class="inline-flex shrink-0" text={$t('creator.brandKit.selectLanguage')}>
306
- <DropdownMenu.Root>
307
- <DropdownMenu.Trigger
308
- class="generation-language-select flex h-10 w-[4.75rem] shrink-0 cursor-pointer items-center justify-between gap-0.5 rounded-lg border border-gray-300 bg-white px-1.5 text-sm text-gray-900"
309
- >
310
- <span class="truncate">{language === 'react' ? 'React' : 'Svelte'}</span>
311
- <svg class="h-3 w-3 shrink-0 text-gray-500" viewBox="0 0 12 12" fill="none" aria-hidden="true">
312
- <path d="M3 4.5 6 7.5 9 4.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
313
- </svg>
314
- </DropdownMenu.Trigger>
315
- <DropdownMenu.Content class="w-[4.75rem] min-w-0">
316
- <DropdownMenu.Item
317
- class="cursor-pointer {language === 'svelte' ? 'bg-[#314F2F]/15 text-[#314F2F]' : ''}"
318
- onSelect={() => (language = 'svelte')}
319
- >Svelte</DropdownMenu.Item>
320
- <DropdownMenu.Item
321
- class="cursor-pointer {language === 'react' ? 'bg-[#314F2F]/15 text-[#314F2F]' : ''}"
322
- onSelect={() => (language = 'react')}
323
- >React</DropdownMenu.Item>
324
- </DropdownMenu.Content>
325
- </DropdownMenu.Root>
326
- </HoverTooltip>
327
- {/if}
328
- {/if}
329
- {#if showPresetLibraries}
330
- <label class="generation-option-toggle flex h-10 shrink-0 cursor-pointer items-center gap-1.5 rounded-lg border px-2 text-sm {librariesEnabled ? 'border-[#314F2F] bg-[#314F2F] text-white' : 'border-gray-300 bg-white text-gray-800'}">
331
- <input class="generation-option-check cursor-pointer" type="checkbox" checked={librariesEnabled} onchange={onLibrariesChange} />
332
- {$t('creator.brandKit.libraries')}
333
- </label>
334
- {/if}
335
- {#if librariesEnabled && showPresetLibraries}
336
- {#each libraryChoices as choice (choice.id)}
337
- <label class="generation-library flex items-center gap-1 text-xs text-gray-700">
338
- <input
339
- class="generation-library-check cursor-pointer"
340
- type="checkbox"
341
- checked={libraries.includes(choice.id)}
342
- onchange={() => toggleLibrary(choice.id)}
343
- />
344
- {choice.label}
345
- </label>
346
- {/each}
347
- {/if}
348
- {#if librariesEnabled && showPresetLibraries}
349
- <HoverTooltip class="inline-flex shrink-0" text={$t('creator.brandKit.addLibrary')}>
350
- <button
351
- type="button"
352
- class="generation-library-add flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border border-gray-300 bg-white text-sm text-gray-800"
353
- aria-label={$t('creator.brandKit.addLibrary')}
354
- onclick={() => addSourceRow('library')}
355
- >+</button>
356
- </HoverTooltip>
357
- {/if}
358
- </div>
359
- {#if librariesEnabled && showPresetLibraries}
360
- {#each libraryRows as row (row.id)}
361
- <div class="generation-source-row flex items-center gap-1">
362
- <FileUrlSourceControl
363
- class="min-w-0 flex-1"
364
- bind:fileName={row.fileName}
365
- bind:fileContent={row.content}
366
- bind:fileEncoding={row.encoding}
367
- bind:url={row.url}
368
- fileLabel={$t('creator.brandKit.uploadLibrary')}
369
- fileTitle={uploadTooltip(false)}
370
- urlPlaceholder={urlPlaceholder(false)}
371
- accept={sourceAccept(false)}
372
- />
373
- {#if libraryRows.length > 1}
374
- <button
375
- type="button"
376
- class="generation-source-remove flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border border-gray-300 text-gray-500"
377
- aria-label={$t('creator.brandKit.removeLibrary')}
378
- onclick={() => removeSourceRow('library', row.id)}
379
- >
380
- <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
381
- <path d="M4 7h16" />
382
- <path d="M9 7V5h6v2" />
383
- <path d="M8 7l1 13h6l1-13" />
384
- </svg>
385
- </button>
386
- {/if}
387
- </div>
388
- {/each}
389
- {/if}
390
- </div>
391
- {/if}
392
- </div>
393
- {#if brandPanelOpen}
394
- <Portal
395
- target="generation-brand-kit-portal"
396
- class="generation-brand-kit-portal-root"
397
- style="position: fixed; top: {brandPanelTop}px; left: {brandPanelLeft}px; /* rtl-ok: worked out from where the button is on the screen and kept inside it, in pixels from the left edge */ width: 320px; height: auto;"
398
- >
399
- <div
400
- class="generation-brand-kit-popover flex flex-col gap-3 overflow-y-auto rounded-lg border border-gray-200 bg-white p-3 shadow-lg"
401
- style={brandPanelMaxHeight > 0 ? `max-height: ${brandPanelMaxHeight}px;` : ''}
402
- bind:this={brandPopoverEl}
403
- >
404
- <p class="generation-options-note text-xs text-gray-500">{$t('creator.brandKit.replacesTheWidgeticPaletteFor')}</p>
405
- <section class="generation-color-palette flex flex-col gap-2">
406
- <h3 class="generation-section-title text-xs font-semibold text-gray-800">{$t('creator.brandKit.colorPalette')}</h3>
407
- <div class="generation-brand-colors flex flex-wrap items-end gap-3">
408
- <label class="generation-brand-color flex flex-col gap-1 text-xs text-gray-600">
409
- {$t('creator.brandKit.primary')}
410
- <input class="generation-brand-color-input h-8 w-14 cursor-pointer border border-gray-200 bg-white" type="color" bind:value={primary} />
411
- </label>
412
- <label class="generation-brand-color flex flex-col gap-1 text-xs text-gray-600">
413
- {$t('creator.brandKit.secondary')}
414
- <input class="generation-brand-color-input h-8 w-14 cursor-pointer border border-gray-200 bg-white" type="color" bind:value={secondary} />
415
- </label>
416
- <label class="generation-brand-color flex flex-col gap-1 text-xs text-gray-600">
417
- {$t('creator.brandKit.title')}
418
- <input class="generation-brand-color-input h-8 w-14 cursor-pointer border border-gray-200 bg-white" type="color" bind:value={title} />
419
- </label>
420
- <label class="generation-brand-color flex flex-col gap-1 text-xs text-gray-600">
421
- {$t('creator.brandKit.sub')}
422
- <input class="generation-brand-color-input h-8 w-14 cursor-pointer border border-gray-200 bg-white" type="color" bind:value={sub} />
423
- </label>
424
- </div>
425
- </section>
426
- <div class="generation-section-separator border-t border-gray-200"></div>
427
- <section class="generation-brand-fonts flex flex-col gap-2">
428
- <div class="generation-fonts-header flex items-center justify-between gap-2">
429
- <h3 class="generation-section-title text-xs font-semibold text-gray-800">{$t('creator.brandKit.fonts')}</h3>
430
- {#if fontModels.length < maxFonts && !suspendPickers}
431
- <button
432
- type="button"
433
- class="generation-brand-font-add h-7 cursor-pointer rounded-md border border-gray-300 px-2 text-xs text-gray-700"
434
- onclick={addFont}
435
- >
436
- {$t('creator.brandKit.addFont')}
437
- </button>
438
- {/if}
439
- </div>
440
- {#each fontModels as model, index (index)}
441
- <div class="generation-brand-font-row flex items-start gap-2">
442
- {#if suspendPickers}
443
- <p class="generation-brand-font-name min-w-0 flex-1 py-2 text-sm text-gray-800">{model.family}</p>
444
- {:else}
445
- <div class="generation-brand-font-picker min-w-0 flex-1">
446
- <FontInputController
447
- label={index === 0 ? $t('creator.brandKit.fontLabel') : $t('creator.brandKit.font', { number: index + 1 })}
448
- controllerId="generation-brand-font-{index}"
449
- value={model}
450
- {openDropdowns}
451
- {toggleDropdown}
452
- hideTrashIcon={true}
453
- hideRecentFromList={true}
454
- onChange={(next) => updateFont(index, next)}
455
- />
456
- </div>
457
- {/if}
458
- {#if fontModels.length > 1}
459
- <button
460
- type="button"
461
- class="generation-brand-font-remove mt-1 flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border border-gray-300 text-gray-500"
462
- aria-label={$t('creator.brandKit.removeFont')}
463
- onclick={() => removeFont(index)}
464
- >
465
- <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
466
- <path d="M4 7h16" />
467
- <path d="M9 7V5h6v2" />
468
- <path d="M8 7l1 13h6l1-13" />
469
- </svg>
470
- </button>
471
- {/if}
472
- </div>
473
- {/each}
474
- <div class="generation-font-upload flex items-center gap-1">
475
- <FileUrlSourceControl
476
- class="min-w-0 flex-1"
477
- bind:fileName={fontFileName}
478
- bind:fileContent={fontFileContent}
479
- bind:fileEncoding={fontFileEncoding}
480
- bind:url={fontFileUrl}
481
- fileLabel={$t('creator.brandKit.uploadFonts')}
482
- fileTitle={$t('creator.brandKit.uploadAFontFileOr')}
483
- urlPlaceholder={$t('creator.brandKit.urlArchiveWoff2TtfOtf')}
484
- accept=".woff,.woff2,.ttf,.otf,.eot,.zip,.tar,.tgz,.gz"
485
- />
486
- {#if fontFileName || fontFileUrl}
487
- <button
488
- type="button"
489
- class="generation-source-remove flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border border-gray-300 text-gray-500"
490
- aria-label={$t('creator.brandKit.removeUploadedFont')}
491
- onclick={clearFontUpload}
492
- >
493
- <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
494
- <path d="M4 7h16" />
495
- <path d="M9 7V5h6v2" />
496
- <path d="M8 7l1 13h6l1-13" />
497
- </svg>
498
- </button>
499
- {/if}
500
- </div>
501
- </section>
502
- <div class="generation-section-separator border-t border-gray-200"></div>
503
- <section class="generation-brand-icons flex flex-col gap-2">
504
- <div class="generation-icons-header flex items-center justify-between gap-2">
505
- <h3 class="generation-section-title text-xs font-semibold text-gray-800">{$t('creator.brandKit.icons')}</h3>
506
- <HoverTooltip text={$t('creator.brandKit.addIconLibrary')}>
507
- <button
508
- type="button"
509
- class="generation-icon-add flex h-7 w-7 cursor-pointer items-center justify-center rounded-md border border-gray-300 text-sm text-gray-700"
510
- aria-label={$t('creator.brandKit.addIconLibrary')}
511
- onclick={() => addSourceRow('icon')}
512
- >+</button>
513
- </HoverTooltip>
514
- </div>
515
- {#each iconRows as row (row.id)}
516
- <div class="generation-source-row flex items-center gap-1">
517
- <FileUrlSourceControl
518
- class="min-w-0 flex-1"
519
- bind:fileName={row.fileName}
520
- bind:fileContent={row.content}
521
- bind:fileEncoding={row.encoding}
522
- bind:url={row.url}
523
- fileLabel={$t('creator.brandKit.uploadLibrary')}
524
- fileTitle={uploadTooltip(true)}
525
- urlPlaceholder={urlPlaceholder(true)}
526
- accept={sourceAccept(true)}
527
- />
528
- {#if iconRows.length > 1}
529
- <button
530
- type="button"
531
- class="generation-source-remove flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border border-gray-300 text-gray-500"
532
- aria-label={$t('creator.brandKit.removeIconLibrary')}
533
- onclick={() => removeSourceRow('icon', row.id)}
534
- >
535
- <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
536
- <path d="M4 7h16" />
537
- <path d="M9 7V5h6v2" />
538
- <path d="M8 7l1 13h6l1-13" />
539
- </svg>
540
- </button>
541
- {/if}
542
- </div>
543
- {/each}
544
- </section>
545
- </div>
546
- </Portal>
547
- {/if}
548
- {/if}
549
-
550
- <style>
551
- .generation-options-checks input:focus,
552
- .generation-options-checks input:focus-visible,
553
- .generation-brand-kit-popover button:focus,
554
- .generation-brand-kit-popover button:focus-visible,
555
- .generation-brand-kit-popover input:focus,
556
- .generation-brand-kit-popover input:focus-visible,
557
- .generation-language-select:focus,
558
- .generation-language-select:focus-visible {
559
- outline: none;
560
- box-shadow: none;
561
- }
562
-
563
- .generation-brand-kit-popover {
564
- scrollbar-width: thin;
565
- scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
566
- }
567
-
568
- .generation-brand-kit-popover::-webkit-scrollbar {
569
- width: 8px;
570
- background: transparent;
571
- }
572
-
573
- .generation-brand-kit-popover::-webkit-scrollbar-track {
574
- background: transparent;
575
- }
576
-
577
- .generation-brand-kit-popover::-webkit-scrollbar-thumb {
578
- background: rgba(0, 0, 0, 0.2);
579
- border-radius: 4px;
580
- }
581
- </style>
@@ -1,33 +0,0 @@
1
- interface Props {
2
- class?: string;
3
- style?: string;
4
- part?: 'checks' | 'panel';
5
- brandKitEnabled?: boolean;
6
- librariesEnabled?: boolean;
7
- showPresetLibraries?: boolean;
8
- suspendPickers?: boolean;
9
- primary?: string;
10
- secondary?: string;
11
- title?: string;
12
- sub?: string;
13
- fonts?: string[];
14
- libraries?: string[];
15
- libraryGitUrl?: string;
16
- libraryFileName?: string;
17
- libraryUploads?: {
18
- name: string;
19
- content: string;
20
- encoding: string;
21
- }[];
22
- fontUploads?: {
23
- name: string;
24
- content: string;
25
- encoding: string;
26
- }[];
27
- showLanguage?: boolean;
28
- language?: string;
29
- languageLocked?: boolean;
30
- }
31
- declare const BrandKitPanel: import("svelte").Component<Props, {}, "sub" | "title" | "brandKitEnabled" | "librariesEnabled" | "primary" | "secondary" | "fonts" | "libraries" | "libraryGitUrl" | "libraryFileName" | "libraryUploads" | "fontUploads" | "language">;
32
- type BrandKitPanel = ReturnType<typeof BrandKitPanel>;
33
- export default BrandKitPanel;