@memorysmithapp/markdown-renderer 0.6.0 → 0.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memorysmithapp/markdown-renderer",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "A React component that draws a MemorySmith note exactly as MemorySmith's reading page does.",
5
5
  "keywords": [
6
6
  "markdown",
@@ -79,7 +79,7 @@
79
79
  "unified": "11.0.5"
80
80
  },
81
81
  "devDependencies": {
82
- "@memorysmithapp/markdown-spec": "0.6.0",
82
+ "@memorysmithapp/markdown-spec": "0.7.1",
83
83
  "@types/hast": "3.0.5",
84
84
  "@types/react": "19.2.18",
85
85
  "@types/react-dom": "19.2.4",
package/structure.css CHANGED
@@ -97,10 +97,14 @@
97
97
  and the text of a title flows around it. In edit mode it stays there, at
98
98
  the end of a bar that holds the toolbar to its left and the save's status
99
99
  under it, and the bar stays at the top of the note while it scrolls. */
100
- /* The group at the top right: Show Markdown, Copy Markdown and the switch (#76). */
100
+ /* The group at the top right: Show Markdown, Copy Markdown and the switch (#76).
101
+ It stays at the top of what is in view while the note is read and scrolled,
102
+ as the bar does in edit mode, and the text flows around the place it takes
103
+ at the top of the note (#97). */
101
104
  .markdown .note-corner {
102
105
  float: right;
103
- position: relative;
106
+ position: sticky;
107
+ top: 0;
104
108
  z-index: 2;
105
109
  display: inline-flex;
106
110
  align-items: stretch;
@@ -116,6 +120,30 @@
116
120
  .markdown .mode-switch-glyph {
117
121
  flex: none;
118
122
  }
123
+ /* The buttons around a note show their word as the host asked (#96). A
124
+ `responsive` one measures what it stands in — the note in reading, the bar
125
+ in edit mode, the dialog of Show Markdown — as a container, and shows its
126
+ word only from `--markdown-button-words-from` on. A container query cannot
127
+ read a custom property, so the threshold is a switch computed from the
128
+ container's width: 0px on a narrower one and 1px from it on, which the
129
+ word's width and the space before it are multiplied by. The editor's root
130
+ is never the container, because a container holds what is fixed, and the
131
+ menu of a right-click is fixed to the window. */
132
+ .markdown.has-responsive-buttons,
133
+ .markdown .has-responsive-buttons {
134
+ container-type: inline-size;
135
+ }
136
+ .markdown .note-button-word {
137
+ white-space: nowrap;
138
+ }
139
+ .markdown [data-buttons='responsive'] {
140
+ gap: 0;
141
+ }
142
+ .markdown [data-buttons='responsive'] .note-button-word {
143
+ overflow: hidden;
144
+ max-width: calc(clamp(0px, (100cqi - var(--markdown-button-words-from, 560px)) * 1000, 1px) * 10000);
145
+ margin-inline-start: min(calc(clamp(0px, (100cqi - var(--markdown-button-words-from, 560px)) * 1000, 1px) * 10000), 0.35em);
146
+ }
119
147
  .markdown .edit-bar {
120
148
  position: sticky;
121
149
  top: 0;
@@ -146,6 +174,7 @@
146
174
  }
147
175
  .markdown .edit-corner .note-corner {
148
176
  float: none;
177
+ position: relative;
149
178
  }
150
179
  /* On a phone the corner keeps the top right, and the tools take the whole
151
180
  width under it rather than a narrow column beside it. */
@@ -430,3 +459,28 @@
430
459
  max-width: 100%;
431
460
  vertical-align: middle;
432
461
  }
462
+ /* An image in edit mode carries its size's controls over its top right and a
463
+ handle at its bottom right corner that drags it (#98). */
464
+ .markdown .edit-image {
465
+ position: relative;
466
+ display: inline-block;
467
+ max-width: 100%;
468
+ vertical-align: middle;
469
+ }
470
+ .markdown .edit-image-controls {
471
+ align-items: center;
472
+ white-space: nowrap;
473
+ }
474
+ .markdown .edit-image-width {
475
+ width: 5em;
476
+ }
477
+ .markdown .edit-image-handle {
478
+ position: absolute;
479
+ right: 0;
480
+ bottom: 0;
481
+ z-index: 1;
482
+ width: 0.9rem;
483
+ height: 0.9rem;
484
+ cursor: nwse-resize;
485
+ touch-action: none;
486
+ }
package/theme-default.css CHANGED
@@ -1193,9 +1193,16 @@
1193
1193
  cursor: pointer;
1194
1194
  }
