react-cheminfo 0.21.0 → 0.22.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 (49) hide show
  1. package/README.md +1 -1
  2. package/lib/build/vite/gitHead.d.ts.map +1 -1
  3. package/lib/build/vite/gitHead.js +17 -2
  4. package/lib/build/vite/gitHead.js.map +1 -1
  5. package/lib/clipboard/ui/ClickToCopy.d.ts +69 -0
  6. package/lib/clipboard/ui/ClickToCopy.d.ts.map +1 -0
  7. package/lib/clipboard/ui/ClickToCopy.js +66 -0
  8. package/lib/clipboard/ui/ClickToCopy.js.map +1 -0
  9. package/lib/clipboard/ui/CopyButton.d.ts +1 -1
  10. package/lib/clipboard/ui/CopyButton.js +1 -1
  11. package/lib/clipboard/ui/CopyableValue.d.ts +3 -3
  12. package/lib/clipboard/ui/CopyableValue.d.ts.map +1 -1
  13. package/lib/clipboard/ui/CopyableValue.js +5 -5
  14. package/lib/clipboard/ui/CopyableValue.js.map +1 -1
  15. package/lib/clipboard/ui/index.d.ts +2 -0
  16. package/lib/clipboard/ui/index.d.ts.map +1 -1
  17. package/lib/clipboard/ui/index.js +1 -0
  18. package/lib/clipboard/ui/index.js.map +1 -1
  19. package/lib/ecosystem/core/groups.d.ts +4 -3
  20. package/lib/ecosystem/core/groups.d.ts.map +1 -1
  21. package/lib/ecosystem/core/groups.js +8 -2
  22. package/lib/ecosystem/core/groups.js.map +1 -1
  23. package/lib/ecosystem/core/sites.d.ts.map +1 -1
  24. package/lib/ecosystem/core/sites.js +39 -0
  25. package/lib/ecosystem/core/sites.js.map +1 -1
  26. package/lib/ecosystem/core/types.d.ts +1 -1
  27. package/lib/ecosystem/core/types.d.ts.map +1 -1
  28. package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
  29. package/lib/ecosystem/ui/glyphs.js +9 -0
  30. package/lib/ecosystem/ui/glyphs.js.map +1 -1
  31. package/lib/error/ui/ErrorFallback.d.ts.map +1 -1
  32. package/lib/error/ui/ErrorFallback.js +1 -1
  33. package/lib/error/ui/ErrorFallback.js.map +1 -1
  34. package/lib/pedagogy/ui/ReferenceSectionBlock.d.ts.map +1 -1
  35. package/lib/pedagogy/ui/ReferenceSectionBlock.js +2 -1
  36. package/lib/pedagogy/ui/ReferenceSectionBlock.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/build/vite/gitHead.ts +17 -2
  39. package/src/clipboard/ui/ClickToCopy.tsx +190 -0
  40. package/src/clipboard/ui/CopyButton.tsx +2 -2
  41. package/src/clipboard/ui/CopyableValue.tsx +11 -6
  42. package/src/clipboard/ui/index.ts +2 -0
  43. package/src/ecosystem/core/groups.ts +10 -3
  44. package/src/ecosystem/core/sites.ts +39 -0
  45. package/src/ecosystem/core/types.ts +4 -1
  46. package/src/ecosystem/ui/glyphs.tsx +51 -0
  47. package/src/error/ui/ErrorFallback.tsx +3 -1
  48. package/src/pedagogy/ui/ReferenceSectionBlock.tsx +10 -1
  49. package/styles/chrome.css +163 -0
package/styles/chrome.css CHANGED
@@ -321,6 +321,169 @@ button {
321
321
  max-width: none;
322
322
  }
323
323
 
