kingkont 0.7.84 → 0.7.85

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.
@@ -14,6 +14,7 @@ beautiful Cyrillic-aware label nodes without needing a network connection.
14
14
  | Comfortaa | Johan Aakerlund | <https://fonts.google.com/specimen/Comfortaa> |
15
15
  | PT Serif | ParaType | <https://fonts.google.com/specimen/PT+Serif> |
16
16
  | PT Mono | ParaType | <https://fonts.google.com/specimen/PT+Mono> |
17
+ | Neucha | Jovanny Lemonad | <https://fonts.google.com/specimen/Neucha> |
17
18
 
18
19
  Files were downloaded from the @fontsource jsDelivr mirror in the
19
20
  `cyrillic-400-normal` and `latin-400-normal` subsets.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kingkont",
3
- "version": "0.7.84",
3
+ "version": "0.7.85",
4
4
  "description": "KingKont · Chatium — нод-редактор сцен с AI-генерацией (картинки/видео/голос/SFX/музыка/текст)",
5
5
  "main": "main.js",
6
6
  "bin": {
@@ -211,7 +211,7 @@ async function addLabelAt(pos) {
211
211
  id: crypto.randomUUID(),
212
212
  type: 'label',
213
213
  text: '',
214
- textStyle: { fontSize: 32, italic: false, fontFamily: 'handwritten' },
214
+ textStyle: { fontSize: 32, italic: false, fontFamily: 'pencil' },
215
215
  x, y,
216
216
  // width/height не задаём — label всегда auto-размер по тексту
217
217
  // (см. createNodeEl: для type='label' inline-style не применяется).
@@ -66,7 +66,8 @@ $('settingsRegen').addEventListener('click', () => {
66
66
  // сохранённые сцены. Новые красивые шрифты добавляем под новыми id.
67
67
  const LABEL_FONTS = [
68
68
  { id: 'default', label: 'Обычный' },
69
- { id: 'handwritten', label: 'Карандашом' }, // Caveat
69
+ { id: 'pencil', label: 'Грифель' }, // Neucha — шероховатый карандашный
70
+ { id: 'handwritten', label: 'Прописью' }, // Caveat — гладкий рукописный
70
71
  { id: 'brush', label: 'Скорописью' }, // Bad Script
71
72
  { id: 'marker', label: 'Кистью' }, // Pacifico
72
73
  { id: 'display', label: 'Декор' }, // Lobster
@@ -618,6 +619,42 @@ function attachResize(el, node, handle) {
618
619
  const startX = e.clientX, startY = e.clientY;
619
620
  const startW = el.offsetWidth, startH = el.offsetHeight;
620
621
 
622
+ // Label: ресайз-хендл МАСШТАБИРУЕТ шрифт, а не меняет размеры бокса.
623
+ // Бокс auto-sized по тексту, поэтому при увеличении fontSize он
624
+ // автоматически растёт. Используем диагональную дистанцию (max от dx/dy)
625
+ // — даёт интуитивный «оттянуть угол → больше».
626
+ if (node.type === 'label') {
627
+ if (!node.textStyle) node.textStyle = { fontSize: 32, italic: false, fontFamily: 'pencil' };
628
+ const startSize = node.textStyle.fontSize || 32;
629
+ const labelTextEl = el.querySelector('.label-text');
630
+ const sizeSel = el.querySelector('.label-toolbar select[title="Размер шрифта"]');
631
+ const onMoveL = ev => {
632
+ const dx = (ev.clientX - startX) / state.zoom;
633
+ const dy = (ev.clientY - startY) / state.zoom;
634
+ // Линейная зависимость: ~0.6px шрифта на пиксель диагонального drag.
635
+ // Берём «среднее с уклоном на больший» — чтобы юзер мог тянуть как
636
+ // вправо-вниз (увеличивать), так и влево-вверх (уменьшать).
637
+ const delta = (dx + dy) * 0.6;
638
+ const newSize = Math.max(8, Math.min(200, Math.round(startSize + delta)));
639
+ node.textStyle.fontSize = newSize;
640
+ if (labelTextEl) labelTextEl.style.fontSize = newSize + 'px';
641
+ // Синхронизируем dropdown в тулбаре, если есть подходящий option.
642
+ if (sizeSel) {
643
+ const has = Array.from(sizeSel.options).some(o => o.value === String(newSize));
644
+ if (has) sizeSel.value = String(newSize);
645
+ }
646
+ renderConnections();
647
+ };
648
+ const onUpL = () => {
649
+ document.removeEventListener('mousemove', onMoveL);
650
+ document.removeEventListener('mouseup', onUpL);
651
+ scheduleSave();
652
+ };
653
+ document.addEventListener('mousemove', onMoveL);
654
+ document.addEventListener('mouseup', onUpL);
655
+ return;
656
+ }
657
+
621
658
  // Aspect-lock для image/video: соблюдаем ratio оригинала. Берём nat-
622
659
  // ural размеры media-элемента, считаем chrome (header + footer + padding)
623
660
  // как разницу высоты ноды и высоты media. На этапе resize меняем ту ось,
@@ -82,6 +82,16 @@
82
82
  src: url('../assets/fonts/pt-mono-latin-400.woff2') format('woff2');
83
83
  unicode-range: U+0000-00FF;
84
84
  }
85
+ @font-face {
86
+ font-family: 'KK Neucha'; font-style: normal; font-weight: 400; font-display: block;
87
+ src: url('../assets/fonts/neucha-cyrillic-400.woff2') format('woff2');
88
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
89
+ }
90
+ @font-face {
91
+ font-family: 'KK Neucha'; font-style: normal; font-weight: 400; font-display: block;
92
+ src: url('../assets/fonts/neucha-latin-400.woff2') format('woff2');
93
+ unicode-range: U+0000-00FF;
94
+ }
85
95
 
86
96
  * { box-sizing: border-box; margin: 0; padding: 0; }
87
97
  html, body { height: 100%; }
@@ -450,9 +460,23 @@
450
460
  }
451
461
  /* Footer для label не используется (нет сгенерированной информации) — скрываем. */
452
462
  .node.label-node .node-footer { display: none; }
453
- /* Resize и anchor для label не нужнытекст auto-размером, ссылок нет. */
454
- .node.label-node .resize-handle,
463
+ /* Anchor для label не нуженэто просто аннотация, не источник для генерации. */
455
464
  .node.label-node .anchor { display: none; }
465
+ /* Resize-handle для label НЕ ресайзит ширину/высоту, а МАСШТАБИРУЕТ шрифт.
466
+ Видимый правый-нижний уголок, hover-only, чтобы не отвлекать. */
467
+ .node.label-node .resize-handle {
468
+ position: absolute;
469
+ right: -2px; bottom: -2px;
470
+ width: 14px; height: 14px;
471
+ background: rgba(90,168,255,0.85);
472
+ border: 1px solid rgba(255,255,255,0.4);
473
+ border-radius: 3px;
474
+ cursor: nwse-resize;
475
+ opacity: 0; transition: opacity 0.15s;
476
+ z-index: 11;
477
+ }
478
+ .node.label-node:hover .resize-handle,
479
+ .node.label-node:focus-within .resize-handle { opacity: 1; }
456
480
 
457
481
  /* Body — wrapper без визуального вклада. */
458
482
  .node.label-node .node-body {
@@ -495,17 +519,23 @@
495
519
  }
496
520
  .node.label-node .label-toolbar .tt-italic { font-style: italic; min-width: 22px; }
497
521
 
498
- /* Сам текст — auto-ширина по контенту, до max-width. */
522
+ /* Сам текст — auto-ширина по контенту, до max-width.
523
+ line-height: 1.5 — чтобы descender'ы рукописных шрифтов (Caveat g/p/y,
524
+ Pacifico, Bad Script) не клипались по нижнему краю. padding 8px вверху
525
+ и внизу — на случай если у конкретной семьи descender лезет ещё дальше. */
499
526
  .node.label-node .label-text {
500
527
  display: inline-block;
501
- padding: 4px 8px;
502
- color: #eaeaea; line-height: 1.2;
528
+ padding: 8px 10px;
529
+ color: #eaeaea; line-height: 1.5;
503
530
  word-break: break-word; white-space: pre-wrap;
504
531
  outline: none; cursor: text;
505
532
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
506
533
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
507
- min-width: 30px;
534
+ min-width: 60px;
508
535
  max-width: 100%;
536
+ /* min-height в em — гарантирует что пустая нода (только placeholder)
537
+ всё равно имеет высоту хотя бы одной строки выбранного шрифта. */
538
+ min-height: 1.5em;
509
539
  }
510
540
  .node.label-node .label-text:empty::before {
511
541
  content: attr(data-placeholder);
@@ -513,10 +543,13 @@
513
543
  }
514
544
  /* === Label-шрифты ===
515
545
  Все варианты — bundled woff2 (см. assets/fonts/), кириллица поддержана. */
546
+ .node.label-node .label-text[data-font="pencil"] {
547
+ /* Грифель — шероховатый «как написано карандашом» (Neucha). */
548
+ font-family: 'KK Neucha', 'Neucha', 'Marker Felt', 'Comic Sans MS', cursive;
549
+ }
516
550
  .node.label-node .label-text[data-font="handwritten"] {
517
- /* Карандашоммягкий рукописный (Caveat). */
551
+ /* Прописьюгладкий рукописный (Caveat). */
518
552
  font-family: 'KK Caveat', 'Caveat', 'Marker Felt', cursive;
519
- line-height: 1.1;
520
553
  }
521
554
  .node.label-node .label-text[data-font="brush"] {
522
555
  /* Скорописью — каллиграфия в русском стиле (Bad Script). */