react-cheminfo 0.128.0 → 0.130.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 +79 -43
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/locales/de.json +9 -0
- package/lib/locales/en.json +9 -0
- package/lib/locales/es.json +9 -0
- package/lib/locales/fr.json +9 -0
- package/lib/locales/it.json +9 -0
- package/lib/mass/ui/MassChart.d.ts.map +1 -1
- package/lib/mass/ui/MassChart.js +4 -2
- package/lib/mass/ui/MassChart.js.map +1 -1
- package/lib/mass/ui/PeakLabels.d.ts +9 -3
- package/lib/mass/ui/PeakLabels.d.ts.map +1 -1
- package/lib/mass/ui/PeakLabels.js +38 -15
- package/lib/mass/ui/PeakLabels.js.map +1 -1
- package/lib/mass/ui/massChartProps.d.ts +8 -0
- package/lib/mass/ui/massChartProps.d.ts.map +1 -1
- package/lib/share/core/exampleMark.d.ts +31 -0
- package/lib/share/core/exampleMark.d.ts.map +1 -0
- package/lib/share/core/exampleMark.js +31 -0
- package/lib/share/core/exampleMark.js.map +1 -0
- package/lib/share/core/index.d.ts +5 -0
- package/lib/share/core/index.d.ts.map +1 -1
- package/lib/share/core/index.js +3 -0
- package/lib/share/core/index.js.map +1 -1
- package/lib/share/core/linkBytes.d.ts +29 -0
- package/lib/share/core/linkBytes.d.ts.map +1 -0
- package/lib/share/core/linkBytes.js +70 -0
- package/lib/share/core/linkBytes.js.map +1 -0
- package/lib/share/core/linkValue.d.ts +34 -0
- package/lib/share/core/linkValue.d.ts.map +1 -0
- package/lib/share/core/linkValue.js +58 -0
- package/lib/share/core/linkValue.js.map +1 -0
- package/lib/share/core/opensOn.d.ts +133 -0
- package/lib/share/core/opensOn.d.ts.map +1 -0
- package/lib/share/core/opensOn.js +82 -0
- package/lib/share/core/opensOn.js.map +1 -0
- package/lib/share/core/seal.d.ts.map +1 -1
- package/lib/share/core/seal.js +3 -32
- package/lib/share/core/seal.js.map +1 -1
- package/lib/share/ui/ShareOpensOn.d.ts +32 -0
- package/lib/share/ui/ShareOpensOn.d.ts.map +1 -0
- package/lib/share/ui/ShareOpensOn.js +49 -0
- package/lib/share/ui/ShareOpensOn.js.map +1 -0
- package/lib/share/ui/index.d.ts +4 -0
- package/lib/share/ui/index.d.ts.map +1 -1
- package/lib/share/ui/index.js +2 -0
- package/lib/share/ui/index.js.map +1 -1
- package/lib/share/ui/useOpensOnShare.d.ts +65 -0
- package/lib/share/ui/useOpensOnShare.d.ts.map +1 -0
- package/lib/share/ui/useOpensOnShare.js +60 -0
- package/lib/share/ui/useOpensOnShare.js.map +1 -0
- package/package.json +1 -1
- package/src/locales/de.json +9 -0
- package/src/locales/en.json +9 -0
- package/src/locales/es.json +9 -0
- package/src/locales/fr.json +9 -0
- package/src/locales/it.json +9 -0
- package/src/mass/ui/MassChart.tsx +4 -0
- package/src/mass/ui/PeakLabels.tsx +50 -18
- package/src/mass/ui/massChartProps.ts +8 -0
- package/src/share/core/exampleMark.ts +52 -0
- package/src/share/core/index.ts +25 -0
- package/src/share/core/linkBytes.ts +75 -0
- package/src/share/core/linkValue.ts +66 -0
- package/src/share/core/opensOn.ts +203 -0
- package/src/share/core/seal.ts +3 -36
- package/src/share/ui/ShareOpensOn.tsx +169 -0
- package/src/share/ui/index.ts +7 -0
- package/src/share/ui/useOpensOnShare.tsx +152 -0
- package/styles/chrome.css +18 -0
package/src/share/core/seal.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EMBED_PARAM } from './config.ts';
|
|
2
|
+
import { fromBase64Url, pipeBytes, toBase64Url } from './linkBytes.ts';
|
|
2
3
|
import { firstValues, parseQuery, serializeQuery } from './query.ts';
|
|
3
4
|
|
|
4
5
|
/** The query parameter a sealed link carries, and the only one it carries. */
|
|
@@ -44,7 +45,7 @@ const keys = new Map<string, Promise<SealKeys>>();
|
|
|
44
45
|
*/
|
|
45
46
|
export async function sealQuery(query: string): Promise<string> {
|
|
46
47
|
const plain = new TextEncoder().encode(query);
|
|
47
|
-
const packed = await
|
|
48
|
+
const packed = await pipeBytes(plain, new CompressionStream('deflate-raw'));
|
|
48
49
|
const compressed = packed.length < plain.length;
|
|
49
50
|
const body = compressed ? packed : plain;
|
|
50
51
|
const message = new Uint8Array(1 + body.length);
|
|
@@ -93,7 +94,7 @@ export async function unsealQuery(token: string): Promise<UnsealResult> {
|
|
|
93
94
|
try {
|
|
94
95
|
const plain =
|
|
95
96
|
flags === COMPRESSED
|
|
96
|
-
? await
|
|
97
|
+
? await pipeBytes(body, new DecompressionStream('deflate-raw'))
|
|
97
98
|
: body;
|
|
98
99
|
const query = new TextDecoder('utf-8', { fatal: true }).decode(plain);
|
|
99
100
|
return { ok: true, query };
|
|
@@ -197,37 +198,3 @@ function sameBytes(left: Uint8Array, right: Uint8Array): boolean {
|
|
|
197
198
|
}
|
|
198
199
|
return difference === 0;
|
|
199
200
|
}
|
|
200
|
-
|
|
201
|
-
async function transform(
|
|
202
|
-
bytes: Uint8Array<ArrayBuffer>,
|
|
203
|
-
stream: CompressionStream | DecompressionStream,
|
|
204
|
-
): Promise<Uint8Array<ArrayBuffer>> {
|
|
205
|
-
const source = new ReadableStream<Uint8Array<ArrayBuffer>>({
|
|
206
|
-
start(controller) {
|
|
207
|
-
controller.enqueue(bytes);
|
|
208
|
-
controller.close();
|
|
209
|
-
},
|
|
210
|
-
});
|
|
211
|
-
const output = await new Response(source.pipeThrough(stream)).arrayBuffer();
|
|
212
|
-
return new Uint8Array(output);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function toBase64Url(bytes: Uint8Array): string {
|
|
216
|
-
let binary = '';
|
|
217
|
-
for (const byte of bytes) binary += String.fromCodePoint(byte);
|
|
218
|
-
return btoa(binary)
|
|
219
|
-
.replaceAll('+', '-')
|
|
220
|
-
.replaceAll('/', '_')
|
|
221
|
-
.replace(/[=]+$/, '');
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
function fromBase64Url(text: string): Uint8Array<ArrayBuffer> | null {
|
|
225
|
-
if (!/^[\w-]*$/.test(text) || text.length % 4 === 1) return null;
|
|
226
|
-
const base64 = text.replaceAll('-', '+').replaceAll('_', '/');
|
|
227
|
-
const binary = atob(base64.padEnd(Math.ceil(base64.length / 4) * 4, '='));
|
|
228
|
-
const bytes = new Uint8Array(binary.length);
|
|
229
|
-
for (let index = 0; index < binary.length; index++) {
|
|
230
|
-
bytes[index] = binary.codePointAt(index) ?? 0;
|
|
231
|
-
}
|
|
232
|
-
return bytes;
|
|
233
|
-
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { H6, HTMLSelect, Radio } from '@blueprintjs/core';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { useId } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useChromeT } from '../../i18n/ui/useT.ts';
|
|
6
|
+
import type {
|
|
7
|
+
OpensOnChoice,
|
|
8
|
+
OpensOnLinks,
|
|
9
|
+
OpensOnTarget,
|
|
10
|
+
ShareExample,
|
|
11
|
+
} from '../core/opensOn.ts';
|
|
12
|
+
|
|
13
|
+
/** Props of {@link ShareOpensOn}. */
|
|
14
|
+
export interface ShareOpensOnProps {
|
|
15
|
+
/** What the dialog can hand out for the page on screen. */
|
|
16
|
+
links: OpensOnLinks;
|
|
17
|
+
/** What the link opens on. */
|
|
18
|
+
choice: OpensOnChoice;
|
|
19
|
+
/** Called with the choice the reader makes. */
|
|
20
|
+
onChange: (choice: OpensOnChoice) => void;
|
|
21
|
+
/** The examples a link can open on, in the order they are listed. */
|
|
22
|
+
examples: readonly ShareExample[];
|
|
23
|
+
/**
|
|
24
|
+
* What the site calls what is on screen: "This circuit", "This drawing".
|
|
25
|
+
* @default the chrome's own words
|
|
26
|
+
*/
|
|
27
|
+
screenLabel?: string;
|
|
28
|
+
/**
|
|
29
|
+
* What a site adds under the choice: the style a link sets, say.
|
|
30
|
+
* @default undefined — nothing
|
|
31
|
+
*/
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The section of the Share dialog saying what the link opens on: what is on
|
|
37
|
+
* screen, when a link can carry it; any of the examples, whatever is on
|
|
38
|
+
* screen; or the page alone.
|
|
39
|
+
* @param props - See {@link ShareOpensOnProps}.
|
|
40
|
+
* @returns The section's content.
|
|
41
|
+
*/
|
|
42
|
+
export function ShareOpensOn(props: ShareOpensOnProps): ReactElement {
|
|
43
|
+
const { links, choice, onChange, examples, screenLabel, children } = props;
|
|
44
|
+
const t = useChromeT();
|
|
45
|
+
const group = useId();
|
|
46
|
+
const select = (opensOn: OpensOnTarget) => () => {
|
|
47
|
+
onChange({ ...choice, opensOn });
|
|
48
|
+
};
|
|
49
|
+
const tooLarge = links.screen === 'too-large';
|
|
50
|
+
const shown = examples.find((example) => example.id === choice.example);
|
|
51
|
+
const changed = links.changed && choice.example === links.example;
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
role="radiogroup"
|
|
55
|
+
aria-label={t('share.opensOn')}
|
|
56
|
+
className="share-opens-on"
|
|
57
|
+
>
|
|
58
|
+
<H6>{t('share.opensOn')}</H6>
|
|
59
|
+
{links.screen === undefined ? null : (
|
|
60
|
+
<Radio
|
|
61
|
+
name={group}
|
|
62
|
+
value="screen"
|
|
63
|
+
checked={choice.opensOn === 'screen'}
|
|
64
|
+
disabled={tooLarge}
|
|
65
|
+
onChange={select('screen')}
|
|
66
|
+
labelElement={
|
|
67
|
+
<Option
|
|
68
|
+
title={screenLabel ?? t('share.opensOnScreen')}
|
|
69
|
+
note={
|
|
70
|
+
tooLarge
|
|
71
|
+
? t('share.opensOnTooLarge')
|
|
72
|
+
: t('share.opensOnScreenNote')
|
|
73
|
+
}
|
|
74
|
+
/>
|
|
75
|
+
}
|
|
76
|
+
/>
|
|
77
|
+
)}
|
|
78
|
+
{examples.length === 0 ? null : (
|
|
79
|
+
<>
|
|
80
|
+
<Radio
|
|
81
|
+
name={group}
|
|
82
|
+
value="example"
|
|
83
|
+
checked={choice.opensOn === 'example'}
|
|
84
|
+
onChange={select('example')}
|
|
85
|
+
label={t('share.opensOnExample')}
|
|
86
|
+
/>
|
|
87
|
+
<div className="share-opens-on__under">
|
|
88
|
+
<HTMLSelect
|
|
89
|
+
fill
|
|
90
|
+
aria-label={t('share.opensOnExampleLabel')}
|
|
91
|
+
value={choice.example}
|
|
92
|
+
onChange={(event) => {
|
|
93
|
+
onChange({ opensOn: 'example', example: event.target.value });
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<ExampleOptions examples={examples} />
|
|
97
|
+
</HTMLSelect>
|
|
98
|
+
{shown?.description ? (
|
|
99
|
+
<span className="share-opens-on__note">{shown.description}</span>
|
|
100
|
+
) : null}
|
|
101
|
+
{changed ? (
|
|
102
|
+
<span className="share-opens-on__note">
|
|
103
|
+
{t('share.opensOnChanged')}
|
|
104
|
+
</span>
|
|
105
|
+
) : null}
|
|
106
|
+
</div>
|
|
107
|
+
</>
|
|
108
|
+
)}
|
|
109
|
+
<Radio
|
|
110
|
+
name={group}
|
|
111
|
+
value="none"
|
|
112
|
+
checked={choice.opensOn === 'none'}
|
|
113
|
+
onChange={select('none')}
|
|
114
|
+
labelElement={
|
|
115
|
+
<Option
|
|
116
|
+
title={t('share.opensOnNone')}
|
|
117
|
+
note={t('share.opensOnNoneNote')}
|
|
118
|
+
/>
|
|
119
|
+
}
|
|
120
|
+
/>
|
|
121
|
+
{children}
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// The title in a span of its own, so it is what a click on the words finds.
|
|
127
|
+
function Option(props: { title: string; note: string }): ReactElement {
|
|
128
|
+
return (
|
|
129
|
+
<>
|
|
130
|
+
<span className="share-opens-on__title">{props.title}</span>
|
|
131
|
+
<span className="share-opens-on__note">{props.note}</span>
|
|
132
|
+
</>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Listed under their groups when they have any, in the order they come.
|
|
137
|
+
function ExampleOptions(props: {
|
|
138
|
+
examples: readonly ShareExample[];
|
|
139
|
+
}): ReactElement {
|
|
140
|
+
const groups = new Map<string, ShareExample[]>();
|
|
141
|
+
const loose: ShareExample[] = [];
|
|
142
|
+
for (const example of props.examples) {
|
|
143
|
+
if (example.group === undefined) {
|
|
144
|
+
loose.push(example);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const group = groups.get(example.group);
|
|
148
|
+
if (group) group.push(example);
|
|
149
|
+
else groups.set(example.group, [example]);
|
|
150
|
+
}
|
|
151
|
+
return (
|
|
152
|
+
<>
|
|
153
|
+
{loose.map((example) => (
|
|
154
|
+
<option key={example.id} value={example.id}>
|
|
155
|
+
{example.name}
|
|
156
|
+
</option>
|
|
157
|
+
))}
|
|
158
|
+
{[...groups].map(([label, members]) => (
|
|
159
|
+
<optgroup key={label} label={label}>
|
|
160
|
+
{members.map((example) => (
|
|
161
|
+
<option key={example.id} value={example.id}>
|
|
162
|
+
{example.name}
|
|
163
|
+
</option>
|
|
164
|
+
))}
|
|
165
|
+
</optgroup>
|
|
166
|
+
))}
|
|
167
|
+
</>
|
|
168
|
+
);
|
|
169
|
+
}
|
package/src/share/ui/index.ts
CHANGED
|
@@ -9,6 +9,13 @@ export type { ShareButtonProps, ShareButtonVariant } from './ShareButton.tsx';
|
|
|
9
9
|
export { ShareButton } from './ShareButton.tsx';
|
|
10
10
|
export type { ShareDialogProps } from './ShareDialog.tsx';
|
|
11
11
|
export type { SharePartDescriptions } from './SharePartRow.tsx';
|
|
12
|
+
export type { ShareOpensOnProps } from './ShareOpensOn.tsx';
|
|
13
|
+
export { ShareOpensOn } from './ShareOpensOn.tsx';
|
|
12
14
|
export type { ShareQrCodeProps } from './ShareQrCode.tsx';
|
|
13
15
|
export { ShareQrCode } from './ShareQrCode.tsx';
|
|
14
16
|
export { ShareDialog } from './ShareDialog.tsx';
|
|
17
|
+
export type {
|
|
18
|
+
OpensOnShareOptions,
|
|
19
|
+
OpensOnShareProps,
|
|
20
|
+
} from './useOpensOnShare.tsx';
|
|
21
|
+
export { useOpensOnShare } from './useOpensOnShare.tsx';
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
OpensOnChoice,
|
|
6
|
+
OpensOnLinks,
|
|
7
|
+
ShareAddress,
|
|
8
|
+
ShareExample,
|
|
9
|
+
ShareOnScreen,
|
|
10
|
+
} from '../core/opensOn.ts';
|
|
11
|
+
import {
|
|
12
|
+
EXAMPLE_PARAM,
|
|
13
|
+
defaultOpensOn,
|
|
14
|
+
opensOnAddress,
|
|
15
|
+
opensOnLinks,
|
|
16
|
+
} from '../core/opensOn.ts';
|
|
17
|
+
|
|
18
|
+
import { ShareOpensOn } from './ShareOpensOn.tsx';
|
|
19
|
+
|
|
20
|
+
/** What {@link useOpensOnShare} is told of the page. */
|
|
21
|
+
export interface OpensOnShareOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Whether the page holding the document is the page on show. Any other page
|
|
24
|
+
* hands out its own address.
|
|
25
|
+
*/
|
|
26
|
+
active: boolean;
|
|
27
|
+
/** The examples a link can open on, in the order the folder lists them. */
|
|
28
|
+
examples: readonly ShareExample[];
|
|
29
|
+
/**
|
|
30
|
+
* What is on screen, read as the dialog opens. A promise when writing it
|
|
31
|
+
* into a link takes a moment: the dialog then opens once it is written.
|
|
32
|
+
*/
|
|
33
|
+
onScreen: () => ShareOnScreen | Promise<ShareOnScreen>;
|
|
34
|
+
/**
|
|
35
|
+
* The parameters naming what a page opens on, besides `example`, which a
|
|
36
|
+
* link replaces: the one carrying a document, say.
|
|
37
|
+
* @default [] — `example` alone
|
|
38
|
+
*/
|
|
39
|
+
openedOn?: readonly string[];
|
|
40
|
+
/**
|
|
41
|
+
* The link to an example.
|
|
42
|
+
* @default `?example=<id>` on the page on screen
|
|
43
|
+
*/
|
|
44
|
+
exampleAddress?: (id: string) => ShareAddress;
|
|
45
|
+
/**
|
|
46
|
+
* The link to the page alone.
|
|
47
|
+
* @default the page on screen, with nothing added
|
|
48
|
+
*/
|
|
49
|
+
aloneAddress?: ShareAddress;
|
|
50
|
+
/**
|
|
51
|
+
* What the site calls what is on screen: "This circuit", "This drawing".
|
|
52
|
+
* @default the chrome's own words
|
|
53
|
+
*/
|
|
54
|
+
screenLabel?: string;
|
|
55
|
+
/**
|
|
56
|
+
* What a site adds under the choice: the style a link sets, say.
|
|
57
|
+
* @default undefined — nothing
|
|
58
|
+
*/
|
|
59
|
+
children?: ReactNode;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** What the header's Share control is told, beyond what every page shares. */
|
|
63
|
+
export interface OpensOnShareProps {
|
|
64
|
+
/** Whether the dialog is open. */
|
|
65
|
+
open: boolean;
|
|
66
|
+
/** Called when the dialog opens or closes. */
|
|
67
|
+
onOpenChange: (open: boolean) => void;
|
|
68
|
+
/** The query string the link is built from. */
|
|
69
|
+
search: string | undefined;
|
|
70
|
+
/** The page the link opens, when it is not the page on screen. */
|
|
71
|
+
baseUrl: string | undefined;
|
|
72
|
+
/** The section saying what the link opens on. */
|
|
73
|
+
children: ReactNode;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The Share dialog of a page holding a document says what the link opens on:
|
|
78
|
+
* what is on screen, any of the examples the site comes with, or the page
|
|
79
|
+
* alone. Spread it into the header's `share` prop.
|
|
80
|
+
* @param options - See {@link OpensOnShareOptions}.
|
|
81
|
+
* @returns What the header's Share control is told.
|
|
82
|
+
*/
|
|
83
|
+
export function useOpensOnShare(
|
|
84
|
+
options: OpensOnShareOptions,
|
|
85
|
+
): OpensOnShareProps {
|
|
86
|
+
const {
|
|
87
|
+
active,
|
|
88
|
+
examples,
|
|
89
|
+
onScreen,
|
|
90
|
+
exampleAddress,
|
|
91
|
+
aloneAddress,
|
|
92
|
+
screenLabel,
|
|
93
|
+
children,
|
|
94
|
+
} = options;
|
|
95
|
+
const openedOn = [EXAMPLE_PARAM, ...(options.openedOn ?? [])];
|
|
96
|
+
const [shared, setShared] = useState<OpensOnLinks | string | null>(null);
|
|
97
|
+
const [choice, setChoice] = useState<OpensOnChoice | null>(null);
|
|
98
|
+
// A dialog closed before what is on screen was written stays closed.
|
|
99
|
+
const asked = useRef(0);
|
|
100
|
+
|
|
101
|
+
function onOpenChange(open: boolean): void {
|
|
102
|
+
const request = ++asked.current;
|
|
103
|
+
if (!open) {
|
|
104
|
+
setShared(null);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const { search } = globalThis.location;
|
|
108
|
+
if (!active) {
|
|
109
|
+
setShared(search);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const show = (screen: ShareOnScreen) => {
|
|
113
|
+
if (request !== asked.current) return;
|
|
114
|
+
const links = opensOnLinks(search, openedOn, screen);
|
|
115
|
+
setChoice(defaultOpensOn(links, examples));
|
|
116
|
+
setShared(links);
|
|
117
|
+
};
|
|
118
|
+
const read = onScreen();
|
|
119
|
+
if (read instanceof Promise) void read.then(show);
|
|
120
|
+
else show(read);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const links = typeof shared === 'string' ? null : shared;
|
|
124
|
+
const address =
|
|
125
|
+
links === null || choice === null
|
|
126
|
+
? undefined
|
|
127
|
+
: opensOnAddress(links, choice, {
|
|
128
|
+
example: exampleAddress,
|
|
129
|
+
alone: aloneAddress,
|
|
130
|
+
});
|
|
131
|
+
return {
|
|
132
|
+
open: shared !== null,
|
|
133
|
+
onOpenChange,
|
|
134
|
+
search: typeof shared === 'string' ? shared : address?.search,
|
|
135
|
+
baseUrl:
|
|
136
|
+
address?.path === undefined
|
|
137
|
+
? undefined
|
|
138
|
+
: new URL(address.path, globalThis.location.href).href,
|
|
139
|
+
children:
|
|
140
|
+
links === null || choice === null ? undefined : (
|
|
141
|
+
<ShareOpensOn
|
|
142
|
+
links={links}
|
|
143
|
+
choice={choice}
|
|
144
|
+
onChange={setChoice}
|
|
145
|
+
examples={examples}
|
|
146
|
+
screenLabel={screenLabel}
|
|
147
|
+
>
|
|
148
|
+
{children}
|
|
149
|
+
</ShareOpensOn>
|
|
150
|
+
),
|
|
151
|
+
};
|
|
152
|
+
}
|
package/styles/chrome.css
CHANGED
|
@@ -796,6 +796,24 @@ a.source-badge:hover {
|
|
|
796
796
|
line-height: 1.45;
|
|
797
797
|
}
|
|
798
798
|
|
|
799
|
+
/* What a link opens on: one choice to a line, what it hands out under its
|
|
800
|
+
label, and the example picker under the radio it belongs to. */
|
|
801
|
+
.share-opens-on .bp6-control.bp6-radio {
|
|
802
|
+
margin-bottom: 6px;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
.share-opens-on__note {
|
|
806
|
+
display: block;
|
|
807
|
+
margin-top: 2px;
|
|
808
|
+
color: var(--text-muted);
|
|
809
|
+
font-size: 12px;
|
|
810
|
+
line-height: 1.45;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
.share-opens-on__under {
|
|
814
|
+
margin: -2px 0 10px 26px;
|
|
815
|
+
}
|
|
816
|
+
|
|
799
817
|
/* The live page, laid out at the screen picked and scaled into the pane. */
|
|
800
818
|
.share-preview {
|
|
801
819
|
display: flex;
|