@inshapardaz/likhari-react 0.1.18 → 0.1.19

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.
@@ -374,6 +374,169 @@
374
374
  content: '[' counter(likhari-footnote-item) '] ';
375
375
  }
376
376
 
377
+ /* Poetry couplets (lexical-editor-spec.md §4.11, editor-ui-design-spec.md §4).
378
+ Own type scale and spacing, distinct from body text — the .likhari-ltr/
379
+ .likhari-rtl per-block classes (above) already switch font-family for this
380
+ element same as any other block; these rules layer poetry's own size/
381
+ line-height/gap on top, combined with those same classes.
382
+ Capped width + auto margins read verse as a centered block on the page —
383
+ conventional poetry typesetting — rather than a full-width paragraph where
384
+ a short line just hugs the start edge regardless of its own text-align. */
385
+ .likhari-poetry {
386
+ box-sizing: border-box;
387
+ margin: 0 auto 1.4em auto;
388
+ max-width: 70%;
389
+ /* A visible boundary while editing, same affordance as a table's own
390
+ border — poetry couplets are a distinct structural block, not a plain
391
+ paragraph, and should read as one at a glance. */
392
+ border: 1px dashed var(--editor-line-strong);
393
+ border-radius: 6px;
394
+ padding: 10px 16px;
395
+ }
396
+
397
+ .likhari-poetry.likhari-ltr {
398
+ font-size: 15px;
399
+ line-height: 1.6;
400
+ }
401
+
402
+ .likhari-poetry.likhari-rtl {
403
+ font-size: 20px;
404
+ line-height: 2.1;
405
+ }
406
+
407
+ /* Misra lines sit tight against each other within a couplet — the generic
408
+ .likhari-paragraph margin would otherwise add the same gap between a
409
+ couplet's own two lines as between separate couplets within the same
410
+ block, losing the pairing entirely. */
411
+ .likhari-poetry .likhari-paragraph {
412
+ margin: 0;
413
+ }
414
+
415
+ /* A poetry block is "one object with multiple couplets, add/remove like
416
+ table rows" — so couplet boundaries get the same visible divider as a
417
+ table's internal row borders, not just extra space. Every couplet but
418
+ the first (nth-child(odd), since each couplet is two paragraph
419
+ children — its first misra always lands on an odd position) gets a
420
+ border-top in place of the previous couplet's margin-bottom. */
421
+ .likhari-poetry--single .likhari-paragraph:nth-child(odd):not(:first-child) {
422
+ border-top: 1px dashed var(--editor-line-strong);
423
+ margin-top: var(--poetry-couplet-gap);
424
+ padding-top: calc(var(--poetry-couplet-gap) * 0.6);
425
+ }
426
+
427
+ .likhari-poetry--spacing-compact { --poetry-couplet-gap: 0.4em; }
428
+ .likhari-poetry--spacing-normal { --poetry-couplet-gap: 1em; }
429
+ .likhari-poetry--spacing-relaxed { --poetry-couplet-gap: 1.8em; }
430
+ .likhari-poetry--spacing-loose { --poetry-couplet-gap: 2.8em; }
431
+
432
+ .likhari-poetry--gutter-compact { --poetry-gutter: 8px; }
433
+ .likhari-poetry--gutter-normal { --poetry-gutter: 20px; }
434
+ .likhari-poetry--gutter-relaxed { --poetry-gutter: 32px; }
435
+ .likhari-poetry--gutter-loose { --poetry-gutter: 48px; }
436
+
437
+ .likhari-poetry--stagger-compact { --poetry-stagger-width: 50%; }
438
+ .likhari-poetry--stagger-normal { --poetry-stagger-width: 65%; }
439
+ .likhari-poetry--stagger-relaxed { --poetry-stagger-width: 75%; }
440
+ .likhari-poetry--stagger-loose { --poetry-stagger-width: 85%; }
441
+
442
+ /* Staggered: couplets are the same flat misra paragraphs as single column,
443
+ but each couplet's two misras are placed in a 65%-wide box that alternates
444
+ sides — the first couplet pushed to the start edge, the next to the end
445
+ edge, and so on. Logical properties keep the alternation mirrored for RTL. */
446
+ .likhari-poetry--staggered .likhari-paragraph {
447
+ width: var(--poetry-stagger-width, 65%);
448
+ }
449
+
450
+ .likhari-poetry--staggered .likhari-paragraph:nth-child(4n+1),
451
+ .likhari-poetry--staggered .likhari-paragraph:nth-child(4n+2) {
452
+ margin-inline-end: auto;
453
+ }
454
+
455
+ .likhari-poetry--staggered .likhari-paragraph:nth-child(4n+3),
456
+ .likhari-poetry--staggered .likhari-paragraph:nth-child(4n+4) {
457
+ margin-inline-start: auto;
458
+ }
459
+
460
+ .likhari-poetry--staggered .likhari-paragraph:nth-child(odd):not(:first-child) {
461
+ border-top: 1px dashed var(--editor-line-strong);
462
+ margin-top: var(--poetry-couplet-gap);
463
+ padding-top: calc(var(--poetry-couplet-gap) * 0.6);
464
+ }
465
+
466
+ .likhari-poetry--two-column .likhari-layout-container {
467
+ margin: 0;
468
+ /* No grid gap — the column divider sits exactly on the track boundary,
469
+ so spacing instead comes from matching padding on each side of it,
470
+ which keeps the gutter visually even on both sides of the line. */
471
+ gap: 0;
472
+ }
473
+
474
+ /* One row per couplet in two-column layout — same table-row-border
475
+ treatment as the single-column rule above, between couplets instead of
476
+ within one. */
477
+ .likhari-poetry--two-column .likhari-layout-container:not(:first-child) {
478
+ border-top: 1px dashed var(--editor-line-strong);
479
+ margin-top: var(--poetry-couplet-gap);
480
+ padding-top: calc(var(--poetry-couplet-gap) * 0.6);
481
+ }
482
+
483
+ .likhari-poetry--two-column .likhari-layout-item {
484
+ text-align: inherit;
485
+ }
486
+
487
+ /* A centered couplet: a two-column row holding one item (see poetryActions.ts's
488
+ $setCoupletCentered) — narrowed to the middle of the block, with no column
489
+ divider or gutter since there's only one column. */
490
+ .likhari-poetry--two-column > .likhari-layout-container:has(> .likhari-layout-item:only-child) {
491
+ width: 60%;
492
+ margin-inline: auto;
493
+ }
494
+
495
+ .likhari-poetry--two-column .likhari-layout-item:only-child {
496
+ padding-inline-end: 0;
497
+ }
498
+
499
+ .likhari-poetry--two-column .likhari-layout-item:first-child {
500
+ padding-inline-end: var(--poetry-gutter, 20px);
501
+ }
502
+
503
+ /* A visible divider between misra columns, same dashed language as the
504
+ couplet's own border — matches a table's internal cell borders. */
505
+ .likhari-poetry--two-column .likhari-layout-item:not(:first-child) {
506
+ border-inline-start: 1px dashed var(--editor-line-strong);
507
+ padding-inline-start: var(--poetry-gutter, 20px);
508
+ }
509
+
510
+ /* PoetryResizer.tsx's drag handle — portaled to a fixed position over the
511
+ active couplet's inline-end edge, so top/left are set inline per drag. */
512
+ .likhari-poetry-resize-handle {
513
+ position: fixed;
514
+ width: 10px;
515
+ /* Physical, not logical: PoetryResizer.tsx already computes `left` as the
516
+ couplet's actual edge in viewport coordinates for either direction, so
517
+ centering the handle on it must stay physical too. */
518
+ margin-left: -5px;
519
+ cursor: ew-resize;
520
+ touch-action: none;
521
+ z-index: 20;
522
+ }
523
+
524
+ .likhari-poetry-resize-handle::before {
525
+ content: '';
526
+ display: block;
527
+ width: 3px;
528
+ height: 100%;
529
+ margin-inline: auto;
530
+ border-radius: 2px;
531
+ background: var(--editor-accent);
532
+ opacity: 0;
533
+ transition: opacity 0.1s ease;
534
+ }
535
+
536
+ .likhari-poetry-resize-handle:hover::before {
537
+ opacity: 0.6;
538
+ }
539
+
377
540
  .likhari-table {
378
541
  border-collapse: collapse;
379
542
  margin: 1em 0;
@@ -1 +1 @@
1
- {"version":3,"file":"editorTheme.d.ts","sourceRoot":"","sources":["../../src/theme/editorTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,kBA+CzB,CAAC"}
1
+ {"version":3,"file":"editorTheme.d.ts","sourceRoot":"","sources":["../../src/theme/editorTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,kBAgDzB,CAAC"}
@@ -45,6 +45,7 @@ export const editorTheme = {
45
45
  footnoteReference: 'likhari-footnote-ref',
46
46
  footnoteList: 'likhari-footnote-list',
47
47
  footnoteItem: 'likhari-footnote-item',
48
+ poetry: 'likhari-poetry',
48
49
  table: 'likhari-table',
49
50
  tableRow: 'likhari-table-row',
50
51
  tableCell: 'likhari-table-cell',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inshapardaz/likhari-react",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "React implementation of the Likhari editor, built on @lexical/react.",
5
5
  "license": "MIT",
6
6
  "repository": {