react-cheminfo 0.33.0 → 0.35.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.
- package/README.md +28 -28
- package/lib/about/core/about.d.ts +1 -30
- package/lib/about/core/about.d.ts.map +1 -1
- package/lib/about/core/about.js +0 -16
- package/lib/about/core/about.js.map +1 -1
- package/lib/about/core/index.d.ts +0 -1
- package/lib/about/core/index.d.ts.map +1 -1
- package/lib/about/core/index.js +0 -1
- package/lib/about/core/index.js.map +1 -1
- package/lib/about/ui/AboutBuild.d.ts +2 -5
- package/lib/about/ui/AboutBuild.d.ts.map +1 -1
- package/lib/about/ui/AboutBuild.js +7 -19
- package/lib/about/ui/AboutBuild.js.map +1 -1
- package/lib/about/ui/AboutPage.d.ts +2 -2
- package/lib/about/ui/AboutPage.d.ts.map +1 -1
- package/lib/about/ui/AboutPage.js +3 -14
- package/lib/about/ui/AboutPage.js.map +1 -1
- package/lib/about/ui/AboutVersion.d.ts +0 -4
- package/lib/about/ui/AboutVersion.d.ts.map +1 -1
- package/lib/about/ui/AboutVersion.js +3 -31
- package/lib/about/ui/AboutVersion.js.map +1 -1
- package/lib/axis/core/axisMarks.d.ts +54 -0
- package/lib/axis/core/axisMarks.d.ts.map +1 -0
- package/lib/axis/core/axisMarks.js +69 -0
- package/lib/axis/core/axisMarks.js.map +1 -0
- package/lib/axis/core/axisScale.d.ts +31 -0
- package/lib/axis/core/axisScale.d.ts.map +1 -0
- package/lib/axis/core/axisScale.js +31 -0
- package/lib/axis/core/axisScale.js.map +1 -0
- package/lib/axis/core/index.d.ts +16 -0
- package/lib/axis/core/index.d.ts.map +1 -0
- package/lib/axis/core/index.js +13 -0
- package/lib/axis/core/index.js.map +1 -0
- package/lib/axis/core/logAxisBounds.d.ts +78 -0
- package/lib/axis/core/logAxisBounds.d.ts.map +1 -0
- package/lib/axis/core/logAxisBounds.js +129 -0
- package/lib/axis/core/logAxisBounds.js.map +1 -0
- package/lib/axis/ui/AxisScaleControl.d.ts +66 -0
- package/lib/axis/ui/AxisScaleControl.d.ts.map +1 -0
- package/lib/axis/ui/AxisScaleControl.js +26 -0
- package/lib/axis/ui/AxisScaleControl.js.map +1 -0
- package/lib/axis/ui/index.d.ts +6 -0
- package/lib/axis/ui/index.d.ts.map +1 -0
- package/lib/axis/ui/index.js +5 -0
- package/lib/axis/ui/index.js.map +1 -0
- package/lib/core.d.ts +1 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +1 -0
- package/lib/core.js.map +1 -1
- package/lib/delimited/core/index.d.ts +2 -0
- package/lib/delimited/core/index.d.ts.map +1 -1
- package/lib/delimited/core/index.js +1 -0
- package/lib/delimited/core/index.js.map +1 -1
- package/lib/delimited/core/tableRows.d.ts +49 -0
- package/lib/delimited/core/tableRows.d.ts.map +1 -0
- package/lib/delimited/core/tableRows.js +63 -0
- package/lib/delimited/core/tableRows.js.map +1 -0
- package/lib/delimited/ui/DelimitedTextPanel.d.ts +9 -0
- package/lib/delimited/ui/DelimitedTextPanel.d.ts.map +1 -1
- package/lib/delimited/ui/DelimitedTextPanel.js +3 -2
- package/lib/delimited/ui/DelimitedTextPanel.js.map +1 -1
- package/lib/delimited/ui/TableDataButton.d.ts +96 -0
- package/lib/delimited/ui/TableDataButton.d.ts.map +1 -0
- package/lib/delimited/ui/TableDataButton.js +39 -0
- package/lib/delimited/ui/TableDataButton.js.map +1 -0
- package/lib/delimited/ui/index.d.ts +2 -0
- package/lib/delimited/ui/index.d.ts.map +1 -1
- package/lib/delimited/ui/index.js +1 -0
- package/lib/delimited/ui/index.js.map +1 -1
- package/lib/download/core/index.d.ts +0 -5
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +0 -3
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/ui/FigureDownload.d.ts +4 -55
- package/lib/download/ui/FigureDownload.d.ts.map +1 -1
- package/lib/download/ui/FigureDownload.js +6 -66
- package/lib/download/ui/FigureDownload.js.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.d.ts +16 -2
- package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.js +11 -30
- package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
- package/lib/download/ui/figureDownloadHint.d.ts +30 -0
- package/lib/download/ui/figureDownloadHint.d.ts.map +1 -0
- package/lib/download/ui/figureDownloadHint.js +33 -0
- package/lib/download/ui/figureDownloadHint.js.map +1 -0
- package/lib/download/ui/index.d.ts +3 -10
- package/lib/download/ui/index.d.ts.map +1 -1
- package/lib/download/ui/index.js +1 -5
- package/lib/download/ui/index.js.map +1 -1
- package/lib/download/ui/useFigureActions.d.ts +50 -0
- package/lib/download/ui/useFigureActions.d.ts.map +1 -0
- package/lib/download/ui/useFigureActions.js +58 -0
- package/lib/download/ui/useFigureActions.js.map +1 -0
- package/lib/download/ui/useFigureDownload.d.ts +85 -0
- package/lib/download/ui/useFigureDownload.d.ts.map +1 -0
- package/lib/download/ui/useFigureDownload.js +75 -0
- package/lib/download/ui/useFigureDownload.js.map +1 -0
- package/lib/ecosystem/core/sites.d.ts.map +1 -1
- package/lib/ecosystem/core/sites.js +0 -40
- package/lib/ecosystem/core/sites.js.map +1 -1
- package/lib/ecosystem/core/types.d.ts +0 -10
- package/lib/ecosystem/core/types.d.ts.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/ir/core/irCommands.d.ts +2 -2
- package/lib/ir/core/irCommands.js +2 -2
- package/lib/ir/core/irCommands.js.map +1 -1
- package/lib/ir/ui/IrAboutDialog.d.ts.map +1 -1
- package/lib/ir/ui/IrAboutDialog.js +1 -1
- package/lib/ir/ui/IrAboutDialog.js.map +1 -1
- package/lib/ir/ui/IrCanvas.d.ts +6 -0
- package/lib/ir/ui/IrCanvas.d.ts.map +1 -1
- package/lib/ir/ui/IrCanvas.js +2 -2
- package/lib/ir/ui/IrCanvas.js.map +1 -1
- package/lib/ir/ui/IrShell.d.ts.map +1 -1
- package/lib/ir/ui/IrShell.js +16 -11
- package/lib/ir/ui/IrShell.js.map +1 -1
- package/lib/ir/ui/IrToolbar.d.ts +11 -1
- package/lib/ir/ui/IrToolbar.d.ts.map +1 -1
- package/lib/ir/ui/IrToolbar.js +12 -2
- package/lib/ir/ui/IrToolbar.js.map +1 -1
- package/lib/ir/ui/index.d.ts +1 -0
- package/lib/ir/ui/index.d.ts.map +1 -1
- package/lib/ir/ui/index.js.map +1 -1
- package/lib/locales/de.json +8 -4
- package/lib/locales/en.json +8 -4
- package/lib/locales/es.json +8 -4
- package/lib/locales/fr.json +8 -4
- package/lib/locales/it.json +8 -4
- package/lib/overlay/ui/OverlayPanel.d.ts +6 -0
- package/lib/overlay/ui/OverlayPanel.d.ts.map +1 -1
- package/lib/overlay/ui/OverlayPanel.js +2 -2
- package/lib/overlay/ui/OverlayPanel.js.map +1 -1
- package/lib/overlay/ui/overlayPanelStyles.d.ts +2 -1
- package/lib/overlay/ui/overlayPanelStyles.d.ts.map +1 -1
- package/lib/overlay/ui/overlayPanelStyles.js +3 -1
- package/lib/overlay/ui/overlayPanelStyles.js.map +1 -1
- package/lib/periodic/core/index.d.ts +1 -1
- package/lib/periodic/core/index.d.ts.map +1 -1
- package/lib/periodic/core/index.js +1 -1
- package/lib/periodic/core/index.js.map +1 -1
- package/lib/periodic/core/layout.d.ts +18 -0
- package/lib/periodic/core/layout.d.ts.map +1 -1
- package/lib/periodic/core/layout.js +9 -0
- package/lib/periodic/core/layout.js.map +1 -1
- package/lib/periodic/ui/ElementCell.d.ts +0 -6
- package/lib/periodic/ui/ElementCell.d.ts.map +1 -1
- package/lib/periodic/ui/ElementCell.js +35 -19
- package/lib/periodic/ui/ElementCell.js.map +1 -1
- package/lib/periodic/ui/PeriodicTable.d.ts +12 -1
- package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTable.js +34 -15
- package/lib/periodic/ui/PeriodicTable.js.map +1 -1
- package/lib/ui.d.ts +1 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +1 -0
- package/lib/ui.js.map +1 -1
- package/package.json +1 -1
- package/src/about/core/about.ts +1 -51
- package/src/about/core/index.ts +0 -1
- package/src/about/ui/AboutBuild.tsx +8 -37
- package/src/about/ui/AboutPage.tsx +8 -64
- package/src/about/ui/AboutVersion.tsx +5 -45
- package/src/axis/core/axisMarks.ts +114 -0
- package/src/axis/core/axisScale.ts +41 -0
- package/src/axis/core/index.ts +20 -0
- package/src/axis/core/logAxisBounds.ts +198 -0
- package/src/axis/ui/AxisScaleControl.tsx +103 -0
- package/src/axis/ui/index.ts +9 -0
- package/src/core.ts +1 -0
- package/src/delimited/core/index.ts +2 -0
- package/src/delimited/core/tableRows.ts +93 -0
- package/src/delimited/ui/DelimitedTextPanel.tsx +25 -9
- package/src/delimited/ui/TableDataButton.tsx +162 -0
- package/src/delimited/ui/index.ts +2 -0
- package/src/download/core/index.ts +0 -25
- package/src/download/ui/FigureDownload.tsx +11 -148
- package/src/download/ui/FigureDownloadPanel.tsx +46 -45
- package/src/download/ui/figureDownloadHint.ts +52 -0
- package/src/download/ui/index.ts +6 -10
- package/src/download/ui/useFigureActions.ts +113 -0
- package/src/download/ui/useFigureDownload.tsx +191 -0
- package/src/ecosystem/core/sites.ts +0 -40
- package/src/ecosystem/core/types.ts +0 -10
- package/src/ir/core/irCommands.ts +2 -2
- package/src/ir/ui/IrAboutDialog.tsx +0 -13
- package/src/ir/ui/IrCanvas.tsx +8 -2
- package/src/ir/ui/IrShell.tsx +23 -25
- package/src/ir/ui/IrToolbar.tsx +36 -6
- package/src/ir/ui/index.ts +1 -0
- package/src/locales/de.json +8 -4
- package/src/locales/en.json +8 -4
- package/src/locales/es.json +8 -4
- package/src/locales/fr.json +8 -4
- package/src/locales/it.json +8 -4
- package/src/overlay/ui/OverlayPanel.tsx +8 -2
- package/src/overlay/ui/overlayPanelStyles.ts +3 -0
- package/src/periodic/core/index.ts +1 -0
- package/src/periodic/core/layout.ts +19 -0
- package/src/periodic/ui/ElementCell.tsx +35 -26
- package/src/periodic/ui/PeriodicTable.tsx +55 -16
- package/src/ui.ts +1 -0
- package/styles/chrome.css +71 -0
- package/lib/about/core/repository.d.ts +0 -14
- package/lib/about/core/repository.d.ts.map +0 -1
- package/lib/about/core/repository.js +0 -21
- package/lib/about/core/repository.js.map +0 -1
- package/lib/download/core/exportStyles.d.ts +0 -22
- package/lib/download/core/exportStyles.d.ts.map +0 -1
- package/lib/download/core/exportStyles.js +0 -19
- package/lib/download/core/exportStyles.js.map +0 -1
- package/lib/download/core/imageResolution.d.ts +0 -88
- package/lib/download/core/imageResolution.d.ts.map +0 -1
- package/lib/download/core/imageResolution.js +0 -77
- package/lib/download/core/imageResolution.js.map +0 -1
- package/lib/download/core/pictureExport.d.ts +0 -93
- package/lib/download/core/pictureExport.d.ts.map +0 -1
- package/lib/download/core/pictureExport.js +0 -116
- package/lib/download/core/pictureExport.js.map +0 -1
- package/lib/download/ui/ExportDialogFrame.d.ts +0 -46
- package/lib/download/ui/ExportDialogFrame.d.ts.map +0 -1
- package/lib/download/ui/ExportDialogFrame.js +0 -24
- package/lib/download/ui/ExportDialogFrame.js.map +0 -1
- package/lib/download/ui/ExportImageDialog.d.ts +0 -47
- package/lib/download/ui/ExportImageDialog.d.ts.map +0 -1
- package/lib/download/ui/ExportImageDialog.js +0 -25
- package/lib/download/ui/ExportImageDialog.js.map +0 -1
- package/lib/download/ui/ExportNameField.d.ts +0 -29
- package/lib/download/ui/ExportNameField.d.ts.map +0 -1
- package/lib/download/ui/ExportNameField.js +0 -99
- package/lib/download/ui/ExportNameField.js.map +0 -1
- package/lib/download/ui/ExportPictureSection.d.ts +0 -38
- package/lib/download/ui/ExportPictureSection.d.ts.map +0 -1
- package/lib/download/ui/ExportPictureSection.js +0 -48
- package/lib/download/ui/ExportPictureSection.js.map +0 -1
- package/lib/download/ui/useDrawingBox.d.ts +0 -23
- package/lib/download/ui/useDrawingBox.d.ts.map +0 -1
- package/lib/download/ui/useDrawingBox.js +0 -21
- package/lib/download/ui/useDrawingBox.js.map +0 -1
- package/src/about/core/repository.ts +0 -22
- package/src/download/core/exportStyles.ts +0 -20
- package/src/download/core/imageResolution.ts +0 -118
- package/src/download/core/pictureExport.ts +0 -207
- package/src/download/ui/ExportDialogFrame.tsx +0 -86
- package/src/download/ui/ExportImageDialog.tsx +0 -91
- package/src/download/ui/ExportNameField.tsx +0 -148
- package/src/download/ui/ExportPictureSection.tsx +0 -142
- package/src/download/ui/useDrawingBox.ts +0 -37
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
* a site's own richer element record never has to cross into this component.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import type {
|
|
13
|
+
import type {
|
|
14
|
+
CSSProperties,
|
|
15
|
+
KeyboardEvent,
|
|
16
|
+
ReactElement,
|
|
17
|
+
ReactNode,
|
|
18
|
+
} from 'react';
|
|
14
19
|
import { useEffect, useRef } from 'react';
|
|
15
20
|
|
|
16
21
|
import type { Swatch } from '../../color/core/interpolate.ts';
|
|
@@ -20,6 +25,7 @@ import type { PeriodicElement } from '../core/elements.ts';
|
|
|
20
25
|
import type { ElementRange } from '../core/layout.ts';
|
|
21
26
|
import {
|
|
22
27
|
COLUMN_COUNT,
|
|
28
|
+
EMPTY_BLOCK,
|
|
23
29
|
elementByArrowKey,
|
|
24
30
|
placedElements,
|
|
25
31
|
} from '../core/layout.ts';
|
|
@@ -66,6 +72,17 @@ export interface PeriodicTableProps {
|
|
|
66
72
|
* @default every element is
|
|
67
73
|
*/
|
|
68
74
|
isIncluded?: (element: PeriodicElement) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* What is written in the block the table leaves empty — columns 3 to 12 of
|
|
77
|
+
* the first three periods, in the middle of the top edge. A tool that reads
|
|
78
|
+
* one element off the table puts what it says about it there, where the eye
|
|
79
|
+
* already is, rather than under the grid.
|
|
80
|
+
*
|
|
81
|
+
* It is sized against the table, like everything else in the grid, so give
|
|
82
|
+
* it type in `em` and it scales with the drawing.
|
|
83
|
+
* @default undefined — the block stays empty
|
|
84
|
+
*/
|
|
85
|
+
inset?: ReactNode;
|
|
69
86
|
/**
|
|
70
87
|
* Whether to draw the group and period strips.
|
|
71
88
|
* @default false
|
|
@@ -119,6 +136,7 @@ export function PeriodicTable(props: PeriodicTableProps): ReactElement {
|
|
|
119
136
|
detailOf,
|
|
120
137
|
nameOf = defaultNameOf,
|
|
121
138
|
isIncluded,
|
|
139
|
+
inset,
|
|
122
140
|
headers = false,
|
|
123
141
|
onSelectRange,
|
|
124
142
|
legend = false,
|
|
@@ -129,7 +147,6 @@ export function PeriodicTable(props: PeriodicTableProps): ReactElement {
|
|
|
129
147
|
} = props;
|
|
130
148
|
|
|
131
149
|
const t = useChromeT();
|
|
132
|
-
const writesDetail = detailOf !== undefined;
|
|
133
150
|
const gridRef = useRef<HTMLDivElement>(null);
|
|
134
151
|
const cameFromKeyRef = useRef(false);
|
|
135
152
|
const offset = headers ? 1 : 0;
|
|
@@ -160,10 +177,13 @@ export function PeriodicTable(props: PeriodicTableProps): ReactElement {
|
|
|
160
177
|
role="grid"
|
|
161
178
|
aria-label={t('periodic.table')}
|
|
162
179
|
data-testid="periodic-table"
|
|
163
|
-
style={gridStyle(headers
|
|
180
|
+
style={gridStyle(headers)}
|
|
164
181
|
onKeyDown={handleKeyDown}
|
|
165
182
|
>
|
|
166
183
|
{headers ? <HeaderStrips onSelectRange={onSelectRange} /> : null}
|
|
184
|
+
{inset === undefined ? null : (
|
|
185
|
+
<div style={insetStyle(offset)}>{inset}</div>
|
|
186
|
+
)}
|
|
167
187
|
{markers ? <InnerTransitionMarkers offset={offset} /> : null}
|
|
168
188
|
{placedElements().map(({ element, cell }) => (
|
|
169
189
|
<ElementCell
|
|
@@ -172,7 +192,6 @@ export function PeriodicTable(props: PeriodicTableProps): ReactElement {
|
|
|
172
192
|
symbol={element.symbol}
|
|
173
193
|
name={nameOf(element)}
|
|
174
194
|
detail={detailOf?.(element)}
|
|
175
|
-
writesDetail={writesDetail}
|
|
176
195
|
swatch={swatchOf(element)}
|
|
177
196
|
isSelected={element.symbol === selected}
|
|
178
197
|
isIncluded={isIncluded?.(element)}
|
|
@@ -188,6 +207,30 @@ export function PeriodicTable(props: PeriodicTableProps): ReactElement {
|
|
|
188
207
|
);
|
|
189
208
|
}
|
|
190
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Where what the caller writes in the empty block is placed.
|
|
212
|
+
* @param offset - 1 when the table draws its header strips, 0 otherwise.
|
|
213
|
+
* @returns The style of the slot.
|
|
214
|
+
*/
|
|
215
|
+
function insetStyle(offset: number): CSSProperties {
|
|
216
|
+
return {
|
|
217
|
+
alignItems: 'center',
|
|
218
|
+
display: 'flex',
|
|
219
|
+
// A column of air on each side, so the writing reads as sitting in the
|
|
220
|
+
// block rather than as running into the cells beside it.
|
|
221
|
+
padding: '0 2.4cqw',
|
|
222
|
+
gridColumn: `${String(EMPTY_BLOCK.column + offset)} / span ${String(EMPTY_BLOCK.columnSpan)}`,
|
|
223
|
+
gridRow: `${String(EMPTY_BLOCK.row + offset)} / span ${String(EMPTY_BLOCK.rowSpan)}`,
|
|
224
|
+
// A share of the table, with a floor, exactly as a cell sizes its symbol:
|
|
225
|
+
// the block holds the same three rows at every width, so what is written
|
|
226
|
+
// in it has to shrink with them.
|
|
227
|
+
fontSize: 'max(0.6rem, 1.8cqw)',
|
|
228
|
+
lineHeight: 1.35,
|
|
229
|
+
minWidth: 0,
|
|
230
|
+
overflow: 'hidden',
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
191
234
|
function defaultSwatchOf(element: PeriodicElement): Swatch {
|
|
192
235
|
return categorySwatch(element.category);
|
|
193
236
|
}
|
|
@@ -207,14 +250,13 @@ const MIN_WIDTH = 280;
|
|
|
207
250
|
/**
|
|
208
251
|
* How tall one row of elements is, as a share of the table's width.
|
|
209
252
|
*
|
|
210
|
-
* A column is about 5.
|
|
211
|
-
*
|
|
212
|
-
* cell need to be
|
|
253
|
+
* A column is about 5.2% of that width, so a cell is a third taller than it is
|
|
254
|
+
* wide — the proportion of a wall chart, and the room the three bands of a
|
|
255
|
+
* cell need to be read from the back of a room. It is the same height in every
|
|
256
|
+
* table: a cell keeps the band it writes a value in whether or not that table
|
|
257
|
+
* writes one.
|
|
213
258
|
*/
|
|
214
|
-
const ROW_HEIGHT = '6.
|
|
215
|
-
|
|
216
|
-
/** The same, in a table that writes nothing under the symbol. */
|
|
217
|
-
const ROW_HEIGHT_ALONE = '4.9cqw';
|
|
259
|
+
const ROW_HEIGHT = '6.8cqw';
|
|
218
260
|
|
|
219
261
|
/** The band the two inner-transition series were lifted out across. */
|
|
220
262
|
const SERIES_GAP = 'max(6px, 1.1cqw)';
|
|
@@ -241,14 +283,11 @@ const baseGridStyle = {
|
|
|
241
283
|
* The grid the cells are placed on.
|
|
242
284
|
* @param headers - Whether a leading column and row hold the period and group
|
|
243
285
|
* numbers.
|
|
244
|
-
* @param writesDetail - Whether a cell writes a third line, which is what a
|
|
245
|
-
* row is tall enough for.
|
|
246
286
|
* @returns The style of the grid.
|
|
247
287
|
*/
|
|
248
|
-
function gridStyle(headers: boolean
|
|
249
|
-
const row = writesDetail ? ROW_HEIGHT : ROW_HEIGHT_ALONE;
|
|
288
|
+
function gridStyle(headers: boolean): CSSProperties {
|
|
250
289
|
// The eighth row is the gap the inner-transition series are lifted out into.
|
|
251
|
-
const rows = `repeat(7, ${
|
|
290
|
+
const rows = `repeat(7, ${ROW_HEIGHT}) ${SERIES_GAP} repeat(2, ${ROW_HEIGHT})`;
|
|
252
291
|
if (!headers) {
|
|
253
292
|
return {
|
|
254
293
|
...baseGridStyle,
|
package/src/ui.ts
CHANGED
package/styles/chrome.css
CHANGED
|
@@ -570,6 +570,77 @@ select,
|
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
|
|
573
|
+
/* ── Help ────────────────────────────────────────────────────────────────── */
|
|
574
|
+
|
|
575
|
+
/*
|
|
576
|
+
Every piece of help in the family opens as the same card, so a reader who has
|
|
577
|
+
met one on one site has met them all: the page's own surface, its border, its
|
|
578
|
+
radius and its shadow. Blueprint's navy slab is a hole in a light page, and
|
|
579
|
+
its 14px body turns an explanation into a wall — the same words at 12.5px
|
|
580
|
+
over 1.55 read as prose.
|
|
581
|
+
*/
|
|
582
|
+
.help-tooltip .bp6-popover-content {
|
|
583
|
+
/*
|
|
584
|
+
One measure for every card, so two opened in a row are the same shape.
|
|
585
|
+
Left to itself the popover is shrink-wrapped around its own longest line.
|
|
586
|
+
*/
|
|
587
|
+
width: 300px;
|
|
588
|
+
padding: 10px 12px;
|
|
589
|
+
border: 1px solid var(--border);
|
|
590
|
+
border-radius: var(--radius);
|
|
591
|
+
background: var(--surface);
|
|
592
|
+
box-shadow: none;
|
|
593
|
+
color: var(--text);
|
|
594
|
+
font-size: 12.5px;
|
|
595
|
+
line-height: 1.55;
|
|
596
|
+
text-wrap: pretty;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/*
|
|
600
|
+
Blueprint opens a tooltip by transitioning it from `scale(0.8)`, and under
|
|
601
|
+
React 19 that transition is created but never ticks: it sits at time zero for
|
|
602
|
+
as long as the card is open, so the card and its type stay at four fifths of
|
|
603
|
+
the size they were drawn at. Help opens without an animation instead.
|
|
604
|
+
*/
|
|
605
|
+
.help-tooltip.bp6-tooltip {
|
|
606
|
+
border-radius: var(--radius);
|
|
607
|
+
box-shadow: var(--shadow-md);
|
|
608
|
+
transform: scale(1);
|
|
609
|
+
transition: none;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/* The arrow is a corner of the same card, so it carries the same two colours. */
|
|
613
|
+
.help-tooltip .bp6-popover-arrow-fill {
|
|
614
|
+
fill: var(--surface);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.help-tooltip .bp6-popover-arrow-border {
|
|
618
|
+
fill: var(--border);
|
|
619
|
+
fill-opacity: 1;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
.help-tooltip .bp6-popover-arrow::before {
|
|
623
|
+
box-shadow: none;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
.help-tooltip .help-body a {
|
|
627
|
+
color: var(--accent);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/*
|
|
631
|
+
The glyph that opens it. How it sits in its row is the site's business — it
|
|
632
|
+
follows a label on one and a heading on another — so only its ink is set
|
|
633
|
+
here.
|
|
634
|
+
*/
|
|
635
|
+
.help-icon {
|
|
636
|
+
color: var(--text-faint);
|
|
637
|
+
cursor: help;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.help-icon:hover {
|
|
641
|
+
color: var(--accent);
|
|
642
|
+
}
|
|
643
|
+
|
|
573
644
|
/* ── Printing ────────────────────────────────────────────────────────────── */
|
|
574
645
|
|
|
575
646
|
/* Students print the cheatsheet. Let them, without the chrome. */
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What can be linked to inside a repository, and when.
|
|
3
|
-
*
|
|
4
|
-
* Only GitHub has the addresses the About page builds — a release tag, a
|
|
5
|
-
* commit — and only a repository a visitor can open is worth pointing them at.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* The sources as a base a release or a commit can be appended to.
|
|
9
|
-
* @param repository - Where the sources live.
|
|
10
|
-
* @returns The address without its trailing slash, or `undefined` when it is
|
|
11
|
-
* not a GitHub repository and nothing inside it can be addressed.
|
|
12
|
-
*/
|
|
13
|
-
export declare function githubSources(repository: string): string | undefined;
|
|
14
|
-
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/about/core/repository.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKpE"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What can be linked to inside a repository, and when.
|
|
3
|
-
*
|
|
4
|
-
* Only GitHub has the addresses the About page builds — a release tag, a
|
|
5
|
-
* commit — and only a repository a visitor can open is worth pointing them at.
|
|
6
|
-
*/
|
|
7
|
-
/** Where our repositories live, and the only host whose paths we know. */
|
|
8
|
-
const GITHUB = 'https://github.com/';
|
|
9
|
-
/**
|
|
10
|
-
* The sources as a base a release or a commit can be appended to.
|
|
11
|
-
* @param repository - Where the sources live.
|
|
12
|
-
* @returns The address without its trailing slash, or `undefined` when it is
|
|
13
|
-
* not a GitHub repository and nothing inside it can be addressed.
|
|
14
|
-
*/
|
|
15
|
-
export function githubSources(repository) {
|
|
16
|
-
const sources = repository.endsWith('/')
|
|
17
|
-
? repository.slice(0, -1)
|
|
18
|
-
: repository;
|
|
19
|
-
return sources.startsWith(GITHUB) ? sources : undefined;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=repository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/about/core/repository.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0EAA0E;AAC1E,MAAM,MAAM,GAAG,qBAAqB,CAAC;AAErC;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,UAAkB;IAC9C,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;QACtC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACzB,CAAC,CAAC,UAAU,CAAC;IACf,OAAO,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1D,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A row of buttons with the name box among them, wrapping when the dialog is
|
|
3
|
-
* too narrow for them.
|
|
4
|
-
*/
|
|
5
|
-
export declare const exportButtonsStyle: {
|
|
6
|
-
readonly display: "flex";
|
|
7
|
-
readonly flexWrap: "wrap";
|
|
8
|
-
readonly alignItems: "center";
|
|
9
|
-
readonly gap: 6;
|
|
10
|
-
};
|
|
11
|
-
/** One group of an export dialog: what it offers, in a column. */
|
|
12
|
-
export declare const exportSectionStyle: {
|
|
13
|
-
readonly display: "flex";
|
|
14
|
-
readonly flexDirection: "column";
|
|
15
|
-
readonly gap: 8;
|
|
16
|
-
};
|
|
17
|
-
/** Text that says something about a control rather than being one. */
|
|
18
|
-
export declare const exportNoteStyle: {
|
|
19
|
-
readonly fontSize: 12;
|
|
20
|
-
readonly opacity: 0.7;
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=exportStyles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exportStyles.d.ts","sourceRoot":"","sources":["../../../src/download/core/exportStyles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAC;AAEX,kEAAkE;AAClE,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC;AAEX,sEAAsE;AACtE,eAAO,MAAM,eAAe;;;CAA0C,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A row of buttons with the name box among them, wrapping when the dialog is
|
|
3
|
-
* too narrow for them.
|
|
4
|
-
*/
|
|
5
|
-
export const exportButtonsStyle = {
|
|
6
|
-
display: 'flex',
|
|
7
|
-
flexWrap: 'wrap',
|
|
8
|
-
alignItems: 'center',
|
|
9
|
-
gap: 6,
|
|
10
|
-
};
|
|
11
|
-
/** One group of an export dialog: what it offers, in a column. */
|
|
12
|
-
export const exportSectionStyle = {
|
|
13
|
-
display: 'flex',
|
|
14
|
-
flexDirection: 'column',
|
|
15
|
-
gap: 8,
|
|
16
|
-
};
|
|
17
|
-
/** Text that says something about a control rather than being one. */
|
|
18
|
-
export const exportNoteStyle = { fontSize: 12, opacity: 0.7 };
|
|
19
|
-
//# sourceMappingURL=exportStyles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exportStyles.js","sourceRoot":"","sources":["../../../src/download/core/exportStyles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,QAAQ;IACpB,GAAG,EAAE,CAAC;CACE,CAAC;AAEX,kEAAkE;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;IACvB,GAAG,EAAE,CAAC;CACE,CAAC;AAEX,sEAAsE;AACtE,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAW,CAAC"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/** How big a picture is written out, as a multiple of the size it is drawn at. */
|
|
2
|
-
export interface ImageResolution {
|
|
3
|
-
/** Identifies the resolution in a picker. */
|
|
4
|
-
id: string;
|
|
5
|
-
/** What the option reads. */
|
|
6
|
-
label: string;
|
|
7
|
-
/** How many pixels each drawing unit becomes. */
|
|
8
|
-
scale: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* The sizes a picture leaves the editor at.
|
|
12
|
-
*
|
|
13
|
-
* A drawing unit is about a screen pixel, so the multipliers read as what the
|
|
14
|
-
* picture is for rather than as numbers: what is on screen, the same again on a
|
|
15
|
-
* retina display, and the two steps up a figure needs to survive being printed
|
|
16
|
-
* or thrown on a wall.
|
|
17
|
-
*/
|
|
18
|
-
export declare const IMAGE_RESOLUTIONS: readonly [{
|
|
19
|
-
readonly id: "screen";
|
|
20
|
-
readonly label: "Screen (1×)";
|
|
21
|
-
readonly scale: 1;
|
|
22
|
-
}, {
|
|
23
|
-
readonly id: "retina";
|
|
24
|
-
readonly label: "Retina (2×)";
|
|
25
|
-
readonly scale: 2;
|
|
26
|
-
}, {
|
|
27
|
-
readonly id: "print";
|
|
28
|
-
readonly label: "Print (4×)";
|
|
29
|
-
readonly scale: 4;
|
|
30
|
-
}, {
|
|
31
|
-
readonly id: "poster";
|
|
32
|
-
readonly label: "Poster (8×)";
|
|
33
|
-
readonly scale: 8;
|
|
34
|
-
}];
|
|
35
|
-
/** One of the resolutions offered. */
|
|
36
|
-
export type ImageResolutionId = (typeof IMAGE_RESOLUTIONS)[number]['id'];
|
|
37
|
-
/**
|
|
38
|
-
* The resolution a picture is written out at unless another is picked: what is
|
|
39
|
-
* on screen, doubled, which is what a picture pasted into a document wants.
|
|
40
|
-
*/
|
|
41
|
-
export declare const DEFAULT_IMAGE_RESOLUTION: {
|
|
42
|
-
readonly id: "retina";
|
|
43
|
-
readonly label: "Retina (2×)";
|
|
44
|
-
readonly scale: 2;
|
|
45
|
-
};
|
|
46
|
-
/** How big a picture comes out, in pixels. */
|
|
47
|
-
export interface ImageSize {
|
|
48
|
-
/** Width of the picture, in pixels. */
|
|
49
|
-
width: number;
|
|
50
|
-
/** Height of the picture, in pixels. */
|
|
51
|
-
height: number;
|
|
52
|
-
/**
|
|
53
|
-
* What each drawing unit was actually worth. Below the resolution that was
|
|
54
|
-
* asked for when it would have made a picture too big to rasterize.
|
|
55
|
-
*/
|
|
56
|
-
scale: number;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* How big a rectangle of the drawing comes out at a given resolution.
|
|
60
|
-
*
|
|
61
|
-
* The resolution is a wish rather than an instruction: a wide glycan asked for
|
|
62
|
-
* at 8× would run past what a browser can rasterize and come back blank, so the
|
|
63
|
-
* scale is brought down until the picture fits instead. The scale it settled on
|
|
64
|
-
* comes back with the size, so what will actually be written can be shown
|
|
65
|
-
* before it is.
|
|
66
|
-
* @param box - The rectangle being written out.
|
|
67
|
-
* @param box.width - How wide it is, in drawing units.
|
|
68
|
-
* @param box.height - How tall it is, in drawing units.
|
|
69
|
-
* @param scale - How many pixels each drawing unit should become.
|
|
70
|
-
* @returns The size, and the scale it was reached at.
|
|
71
|
-
*/
|
|
72
|
-
export declare function imageSize(box: {
|
|
73
|
-
width: number;
|
|
74
|
-
height: number;
|
|
75
|
-
}, scale: number): ImageSize;
|
|
76
|
-
/**
|
|
77
|
-
* The resolution an identifier stands for.
|
|
78
|
-
* @param id - What was picked.
|
|
79
|
-
* @returns The resolution, falling back to the default one.
|
|
80
|
-
*/
|
|
81
|
-
export declare function imageResolution(id: string): ImageResolution;
|
|
82
|
-
/**
|
|
83
|
-
* A size, written the way it is shown next to the resolution it comes from.
|
|
84
|
-
* @param size - The size to write, `null` when nothing is drawn.
|
|
85
|
-
* @returns The text, e.g. `1440 × 620 px`.
|
|
86
|
-
*/
|
|
87
|
-
export declare function formatImageSize(size: ImageSize | null): string;
|
|
88
|
-
//# sourceMappingURL=imageResolution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"imageResolution.d.ts","sourceRoot":"","sources":["../../../src/download/core/imageResolution.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,WAAW,eAAe;IAC9B,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;EAKiB,CAAC;AAEhD,sCAAsC;AACtC,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;CAAuB,CAAC;AAa7D,8CAA8C;AAC9C,MAAM,WAAW,SAAS;IACxB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACtC,KAAK,EAAE,MAAM,GACZ,SAAS,CAoBX;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,CAK3D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAG9D"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The sizes a picture leaves the editor at.
|
|
3
|
-
*
|
|
4
|
-
* A drawing unit is about a screen pixel, so the multipliers read as what the
|
|
5
|
-
* picture is for rather than as numbers: what is on screen, the same again on a
|
|
6
|
-
* retina display, and the two steps up a figure needs to survive being printed
|
|
7
|
-
* or thrown on a wall.
|
|
8
|
-
*/
|
|
9
|
-
export const IMAGE_RESOLUTIONS = [
|
|
10
|
-
{ id: 'screen', label: 'Screen (1×)', scale: 1 },
|
|
11
|
-
{ id: 'retina', label: 'Retina (2×)', scale: 2 },
|
|
12
|
-
{ id: 'print', label: 'Print (4×)', scale: 4 },
|
|
13
|
-
{ id: 'poster', label: 'Poster (8×)', scale: 8 },
|
|
14
|
-
];
|
|
15
|
-
/**
|
|
16
|
-
* The resolution a picture is written out at unless another is picked: what is
|
|
17
|
-
* on screen, doubled, which is what a picture pasted into a document wants.
|
|
18
|
-
*/
|
|
19
|
-
export const DEFAULT_IMAGE_RESOLUTION = IMAGE_RESOLUTIONS[1];
|
|
20
|
-
/**
|
|
21
|
-
* Longest side a browser rasterizes reliably.
|
|
22
|
-
*
|
|
23
|
-
* Above roughly this, Safari and Chrome quietly hand back an empty canvas
|
|
24
|
-
* instead of refusing, so the picture would be saved blank.
|
|
25
|
-
*/
|
|
26
|
-
const MAXIMUM_SIDE = 8192;
|
|
27
|
-
/** Most pixels a rasterized picture is allowed to hold. */
|
|
28
|
-
const MAXIMUM_PIXELS = 32 * 1024 * 1024;
|
|
29
|
-
/**
|
|
30
|
-
* How big a rectangle of the drawing comes out at a given resolution.
|
|
31
|
-
*
|
|
32
|
-
* The resolution is a wish rather than an instruction: a wide glycan asked for
|
|
33
|
-
* at 8× would run past what a browser can rasterize and come back blank, so the
|
|
34
|
-
* scale is brought down until the picture fits instead. The scale it settled on
|
|
35
|
-
* comes back with the size, so what will actually be written can be shown
|
|
36
|
-
* before it is.
|
|
37
|
-
* @param box - The rectangle being written out.
|
|
38
|
-
* @param box.width - How wide it is, in drawing units.
|
|
39
|
-
* @param box.height - How tall it is, in drawing units.
|
|
40
|
-
* @param scale - How many pixels each drawing unit should become.
|
|
41
|
-
* @returns The size, and the scale it was reached at.
|
|
42
|
-
*/
|
|
43
|
-
export function imageSize(box, scale) {
|
|
44
|
-
const wanted = Number.isFinite(scale) && scale > 0 ? scale : 1;
|
|
45
|
-
const width = Math.max(box.width, 1);
|
|
46
|
-
const height = Math.max(box.height, 1);
|
|
47
|
-
const limit = Math.min(MAXIMUM_SIDE / width, MAXIMUM_SIDE / height, Math.sqrt(MAXIMUM_PIXELS / (width * height)));
|
|
48
|
-
const used = Math.min(wanted, limit);
|
|
49
|
-
// A picture held back by the limit is rounded down rather than to the nearest
|
|
50
|
-
// pixel, so rounding cannot put it back over what it was held to.
|
|
51
|
-
const toPixels = used < wanted ? Math.floor : Math.round;
|
|
52
|
-
return {
|
|
53
|
-
width: Math.max(1, toPixels(width * used)),
|
|
54
|
-
height: Math.max(1, toPixels(height * used)),
|
|
55
|
-
scale: used,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* The resolution an identifier stands for.
|
|
60
|
-
* @param id - What was picked.
|
|
61
|
-
* @returns The resolution, falling back to the default one.
|
|
62
|
-
*/
|
|
63
|
-
export function imageResolution(id) {
|
|
64
|
-
return (IMAGE_RESOLUTIONS.find((resolution) => resolution.id === id) ??
|
|
65
|
-
DEFAULT_IMAGE_RESOLUTION);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* A size, written the way it is shown next to the resolution it comes from.
|
|
69
|
-
* @param size - The size to write, `null` when nothing is drawn.
|
|
70
|
-
* @returns The text, e.g. `1440 × 620 px`.
|
|
71
|
-
*/
|
|
72
|
-
export function formatImageSize(size) {
|
|
73
|
-
if (!size)
|
|
74
|
-
return 'nothing to export';
|
|
75
|
-
return `${size.width} × ${size.height} px`;
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=imageResolution.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"imageResolution.js","sourceRoot":"","sources":["../../../src/download/core/imageResolution.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE;IAChD,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE;IAChD,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE;IAC9C,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE;CACH,CAAC;AAKhD;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B,2DAA2D;AAC3D,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAexC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS,CACvB,GAAsC,EACtC,KAAa;IAEb,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAEvC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CACpB,YAAY,GAAG,KAAK,EACpB,YAAY,GAAG,MAAM,EACrB,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAC7C,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACrC,8EAA8E;IAC9E,kEAAkE;IAClE,MAAM,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IAEzD,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QAC1C,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;QAC5C,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,EAAU;IACxC,OAAO,CACL,iBAAiB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC;QAC5D,wBAAwB,CACzB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAsB;IACpD,IAAI,CAAC,IAAI;QAAE,OAAO,mBAAmB,CAAC;IACtC,OAAO,GAAG,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,MAAM,KAAK,CAAC;AAC7C,CAAC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type { ImageSize } from './imageResolution.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Room left around a drawing in a written-out picture, in drawing units.
|
|
4
|
-
*
|
|
5
|
-
* Enough that a name written under the bottom of the drawing, and the stroke
|
|
6
|
-
* around its outermost mark, are inside the picture rather than against its
|
|
7
|
-
* edge.
|
|
8
|
-
*/
|
|
9
|
-
export declare const PICTURE_PADDING = 12;
|
|
10
|
-
/**
|
|
11
|
-
* What the picture is of: the drawing, or the element it is drawn in.
|
|
12
|
-
*
|
|
13
|
-
* `content` measures the drawing and ignores the canvas around it, which is
|
|
14
|
-
* what a drawing surface wants — it is mostly empty space, panned and zoomed to
|
|
15
|
-
* wherever it was last left, and none of that belongs in a file. `element`
|
|
16
|
-
* takes the element as it is laid out, which is what a chart wants: its axes
|
|
17
|
-
* are drawn to the box it was given, so the box *is* the picture and measuring
|
|
18
|
-
* the marks inside it would crop the frame to wherever the data happens to
|
|
19
|
-
* reach.
|
|
20
|
-
*/
|
|
21
|
-
export type PictureFrame = 'content' | 'element';
|
|
22
|
-
export interface PictureOptions {
|
|
23
|
-
/**
|
|
24
|
-
* How many pixels each drawing unit becomes.
|
|
25
|
-
* @default 2
|
|
26
|
-
*/
|
|
27
|
-
scale?: number;
|
|
28
|
-
/**
|
|
29
|
-
* The name saved files take, without their extension.
|
|
30
|
-
* @default 'picture'
|
|
31
|
-
*/
|
|
32
|
-
filename?: string;
|
|
33
|
-
/**
|
|
34
|
-
* What the picture is read out as, in place of the instructions the element
|
|
35
|
-
* carries for whoever is working it.
|
|
36
|
-
* @default 'Drawing'
|
|
37
|
-
*/
|
|
38
|
-
label?: string;
|
|
39
|
-
/**
|
|
40
|
-
* What the picture is of.
|
|
41
|
-
* @default 'content'
|
|
42
|
-
*/
|
|
43
|
-
frame?: PictureFrame;
|
|
44
|
-
/**
|
|
45
|
-
* Room left around the drawing, in drawing units. Ignored when the picture is
|
|
46
|
-
* the element, which is already the size it wants to be.
|
|
47
|
-
* @default PICTURE_PADDING
|
|
48
|
-
*/
|
|
49
|
-
padding?: number;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* How big the drawing comes out at a resolution, before it is written out.
|
|
53
|
-
*
|
|
54
|
-
* What is measured is what the picture will be of rather than whatever is on
|
|
55
|
-
* screen, so the answer does not change when the window is resized or the
|
|
56
|
-
* drawing panned — the size shown next to the resolution is the size of the
|
|
57
|
-
* file that is about to be written.
|
|
58
|
-
* @param svg - The element, as it is rendered.
|
|
59
|
-
* @param scale - How many pixels each drawing unit becomes.
|
|
60
|
-
* @param options - What the picture is of.
|
|
61
|
-
* @returns The size, or `null` when nothing is drawn.
|
|
62
|
-
*/
|
|
63
|
-
export declare function pictureSize(svg: SVGSVGElement | null, scale: number, options?: Pick<PictureOptions, 'frame' | 'padding'>): ImageSize | null;
|
|
64
|
-
/**
|
|
65
|
-
* Put the drawing on the clipboard as a PNG.
|
|
66
|
-
*
|
|
67
|
-
* The rasterization is handed to the clipboard as a promise rather than awaited
|
|
68
|
-
* first: Safari only allows a clipboard write the click itself started.
|
|
69
|
-
* @param svg - The element, as it is rendered.
|
|
70
|
-
* @param options - How big to make it.
|
|
71
|
-
* @returns Whether it was copied. `false` when nothing is drawn, and in a
|
|
72
|
-
* browser whose clipboard takes text only.
|
|
73
|
-
*/
|
|
74
|
-
export declare function copyPicture(svg: SVGSVGElement | null, options?: PictureOptions): Promise<boolean>;
|
|
75
|
-
/**
|
|
76
|
-
* Save the drawing as a PNG.
|
|
77
|
-
* @param svg - The element, as it is rendered.
|
|
78
|
-
* @param options - How big to make it, and what to call it.
|
|
79
|
-
* @returns Whether it was saved. `false` when nothing is drawn.
|
|
80
|
-
*/
|
|
81
|
-
export declare function savePngPicture(svg: SVGSVGElement | null, options?: PictureOptions): Promise<boolean>;
|
|
82
|
-
/**
|
|
83
|
-
* Save the drawing as an SVG.
|
|
84
|
-
*
|
|
85
|
-
* The resolution is carried into the file as the size it opens at, but the
|
|
86
|
-
* shapes stay shapes: an SVG printed at any size is drawn again rather than
|
|
87
|
-
* enlarged, which is the reason to prefer it wherever it can go.
|
|
88
|
-
* @param svg - The element, as it is rendered.
|
|
89
|
-
* @param options - How big to make it, and what to call it.
|
|
90
|
-
* @returns Whether it was saved. `false` when nothing is drawn.
|
|
91
|
-
*/
|
|
92
|
-
export declare function saveSvgPicture(svg: SVGSVGElement | null, options?: PictureOptions): boolean;
|
|
93
|
-
//# sourceMappingURL=pictureExport.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pictureExport.d.ts","sourceRoot":"","sources":["../../../src/download/core/pictureExport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAOtD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;AAEjD,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,aAAa,GAAG,IAAI,EACzB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,SAAS,CAAM,GACtD,SAAS,GAAG,IAAI,CAGlB;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,aAAa,GAAG,IAAI,EACzB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,OAAO,CAAC,CAIlB;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,aAAa,GAAG,IAAI,EACzB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,aAAa,GAAG,IAAI,EACzB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAST"}
|