324
+ /* ── Selection ───────────────────────────────────────────────────────────── */
325
+
326
+ /* A tool is clicked and dragged, not read: a drag across a viewer, a double
327
+ click on a control or a stray triple click must not paint the page. What is
328
+ worth taking away is copied with a click instead (`<ClickToCopy>`). Form
329
+ controls stay editable, and what a visitor reads, quotes or reports stays
330
+ selectable: the About page, the glossary, a code block, a reference, an
331
+ error, and any region a site marks with `text-selectable`. The regions are
332
+ reopened down to their descendants, so a site's own `* { user-select: none }`
333
+ cannot close them again. */
334
+ body {
335
+ -webkit-user-select: none;
336
+ user-select: none;
337
+ }
338
+
339
+ input,
340
+ textarea,
341
+ select,
342
+ [contenteditable],
343
+ :is(
344
+ .text-selectable,
345
+ .about-page,
346
+ .glossary-index,
347
+ .code-block,
348
+ .citation-preview,
349
+ .error-fallback__message,
350
+ .bp6-callout.bp6-intent-danger
351
+ ),
352
+ :is(
353
+ .text-selectable,
354
+ .about-page,
355
+ .glossary-index,
356
+ .code-block,
357
+ .citation-preview,
358
+ .error-fallback__message,
359
+ .bp6-callout.bp6-intent-danger
360
+ )
361
+ * {
362
+ -webkit-user-select: text;
363
+ user-select: text;
364
+ }
365
+
366
+ /* ── Click to copy ───────────────────────────────────────────────────────── */
367
+
368
+ /* The copy cursor, the tint and the clipboard glyph are the promise; a tick
369
+ keeps it. The glyph is `clipboard`, never `duplicate`: two overlapping squares
370
+ read as "add another". Green and red are the confirmation's own colours,
371
+ the ones Blueprint gives success and danger. */
372
+ .click-to-copy {
373
+ position: relative;
374
+ border-radius: 4px;
375
+ cursor: copy;
376
+ transition: background-color 120ms ease;
377
+ }
378
+
379
+ .click-to-copy:focus-visible {
380
+ outline: 2px solid var(--accent);
381
+ outline-offset: 1px;
382
+ }
383
+
384
+ .click-to-copy[data-copy='copied'] {
385
+ background-color: color-mix(in oklab, #238551 15%, transparent);
386
+ }
387
+
388
+ .click-to-copy[data-copy='failed'] {
389
+ background-color: color-mix(in oklab, #cd4246 15%, transparent);
390
+ }
391
+
392
+ .click-to-copy__icon {
393
+ position: absolute;
394
+ top: 50%;
395
+ color: var(--text-muted);
396
+ opacity: 0;
397
+ pointer-events: none;
398
+ transition: opacity 120ms ease;
399
+ }
400
+
401
+ /* In a line of text the glyph floats just past the value, so the line keeps
402
+ its spacing; a block keeps room for it inside its right edge. */
403
+ .click-to-copy--inline .click-to-copy__icon {
404
+ left: 100%;
405
+ transform: translate(3px, -50%);
406
+ }
407
+
408
+ .click-to-copy--block {
409
+ padding-right: 22px;
410
+ }
411
+
412
+ .click-to-copy--block .click-to-copy__icon {
413
+ right: 4px;
414
+ transform: translateY(-50%);
415
+ }
416
+
417
+ .click-to-copy:focus-visible .click-to-copy__icon,
418
+ .click-to-copy[data-copy] .click-to-copy__icon {
419
+ opacity: 1;
420
+ }
421
+
422
+ .click-to-copy[data-copy='copied'] .click-to-copy__icon {
423
+ color: #238551;
424
+ }
425
+
426
+ .click-to-copy[data-copy='failed'] .click-to-copy__icon {
427
+ color: #cd4246;
428
+ }
429
+
430
+ /* Only where there is a pointer to hover with: on a touch screen the tint
431
+ would stay on after the tap, over the tick. */
432
+ @media (hover: hover) {
433
+ .click-to-copy:not([data-copy]):hover {
434
+ background-color: color-mix(in oklab, var(--accent) 12%, transparent);
435
+ }
436
+
437
+ .click-to-copy:hover .click-to-copy__icon {
438
+ opacity: 1;
439
+ }
440
+ }
441
+
442
+ /* Blueprint's interactive and striped tables paint and point every cell from
443
+ three classes deep, so a copyable cell repeats its class to stay ahead. */
444
+ .click-to-copy.click-to-copy.click-to-copy.click-to-copy:is(td, th) {
445
+ border-radius: 0;
446
+ cursor: copy;
447
+ }
448
+
449
+ .click-to-copy.click-to-copy.click-to-copy.click-to-copy:is(
450
+ td,
451
+ th
452
+ )[data-copy='copied'] {
453
+ background-color: color-mix(in oklab, #238551 15%, transparent);
454
+ }
455
+
456
+ .click-to-copy.click-to-copy.click-to-copy.click-to-copy:is(
457
+ td,
458
+ th
459
+ )[data-copy='failed'] {
460
+ background-color: color-mix(in oklab, #cd4246 15%, transparent);
461
+ }
462
+
463
+ @media (hover: hover) {
464
+ .click-to-copy.click-to-copy.click-to-copy.click-to-copy:is(td, th):not(
465
+ [data-copy]
466
+ ):hover {
467
+ background-color: color-mix(in oklab, var(--accent) 12%, transparent);
468
+ }
469
+ }
470
+
471
+ /* The glyph carries the confirmation to the eye; this carries it to a reader. */
472
+ .click-to-copy__status {
473
+ position: absolute;
474
+ width: 1px;
475
+ height: 1px;
476
+ overflow: hidden;
477
+ clip-path: inset(50%);
478
+ white-space: nowrap;
479
+ }
480
+
481
+ @media print {
482
+ .click-to-copy__icon {
483
+ display: none;
484
+ }
485
+ }
486
+
324
487
  /* ── Printing ────────────────────────────────────────────────────────────── */
325
488
 
326
489
  /* Students print the cheatsheet. Let them, without the chrome. */