tacel-canva 1.0.0 → 1.1.0

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 (3) hide show
  1. package/canva.css +141 -4
  2. package/canva.js +92 -0
  3. package/package.json +1 -1
package/canva.css CHANGED
@@ -254,6 +254,7 @@
254
254
  display: flex;
255
255
  align-items: center;
256
256
  justify-content: space-between;
257
+ overflow: visible;
257
258
  gap: var(--tc-spacing);
258
259
  padding: var(--tc-spacing) var(--tc-spacing-lg);
259
260
  border-bottom: 1px solid var(--tc-border-light);
@@ -288,6 +289,8 @@
288
289
  display: flex;
289
290
  align-items: center;
290
291
  gap: var(--tc-spacing);
292
+ position: relative;
293
+ overflow: visible;
291
294
  }
292
295
 
293
296
  .tc-user-info {
@@ -2004,6 +2007,122 @@
2004
2007
  THEME PICKER
2005
2008
  ═══════════════════════════════════════════════════════════════ */
2006
2009
 
2010
+ /* ── Theme Dropdown ── */
2011
+ .tc-theme-dropdown-wrap {
2012
+ position: relative;
2013
+ display: inline-flex;
2014
+ }
2015
+
2016
+ .tc-theme-dropdown-btn {
2017
+ display: inline-flex;
2018
+ align-items: center;
2019
+ gap: 6px;
2020
+ padding: 6px 10px;
2021
+ border: 1px solid var(--tc-border);
2022
+ border-radius: var(--tc-border-radius);
2023
+ background: var(--tc-bg);
2024
+ color: var(--tc-text-muted);
2025
+ cursor: pointer;
2026
+ transition: var(--tc-transition);
2027
+ font-size: 13px;
2028
+ }
2029
+
2030
+ .tc-theme-dropdown-btn:hover {
2031
+ border-color: var(--tc-primary);
2032
+ color: var(--tc-primary);
2033
+ background: var(--tc-bg-secondary);
2034
+ }
2035
+
2036
+ .tc-theme-dropdown-btn svg {
2037
+ width: 14px;
2038
+ height: 14px;
2039
+ flex-shrink: 0;
2040
+ }
2041
+
2042
+ .tc-theme-dropdown-label {
2043
+ font-size: 12px;
2044
+ font-weight: 500;
2045
+ }
2046
+
2047
+ .tc-theme-dropdown-menu {
2048
+ display: none;
2049
+ position: absolute;
2050
+ top: 100%;
2051
+ right: 0;
2052
+ margin-top: 4px;
2053
+ min-width: 180px;
2054
+ max-height: 320px;
2055
+ overflow-y: auto;
2056
+ background: var(--tc-bg);
2057
+ border: 1px solid var(--tc-border);
2058
+ border-radius: var(--tc-border-radius);
2059
+ box-shadow: 0 8px 24px var(--tc-shadow-lg);
2060
+ z-index: 9999;
2061
+ padding: 4px;
2062
+ }
2063
+
2064
+ .tc-theme-dropdown-menu.open {
2065
+ display: flex;
2066
+ flex-direction: column;
2067
+ gap: 1px;
2068
+ }
2069
+
2070
+ .tc-theme-dropdown-item {
2071
+ display: flex;
2072
+ align-items: center;
2073
+ gap: 8px;
2074
+ padding: 8px 10px;
2075
+ border-radius: var(--tc-border-radius-sm);
2076
+ cursor: pointer;
2077
+ transition: var(--tc-transition);
2078
+ color: var(--tc-text-muted);
2079
+ font-size: 13px;
2080
+ white-space: nowrap;
2081
+ }
2082
+
2083
+ .tc-theme-dropdown-item:hover {
2084
+ background: var(--tc-bg-secondary);
2085
+ color: var(--tc-text);
2086
+ }
2087
+
2088
+ .tc-theme-dropdown-item.active {
2089
+ background: var(--tc-primary-light);
2090
+ color: var(--tc-text);
2091
+ }
2092
+
2093
+ .tc-theme-swatch {
2094
+ width: 20px;
2095
+ height: 20px;
2096
+ min-width: 20px;
2097
+ border-radius: 5px;
2098
+ border: 2px solid;
2099
+ display: flex;
2100
+ align-items: center;
2101
+ justify-content: center;
2102
+ flex-shrink: 0;
2103
+ }
2104
+
2105
+ .tc-theme-swatch-dot {
2106
+ width: 8px;
2107
+ height: 8px;
2108
+ border-radius: 50%;
2109
+ }
2110
+
2111
+ .tc-theme-item-label {
2112
+ flex: 1;
2113
+ overflow: hidden;
2114
+ text-overflow: ellipsis;
2115
+ white-space: nowrap;
2116
+ }
2117
+
2118
+ .tc-theme-check {
2119
+ color: var(--tc-primary);
2120
+ font-size: 13px;
2121
+ font-weight: 700;
2122
+ flex-shrink: 0;
2123
+ }
2124
+
2125
+ /* Legacy theme picker classes - kept for compatibility */
2007
2126
  .tc-theme-picker {
2008
2127
  position: relative;
2009
2128
  }
@@ -2039,9 +2158,9 @@
2039
2158
  }
2040
2159
 
