@happyvertical/smrt-content 0.60.16 → 0.60.18

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 (55) hide show
  1. package/README.md +8 -0
  2. package/dist/body-format.d.ts.map +1 -1
  3. package/dist/body-format.js +9 -5
  4. package/dist/body-format.js.map +1 -1
  5. package/dist/chunks/{content-query-DBPoyQ2f.js → content-query-Cn8dEhLF.js} +4 -4
  6. package/dist/chunks/{content-query-DBPoyQ2f.js.map → content-query-Cn8dEhLF.js.map} +1 -1
  7. package/dist/chunks/{content-versions-CwkvR0AU.js → content-versions-BYhUbSKu.js} +2 -2
  8. package/dist/chunks/{content-versions-CwkvR0AU.js.map → content-versions-BYhUbSKu.js.map} +1 -1
  9. package/dist/chunks/{contents--XgOmNqW.js → contents-CequuA0H.js} +2 -2
  10. package/dist/chunks/{contents--XgOmNqW.js.map → contents-CequuA0H.js.map} +1 -1
  11. package/dist/index.js +4 -4
  12. package/dist/manifest.json +1 -1
  13. package/dist/server.js +1 -1
  14. package/dist/smrt-knowledge.json +3 -3
  15. package/dist/svelte/components/ArticleCard.svelte +39 -36
  16. package/dist/svelte/components/ArticleList.svelte +10 -5
  17. package/dist/svelte/components/ContentAgentChat.svelte +90 -82
  18. package/dist/svelte/components/ContentBodyEditor.svelte +246 -231
  19. package/dist/svelte/components/ContentBodyEditor.svelte.d.ts.map +1 -1
  20. package/dist/svelte/components/ContentBodyRenderer.svelte +76 -82
  21. package/dist/svelte/components/ContentClaimAuditTool.svelte +100 -112
  22. package/dist/svelte/components/ContentContributionForm.svelte +17 -15
  23. package/dist/svelte/components/ContentContributionInbox.svelte +55 -51
  24. package/dist/svelte/components/ContentContributionPortal.svelte +50 -48
  25. package/dist/svelte/components/ContentContributionTypeManager.svelte +33 -31
  26. package/dist/svelte/components/ContentContributorManager.svelte +29 -27
  27. package/dist/svelte/components/ContentCorrectionsTool.svelte +76 -79
  28. package/dist/svelte/components/ContentEditor.svelte +523 -527
  29. package/dist/svelte/components/ContentGovernanceAssignmentEditor.svelte +19 -16
  30. package/dist/svelte/components/ContentGovernanceManager.svelte +33 -33
  31. package/dist/svelte/components/ContentGovernancePanel.svelte +336 -359
  32. package/dist/svelte/components/ContentGovernancePolicyEditor.svelte +14 -11
  33. package/dist/svelte/components/ContentGovernanceProfileEditor.svelte +21 -19
  34. package/dist/svelte/components/ContentImageBrowser.svelte +72 -68
  35. package/dist/svelte/components/ContentImageChooser.svelte +30 -22
  36. package/dist/svelte/components/ContentList.svelte +504 -488
  37. package/dist/svelte/components/ContentListLifecyclePanel.svelte +19 -21
  38. package/dist/svelte/components/ContentMetadataFields.svelte +15 -12
  39. package/dist/svelte/components/ContentPictureDrawer.svelte +115 -112
  40. package/dist/svelte/components/ContentReferencesPanel.svelte +59 -54
  41. package/dist/svelte/components/ContentReviewStatusTray.svelte +40 -38
  42. package/dist/svelte/components/ContentStatusFields.svelte +12 -9
  43. package/dist/svelte/components/ContentTitleField.svelte +20 -20
  44. package/dist/svelte/components/ContentTransparencyReport.svelte +94 -92
  45. package/dist/svelte/components/ContentTransparencyTool.svelte +84 -87
  46. package/dist/svelte/components/ContentVersionsTool.svelte +60 -63
  47. package/dist/svelte/components/GovernedContentEditor.svelte +36 -35
  48. package/dist/svelte/components/ImageThumbnail.svelte +18 -12
  49. package/dist/svelte/components/Markdown.svelte +58 -55
  50. package/dist/svelte/routes/ContentContributionsRoute.svelte +206 -209
  51. package/dist/svelte/routes/ContentFactsRoute.svelte +239 -252
  52. package/dist/svelte/routes/ContentGovernanceRoute.svelte +77 -78
  53. package/dist/svelte/routes/ContentWorkspaceRoute.svelte +98 -106
  54. package/dist/svelte/routes/PublishedArticleRoute.svelte +81 -77
  55. package/package.json +25 -25
@@ -602,7 +602,7 @@ function setImageWidth(frame: HTMLElement, width: number) {
602
602
  );
603
603
 
604
604
  frame.setAttribute('data-smrt-width', String(clamped));
605
- frame.style.width = `${clamped}px`;
605
+ frame.style.setProperty('--smrt-content-body-image-width', `${clamped}px`);
606
606
  frame.style.maxWidth = '100%';
607
607
 
