@zuilib/text-editor 0.9.0 → 0.10.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.
package/dist/styles.css CHANGED
@@ -366,16 +366,20 @@
366
366
  }
367
367
 
368
368
  /*
369
- * Floating table settings (width, density), straddling the top-right corner
370
- * of the table the caret is in (positioned within .zui-text-editor-main). It
371
- * stays inside the table's own top margin so it never covers the previous
372
- * paragraph. The settings themselves are an inline style on the <table>
373
- * (see tableSettings.ts).
369
+ * Floating table controls (positioned within .zui-text-editor-main, so they
370
+ * scroll with the document; TableControlsPlugin.tsx).
371
+ *
372
+ * The layout presets sit above the table the caret is in, aligned with
373
+ * its right edge and stacked above the column rail (the plugin sets `top`
374
+ * to the rail's top; the transform lifts the toolbar clear of it). The
375
+ * settings themselves are an inline style on the <table> (see
376
+ * tableSettings.ts).
374
377
  */
375
378
  .zui-table-settings {
376
379
  position: absolute;
377
380
  z-index: 5;
378
381
  display: flex;
382
+ align-items: center;
379
383
  gap: 0.125rem;
380
384
  padding: 0.125rem;
381
385
  border: 1px solid var(--border, color-mix(in srgb, currentColor 12%, transparent));
@@ -383,7 +387,151 @@
383
387
  background: var(--popover, #ffffff);
384
388
  color: var(--popover-foreground, inherit);
385
389
  box-shadow: var(--shadow-medium, 0 1px 4px rgba(0, 0, 0, 0.08));
386
- transform: translateY(-70%);
390
+ transform: translateY(calc(-100% - 0.25rem));
391
+ }
392
+
393
+ /*
394
+ * Rails: the row rail hugs the table's left edge (inside the pane gutter),
395
+ * the column rail its top edge (inside the block margin). A bar marks the
396
+ * caret's row / column and slides with it. One handle rests after the last
397
+ * lane as a `+` and, while the rail is hovered, follows the pointer: a `+`
398
+ * near a boundary (hover previews the insertion line), a `−` over a lane
399
+ * (hover tints the lane it will remove). Motion is short and eased so the
400
+ * controls feel attached to the table rather than popping in.
401
+ */
402
+ .zui-table-rail {
403
+ position: absolute;
404
+ z-index: 4;
405
+ --zui-table-rail-accent: var(--primary, #6965db);
406
+ --zui-table-rail-accent-foreground: var(--primary-foreground, #ffffff);
407
+ --zui-table-rail-danger: var(--destructive, #dc2626);
408
+ --zui-table-rail-danger-foreground: var(--destructive-foreground, #ffffff);
409
+ }
410
+
411
+ .zui-table-rail-marker {
412
+ position: absolute;
413
+ border-radius: 999px;
414
+ background: var(--zui-table-rail-accent);
415
+ opacity: 0.55;
416
+ pointer-events: none;
417
+ transition:
418
+ top 140ms cubic-bezier(0.2, 0, 0, 1),
419
+ left 140ms cubic-bezier(0.2, 0, 0, 1),
420
+ width 140ms cubic-bezier(0.2, 0, 0, 1),
421
+ height 140ms cubic-bezier(0.2, 0, 0, 1);
422
+ }
423
+
424
+ .zui-table-rail.is-row .zui-table-rail-marker {
425
+ right: 5px;
426
+ width: 3px;
427
+ }
428
+
429
+ .zui-table-rail.is-column .zui-table-rail-marker {
430
+ bottom: 5px;
431
+ height: 3px;
432
+ }
433
+
434
+ .zui-table-rail-handle {
435
+ position: absolute;
436
+ display: inline-flex;
437
+ align-items: center;
438
+ justify-content: center;
439
+ width: 20px;
440
+ height: 20px;
441
+ padding: 0;
442
+ border: 1px solid var(--border, color-mix(in srgb, currentColor 14%, transparent));
443
+ border-radius: 999px;
444
+ background: var(--popover, #ffffff);
445
+ color: var(--popover-foreground, inherit);
446
+ box-shadow: var(--shadow-medium, 0 1px 4px rgba(0, 0, 0, 0.08));
447
+ cursor: pointer;
448
+ transition:
449
+ top 140ms cubic-bezier(0.2, 0, 0, 1),
450
+ left 140ms cubic-bezier(0.2, 0, 0, 1),
451
+ opacity 140ms ease,
452
+ background-color 120ms ease,
453
+ color 120ms ease,
454
+ border-color 120ms ease,
455
+ scale 120ms ease;
456
+ }
457
+
458
+ .zui-table-rail.is-row .zui-table-rail-handle {
459
+ left: 2px;
460
+ transform: translateY(-50%);
461
+ }
462
+
463
+ .zui-table-rail.is-column .zui-table-rail-handle {
464
+ top: 2px;
465
+ transform: translateX(-50%);
466
+ }
467
+
468
+ .zui-table-rail-handle.is-resting {
469
+ opacity: 0.4;
470
+ }
471
+
472
+ .zui-table-rail:hover .zui-table-rail-handle,
473
+ .zui-table-rail-handle:focus-visible {
474
+ opacity: 1;
475
+ }
476
+
477
+ .zui-table-rail-handle:hover,
478
+ .zui-table-rail-handle:focus-visible {
479
+ border-color: var(--zui-table-rail-accent);
480
+ background: var(--zui-table-rail-accent);
481
+ color: var(--zui-table-rail-accent-foreground);
482
+ scale: 1.1;
483
+ outline: none;
484
+ }
485
+
486
+ .zui-table-rail-handle.is-delete:hover,
487
+ .zui-table-rail-handle.is-delete:focus-visible {
488
+ border-color: var(--zui-table-rail-danger);
489
+ background: var(--zui-table-rail-danger);
490
+ color: var(--zui-table-rail-danger-foreground);
491
+ }
492
+
493
+ /* Insertion line, or the tinted row / column about to be removed */
494
+ .zui-table-rail-preview {
495
+ position: absolute;
496
+ opacity: 0;
497
+ pointer-events: none;
498
+ transition:
499
+ top 140ms cubic-bezier(0.2, 0, 0, 1),
500
+ left 140ms cubic-bezier(0.2, 0, 0, 1),
501
+ opacity 120ms ease;
502
+ }
503
+
504
+ .zui-table-rail-preview.is-insert {
505
+ border-radius: 1px;
506
+ background: var(--zui-table-rail-accent);
507
+ }
508
+
509
+ .zui-table-rail.is-row .zui-table-rail-preview.is-insert {
510
+ height: 2px;
511
+ transform: translateY(-50%);
512
+ }
513
+
514
+ .zui-table-rail.is-column .zui-table-rail-preview.is-insert {
515
+ width: 2px;
516
+ transform: translateX(-50%);
517
+ }
518
+
519
+ .zui-table-rail-preview.is-delete {
520
+ background: color-mix(in srgb, var(--zui-table-rail-danger) 10%, transparent);
521
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--zui-table-rail-danger) 45%, transparent);
522
+ }
523
+
524
+ .zui-table-rail-handle:hover + .zui-table-rail-preview,
525
+ .zui-table-rail-handle:focus-visible + .zui-table-rail-preview {
526
+ opacity: 1;
527
+ }
528
+
529
+ @media (prefers-reduced-motion: reduce) {
530
+ .zui-table-rail-marker,
531
+ .zui-table-rail-handle,
532
+ .zui-table-rail-preview {
533
+ transition: none;
534
+ }
387
535
  }
388
536
 
389
537
  /*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuilib/text-editor",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
4
4
  "description": "ZUI — A markdown editor component wrapping Lexical",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",