2041
2160
  .tc-theme-dropdown {
2042
- position: absolute;
2043
- top: 100%;
2044
- right: 0;
2161
+ position: fixed;
2162
+ top: auto;
2163
+ right: auto;
2045
2164
  margin-top: 4px;
2046
2165
  background: var(--tc-bg);
2047
2166
  border: 1px solid var(--tc-border);
@@ -2050,8 +2169,26 @@
2050
2169
  min-width: 220px;
2051
2170
  max-height: 400px;
2052
2171
  overflow-y: auto;
2053
- z-index: 100;
2172
+ z-index: 9999;
2054
2173
  padding: 6px;
2174
+ display: none;
2175
+ }
2176
+
2177
+ .tc-theme-dropdown.open {
2178
+ display: block;
2179
+ }
2180
+
2181
+ .tc-theme-preview {
2182
+ width: 24px;
2183
+ height: 24px;
2184
+ border-radius: 6px;
2185
+ flex-shrink: 0;
2186
+ }
2187
+
2188
+ .tc-theme-name {
2189
+ flex: 1;
2190
+ font-size: 13px;
2191
+ color: var(--tc-text);
2055
2192
  }
2056
2193
 
2057
2194
  .tc-theme-option {
package/canva.js CHANGED
@@ -414,6 +414,98 @@ class TacelCanvaInstance {
414
414
  return header;
415
415
  }
416
416
 
417
+ _renderThemePicker() {
418
+ const wrap = DomUtils.el('div', { className: 'tc-theme-dropdown-wrap' });
419
+
420
+ const btn = DomUtils.el('button', {
421
+ className: 'tc-theme-dropdown-btn',
422
+ attrs: { title: 'Change theme' }
423
+ });
424
+ btn.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg>';
425
+ const label = DomUtils.el('span', { className: 'tc-theme-dropdown-label', text: 'Theme' });
426
+ btn.appendChild(label);
427
+ wrap.appendChild(btn);
428
+
429
+ // Dropdown menu
430
+ const menu = DomUtils.el('div', { className: 'tc-theme-dropdown-menu' });
431
+
432
+ // Get themes
433
+ const themeObj = (typeof CANVA_THEMES !== 'undefined') ? CANVA_THEMES : {};
434
+ const themeNames = Object.keys(themeObj);
435
+ const currentTheme = this._state.currentTheme || this._config.theme || 'default';
436
+
437
+ themeNames.forEach(name => {
438
+ const theme = themeObj[name] || {};
439
+ const item = DomUtils.el('div', {
440
+ className: 'tc-theme-dropdown-item' + (currentTheme === name ? ' active' : '')
441
+ });
442
+
443
+ // Color swatch
444
+ const accentColor = theme.variables?.['--tc-primary'] || '#3b82f6';
445
+ const bgColor = theme.variables?.['--tc-bg'] || '#ffffff';
446
+ const swatch = DomUtils.el('span', { className: 'tc-theme-swatch' });
447
+ swatch.style.borderColor = accentColor;
448
+ swatch.style.background = bgColor;
449
+ const dot = DomUtils.el('span', { className: 'tc-theme-swatch-dot' });
450
+ dot.style.background = accentColor;
451
+ swatch.appendChild(dot);
452
+ item.appendChild(swatch);
453
+
454
+ // Label
455
+ item.appendChild(DomUtils.el('span', {
456
+ className: 'tc-theme-item-label',
457
+ text: theme.name || name.charAt(0).toUpperCase() + name.slice(1).replace(/-/g, ' ')
458
+ }));
459
+
460
+ // Checkmark for active
461
+ if (currentTheme === name) {
462
+ item.appendChild(DomUtils.el('span', { className: 'tc-theme-check', text: '✓' }));
463
+ }
464
+
465
+ item.addEventListener('click', (e) => {
466
+ e.stopPropagation();
467
+ this._state.currentTheme = name;
468
+ this._applyTheme(name);
469
+ menu.querySelectorAll('.tc-theme-dropdown-item').forEach(el => el.classList.remove('active'));
470
+ item.classList.add('active');
471
+ menu.classList.remove('open');
472
+ });
473
+
474
+ menu.appendChild(item);
475
+ });
476
+
477
+ wrap.appendChild(menu);
478
+
479
+ // Toggle menu
480
+ btn.addEventListener('click', (e) => {
481
+ e.stopPropagation();
482
+ const wasOpen = menu.classList.contains('open');
483
+ this._container.querySelectorAll('.tc-theme-dropdown-menu.open').forEach(m => m.classList.remove('open'));
484
+ if (!wasOpen) {
485
+ menu.classList.add('open');
486
+ }
487
+ });
488
+
489
+ // Close on outside click
490
+ document.addEventListener('click', (e) => {
491
+ if (!wrap.contains(e.target)) {
492
+ menu.classList.remove('open');
493
+ }
494
+ });
495
+
496
+ return wrap;
497
+ }
498
+
499
+ _applyTheme(themeId) {
500
+ if (typeof CANVA_THEMES === 'undefined') return;
501
+ const theme = CANVA_THEMES[themeId];
502
+ if (!theme || !theme.variables) return;
503
+
504
+ Object.entries(theme.variables).forEach(([prop, value]) => {
505
+ this._container.style.setProperty(prop, value);
506
+ });
507
+ }
508
+
417
509
  _renderToolbar() {
418
510
  const toolbar = DomUtils.el('div', { className: 'tc-toolbar' });
419
511
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tacel-canva",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Premium Canva integration module for Tacel Electron apps with OAuth 2.0, inline design editor, 10 productivity features, 34 themes, keyboard shortcuts, and glassmorphism UI.",
5
5
  "main": "index.js",
6
6
  "files": [