608
608
  if (getImagePlacement(frame) === 'full') {
@@ -1033,13 +1033,15 @@ function applyImagePlacement(placement: ContentBodyImagePlacement) {
1033
1033
 
1034
1034
  if (placement === 'full') {
1035
1035
  frame.removeAttribute('data-smrt-width');
1036
- frame.style.width = '100%';
1036
+ frame.style.removeProperty('--smrt-content-body-image-width');
1037
1037
  frame.style.maxWidth = '100%';
1038
1038
  } else if (placement === 'left' || placement === 'right') {
1039
1039
  const wrappedWidth = Math.min(360, Math.round(getMaxImageWidth() * 0.45));
1040
1040
  setImageWidth(frame, Math.min(getImageWidth(frame), wrappedWidth));
1041
- } else if (frame.style.width === '100%') {
1042
- frame.style.removeProperty('width');
1041
+ } else if (
1042
+ frame.style.getPropertyValue('--smrt-content-body-image-width') === '100%'
1043
+ ) {
1044
+ frame.style.removeProperty('--smrt-content-body-image-width');
1043
1045
  }
1044
1046
 
1045
1047
  selectImageElement(image, { notify: false });
@@ -1532,7 +1534,7 @@ function handleSurfacePointerOut(event: PointerEvent) {
1532
1534
  if (!hoveredImage) return;
1533
1535
  const next = event.relatedTarget as Element | null;
1534
1536
  // Moving onto the badge keeps it; moving elsewhere in the text hides it.
1535
- if (next?.closest?.('.image-change-badge')) return;
1537
+ if (next?.closest?.('.smrt-content-body-editor__image-change-badge')) return;
1536
1538
  if (next && next === hoveredImage) return;
1537
1539
  hoveredImage = null;
1538
1540
  hoveredImageBox = null;
@@ -1633,8 +1635,8 @@ function handleEditorDragEnd() {
1633
1635
  </script>
1634
1636
 
1635
1637
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1636
- <div bind:this={rootElement} class="content-body-editor" onpointerleave={handleRootPointerLeave} data-smrt-component="ContentBodyEditor">
1637
- <div class="body-editor-toolbar" aria-label={t(M['content.content_body_editor.toolbar'])}>
1638
+ <div bind:this={rootElement} class="smrt-content-body-editor__root" onpointerleave={handleRootPointerLeave} data-smrt-component="ContentBodyEditor">
1639
+ <div class="smrt-content-body-editor__toolbar" data-smrt-part="actions" aria-label={t(M['content.content_body_editor.toolbar'])}>
1638
1640
  <Button variant="ghost" size="sm" class="editor-toolbar-button" type="button" title={t(M['content.content_body_editor.bold'])} aria-label={t(M['content.content_body_editor.bold'])} onclick={() => runCommand('bold')}>
1639
1641
  <strong>B</strong>
1640
1642
  </Button>
@@ -1654,7 +1656,7 @@ function handleEditorDragEnd() {
1654
1656
  <circle cx="4" cy="18" r="1"></circle>
1655
1657
  </svg>
1656
1658
  </Button>
1657
- <span class="editor-toolbar-slot" bind:this={imageButtonElement}>
1659
+ <span class="smrt-content-body-editor__toolbar-slot" data-smrt-part="trigger" bind:this={imageButtonElement}>
1658
1660
  <Button
1659
1661
  variant="ghost"
1660
1662
  size="sm"
@@ -1675,7 +1677,7 @@ function handleEditorDragEnd() {
1675
1677
  </span>
1676
1678
 
1677
1679
  {#if showFormatPicker}
1678
- <label class="format-select">
1680
+ <label class="smrt-content-body-editor__format-select" data-smrt-part="field">
1679
1681
  <span>{t(M['content.content_body_editor.save_as'])}</span>
1680
1682
  <Select
1681
1683
  value={currentFormat}
@@ -1694,7 +1696,8 @@ function handleEditorDragEnd() {
1694
1696
  <section
1695
1697
  bind:this={imagePanelElement}
1696
1698
  id={imagePanelId}
1697
- class="body-editor-image-panel"
1699
+ class="smrt-content-body-editor__image-panel"
1700
+ data-smrt-part="panel"
1698
1701
  aria-label={resolvedImagePanelLabel}
1699
1702
  tabindex="-1"
1700
1703
  onkeydown={handleImagePanelKeydown}
@@ -1706,7 +1709,8 @@ function handleEditorDragEnd() {
1706
1709
 
1707
1710
  {#if dropIndicatorTop !== null}
1708
1711
  <div
1709
- class="body-drop-indicator"
1712
+ class="smrt-content-body-editor__drop-indicator"
1713
+ data-smrt-part="indicator"
1710
1714
  style={`top: ${dropIndicatorTop}px;`}
1711
1715
  aria-hidden="true"
1712
1716
  data-testid="body-drop-indicator"
@@ -1715,7 +1719,8 @@ function handleEditorDragEnd() {
1715
1719
 
1716
1720
  {#if selectedImageBox}
1717
1721
  <div
1718
- class="image-control-popover"
1722
+ class="smrt-content-body-editor__image-control-popover"
1723
+ data-smrt-part="actions"
1719
1724
  style={`top: ${Math.max(44, selectedImageBox.top + 8)}px; left: ${selectedImageBox.left + selectedImageBox.width / 2}px;`}
1720
1725
  aria-label={t(M['content.content_body_editor.selected_image_controls'])}
1721
1726
  >
@@ -1726,7 +1731,7 @@ function handleEditorDragEnd() {
1726
1731
  <path d="M19 15v4"></path>
1727
1732
  <path d="M17 17h4"></path>
1728
1733
  </svg>
1729
- <span class="editor-popover-button-text">{t(M['content.content_body_editor.change_image_short'])}</span>
1734
+ <span class="smrt-content-body-editor__popover-button-text" data-smrt-part="label">{t(M['content.content_body_editor.change_image_short'])}</span>
1730
1735
  </Button>
1731
1736
  {/if}
1732
1737
  <Button variant="ghost" size="sm" class="editor-popover-button" type="button" title={t(M['content.content_body_editor.move_image'])} aria-label={t(M['content.content_body_editor.move_image'])} onpointerdown={startImageMove}>
@@ -1751,7 +1756,7 @@ function handleEditorDragEnd() {
1751
1756
  <path d="m19 12-7 7-7-7"></path>
1752
1757
  </svg>
1753
1758
  </Button>
1754
- <span class="image-control-divider"></span>
1759
+ <span class="smrt-content-body-editor__image-control-divider" data-smrt-part="marker"></span>
1755
1760
  <Button
1756
1761
  variant="ghost"
1757
1762
  size="sm"
@@ -1820,7 +1825,7 @@ function handleEditorDragEnd() {
1820
1825
  <path d="M3 19h18"></path>
1821
1826
  </svg>
1822
1827
  </Button>
1823
- <span class="image-control-divider"></span>
1828
+ <span class="smrt-content-body-editor__image-control-divider" data-smrt-part="marker"></span>
1824
1829
  <Button variant="ghost" size="sm" class="editor-popover-button" type="button" title={t(M['content.content_body_editor.make_smaller'])} aria-label={t(M['content.content_body_editor.make_image_smaller'])} onclick={() => resizeSelectedImage(-IMAGE_WIDTH_STEP)}>
1825
1830
  <svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
1826
1831
  <path d="M5 12h14"></path>
@@ -1854,7 +1859,8 @@ function handleEditorDragEnd() {
1854
1859
  <!-- raw-primitive-allow: custom press-and-drag image resize handle driven by onpointerdown pointer-capture gesture and absolute positioning; no Button primitive owns this draggable resize grabber -->
1855
1860
  <button
1856
1861
  type="button"
1857
- class="image-resize-handle"
1862
+ class="smrt-content-body-editor__image-resize-handle"
1863
+ data-smrt-part="meta"
1858
1864
  title={t(M['content.content_body_editor.resize_image'])}
1859
1865
  aria-label={t(M['content.content_body_editor.resize_selected_image'])}
1860
1866
  style={`top: ${selectedImageBox.top + selectedImageBox.height - 12}px; left: ${selectedImageBox.left + selectedImageBox.width - 12}px;`}
@@ -1871,7 +1877,8 @@ function handleEditorDragEnd() {
1871
1877
  <!-- raw-primitive-allow: a round 44px icon button pinned to a picture's corner (absolute position over the story); Button's padding and layout do not fit an overlay badge -->
1872
1878
  <button
1873
1879
  type="button"
1874
- class="image-change-badge"
1880
+ class="smrt-content-body-editor__image-change-badge"
1881
+ data-smrt-part="badge"
1875
1882
  title={t(M['content.content_body_editor.change_image_hint'])}
1876
1883
  aria-label={t(M['content.content_body_editor.change_image'])}
1877
1884
  style={`top: ${changeBadgeBox.top + changeBadgeBox.height - 52}px; left: ${changeBadgeBox.left + 8}px;`}
@@ -1892,8 +1899,9 @@ function handleEditorDragEnd() {
1892
1899
  aria-label={resolvedLabel}
1893
1900
  data-smrt-control={name || undefined}
1894
1901
  data-smrt-form={interactionContext?.formId}
1895
- class="body-editor-surface"
1896
- class:body-editor-surface--dragging={isDragging}
1902
+ class="smrt-content-body-editor__surface"
1903
+ class:smrt-content-body-editor__surface--dragging={isDragging}
1904
+ data-smrt-part="body"
1897
1905
  contenteditable="true"
1898
1906
  role="textbox"
1899
1907
  aria-multiline="true"
@@ -1930,280 +1938,199 @@ function handleEditorDragEnd() {
1930
1938
 
1931
1939
  <style>
1932
1940
  @layer smrt.reset, smrt.structure, smrt.theme;
1933
- @layer smrt.theme {
1934
- .content-body-editor {
1941
+ @layer smrt.structure {
1942
+ .smrt-content-body-editor__root {
1935
1943
  position: relative;
1936
1944
  display: flex;
1937
1945
  flex-direction: column;
1938
- border: var(--smrt-hairline);
1939
- border-radius: 0.85rem;
1940
- background: var(--smrt-color-surface);
1941
1946
  overflow: visible;
1942
1947
  }
1943
-
1944
- .body-editor-toolbar {
1948
+ .smrt-content-body-editor__toolbar {
1945
1949
  display: flex;
1946
1950
  align-items: center;
1947
1951
  gap: 0.35rem;
1948
1952
  padding: 0.45rem 0.55rem;
1949
- border-bottom: var(--smrt-hairline);
1950
- background: var(--smrt-color-surface-container-low, var(--smrt-color-surface-container));
1951
1953
  }
1952
-
1953
1954
  /* Icon buttons are a fixed square. smrt-ui's `size="sm"` padding
1954
- (0.5rem 0.75rem) would leave a 2rem button ~6px of content width, which
1955
- squeezed the SVG icons (list, image) far below the text glyphs (B, I, H2).
1956
- Zero the padding and never let an icon shrink: every toolbar glyph renders
1957
- at the same --smrt-content-editor-icon-size. */
1958
- .body-editor-toolbar :global(.editor-toolbar-button) {
1955
+ (0.5rem 0.75rem) would leave a 2rem button ~6px of content width, which
1956
+ squeezed the SVG icons (list, image) far below the text glyphs (B, I, H2).
1957
+ Zero the padding and never let an icon shrink: every toolbar glyph renders
1958
+ at the same --smrt-content-editor-icon-size. */
1959
+ .smrt-content-body-editor__toolbar :global(.editor-toolbar-button) {
1959
1960
  width: 2.25rem;
1960
1961
  height: 2.25rem;
1961
1962
  min-width: 2.25rem;
1962
1963
  padding: 0;
1963
1964
  display: inline-grid;
1964
1965
  place-items: center;
1965
- border: 1px solid transparent;
1966
- border-radius: 0.45rem;
1967
- background: transparent;
1968
- color: var(--smrt-color-on-surface);
1969
1966
  cursor: pointer;
1970
1967
  }
1971
-
1972
- .body-editor-toolbar :global(.editor-toolbar-button svg),
1973
- .image-control-popover :global(.editor-popover-button svg) {
1968
+ .smrt-content-body-editor__toolbar :global(.editor-toolbar-button svg),
1969
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button svg) {
1974
1970
  flex-shrink: 0;
1975
1971
  width: var(--smrt-content-editor-icon-size, 1.125rem);
1976
1972
  height: var(--smrt-content-editor-icon-size, 1.125rem);
1977
1973
  }
1978
-
1979
1974
  /* Touch screens: 44px targets (WCAG 2.5.5), same icon size. The toolbar
1980
- wraps rather than scrolling off a phone. */
1975
+ wraps rather than scrolling off a phone. */
1981
1976
  @media (pointer: coarse) {
1982
- .body-editor-toolbar {
1977
+ .smrt-content-body-editor__toolbar {
1983
1978
  flex-wrap: wrap;
1984
1979
  }
1985
-
1986
- .body-editor-toolbar :global(.editor-toolbar-button) {
1980
+ .smrt-content-body-editor__toolbar :global(.editor-toolbar-button) {
1987
1981
  width: 2.75rem;
1988
1982
  height: 2.75rem;
1989
1983
  min-width: 2.75rem;
1990
1984
  }
1991
1985
  }
1992
-
1993
- .body-editor-toolbar :global(.editor-toolbar-button[aria-expanded='true']) {
1994
- border-color: var(--smrt-color-primary);
1995
- background: var(--smrt-color-primary-container, var(--smrt-color-surface-container));
1996
- color: var(--smrt-color-on-primary-container, var(--smrt-color-primary));
1997
- }
1998
-
1999
- .body-editor-toolbar :global(.editor-toolbar-button:hover) {
2000
- border-color: var(--smrt-hairline-color);
2001
- background: var(--smrt-color-surface-container);
2002
- }
2003
-
2004
- .editor-toolbar-slot {
1986
+ .smrt-content-body-editor__toolbar-slot {
2005
1987
  display: inline-flex;
2006
1988
  }
2007
-
2008
1989
  /* The image panel sits between the toolbar and the text so it opens above
2009
- the story rather than below it. Full width, in the page flow (no modal),
2010
- so it works the same on a phone. */
2011
- .body-editor-image-panel {
2012
- border-bottom: var(--smrt-hairline);
2013
- background: var(--smrt-color-surface-container-lowest, var(--smrt-color-surface));
1990
+ the story rather than below it. Full width, in the page flow (no modal),
1991
+ so it works the same on a phone. */
1992
+ .smrt-content-body-editor__image-panel {
2014
1993
  padding: 0.75rem;
2015
1994
  max-height: min(70vh, 40rem);
2016
1995
  overflow: auto;
2017
1996
  overscroll-behavior: contain;
2018
1997
  }
2019
-
2020
- .body-editor-image-panel:focus-visible {
2021
- outline: 2px solid var(--smrt-color-primary);
2022
- outline-offset: -2px;
2023
- }
2024
-
2025
- .format-select {
1998
+ .smrt-content-body-editor__format-select {
2026
1999
  margin-left: auto;
2027
2000
  display: inline-flex;
2028
2001
  align-items: center;
2029
2002
  gap: 0.4rem;
2030
- font-size: var(--smrt-typography-label-medium-size, 0.78rem);
2031
- color: var(--smrt-color-on-surface-variant);
2032
2003
  }
2033
-
2034
- .format-select :global([data-smrt-component="Select"]) {
2004
+ .smrt-content-body-editor__format-select :global([data-smrt-component="Select"]) {
2035
2005
  min-height: 2rem;
2036
- border: var(--smrt-hairline);
2037
- border-radius: 0.45rem;
2038
- background: var(--smrt-color-surface);
2039
- color: var(--smrt-color-on-surface);
2040
2006
  padding: 0 0.5rem;
2041
2007
  }
2042
-
2043
- .body-editor-surface {
2008
+ .smrt-content-body-editor__surface {
2044
2009
  min-height: 22rem;
2045
2010
  padding: clamp(1rem, 2vw, 1.5rem);
2046
- outline: none;
2047
- color: var(--smrt-color-on-surface);
2048
- font-size: var(--smrt-typography-body-large-size, 1.05rem);
2049
- line-height: var(--smrt-typography-body-large-line-height, 1.65);
2050
2011
  overflow: auto;
2051
2012
  overflow-wrap: anywhere;
2052
2013
  }
2053
-
2054
- .body-editor-surface::after {
2055
- content: '';
2014
+ .smrt-content-body-editor__surface::after {
2056
2015
  display: block;
2057
2016
  clear: both;
2017
+ content: '';
2058
2018
  }
2059
-
2060
- .body-editor-surface:empty::before {
2019
+ .smrt-content-body-editor__surface:empty::before {
2061
2020
  content: attr(data-placeholder);
2062
- color: var(--smrt-color-on-surface-variant);
2063
2021
  pointer-events: none;
2064
2022
  }
2065
-
2066
- .body-editor-surface--dragging {
2067
- box-shadow: inset 0 0 0 2px var(--smrt-color-primary);
2068
- background: color-mix(in srgb, var(--smrt-color-primary) 6%, var(--smrt-color-surface));
2069
- }
2070
-
2071
- .body-editor-surface :global(p:first-child),
2072
- .body-editor-surface :global(h1:first-child),
2073
- .body-editor-surface :global(h2:first-child),
2074
- .body-editor-surface :global(h3:first-child) {
2023
+ .smrt-content-body-editor__surface :global(p:first-child),
2024
+ .smrt-content-body-editor__surface :global(h1:first-child),
2025
+ .smrt-content-body-editor__surface :global(h2:first-child),
2026
+ .smrt-content-body-editor__surface :global(h3:first-child) {
2075
2027
  margin-top: 0;
2076
2028
  }
2077
-
2078
- .body-editor-surface :global(p:last-child) {
2029
+ .smrt-content-body-editor__surface :global(p:last-child) {
2079
2030
  margin-bottom: 0;
2080
2031
  }
2081
-
2082
- .body-editor-surface :global(p) {
2032
+ .smrt-content-body-editor__surface :global(p) {
2083
2033
  min-height: 1.65em;
2084
2034
  }
2085
-
2086
- .body-editor-surface :global(h1),
2087
- .body-editor-surface :global(h2),
2088
- .body-editor-surface :global(h3) {
2089
- line-height: 1.2;
2035
+ .smrt-content-body-editor__surface :global(h1),
2036
+ .smrt-content-body-editor__surface :global(h2),
2037
+ .smrt-content-body-editor__surface :global(h3) {
2090
2038
  margin: 1.25em 0 0.5em;
2091
2039
  }
2092
-
2093
- .body-editor-surface :global(figure[data-smrt-inline-image]) {
2040
+ .smrt-content-body-editor__surface :global(figure[data-smrt-inline-image]) {
2094
2041
  display: block;
2095
- width: min(100%, 32rem);
2042
+ width: var(--smrt-content-body-image-width, min(100%, 32rem));
2096
2043
  max-width: 100%;
2097
2044
  margin: 1.25rem 0;
2098
2045
  clear: none;
2099
2046
  }
2100
-
2101
- .body-editor-surface :global(figure[data-smrt-inline-image] img) {
2047
+ .smrt-content-body-editor__surface :global(figure[data-smrt-inline-image] img) {
2102
2048
  display: block;
2103
2049
  width: 100%;
2104
2050
  max-width: 100%;
2105
2051
  }
2106
-
2107
- .body-editor-surface :global(figure[data-smrt-placement='left']),
2108
- .body-editor-surface :global(img[data-smrt-placement='left']) {
2052
+ .smrt-content-body-editor__surface :global(figure[data-smrt-placement='left']),
2053
+ .smrt-content-body-editor__surface :global(img[data-smrt-placement='left']) {
2109
2054
  float: left;
2110
- width: min(45%, 22rem);
2055
+ width: var(--smrt-content-body-image-width, min(45%, 22rem));
2111
2056
  margin: 0.4rem 1.25rem 0.75rem 0;
2112
2057
  }
2113
-
2114
- .body-editor-surface :global(figure[data-smrt-placement='right']),
2115
- .body-editor-surface :global(img[data-smrt-placement='right']) {
2058
+ .smrt-content-body-editor__surface :global(figure[data-smrt-placement='right']),
2059
+ .smrt-content-body-editor__surface :global(img[data-smrt-placement='right']) {
2116
2060
  float: right;
2117
- width: min(45%, 22rem);
2061
+ width: var(--smrt-content-body-image-width, min(45%, 22rem));
2118
2062
  margin: 0.4rem 0 0.75rem 1.25rem;
2119
2063
  }
2120
-
2121
- .body-editor-surface :global(figure[data-smrt-placement='center']),
2122
- .body-editor-surface :global(figure[data-smrt-placement='block']),
2123
- .body-editor-surface :global(img[data-smrt-placement='center']),
2124
- .body-editor-surface :global(img[data-smrt-placement='block']) {
2064
+ .smrt-content-body-editor__surface :global(figure[data-smrt-placement='center']),
2065
+ .smrt-content-body-editor__surface :global(figure[data-smrt-placement='block']),
2066
+ .smrt-content-body-editor__surface :global(img[data-smrt-placement='center']),
2067
+ .smrt-content-body-editor__surface :global(img[data-smrt-placement='block']) {
2125
2068
  float: none;
2126
2069
  display: block;
2127
2070
  clear: both;
2128
2071
  margin-left: auto;
2129
2072
  margin-right: auto;
2130
2073
  }
2131
-
2132
- .body-editor-surface :global(figure[data-smrt-placement='full']),
2133
- .body-editor-surface :global(img[data-smrt-placement='full']) {
2074
+ .smrt-content-body-editor__surface :global(figure[data-smrt-placement='full']),
2075
+ .smrt-content-body-editor__surface :global(img[data-smrt-placement='full']),
2076
+ .smrt-content-body-editor__surface :global(img[data-smrt-inline-image][data-smrt-placement='full']) {
2134
2077
  float: none;
2135
- width: 100% !important;
2078
+ width: 100%;
2136
2079
  max-width: 100%;
2137
2080
  margin-left: 0;
2138
2081
  margin-right: 0;
2139
2082
  clear: both;
2140
2083
  }
2141
-
2142
- .body-editor-surface :global(img) {
2143
- /* iOS: no callout on a long press, which asks for a change instead. */
2144
- -webkit-touch-callout: none;
2084
+ .smrt-content-body-editor__surface :global(img) {
2145
2085
  display: block;
2086
+ width: var(--smrt-content-body-image-width, auto);
2146
2087
  max-width: min(100%, 44rem);
2147
2088
  height: auto;
2148
- border-radius: 0.55rem;
2089
+ /* iOS: no callout on a long press, which asks for a change instead. */
2090
+ -webkit-touch-callout: none;
2149
2091
  }
2150
-
2151
- .body-editor-surface :global(img[data-smrt-inline-image]) {
2152
- width: min(100%, 32rem);
2092
+ .smrt-content-body-editor__surface :global(img[data-smrt-inline-image]) {
2093
+ width: var(--smrt-content-body-image-width, min(100%, 32rem));
2153
2094
  max-width: 100%;
2154
2095
  margin-top: 1.25rem;
2155
2096
  margin-bottom: 1.25rem;
2156
2097
  clear: both;
2157
2098
  }
2158
-
2159
- .body-editor-surface :global(img[data-smrt-inline-image][data-smrt-placement='left']),
2160
- .body-editor-surface :global(img[data-smrt-inline-image][data-smrt-placement='right']) {
2161
- width: min(45%, 22rem);
2099
+ .smrt-content-body-editor__surface :global(img[data-smrt-inline-image][data-smrt-placement='left']),
2100
+ .smrt-content-body-editor__surface :global(img[data-smrt-inline-image][data-smrt-placement='right']) {
2101
+ width: var(--smrt-content-body-image-width, min(45%, 22rem));
2162
2102
  clear: none;
2163
2103
  }
2164
-
2165
- .body-editor-surface :global(figure[data-smrt-inline-image] img) {
2104
+ .smrt-content-body-editor__surface :global(figure[data-smrt-inline-image] img) {
2166
2105
  width: 100%;
2167
2106
  max-width: 100%;
2168
2107
  margin: 0;
2169
2108
  }
2170
-
2171
- .body-editor-surface :global(img[data-smrt-placement='full']) {
2109
+ .smrt-content-body-editor__surface :global(img[data-smrt-placement='full']),
2110
+ .smrt-content-body-editor__surface :global(img[data-smrt-inline-image][data-smrt-placement='full']) {
2172
2111
  width: 100%;
2173
2112
  max-width: 100%;
2174
2113
  }
2175
-
2176
- .body-editor-surface :global(img[data-smrt-thumbnail][data-smrt-placement='full']) {
2114
+ .smrt-content-body-editor__surface :global(img[data-smrt-thumbnail][data-smrt-placement='full']) {
2177
2115
  margin-top: 0;
2178
2116
  }
2179
-
2180
- .body-editor-surface :global(img[data-smrt-thumbnail][data-smrt-placement='right']) {
2117
+ .smrt-content-body-editor__surface :global(img[data-smrt-thumbnail][data-smrt-placement='right']) {
2181
2118
  margin-top: 0.25rem;
2182
2119
  }
2183
-
2184
2120
  /* Phones: wrapped images stack full width, as the published page shows them. */
2185
2121
  @media (max-width: 36rem) {
2186
- .body-editor-surface :global(figure[data-smrt-placement='left']),
2187
- .body-editor-surface :global(figure[data-smrt-placement='right']),
2188
- .body-editor-surface :global(img[data-smrt-placement='left']),
2189
- .body-editor-surface :global(img[data-smrt-placement='right']) {
2122
+ .smrt-content-body-editor__surface :global(figure[data-smrt-placement='left']),
2123
+ .smrt-content-body-editor__surface :global(figure[data-smrt-placement='right']),
2124
+ .smrt-content-body-editor__surface :global(img[data-smrt-placement='left']),
2125
+ .smrt-content-body-editor__surface :global(img[data-smrt-placement='right']),
2126
+ .smrt-content-body-editor__surface :global(img[data-smrt-inline-image][data-smrt-placement='left']),
2127
+ .smrt-content-body-editor__surface :global(img[data-smrt-inline-image][data-smrt-placement='right']) {
2190
2128
  float: none;
2191
- width: 100% !important;
2129
+ width: 100%;
2192
2130
  margin: 0.75rem 0;
2193
2131
  }
2194
2132
  }
2195
-
2196
- .body-editor-surface :global(img[data-smrt-selected='true']) {
2197
- outline: 3px solid var(--smrt-color-primary);
2198
- outline-offset: 3px;
2199
- }
2200
-
2201
- .body-editor-surface :global([data-smrt-moving='true']),
2202
- .body-editor-surface :global([data-smrt-resizing='true']) {
2203
- opacity: 0.78;
2204
- }
2205
-
2206
- .image-change-badge {
2133
+ .smrt-content-body-editor__image-change-badge {
2207
2134
  position: absolute;
2208
2135
  z-index: 19;
2209
2136
  display: inline-grid;
@@ -2211,128 +2138,216 @@ function handleEditorDragEnd() {
2211
2138
  inline-size: 44px;
2212
2139
  block-size: 44px;
2213
2140
  padding: 0;
2214
- border: var(--smrt-hairline);
2215
- border-radius: var(--smrt-radius-full);
2216
- background: color-mix(in srgb, var(--smrt-color-surface) 94%, transparent);
2217
- color: var(--smrt-color-primary);
2218
- box-shadow: var(--smrt-elevation-3, 0 0.4rem 1rem color-mix(in srgb, var(--smrt-color-shadow) 20%, transparent));
2219
2141
  cursor: pointer;
2220
2142
  }
2221
-
2222
- .image-change-badge:hover,
2223
- .image-change-badge:focus-visible {
2224
- background: var(--smrt-color-primary-container);
2225
- }
2226
-
2227
- .image-control-popover :global(.editor-popover-button.editor-popover-button--change) {
2143
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button.editor-popover-button--change) {
2228
2144
  inline-size: auto;
2229
2145
  min-inline-size: 44px;
2230
2146
  block-size: 44px;
2231
2147
  padding: 0 0.7rem 0 0.55rem;
2232
2148
  gap: 0.3rem;
2233
2149
  display: inline-flex;
2234
- color: var(--smrt-color-primary);
2235
- font-weight: var(--smrt-typography-weight-semibold, 600);
2236
2150
  }
2237
-
2238
2151
  /* Phones: the picture toolbar is already wide; Change is icon-only there
2239
- (still 44px and named "Change this picture"). */
2152
+ (still 44px and named "Change this picture"). */
2240
2153
  @media (max-width: 48rem) {
2241
- .image-control-popover :global(.editor-popover-button-text) {
2154
+ .smrt-content-body-editor__image-control-popover :global(.smrt-content-body-editor__popover-button-text) {
2242
2155
  display: none;
2243
2156
  }
2244
-
2245
- .image-control-popover :global(.editor-popover-button.editor-popover-button--change) {
2157
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button.editor-popover-button--change) {
2246
2158
  padding: 0;
2247
2159
  inline-size: 44px;
2248
2160
  }
2249
2161
  }
2250
-
2251
- .image-control-popover {
2162
+ .smrt-content-body-editor__image-control-popover {
2252
2163
  position: absolute;
2253
2164
  z-index: 20;
2254
2165
  display: inline-flex;
2255
2166
  align-items: center;
2256
2167
  gap: 0.1rem;
2257
2168
  padding: 0.25rem;
2258
- border: var(--smrt-hairline);
2259
- border-radius: var(--smrt-radius-full);
2260
- background: color-mix(in srgb, var(--smrt-color-surface) 96%, transparent);
2261
- color: var(--smrt-color-on-surface);
2262
- box-shadow: var(--smrt-elevation-5, 0 0.75rem 1.75rem color-mix(in srgb, var(--smrt-color-shadow) 18%, transparent));
2263
2169
  transform: translateX(-50%);
2264
- backdrop-filter: blur(10px);
2265
2170
  }
2266
-
2267
- .image-control-popover :global(.editor-popover-button),
2268
- .image-resize-handle {
2171
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button),
2172
+ .smrt-content-body-editor__image-resize-handle {
2269
2173
  display: inline-grid;
2270
2174
  place-items: center;
2271
- border: 0;
2272
- background: transparent;
2273
- color: inherit;
2274
2175
  cursor: pointer;
2275
2176
  }
2276
-
2277
- .image-control-popover :global(.editor-popover-button) {
2177
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button) {
2278
2178
  width: 2rem;
2279
2179
  height: 2rem;
2280
2180
  min-width: 2rem;
2281
2181
  padding: 0;
2282
- border-radius: var(--smrt-radius-full);
2283
2182
  }
2284
-
2285
2183
  /* Move up / Move down: full 44px touch targets. */
2286
- .image-control-popover :global(.editor-popover-button.editor-popover-button--move) {
2184
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button.editor-popover-button--move) {
2287
2185
  width: 2.75rem;
2288
2186
  height: 2.75rem;
2289
2187
  min-width: 2.75rem;
2290
2188
  }
2291
-
2292
- .image-control-popover :global(.editor-popover-button:disabled) {
2293
- opacity: 0.4;
2189
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button:disabled) {
2294
2190
  cursor: default;
2295
2191
  }
2296
-
2297
- .body-drop-indicator {
2192
+ .smrt-content-body-editor__drop-indicator {
2298
2193
  position: absolute;
2299
2194
  z-index: 19;
2300
2195
  left: 1rem;
2301
2196
  right: 1rem;
2302
2197
  height: 4px;
2303
- border-radius: var(--smrt-radius-sm);
2304
- background: var(--smrt-color-primary);
2305
- box-shadow: 0 0 0 2px color-mix(in srgb, var(--smrt-color-primary) 25%, transparent);
2306
2198
  pointer-events: none;
2307
2199
  }
2308
-
2309
- .image-control-popover :global(.editor-popover-button:hover),
2310
- .image-control-popover :global(.editor-popover-button.editor-popover-button--active) {
2311
- background: var(--smrt-color-surface-container);
2312
- color: var(--smrt-color-primary);
2313
- }
2314
-
2315
- .image-control-divider {
2200
+ .smrt-content-body-editor__image-control-divider {
2316
2201
  width: 1px;
2317
2202
  height: 1.15rem;
2318
2203
  margin: 0 0.15rem;
2319
- background: var(--smrt-color-outline-variant);
2320
2204
  }
2321
-
2322
- .image-resize-handle {
2205
+ .smrt-content-body-editor__image-resize-handle {
2323
2206
  position: absolute;
2324
2207
  z-index: 21;
2325
2208
  width: 1.45rem;
2326
2209
  height: 1.45rem;
2210
+ cursor: nwse-resize;
2211
+ }
2212
+ }
2213
+
2214
+ @layer smrt.theme {
2215
+ .smrt-content-body-editor__root {
2216
+ border: var(--smrt-hairline);
2217
+ border-radius: 0.85rem;
2218
+ background: var(--smrt-color-surface);
2219
+ }
2220
+ .smrt-content-body-editor__toolbar {
2221
+ border-bottom: var(--smrt-hairline);
2222
+ background: var(--smrt-color-surface-container-low, var(--smrt-color-surface-container));
2223
+ }
2224
+ /* Icon buttons are a fixed square. smrt-ui's `size="sm"` padding
2225
+ (0.5rem 0.75rem) would leave a 2rem button ~6px of content width, which
2226
+ squeezed the SVG icons (list, image) far below the text glyphs (B, I, H2).
2227
+ Zero the padding and never let an icon shrink: every toolbar glyph renders
2228
+ at the same --smrt-content-editor-icon-size. */
2229
+ .smrt-content-body-editor__toolbar :global(.editor-toolbar-button) {
2230
+ border: 1px solid transparent;
2231
+ border-radius: 0.45rem;
2232
+ background: transparent;
2233
+ color: var(--smrt-color-on-surface);
2234
+ }
2235
+ .smrt-content-body-editor__toolbar :global(.editor-toolbar-button[aria-expanded='true']) {
2236
+ border-color: var(--smrt-color-primary);
2237
+ background: var(--smrt-color-primary-container, var(--smrt-color-surface-container));
2238
+ color: var(--smrt-color-on-primary-container, var(--smrt-color-primary));
2239
+ }
2240
+ .smrt-content-body-editor__toolbar :global(.editor-toolbar-button:hover) {
2241
+ border-color: var(--smrt-hairline-color);
2242
+ background: var(--smrt-color-surface-container);
2243
+ }
2244
+ /* The image panel sits between the toolbar and the text so it opens above
2245
+ the story rather than below it. Full width, in the page flow (no modal),
2246
+ so it works the same on a phone. */
2247
+ .smrt-content-body-editor__image-panel {
2248
+ border-bottom: var(--smrt-hairline);
2249
+ background: var(--smrt-color-surface-container-lowest, var(--smrt-color-surface));
2250
+ }
2251
+ .smrt-content-body-editor__image-panel:focus-visible {
2252
+ outline: 2px solid var(--smrt-color-primary);
2253
+ outline-offset: -2px;
2254
+ }
2255
+ .smrt-content-body-editor__format-select {
2256
+ font-size: var(--smrt-typography-label-medium-size, 0.78rem);
2257
+ color: var(--smrt-color-on-surface-variant);
2258
+ }
2259
+ .smrt-content-body-editor__format-select :global([data-smrt-component="Select"]) {
2260
+ border: var(--smrt-hairline);
2261
+ border-radius: 0.45rem;
2262
+ background: var(--smrt-color-surface);
2263
+ color: var(--smrt-color-on-surface);
2264
+ }
2265
+ .smrt-content-body-editor__surface {
2266
+ outline: none;
2267
+ color: var(--smrt-color-on-surface);
2268
+ font-size: var(--smrt-typography-body-large-size, 1.05rem);
2269
+ line-height: var(--smrt-typography-body-large-line-height, 1.65);
2270
+ }
2271
+ .smrt-content-body-editor__surface:empty::before {
2272
+ color: var(--smrt-color-on-surface-variant);
2273
+ }
2274
+ .smrt-content-body-editor__surface--dragging {
2275
+ box-shadow: inset 0 0 0 2px var(--smrt-color-primary);
2276
+ background: color-mix(in srgb, var(--smrt-color-primary) 6%, var(--smrt-color-surface));
2277
+ }
2278
+ .smrt-content-body-editor__surface :global(h1),
2279
+ .smrt-content-body-editor__surface :global(h2),
2280
+ .smrt-content-body-editor__surface :global(h3) {
2281
+ line-height: 1.2;
2282
+ }
2283
+ .smrt-content-body-editor__surface :global(img) {
2284
+ border-radius: 0.55rem;
2285
+ }
2286
+ .smrt-content-body-editor__surface :global(img[data-smrt-selected='true']) {
2287
+ outline: 3px solid var(--smrt-color-primary);
2288
+ outline-offset: 3px;
2289
+ }
2290
+ .smrt-content-body-editor__surface :global([data-smrt-moving='true']),
2291
+ .smrt-content-body-editor__surface :global([data-smrt-resizing='true']) {
2292
+ opacity: 0.78;
2293
+ }
2294
+ .smrt-content-body-editor__image-change-badge {
2295
+ border: var(--smrt-hairline);
2296
+ border-radius: var(--smrt-radius-full);
2297
+ background: color-mix(in srgb, var(--smrt-color-surface) 94%, transparent);
2298
+ color: var(--smrt-color-primary);
2299
+ box-shadow: var(--smrt-elevation-3, 0 0.4rem 1rem color-mix(in srgb, var(--smrt-color-shadow) 20%, transparent));
2300
+ }
2301
+ .smrt-content-body-editor__image-change-badge:hover,
2302
+ .smrt-content-body-editor__image-change-badge:focus-visible {
2303
+ background: var(--smrt-color-primary-container);
2304
+ }
2305
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button.editor-popover-button--change) {
2306
+ color: var(--smrt-color-primary);
2307
+ font-weight: var(--smrt-typography-weight-semibold, 600);
2308
+ }
2309
+ .smrt-content-body-editor__image-control-popover {
2310
+ border: var(--smrt-hairline);
2311
+ border-radius: var(--smrt-radius-full);
2312
+ background: color-mix(in srgb, var(--smrt-color-surface) 96%, transparent);
2313
+ color: var(--smrt-color-on-surface);
2314
+ box-shadow: var(--smrt-elevation-5, 0 0.75rem 1.75rem color-mix(in srgb, var(--smrt-color-shadow) 18%, transparent));
2315
+ backdrop-filter: blur(10px);
2316
+ }
2317
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button),
2318
+ .smrt-content-body-editor__image-resize-handle {
2319
+ border: 0;
2320
+ background: transparent;
2321
+ color: inherit;
2322
+ }
2323
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button) {
2324
+ border-radius: var(--smrt-radius-full);
2325
+ }
2326
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button:disabled) {
2327
+ opacity: 0.4;
2328
+ }
2329
+ .smrt-content-body-editor__drop-indicator {
2330
+ border-radius: var(--smrt-radius-sm);
2331
+ background: var(--smrt-color-primary);
2332
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--smrt-color-primary) 25%, transparent);
2333
+ }
2334
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button:hover),
2335
+ .smrt-content-body-editor__image-control-popover :global(.editor-popover-button.editor-popover-button--active) {
2336
+ background: var(--smrt-color-surface-container);
2337
+ color: var(--smrt-color-primary);
2338
+ }
2339
+ .smrt-content-body-editor__image-control-divider {
2340
+ background: var(--smrt-color-outline-variant);
2341
+ }
2342
+ .smrt-content-body-editor__image-resize-handle {
2327
2343
  border: var(--smrt-hairline);
2328
2344
  border-radius: var(--smrt-radius-full);
2329
2345
  background: var(--smrt-color-surface);
2330
2346
  box-shadow: var(--smrt-elevation-4, 0 0.45rem 1rem color-mix(in srgb, var(--smrt-color-shadow) 18%, transparent));
2331
- cursor: nwse-resize;
2332
2347
  }
2333
-
2334
- .image-resize-handle:hover {
2348
+ .smrt-content-body-editor__image-resize-handle:hover {
2335
2349
  color: var(--smrt-color-primary);
2336
2350
  }
2337
2351
  }
2352
+
2338
2353
  </style>