1195
1195
  .markdown .mode-switch.mode-switch-icon,
1196
- .markdown .note-action {
1196
+ .markdown .note-action.note-action-icon {
1197
1197
  padding: 0.3rem 0.4rem;
1198
1198
  }
1199
+ /* A responsive button keeps an icon's padding on a narrow note and takes a
1200
+ word's from --markdown-button-words-from on (#96). */
1201
+ .markdown .mode-switch.mode-switch-responsive,
1202
+ .markdown .note-action.note-action-responsive {
1203
+ padding-block: 0.3rem;
1204
+ padding-inline: calc(0.4rem + min(calc(clamp(0px, (100cqi - var(--markdown-button-words-from, 560px)) * 1000, 1px) * 10000), 0.3rem));
1205
+ }
1199
1206
  .markdown .note-action {
1200
1207
  color: var(--ms-text-soft);
1201
1208
  }
@@ -1936,9 +1943,51 @@
1936
1943
  transition: opacity 0.12s;
1937
1944
  }
1938
1945
  .markdown .cm-ms-block:hover .edit-block-controls,
1939
- .markdown .edit-block:focus-within .edit-block-controls {
1946
+ .markdown .edit-block:focus-within .edit-block-controls,
1947
+ .markdown .edit-image:hover .edit-block-controls,
1948
+ .markdown .edit-image:focus-within .edit-block-controls,
1949
+ .markdown .edit-image[data-resizing] .edit-block-controls {
1940
1950
  opacity: 1;
1941
1951
  }
1952
+ .markdown .edit-image-controls {
1953
+ font-size: 0.8rem;
1954
+ line-height: 1.2;
1955
+ }
1956
+ .markdown .edit-image-width.edit-field {
1957
+ height: 1.9rem;
1958
+ border-color: var(--ms-border);
1959
+ background: var(--ms-surface);
1960
+ color: var(--ms-text);
1961
+ font-size: 0.8rem;
1962
+ }
1963
+ .markdown .edit-image-unit {
1964
+ padding-inline-end: 0.2rem;
1965
+ color: var(--ms-text-soft);
1966
+ font-size: 0.8rem;
1967
+ }
1968
+ /* The handle is a corner of the accent's colour, shown with the controls. */
1969
+ .markdown .edit-image-handle {
1970
+ opacity: 0;
1971
+ border-right: 3px solid var(--ms-accent);
1972
+ border-bottom: 3px solid var(--ms-accent);
1973
+ border-bottom-right-radius: 3px;
1974
+ transition: opacity 0.12s;
1975
+ }
1976
+ .markdown .edit-image:hover .edit-image-handle,
1977
+ .markdown .edit-image[data-resizing] .edit-image-handle {
1978
+ opacity: 1;
1979
+ }
1980
+ /* Where nothing hovers, as on a phone, an image's size is always at hand. */
1981
+ @media (hover: none) {
1982
+ .markdown .edit-image .edit-block-controls,
1983
+ .markdown .edit-image .edit-image-handle {
1984
+ opacity: 1;
1985
+ }
1986
+ }
1987
+ .markdown .edit-image[data-resizing] .cm-ms-image,
1988
+ .markdown .edit-image[data-resizing] img {
1989
+ outline: 1px dashed var(--ms-accent);
1990
+ }
1942
1991
  .markdown .edit-table table {
1943
1992
  width: 100%;
1944
1993
  }