@cratis/showrunner.playbill.react 2.20.0 → 2.21.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/Dialog/PlaybillDialog.tsx +5 -2
- package/Dialog/PlaybillHistoryDialog.tsx +47 -0
- package/Dialog/index.ts +1 -0
- package/Markdown/index.ts +1 -0
- package/Markdown/linkIssueReferences.ts +25 -0
- package/Playbill.tsx +5 -1
- package/README.md +2 -1
- package/Release/ReleaseNoteView.tsx +7 -3
- package/Release/index.ts +1 -0
- package/Release/issueRepositoryFor.ts +17 -0
- package/dist/cjs/Dialog/PlaybillDialog.d.ts +3 -2
- package/dist/cjs/Dialog/PlaybillDialog.d.ts.map +1 -1
- package/dist/cjs/Dialog/PlaybillDialog.js +3 -1
- package/dist/cjs/Dialog/PlaybillDialog.js.map +1 -1
- package/dist/cjs/Dialog/PlaybillHistoryDialog.d.ts +7 -0
- package/dist/cjs/Dialog/PlaybillHistoryDialog.d.ts.map +1 -0
- package/dist/cjs/Dialog/PlaybillHistoryDialog.js +41 -0
- package/dist/cjs/Dialog/PlaybillHistoryDialog.js.map +1 -0
- package/dist/cjs/Dialog/index.d.ts +1 -0
- package/dist/cjs/Dialog/index.d.ts.map +1 -1
- package/dist/cjs/Examples/HistoryDialog.d.ts +2 -0
- package/dist/cjs/Examples/HistoryDialog.d.ts.map +1 -0
- package/dist/cjs/Markdown/index.d.ts +1 -0
- package/dist/cjs/Markdown/index.d.ts.map +1 -1
- package/dist/cjs/Markdown/linkIssueReferences.d.ts +2 -0
- package/dist/cjs/Markdown/linkIssueReferences.d.ts.map +1 -0
- package/dist/cjs/Markdown/linkIssueReferences.js +22 -0
- package/dist/cjs/Markdown/linkIssueReferences.js.map +1 -0
- package/dist/cjs/Playbill.d.ts +3 -2
- package/dist/cjs/Playbill.d.ts.map +1 -1
- package/dist/cjs/Playbill.js +3 -1
- package/dist/cjs/Playbill.js.map +1 -1
- package/dist/cjs/Release/ReleaseNoteView.d.ts +2 -1
- package/dist/cjs/Release/ReleaseNoteView.d.ts.map +1 -1
- package/dist/cjs/Release/ReleaseNoteView.js +5 -3
- package/dist/cjs/Release/ReleaseNoteView.js.map +1 -1
- package/dist/cjs/Release/index.d.ts +1 -0
- package/dist/cjs/Release/index.d.ts.map +1 -1
- package/dist/cjs/Release/issueRepositoryFor.d.ts +3 -0
- package/dist/cjs/Release/issueRepositoryFor.d.ts.map +1 -0
- package/dist/cjs/Release/issueRepositoryFor.js +16 -0
- package/dist/cjs/Release/issueRepositoryFor.js.map +1 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/Dialog/PlaybillDialog.d.ts +3 -2
- package/dist/esm/Dialog/PlaybillDialog.d.ts.map +1 -1
- package/dist/esm/Dialog/PlaybillDialog.js +3 -1
- package/dist/esm/Dialog/PlaybillDialog.js.map +1 -1
- package/dist/esm/Dialog/PlaybillHistoryDialog.d.ts +7 -0
- package/dist/esm/Dialog/PlaybillHistoryDialog.d.ts.map +1 -0
- package/dist/esm/Dialog/PlaybillHistoryDialog.js +39 -0
- package/dist/esm/Dialog/PlaybillHistoryDialog.js.map +1 -0
- package/dist/esm/Dialog/index.d.ts +1 -0
- package/dist/esm/Dialog/index.d.ts.map +1 -1
- package/dist/esm/Dialog/index.js +1 -0
- package/dist/esm/Dialog/index.js.map +1 -1
- package/dist/esm/Examples/HistoryDialog.d.ts +2 -0
- package/dist/esm/Examples/HistoryDialog.d.ts.map +1 -0
- package/dist/esm/Examples/HistoryDialog.js +8 -0
- package/dist/esm/Examples/HistoryDialog.js.map +1 -0
- package/dist/esm/Markdown/index.d.ts +1 -0
- package/dist/esm/Markdown/index.d.ts.map +1 -1
- package/dist/esm/Markdown/index.js +1 -0
- package/dist/esm/Markdown/index.js.map +1 -1
- package/dist/esm/Markdown/linkIssueReferences.d.ts +2 -0
- package/dist/esm/Markdown/linkIssueReferences.d.ts.map +1 -0
- package/dist/esm/Markdown/linkIssueReferences.js +20 -0
- package/dist/esm/Markdown/linkIssueReferences.js.map +1 -0
- package/dist/esm/Playbill.d.ts +3 -2
- package/dist/esm/Playbill.d.ts.map +1 -1
- package/dist/esm/Playbill.js +3 -1
- package/dist/esm/Playbill.js.map +1 -1
- package/dist/esm/Release/ReleaseNoteView.d.ts +2 -1
- package/dist/esm/Release/ReleaseNoteView.d.ts.map +1 -1
- package/dist/esm/Release/ReleaseNoteView.js +5 -3
- package/dist/esm/Release/ReleaseNoteView.js.map +1 -1
- package/dist/esm/Release/index.d.ts +1 -0
- package/dist/esm/Release/index.d.ts.map +1 -1
- package/dist/esm/Release/index.js +1 -0
- package/dist/esm/Release/index.js.map +1 -1
- package/dist/esm/Release/issueRepositoryFor.d.ts +3 -0
- package/dist/esm/Release/issueRepositoryFor.d.ts.map +1 -0
- package/dist/esm/Release/issueRepositoryFor.js +14 -0
- package/dist/esm/Release/issueRepositoryFor.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
- package/styles.css +6 -0
|
@@ -7,7 +7,7 @@ import { ComponentType, useMemo, useState } from 'react';
|
|
|
7
7
|
import { usePlaybillClient } from '../Configuration/index.js';
|
|
8
8
|
import { PlaybillLabels, resolveLabels, withCount } from '../Labels/index.js';
|
|
9
9
|
import { PlaybillMarkdown, PlaybillMarkdownProps } from '../Markdown/index.js';
|
|
10
|
-
import { ReleaseNoteView, ReleaseNoteViewProps } from '../Release/index.js';
|
|
10
|
+
import { IssueRepository, issueRepositoryFor, ReleaseNoteView, ReleaseNoteViewProps } from '../Release/index.js';
|
|
11
11
|
import { usePlaybillStatus } from '../usePlaybillStatus.js';
|
|
12
12
|
import { useReleaseNotes } from '../useReleases.js';
|
|
13
13
|
|
|
@@ -23,6 +23,8 @@ export interface PlaybillDialogProps {
|
|
|
23
23
|
labels?: Partial<PlaybillLabels>;
|
|
24
24
|
/** The locale to write the dates in; the browser's when not given. */
|
|
25
25
|
locale?: string | string[];
|
|
26
|
+
/** Where the issues of the releases are tracked, so `#123` in a note links to one. A function answers for each version. Not linked when not given. */
|
|
27
|
+
issues?: IssueRepository;
|
|
26
28
|
/** The most releases to show at once, the newest first. Defaults to 5; the rest are pointed to with the `earlier` text. */
|
|
27
29
|
maxReleases?: number;
|
|
28
30
|
}
|
|
@@ -32,7 +34,7 @@ export interface PlaybillDialogProps {
|
|
|
32
34
|
* seen, and records that they have when it is closed, so it does not return on any device. Nothing opens when nothing
|
|
33
35
|
* is unread. Mount it once, in the application shell and inside Arc's context.
|
|
34
36
|
*/
|
|
35
|
-
export const PlaybillDialog = ({ release: Release = ReleaseNoteView, markdown, labels, locale, maxReleases = 5 }: PlaybillDialogProps) => {
|
|
37
|
+
export const PlaybillDialog = ({ release: Release = ReleaseNoteView, markdown, labels, locale, issues, maxReleases = 5 }: PlaybillDialogProps) => {
|
|
36
38
|
const client = usePlaybillClient();
|
|
37
39
|
const { unreadVersions, markSeen } = usePlaybillStatus();
|
|
38
40
|
const resolved = useMemo(() => resolveLabels(labels), [labels]);
|
|
@@ -72,6 +74,7 @@ export const PlaybillDialog = ({ release: Release = ReleaseNoteView, markdown, l
|
|
|
72
74
|
labels={resolved}
|
|
73
75
|
markdown={markdown ?? PlaybillMarkdown}
|
|
74
76
|
locale={locale}
|
|
77
|
+
issueRepository={issueRepositoryFor(issues, note.version)}
|
|
75
78
|
headingLevel={3} />
|
|
76
79
|
))}
|
|
77
80
|
{unreadVersions.length > shown.length && (
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { DialogButtons } from '@cratis/arc.react/dialogs';
|
|
5
|
+
import { Dialog, DialogInitialFocus } from '@cratis/components/Dialogs';
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
import { resolveLabels } from '../Labels/index.js';
|
|
8
|
+
import { Playbill, PlaybillProps } from '../Playbill.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Props for {@link PlaybillHistoryDialog}.
|
|
12
|
+
*/
|
|
13
|
+
export interface PlaybillHistoryDialogProps extends Omit<PlaybillProps, 'selected' | 'onSelect'> {
|
|
14
|
+
/** Whether the dialog is shown. */
|
|
15
|
+
open: boolean;
|
|
16
|
+
/** Called when the person closes the dialog. */
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The whole release history in a dialog, for an application that has no page for it: the "What's new" entry of a menu or the
|
|
22
|
+
* "About" dialog opens it on request. It is the {@link Playbill} page inside a dialog, so showing a release that has not been
|
|
23
|
+
* seen records it as seen. Mount it once in the application shell, inside Arc's context, and control it with `open`.
|
|
24
|
+
*/
|
|
25
|
+
export const PlaybillHistoryDialog = ({ open, onClose, labels, ...page }: PlaybillHistoryDialogProps) => {
|
|
26
|
+
const resolved = useMemo(() => resolveLabels(labels), [labels]);
|
|
27
|
+
|
|
28
|
+
if (!open) {
|
|
29
|
+
return <></>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Dialog
|
|
34
|
+
title={resolved.title}
|
|
35
|
+
width='56rem'
|
|
36
|
+
buttons={DialogButtons.Ok}
|
|
37
|
+
okLabel={resolved.acknowledge}
|
|
38
|
+
closeAriaLabel={resolved.close}
|
|
39
|
+
initialFocus={DialogInitialFocus.Content}
|
|
40
|
+
onConfirm={onClose}
|
|
41
|
+
onCancel={onClose}>
|
|
42
|
+
<div className='playbill-history'>
|
|
43
|
+
<Playbill labels={labels} {...page} />
|
|
44
|
+
</div>
|
|
45
|
+
</Dialog>
|
|
46
|
+
);
|
|
47
|
+
};
|
package/Dialog/index.ts
CHANGED
package/Markdown/index.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
// A qualified issue reference (`owner/repo#123`) after the start of a line, whitespace or an opening parenthesis.
|
|
5
|
+
const qualifiedIssuePattern = /(^|[\s(])([A-Za-z\d][A-Za-z\d-]*\/[A-Za-z\d._-]+)#(\d+)\b/g;
|
|
6
|
+
|
|
7
|
+
// A bare issue reference (`#123`) in the same places. A heading never matches, because `#` is followed by a space, and a
|
|
8
|
+
// reference inside a link or an address is preceded by a character that does not match.
|
|
9
|
+
const bareIssuePattern = /(^|[\s(])#(\d+)\b/g;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Turns the issue references in a note into links: `#123` to an issue of the repository the notes belong to, and
|
|
13
|
+
* `owner/repo#123` to that repository's.
|
|
14
|
+
* @param markdown - The Markdown of the note.
|
|
15
|
+
* @param repository - The address of the repository `#123` belongs to, such as `https://github.com/Cratis/Studio`.
|
|
16
|
+
* @returns The Markdown with the references as links.
|
|
17
|
+
*/
|
|
18
|
+
export const linkIssueReferences = (markdown: string, repository: string): string => {
|
|
19
|
+
const home = repository.replace(/\/+$/, '');
|
|
20
|
+
return markdown
|
|
21
|
+
.replace(qualifiedIssuePattern, (_match, prefix: string, name: string, number: string) =>
|
|
22
|
+
`${prefix}[${name}#${number}](https://github.com/${name}/issues/${number})`)
|
|
23
|
+
.replace(bareIssuePattern, (_match, prefix: string, number: string) =>
|
|
24
|
+
`${prefix}[#${number}](${home}/issues/${number})`);
|
|
25
|
+
};
|
package/Playbill.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import { ComponentType, useEffect, useMemo, useState } from 'react';
|
|
|
5
5
|
import { usePlaybillClient } from './Configuration/index.js';
|
|
6
6
|
import { PlaybillLabels, resolveLabels } from './Labels/index.js';
|
|
7
7
|
import { PlaybillMarkdown, PlaybillMarkdownProps } from './Markdown/index.js';
|
|
8
|
-
import { formatReleaseDate, ReleaseNoteView, ReleaseNoteViewProps } from './Release/index.js';
|
|
8
|
+
import { formatReleaseDate, IssueRepository, issueRepositoryFor, ReleaseNoteView, ReleaseNoteViewProps } from './Release/index.js';
|
|
9
9
|
import { usePlaybill } from './usePlaybill.js';
|
|
10
10
|
import { useRelease } from './useReleases.js';
|
|
11
11
|
|
|
@@ -21,6 +21,8 @@ export interface PlaybillProps {
|
|
|
21
21
|
labels?: Partial<PlaybillLabels>;
|
|
22
22
|
/** The locale to write the dates in; the browser's when not given. */
|
|
23
23
|
locale?: string | string[];
|
|
24
|
+
/** Where the issues of the releases are tracked, so `#123` in a note links to one. A function answers for each version. Not linked when not given. */
|
|
25
|
+
issues?: IssueRepository;
|
|
24
26
|
/** The version to show. Give it, with `onSelect`, to keep the selection in the address; by default the newest is selected. */
|
|
25
27
|
selected?: string;
|
|
26
28
|
/** Called when the person picks another release. */
|
|
@@ -39,6 +41,7 @@ export const Playbill = ({
|
|
|
39
41
|
markdown,
|
|
40
42
|
labels,
|
|
41
43
|
locale,
|
|
44
|
+
issues,
|
|
42
45
|
selected,
|
|
43
46
|
onSelect,
|
|
44
47
|
markSeenWhenShown = true
|
|
@@ -112,6 +115,7 @@ export const Playbill = ({
|
|
|
112
115
|
labels={resolved}
|
|
113
116
|
markdown={markdown ?? PlaybillMarkdown}
|
|
114
117
|
locale={locale}
|
|
118
|
+
issueRepository={issueRepositoryFor(issues, note.version)}
|
|
115
119
|
isUnread={selectedIsUnread}
|
|
116
120
|
isCurrent={note.version === current} />
|
|
117
121
|
)}
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @cratis/showrunner.playbill.react
|
|
2
2
|
|
|
3
3
|
The Playbill release-notes experience for React, the Showrunner release-notes part: `<Playbill />` is a releases page,
|
|
4
|
-
`<PlaybillDialog />` opens by itself with what is new, and `<PlaybillBadge />` is the unread count for a header. Built on
|
|
4
|
+
`<PlaybillDialog />` opens by itself with what is new, `<PlaybillHistoryDialog />` opens the whole history on request, and `<PlaybillBadge />` is the unread count for a header. Built on
|
|
5
5
|
`@cratis/components` and the generated proxies in `@cratis/showrunner.playbill`. How to use it:
|
|
6
6
|
[Documentation/Playbill](../../../Documentation/Playbill/index.md).
|
|
7
7
|
|
|
@@ -14,6 +14,7 @@ Playbill usePlaybill, then the list and the selected release
|
|
|
14
14
|
└── PlaybillMarkdown the lead and each section
|
|
15
15
|
|
|
16
16
|
PlaybillDialog Cratis Components Dialog, the notes of every unread release
|
|
17
|
+
PlaybillHistoryDialog Cratis Components Dialog, the Playbill page, opened with `open`
|
|
17
18
|
└── ReleaseNoteView one for each release, one heading level down
|
|
18
19
|
|
|
19
20
|
PlaybillBadge a button with the unread count and an accessible name that says it in words
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { ComponentType } from 'react';
|
|
5
5
|
import { Release } from '../Client/index.js';
|
|
6
6
|
import { PlaybillLabels } from '../Labels/index.js';
|
|
7
|
-
import { PlaybillMarkdown, PlaybillMarkdownProps } from '../Markdown/index.js';
|
|
7
|
+
import { linkIssueReferences, PlaybillMarkdown, PlaybillMarkdownProps } from '../Markdown/index.js';
|
|
8
8
|
import { formatReleaseDate } from './formatReleaseDate.js';
|
|
9
9
|
import { sectionPresentation } from './sectionPresentation.js';
|
|
10
10
|
|
|
@@ -27,6 +27,8 @@ export interface ReleaseNoteViewProps {
|
|
|
27
27
|
isUnread?: boolean;
|
|
28
28
|
/** Whether this is the version the application is running; it is marked with the `current` text. */
|
|
29
29
|
isCurrent?: boolean;
|
|
30
|
+
/** The address of the repository whose issues a bare `#123` in the note refers to. The references are made links when it is given. */
|
|
31
|
+
issueRepository?: string;
|
|
30
32
|
/** The level of the heading of the version, so the release fits under the heading of the page or dialog around it. Defaults to 2. */
|
|
31
33
|
headingLevel?: 2 | 3 | 4;
|
|
32
34
|
}
|
|
@@ -43,11 +45,13 @@ export const ReleaseNoteView = ({
|
|
|
43
45
|
locale,
|
|
44
46
|
isUnread = false,
|
|
45
47
|
isCurrent = false,
|
|
48
|
+
issueRepository,
|
|
46
49
|
headingLevel = 2
|
|
47
50
|
}: ReleaseNoteViewProps) => {
|
|
48
51
|
const Heading = `h${headingLevel}` as 'h2';
|
|
49
52
|
const SectionHeading = `h${headingLevel + 1}` as 'h3';
|
|
50
53
|
const date = formatReleaseDate(release.releasedAt, locale);
|
|
54
|
+
const prepared = (markdown: string) => issueRepository ? linkIssueReferences(markdown, issueRepository) : markdown;
|
|
51
55
|
return (
|
|
52
56
|
<article className='playbill-release' data-version={release.version}>
|
|
53
57
|
<header className='playbill-release__header'>
|
|
@@ -62,7 +66,7 @@ export const ReleaseNoteView = ({
|
|
|
62
66
|
</header>
|
|
63
67
|
{release.lead.trim() !== '' && (
|
|
64
68
|
<div className='playbill-release__lead'>
|
|
65
|
-
<Markdown source={release.lead} assetBase={assetBase} />
|
|
69
|
+
<Markdown source={prepared(release.lead)} assetBase={assetBase} />
|
|
66
70
|
</div>
|
|
67
71
|
)}
|
|
68
72
|
{release.sections.map(section => {
|
|
@@ -70,7 +74,7 @@ export const ReleaseNoteView = ({
|
|
|
70
74
|
return (
|
|
71
75
|
<section key={section.name} className={`playbill-section playbill-section--${presentation.modifier}`}>
|
|
72
76
|
<SectionHeading className='playbill-section__title'>{presentation.title}</SectionHeading>
|
|
73
|
-
<Markdown source={section.markdown} assetBase={assetBase} />
|
|
77
|
+
<Markdown source={prepared(section.markdown)} assetBase={assetBase} />
|
|
74
78
|
</section>
|
|
75
79
|
);
|
|
76
80
|
})}
|
package/Release/index.ts
CHANGED
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
4
|
export * from './formatReleaseDate.js';
|
|
5
|
+
export * from './issueRepositoryFor.js';
|
|
5
6
|
export * from './ReleaseNoteView.js';
|
|
6
7
|
export * from './sectionPresentation.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Where the issues of a release are tracked: one address for every release, or a function that answers for each version, for a
|
|
6
|
+
* product whose issues moved to another repository at some point.
|
|
7
|
+
*/
|
|
8
|
+
export type IssueRepository = string | ((version: string) => string | undefined);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Works out the repository a release's issue references belong to.
|
|
12
|
+
* @param issues - What the product gave, if anything.
|
|
13
|
+
* @param version - The version of the release.
|
|
14
|
+
* @returns The address of the repository, or undefined to leave the references as text.
|
|
15
|
+
*/
|
|
16
|
+
export const issueRepositoryFor = (issues: IssueRepository | undefined, version: string): string | undefined =>
|
|
17
|
+
typeof issues === 'function' ? issues(version) : issues;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
import { PlaybillLabels } from '../Labels/index.js';
|
|
3
3
|
import { PlaybillMarkdownProps } from '../Markdown/index.js';
|
|
4
|
-
import { ReleaseNoteViewProps } from '../Release/index.js';
|
|
4
|
+
import { IssueRepository, ReleaseNoteViewProps } from '../Release/index.js';
|
|
5
5
|
export interface PlaybillDialogProps {
|
|
6
6
|
release?: ComponentType<ReleaseNoteViewProps>;
|
|
7
7
|
markdown?: ComponentType<PlaybillMarkdownProps>;
|
|
8
8
|
labels?: Partial<PlaybillLabels>;
|
|
9
9
|
locale?: string | string[];
|
|
10
|
+
issues?: IssueRepository;
|
|
10
11
|
maxReleases?: number;
|
|
11
12
|
}
|
|
12
|
-
export declare const PlaybillDialog: ({ release: Release, markdown, labels, locale, maxReleases }: PlaybillDialogProps) => import("react").JSX.Element;
|
|
13
|
+
export declare const PlaybillDialog: ({ release: Release, markdown, labels, locale, issues, maxReleases }: PlaybillDialogProps) => import("react").JSX.Element;
|
|
13
14
|
//# sourceMappingURL=PlaybillDialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaybillDialog.d.ts","sourceRoot":"","sources":["../../../Dialog/PlaybillDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAqB,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,cAAc,EAA4B,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAoB,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"PlaybillDialog.d.ts","sourceRoot":"","sources":["../../../Dialog/PlaybillDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAqB,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,cAAc,EAA4B,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAoB,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAuC,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAOjH,MAAM,WAAW,mBAAmB;IAEhC,OAAO,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAE9C,QAAQ,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAEhD,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAEjC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAOD,eAAO,MAAM,cAAc,GAAI,qEAA2F,mBAAmB,gCAiD5I,CAAC"}
|
|
@@ -7,6 +7,7 @@ var react = require('react');
|
|
|
7
7
|
var PlaybillProvider = require('../Configuration/PlaybillProvider.js');
|
|
8
8
|
var resolveLabels = require('../Labels/resolveLabels.js');
|
|
9
9
|
var PlaybillMarkdown = require('../Markdown/PlaybillMarkdown.js');
|
|
10
|
+
var issueRepositoryFor = require('../Release/issueRepositoryFor.js');
|
|
10
11
|
var ReleaseNoteView = require('../Release/ReleaseNoteView.js');
|
|
11
12
|
var usePlaybillStatus = require('../usePlaybillStatus.js');
|
|
12
13
|
var useReleases = require('../useReleases.js');
|
|
@@ -15,7 +16,7 @@ var useReleases = require('../useReleases.js');
|
|
|
15
16
|
* Tells the signed-in person what is new: a dialog that opens by itself with the notes of the releases they have not
|
|
16
17
|
* seen, and records that they have when it is closed, so it does not return on any device. Nothing opens when nothing
|
|
17
18
|
* is unread. Mount it once, in the application shell and inside Arc's context.
|
|
18
|
-
*/ const PlaybillDialog = ({ release: Release = ReleaseNoteView.ReleaseNoteView, markdown, labels, locale, maxReleases = 5 })=>{
|
|
19
|
+
*/ const PlaybillDialog = ({ release: Release = ReleaseNoteView.ReleaseNoteView, markdown, labels, locale, issues, maxReleases = 5 })=>{
|
|
19
20
|
const client = PlaybillProvider.usePlaybillClient();
|
|
20
21
|
const { unreadVersions, markSeen } = usePlaybillStatus.usePlaybillStatus();
|
|
21
22
|
const resolved = react.useMemo(()=>resolveLabels.resolveLabels(labels), [
|
|
@@ -64,6 +65,7 @@ var useReleases = require('../useReleases.js');
|
|
|
64
65
|
labels: resolved,
|
|
65
66
|
markdown: markdown ?? PlaybillMarkdown.PlaybillMarkdown,
|
|
66
67
|
locale: locale,
|
|
68
|
+
issueRepository: issueRepositoryFor.issueRepositoryFor(issues, note.version),
|
|
67
69
|
headingLevel: 3
|
|
68
70
|
}, note.version)),
|
|
69
71
|
unreadVersions.length > shown.length && /*#__PURE__*/ jsxRuntime.jsx("p", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaybillDialog.js","sources":["../../../Dialog/PlaybillDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogButtons } from '@cratis/arc.react/dialogs';\nimport { Dialog, DialogInitialFocus } from '@cratis/components/Dialogs';\nimport { ComponentType, useMemo, useState } from 'react';\nimport { usePlaybillClient } from '../Configuration/index.js';\nimport { PlaybillLabels, resolveLabels, withCount } from '../Labels/index.js';\nimport { PlaybillMarkdown, PlaybillMarkdownProps } from '../Markdown/index.js';\nimport { ReleaseNoteView, ReleaseNoteViewProps } from '../Release/index.js';\nimport { usePlaybillStatus } from '../usePlaybillStatus.js';\nimport { useReleaseNotes } from '../useReleases.js';\n\n/**\n * Props for {@link PlaybillDialog}.\n */\nexport interface PlaybillDialogProps {\n /** Replaces how one release is drawn. */\n release?: ComponentType<ReleaseNoteViewProps>;\n /** Replaces the Markdown renderer the default release view uses, and that a custom one is given. */\n markdown?: ComponentType<PlaybillMarkdownProps>;\n /** The texts to replace; the rest stay English. */\n labels?: Partial<PlaybillLabels>;\n /** The locale to write the dates in; the browser's when not given. */\n locale?: string | string[];\n /** The most releases to show at once, the newest first. Defaults to 5; the rest are pointed to with the `earlier` text. */\n maxReleases?: number;\n}\n\n/**\n * Tells the signed-in person what is new: a dialog that opens by itself with the notes of the releases they have not\n * seen, and records that they have when it is closed, so it does not return on any device. Nothing opens when nothing\n * is unread. Mount it once, in the application shell and inside Arc's context.\n */\nexport const PlaybillDialog = ({ release: Release = ReleaseNoteView, markdown, labels, locale, maxReleases = 5 }: PlaybillDialogProps) => {\n const client = usePlaybillClient();\n const { unreadVersions, markSeen } = usePlaybillStatus();\n const resolved = useMemo(() => resolveLabels(labels), [labels]);\n const shown = useMemo(() => unreadVersions.slice(0, maxReleases), [unreadVersions, maxReleases]);\n const key = shown.join('|');\n const [dismissed, setDismissed] = useState<string>();\n const { data: releases, isLoading, error } = useReleaseNotes(shown);\n\n if (shown.length === 0 || dismissed === key) {\n return <></>;\n }\n\n const close = () => {\n setDismissed(key);\n // Failing to remember it must not keep a person from reading on.\n markSeen(shown[0]).catch(() => undefined);\n };\n\n return (\n <Dialog\n title={resolved.title}\n width='40rem'\n buttons={DialogButtons.Ok}\n okLabel={resolved.acknowledge}\n closeAriaLabel={resolved.close}\n initialFocus={DialogInitialFocus.Content}\n onConfirm={close}\n onCancel={close}>\n <div className='playbill-dialog'>\n {isLoading && <p className='playbill-status' role='status'>{resolved.loading}</p>}\n {error && <p className='playbill-status playbill-status--failed' role='alert'>{resolved.failed}</p>}\n {!isLoading && !error && releases?.map(note => (\n <Release\n key={note.version}\n release={note}\n assetBase={client.assetBase(note.version)}\n labels={resolved}\n markdown={markdown ?? PlaybillMarkdown}\n locale={locale}\n headingLevel={3} />\n ))}\n {unreadVersions.length > shown.length && (\n <p className='playbill-dialog__earlier'>{withCount(resolved.earlier, unreadVersions.length - shown.length)}</p>\n )}\n </div>\n </Dialog>\n );\n};\n"],"names":["PlaybillDialog","release","Release","ReleaseNoteView","markdown","labels","locale","maxReleases","client","usePlaybillClient","unreadVersions","markSeen","usePlaybillStatus","resolved","useMemo","resolveLabels","shown","slice","key","join","dismissed","setDismissed","useState","data","releases","isLoading","error","useReleaseNotes","length","_jsx","_Fragment","close","catch","undefined","Dialog","title","width","buttons","DialogButtons","Ok","okLabel","acknowledge","closeAriaLabel","initialFocus","DialogInitialFocus","Content","onConfirm","onCancel","_jsxs","div","className","p","role","loading","failed","map","note","assetBase","version","PlaybillMarkdown","headingLevel","withCount","earlier"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlaybillDialog.js","sources":["../../../Dialog/PlaybillDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogButtons } from '@cratis/arc.react/dialogs';\nimport { Dialog, DialogInitialFocus } from '@cratis/components/Dialogs';\nimport { ComponentType, useMemo, useState } from 'react';\nimport { usePlaybillClient } from '../Configuration/index.js';\nimport { PlaybillLabels, resolveLabels, withCount } from '../Labels/index.js';\nimport { PlaybillMarkdown, PlaybillMarkdownProps } from '../Markdown/index.js';\nimport { IssueRepository, issueRepositoryFor, ReleaseNoteView, ReleaseNoteViewProps } from '../Release/index.js';\nimport { usePlaybillStatus } from '../usePlaybillStatus.js';\nimport { useReleaseNotes } from '../useReleases.js';\n\n/**\n * Props for {@link PlaybillDialog}.\n */\nexport interface PlaybillDialogProps {\n /** Replaces how one release is drawn. */\n release?: ComponentType<ReleaseNoteViewProps>;\n /** Replaces the Markdown renderer the default release view uses, and that a custom one is given. */\n markdown?: ComponentType<PlaybillMarkdownProps>;\n /** The texts to replace; the rest stay English. */\n labels?: Partial<PlaybillLabels>;\n /** The locale to write the dates in; the browser's when not given. */\n locale?: string | string[];\n /** Where the issues of the releases are tracked, so `#123` in a note links to one. A function answers for each version. Not linked when not given. */\n issues?: IssueRepository;\n /** The most releases to show at once, the newest first. Defaults to 5; the rest are pointed to with the `earlier` text. */\n maxReleases?: number;\n}\n\n/**\n * Tells the signed-in person what is new: a dialog that opens by itself with the notes of the releases they have not\n * seen, and records that they have when it is closed, so it does not return on any device. Nothing opens when nothing\n * is unread. Mount it once, in the application shell and inside Arc's context.\n */\nexport const PlaybillDialog = ({ release: Release = ReleaseNoteView, markdown, labels, locale, issues, maxReleases = 5 }: PlaybillDialogProps) => {\n const client = usePlaybillClient();\n const { unreadVersions, markSeen } = usePlaybillStatus();\n const resolved = useMemo(() => resolveLabels(labels), [labels]);\n const shown = useMemo(() => unreadVersions.slice(0, maxReleases), [unreadVersions, maxReleases]);\n const key = shown.join('|');\n const [dismissed, setDismissed] = useState<string>();\n const { data: releases, isLoading, error } = useReleaseNotes(shown);\n\n if (shown.length === 0 || dismissed === key) {\n return <></>;\n }\n\n const close = () => {\n setDismissed(key);\n // Failing to remember it must not keep a person from reading on.\n markSeen(shown[0]).catch(() => undefined);\n };\n\n return (\n <Dialog\n title={resolved.title}\n width='40rem'\n buttons={DialogButtons.Ok}\n okLabel={resolved.acknowledge}\n closeAriaLabel={resolved.close}\n initialFocus={DialogInitialFocus.Content}\n onConfirm={close}\n onCancel={close}>\n <div className='playbill-dialog'>\n {isLoading && <p className='playbill-status' role='status'>{resolved.loading}</p>}\n {error && <p className='playbill-status playbill-status--failed' role='alert'>{resolved.failed}</p>}\n {!isLoading && !error && releases?.map(note => (\n <Release\n key={note.version}\n release={note}\n assetBase={client.assetBase(note.version)}\n labels={resolved}\n markdown={markdown ?? PlaybillMarkdown}\n locale={locale}\n issueRepository={issueRepositoryFor(issues, note.version)}\n headingLevel={3} />\n ))}\n {unreadVersions.length > shown.length && (\n <p className='playbill-dialog__earlier'>{withCount(resolved.earlier, unreadVersions.length - shown.length)}</p>\n )}\n </div>\n </Dialog>\n );\n};\n"],"names":["PlaybillDialog","release","Release","ReleaseNoteView","markdown","labels","locale","issues","maxReleases","client","usePlaybillClient","unreadVersions","markSeen","usePlaybillStatus","resolved","useMemo","resolveLabels","shown","slice","key","join","dismissed","setDismissed","useState","data","releases","isLoading","error","useReleaseNotes","length","_jsx","_Fragment","close","catch","undefined","Dialog","title","width","buttons","DialogButtons","Ok","okLabel","acknowledge","closeAriaLabel","initialFocus","DialogInitialFocus","Content","onConfirm","onCancel","_jsxs","div","className","p","role","loading","failed","map","note","assetBase","version","PlaybillMarkdown","issueRepository","issueRepositoryFor","headingLevel","withCount","earlier"],"mappings":";;;;;;;;;;;;;;AA+BA;;;;AAIC,IACM,MAAMA,cAAAA,GAAiB,CAAC,EAAEC,OAAAA,EAASC,UAAUC,+BAAe,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,WAAAA,GAAc,CAAC,EAAuB,GAAA;AACzI,IAAA,MAAMC,MAAAA,GAASC,kCAAAA,EAAAA;AACf,IAAA,MAAM,EAAEC,cAAc,EAAEC,QAAQ,EAAE,GAAGC,mCAAAA,EAAAA;AACrC,IAAA,MAAMC,QAAAA,GAAWC,aAAAA,CAAQ,IAAMC,2BAAAA,CAAcX,MAAAA,CAAAA,EAAS;AAACA,QAAAA;AAAO,KAAA,CAAA;AAC9D,IAAA,MAAMY,QAAQF,aAAAA,CAAQ,IAAMJ,eAAeO,KAAK,CAAC,GAAGV,WAAAA,CAAAA,EAAc;AAACG,QAAAA,cAAAA;AAAgBH,QAAAA;AAAY,KAAA,CAAA;IAC/F,MAAMW,GAAAA,GAAMF,KAAAA,CAAMG,IAAI,CAAC,GAAA,CAAA;IACvB,MAAM,CAACC,SAAAA,EAAWC,YAAAA,CAAa,GA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CAAC7B,aAAa,CAACC,KAAAA,IAASF,UAAU+B,GAAAA,CAAIC,CAAAA,qBACnC3B,cAAA,CAAC5B,OAAAA,EAAAA;wBAEGD,OAAAA,EAASwD,IAAAA;AACTC,wBAAAA,SAAAA,EAAWjD,MAAAA,CAAOiD,SAAS,CAACD,IAAAA,CAAKE,OAAO,CAAA;wBACxCtD,MAAAA,EAAQS,QAAAA;AACRV,wBAAAA,QAAAA,EAAUA,QAAAA,IAAYwD,iCAAAA;wBACtBtD,MAAAA,EAAQA,MAAAA;wBACRuD,eAAAA,EAAiBC,qCAAAA,CAAmBvD,MAAAA,EAAQkD,IAAAA,CAAKE,OAAO,CAAA;wBACxDI,YAAAA,EAAc;AAPTN,qBAAAA,EAAAA,IAAAA,CAAKE,OAAO,CAAA,CAAA;AASxBhD,gBAAAA,cAAAA,CAAekB,MAAM,GAAGZ,KAAAA,CAAMY,MAAM,kBACjCC,cAAA,CAACsB,GAAAA,EAAAA;oBAAED,SAAAA,EAAU,0BAAA;AAA4Ba,oBAAAA,QAAAA,EAAAA,uBAAAA,CAAUlD,SAASmD,OAAO,EAAEtD,eAAekB,MAAM,GAAGZ,MAAMY,MAAM;;;;;AAK7H;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PlaybillProps } from '../Playbill.js';
|
|
2
|
+
export interface PlaybillHistoryDialogProps extends Omit<PlaybillProps, 'selected' | 'onSelect'> {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const PlaybillHistoryDialog: ({ open, onClose, labels, ...page }: PlaybillHistoryDialogProps) => import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=PlaybillHistoryDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlaybillHistoryDialog.d.ts","sourceRoot":"","sources":["../../../Dialog/PlaybillHistoryDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAY,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKzD,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,UAAU,CAAC;IAE5F,IAAI,EAAE,OAAO,CAAC;IAEd,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAOD,eAAO,MAAM,qBAAqB,GAAI,oCAAoC,0BAA0B,gCAsBnG,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var dialogs = require('@cratis/arc.react/dialogs');
|
|
5
|
+
var Dialogs = require('@cratis/components/Dialogs');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var resolveLabels = require('../Labels/resolveLabels.js');
|
|
8
|
+
var Playbill = require('../Playbill.js');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The whole release history in a dialog, for an application that has no page for it: the "What's new" entry of a menu or the
|
|
12
|
+
* "About" dialog opens it on request. It is the {@link Playbill} page inside a dialog, so showing a release that has not been
|
|
13
|
+
* seen records it as seen. Mount it once in the application shell, inside Arc's context, and control it with `open`.
|
|
14
|
+
*/ const PlaybillHistoryDialog = ({ open, onClose, labels, ...page })=>{
|
|
15
|
+
const resolved = react.useMemo(()=>resolveLabels.resolveLabels(labels), [
|
|
16
|
+
labels
|
|
17
|
+
]);
|
|
18
|
+
if (!open) {
|
|
19
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
20
|
+
}
|
|
21
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Dialogs.Dialog, {
|
|
22
|
+
title: resolved.title,
|
|
23
|
+
width: "56rem",
|
|
24
|
+
buttons: dialogs.DialogButtons.Ok,
|
|
25
|
+
okLabel: resolved.acknowledge,
|
|
26
|
+
closeAriaLabel: resolved.close,
|
|
27
|
+
initialFocus: Dialogs.DialogInitialFocus.Content,
|
|
28
|
+
onConfirm: onClose,
|
|
29
|
+
onCancel: onClose,
|
|
30
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
31
|
+
className: "playbill-history",
|
|
32
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Playbill.Playbill, {
|
|
33
|
+
labels: labels,
|
|
34
|
+
...page
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
exports.PlaybillHistoryDialog = PlaybillHistoryDialog;
|
|
41
|
+
//# sourceMappingURL=PlaybillHistoryDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlaybillHistoryDialog.js","sources":["../../../Dialog/PlaybillHistoryDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogButtons } from '@cratis/arc.react/dialogs';\nimport { Dialog, DialogInitialFocus } from '@cratis/components/Dialogs';\nimport { useMemo } from 'react';\nimport { resolveLabels } from '../Labels/index.js';\nimport { Playbill, PlaybillProps } from '../Playbill.js';\n\n/**\n * Props for {@link PlaybillHistoryDialog}.\n */\nexport interface PlaybillHistoryDialogProps extends Omit<PlaybillProps, 'selected' | 'onSelect'> {\n /** Whether the dialog is shown. */\n open: boolean;\n /** Called when the person closes the dialog. */\n onClose: () => void;\n}\n\n/**\n * The whole release history in a dialog, for an application that has no page for it: the \"What's new\" entry of a menu or the\n * \"About\" dialog opens it on request. It is the {@link Playbill} page inside a dialog, so showing a release that has not been\n * seen records it as seen. Mount it once in the application shell, inside Arc's context, and control it with `open`.\n */\nexport const PlaybillHistoryDialog = ({ open, onClose, labels, ...page }: PlaybillHistoryDialogProps) => {\n const resolved = useMemo(() => resolveLabels(labels), [labels]);\n\n if (!open) {\n return <></>;\n }\n\n return (\n <Dialog\n title={resolved.title}\n width='56rem'\n buttons={DialogButtons.Ok}\n okLabel={resolved.acknowledge}\n closeAriaLabel={resolved.close}\n initialFocus={DialogInitialFocus.Content}\n onConfirm={onClose}\n onCancel={onClose}>\n <div className='playbill-history'>\n <Playbill labels={labels} {...page} />\n </div>\n </Dialog>\n );\n};\n"],"names":["PlaybillHistoryDialog","open","onClose","labels","page","resolved","useMemo","resolveLabels","_jsx","_Fragment","Dialog","title","width","buttons","DialogButtons","Ok","okLabel","acknowledge","closeAriaLabel","close","initialFocus","DialogInitialFocus","Content","onConfirm","onCancel","div","className","Playbill"],"mappings":";;;;;;;;;AAmBA;;;;AAIC,IACM,MAAMA,qBAAAA,GAAwB,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGC,IAAAA,EAAkC,GAAA;AAChG,IAAA,MAAMC,QAAAA,GAAWC,aAAAA,CAAQ,IAAMC,2BAAAA,CAAcJ,MAAAA,CAAAA,EAAS;AAACA,QAAAA;AAAO,KAAA,CAAA;AAE9D,IAAA,IAAI,CAACF,IAAAA,EAAM;QACP,qBAAOO,cAAA,CAAAC,mBAAA,EAAA,EAAA,CAAA;AACX,IAAA;AAEA,IAAA,qBACID,cAAA,CAACE,cAAAA,EAAAA;AACGC,QAAAA,KAAAA,EAAON,SAASM,KAAK;QACrBC,KAAAA,EAAM,OAAA;AACNC,QAAAA,OAAAA,EAASC,sBAAcC,EAAE;AACzBC,QAAAA,OAAAA,EAASX,SAASY,WAAW;AAC7BC,QAAAA,cAAAA,EAAgBb,SAASc,KAAK;AAC9BC,QAAAA,YAAAA,EAAcC,2BAAmBC,OAAO;QACxCC,SAAAA,EAAWrB,OAAAA;QACXsB,QAAAA,EAAUtB,OAAAA;AACV,QAAA,QAAA,gBAAAM,cAAA,CAACiB,KAAAA,EAAAA;YAAIC,SAAAA,EAAU,kBAAA;AACX,YAAA,QAAA,gBAAAlB,cAAA,CAACmB,iBAAAA,EAAAA;gBAASxB,MAAAA,EAAQA,MAAAA;AAAS,gBAAA,GAAGC;;;;AAI9C;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Dialog/index.ts"],"names":[],"mappings":"AAGA,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Dialog/index.ts"],"names":[],"mappings":"AAGA,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoryDialog.d.ts","sourceRoot":"","sources":["../../../Examples/HistoryDialog.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,mCAS7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Markdown/index.ts"],"names":[],"mappings":"AAGA,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Markdown/index.ts"],"names":[],"mappings":"AAGA,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkIssueReferences.d.ts","sourceRoot":"","sources":["../../../Markdown/linkIssueReferences.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,mBAAmB,GAAI,UAAU,MAAM,EAAE,YAAY,MAAM,KAAG,MAO1E,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
// A qualified issue reference (`owner/repo#123`) after the start of a line, whitespace or an opening parenthesis.
|
|
6
|
+
const qualifiedIssuePattern = /(^|[\s(])([A-Za-z\d][A-Za-z\d-]*\/[A-Za-z\d._-]+)#(\d+)\b/g;
|
|
7
|
+
// A bare issue reference (`#123`) in the same places. A heading never matches, because `#` is followed by a space, and a
|
|
8
|
+
// reference inside a link or an address is preceded by a character that does not match.
|
|
9
|
+
const bareIssuePattern = /(^|[\s(])#(\d+)\b/g;
|
|
10
|
+
/**
|
|
11
|
+
* Turns the issue references in a note into links: `#123` to an issue of the repository the notes belong to, and
|
|
12
|
+
* `owner/repo#123` to that repository's.
|
|
13
|
+
* @param markdown - The Markdown of the note.
|
|
14
|
+
* @param repository - The address of the repository `#123` belongs to, such as `https://github.com/Cratis/Studio`.
|
|
15
|
+
* @returns The Markdown with the references as links.
|
|
16
|
+
*/ const linkIssueReferences = (markdown, repository)=>{
|
|
17
|
+
const home = repository.replace(/\/+$/, '');
|
|
18
|
+
return markdown.replace(qualifiedIssuePattern, (_match, prefix, name, number)=>`${prefix}[${name}#${number}](https://github.com/${name}/issues/${number})`).replace(bareIssuePattern, (_match, prefix, number)=>`${prefix}[#${number}](${home}/issues/${number})`);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.linkIssueReferences = linkIssueReferences;
|
|
22
|
+
//# sourceMappingURL=linkIssueReferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkIssueReferences.js","sources":["../../../Markdown/linkIssueReferences.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// A qualified issue reference (`owner/repo#123`) after the start of a line, whitespace or an opening parenthesis.\nconst qualifiedIssuePattern = /(^|[\\s(])([A-Za-z\\d][A-Za-z\\d-]*\\/[A-Za-z\\d._-]+)#(\\d+)\\b/g;\n\n// A bare issue reference (`#123`) in the same places. A heading never matches, because `#` is followed by a space, and a\n// reference inside a link or an address is preceded by a character that does not match.\nconst bareIssuePattern = /(^|[\\s(])#(\\d+)\\b/g;\n\n/**\n * Turns the issue references in a note into links: `#123` to an issue of the repository the notes belong to, and\n * `owner/repo#123` to that repository's.\n * @param markdown - The Markdown of the note.\n * @param repository - The address of the repository `#123` belongs to, such as `https://github.com/Cratis/Studio`.\n * @returns The Markdown with the references as links.\n */\nexport const linkIssueReferences = (markdown: string, repository: string): string => {\n const home = repository.replace(/\\/+$/, '');\n return markdown\n .replace(qualifiedIssuePattern, (_match, prefix: string, name: string, number: string) =>\n `${prefix}[${name}#${number}](https://github.com/${name}/issues/${number})`)\n .replace(bareIssuePattern, (_match, prefix: string, number: string) =>\n `${prefix}[#${number}](${home}/issues/${number})`);\n};\n"],"names":["qualifiedIssuePattern","bareIssuePattern","linkIssueReferences","markdown","repository","home","replace","_match","prefix","name","number"],"mappings":";;AAAA;AACA;AAEA;AACA,MAAMA,qBAAAA,GAAwB,4DAAA;AAE9B;AACA;AACA,MAAMC,gBAAAA,GAAmB,oBAAA;AAEzB;;;;;;AAMC,IACM,MAAMC,mBAAAA,GAAsB,CAACC,QAAAA,EAAkBC,UAAAA,GAAAA;AAClD,IAAA,MAAMC,IAAAA,GAAOD,UAAAA,CAAWE,OAAO,CAAC,MAAA,EAAQ,EAAA,CAAA;IACxC,OAAOH,QAAAA,CACFG,OAAO,CAACN,qBAAAA,EAAuB,CAACO,MAAAA,EAAQC,MAAAA,EAAgBC,MAAcC,MAAAA,GACnE,CAAA,EAAGF,OAAO,CAAC,EAAEC,KAAK,CAAC,EAAEC,OAAO,qBAAqB,EAAED,KAAK,QAAQ,EAAEC,OAAO,CAAC,CAAC,EAC9EJ,OAAO,CAACL,kBAAkB,CAACM,MAAAA,EAAQC,QAAgBE,MAAAA,GAChD,CAAA,EAAGF,OAAO,EAAE,EAAEE,OAAO,EAAE,EAAEL,KAAK,QAAQ,EAAEK,MAAAA,CAAO,CAAC,CAAC,CAAA;AAC7D;;"}
|
package/dist/cjs/Playbill.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
import { PlaybillLabels } from './Labels/index.js';
|
|
3
3
|
import { PlaybillMarkdownProps } from './Markdown/index.js';
|
|
4
|
-
import { ReleaseNoteViewProps } from './Release/index.js';
|
|
4
|
+
import { IssueRepository, ReleaseNoteViewProps } from './Release/index.js';
|
|
5
5
|
export interface PlaybillProps {
|
|
6
6
|
release?: ComponentType<ReleaseNoteViewProps>;
|
|
7
7
|
markdown?: ComponentType<PlaybillMarkdownProps>;
|
|
8
8
|
labels?: Partial<PlaybillLabels>;
|
|
9
9
|
locale?: string | string[];
|
|
10
|
+
issues?: IssueRepository;
|
|
10
11
|
selected?: string;
|
|
11
12
|
onSelect?: (version: string) => void;
|
|
12
13
|
markSeenWhenShown?: boolean;
|
|
13
14
|
}
|
|
14
|
-
export declare const Playbill: ({ release: Release, markdown, labels, locale, selected, onSelect, markSeenWhenShown }: PlaybillProps) => import("react").JSX.Element;
|
|
15
|
+
export declare const Playbill: ({ release: Release, markdown, labels, locale, issues, selected, onSelect, markSeenWhenShown }: PlaybillProps) => import("react").JSX.Element;
|
|
15
16
|
//# sourceMappingURL=Playbill.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Playbill.d.ts","sourceRoot":"","sources":["../../Playbill.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAgC,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAiB,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAoB,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,
|
|
1
|
+
{"version":3,"file":"Playbill.d.ts","sourceRoot":"","sources":["../../Playbill.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAgC,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAiB,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAoB,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAqB,eAAe,EAAuC,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAOnI,MAAM,WAAW,aAAa;IAE1B,OAAO,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAE9C,QAAQ,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAEhD,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAEjC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAErC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAOD,eAAO,MAAM,QAAQ,GAAI,+FAStB,aAAa,gCA6Ef,CAAC"}
|
package/dist/cjs/Playbill.js
CHANGED
|
@@ -6,6 +6,7 @@ var PlaybillProvider = require('./Configuration/PlaybillProvider.js');
|
|
|
6
6
|
var resolveLabels = require('./Labels/resolveLabels.js');
|
|
7
7
|
var PlaybillMarkdown = require('./Markdown/PlaybillMarkdown.js');
|
|
8
8
|
var formatReleaseDate = require('./Release/formatReleaseDate.js');
|
|
9
|
+
var issueRepositoryFor = require('./Release/issueRepositoryFor.js');
|
|
9
10
|
var ReleaseNoteView = require('./Release/ReleaseNoteView.js');
|
|
10
11
|
var usePlaybill = require('./usePlaybill.js');
|
|
11
12
|
var useReleases = require('./useReleases.js');
|
|
@@ -14,7 +15,7 @@ var useReleases = require('./useReleases.js');
|
|
|
14
15
|
* The release notes of the application as a page: the releases newest first on one side and the selected release on the
|
|
15
16
|
* other. It marks what the person has not seen with a tag, and records a release as seen when it is shown. Place it
|
|
16
17
|
* where the application has room for a page, inside Arc's context. It draws no heading of its own.
|
|
17
|
-
*/ const Playbill = ({ release: Release = ReleaseNoteView.ReleaseNoteView, markdown, labels, locale, selected, onSelect, markSeenWhenShown = true })=>{
|
|
18
|
+
*/ const Playbill = ({ release: Release = ReleaseNoteView.ReleaseNoteView, markdown, labels, locale, issues, selected, onSelect, markSeenWhenShown = true })=>{
|
|
18
19
|
const client = PlaybillProvider.usePlaybillClient();
|
|
19
20
|
const { releases, current, isLoading, error, unreadVersions, markSeen } = usePlaybill.usePlaybill();
|
|
20
21
|
const resolved = react.useMemo(()=>resolveLabels.resolveLabels(labels), [
|
|
@@ -122,6 +123,7 @@ var useReleases = require('./useReleases.js');
|
|
|
122
123
|
labels: resolved,
|
|
123
124
|
markdown: markdown ?? PlaybillMarkdown.PlaybillMarkdown,
|
|
124
125
|
locale: locale,
|
|
126
|
+
issueRepository: issueRepositoryFor.issueRepositoryFor(issues, note.version),
|
|
125
127
|
isUnread: selectedIsUnread,
|
|
126
128
|
isCurrent: note.version === current
|
|
127
129
|
})
|
package/dist/cjs/Playbill.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Playbill.js","sources":["../../Playbill.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentType, useEffect, useMemo, useState } from 'react';\nimport { usePlaybillClient } from './Configuration/index.js';\nimport { PlaybillLabels, resolveLabels } from './Labels/index.js';\nimport { PlaybillMarkdown, PlaybillMarkdownProps } from './Markdown/index.js';\nimport { formatReleaseDate, ReleaseNoteView, ReleaseNoteViewProps } from './Release/index.js';\nimport { usePlaybill } from './usePlaybill.js';\nimport { useRelease } from './useReleases.js';\n\n/**\n * Props for {@link Playbill}.\n */\nexport interface PlaybillProps {\n /** Replaces how the selected release is drawn. */\n release?: ComponentType<ReleaseNoteViewProps>;\n /** Replaces the Markdown renderer the default release view uses, and that a custom one is given. */\n markdown?: ComponentType<PlaybillMarkdownProps>;\n /** The texts to replace; the rest stay English. */\n labels?: Partial<PlaybillLabels>;\n /** The locale to write the dates in; the browser's when not given. */\n locale?: string | string[];\n /** The version to show. Give it, with `onSelect`, to keep the selection in the address; by default the newest is selected. */\n selected?: string;\n /** Called when the person picks another release. */\n onSelect?: (version: string) => void;\n /** Records that the person has seen a release when it is shown. On by default; turn it off to leave what is unread to a dialog. */\n markSeenWhenShown?: boolean;\n}\n\n/**\n * The release notes of the application as a page: the releases newest first on one side and the selected release on the\n * other. It marks what the person has not seen with a tag, and records a release as seen when it is shown. Place it\n * where the application has room for a page, inside Arc's context. It draws no heading of its own.\n */\nexport const Playbill = ({\n release: Release = ReleaseNoteView,\n markdown,\n labels,\n locale,\n selected,\n onSelect,\n markSeenWhenShown = true\n}: PlaybillProps) => {\n const client = usePlaybillClient();\n const { releases, current, isLoading, error, unreadVersions, markSeen } = usePlaybill();\n const resolved = useMemo(() => resolveLabels(labels), [labels]);\n const [picked, setPicked] = useState<string>();\n const version = selected ?? picked ?? releases[0]?.version;\n const { data: note, isLoading: isLoadingNote, error: noteError } = useRelease(version);\n const isUnread = (candidate?: string) => candidate !== undefined && unreadVersions.includes(candidate);\n const selectedIsUnread = isUnread(version);\n\n useEffect(() => {\n if (markSeenWhenShown && note && selectedIsUnread) {\n // Failing to remember it must not keep a person from reading on.\n markSeen(note.version).catch(() => undefined);\n }\n }, [markSeenWhenShown, note, selectedIsUnread, markSeen]);\n\n const select = (next: string) => {\n setPicked(next);\n onSelect?.(next);\n };\n\n if (error || noteError) {\n return <p className='playbill-status playbill-status--failed' role='alert'>{resolved.failed}</p>;\n }\n\n if (isLoading) {\n return <p className='playbill-status' role='status'>{resolved.loading}</p>;\n }\n\n if (releases.length === 0) {\n return <p className='playbill-status'>{resolved.empty}</p>;\n }\n\n return (\n <div className='playbill'>\n <nav className='playbill__list' aria-label={resolved.releases}>\n <ul>\n {releases.map(summary => {\n const date = formatReleaseDate(summary.releasedAt, locale);\n const isSelected = summary.version === version;\n return (\n <li key={summary.version}>\n <button\n type='button'\n className={isSelected ? 'playbill-item playbill-item--selected' : 'playbill-item'}\n aria-current={isSelected ? 'true' : undefined}\n onClick={() => select(summary.version)}>\n <span className='playbill-item__heading'>\n <span className='playbill-item__version'>{summary.version}</span>\n {summary.version === current && <span className='playbill-tag playbill-tag--current'>{resolved.current}</span>}\n {isUnread(summary.version) && <span className='playbill-tag playbill-tag--unread'>{resolved.unread}</span>}\n </span>\n {date && <span className='playbill-item__date'>{date}</span>}\n {summary.summary && <span className='playbill-item__summary'>{summary.summary}</span>}\n </button>\n </li>\n );\n })}\n </ul>\n </nav>\n <div className='playbill__content'>\n {isLoadingNote && <p className='playbill-status' role='status'>{resolved.loading}</p>}\n {!isLoadingNote && note && (\n <Release\n release={note}\n assetBase={client.assetBase(note.version)}\n labels={resolved}\n markdown={markdown ?? PlaybillMarkdown}\n locale={locale}\n isUnread={selectedIsUnread}\n isCurrent={note.version === current} />\n )}\n </div>\n </div>\n );\n};\n"],"names":["Playbill","release","Release","ReleaseNoteView","markdown","labels","locale","selected","onSelect","markSeenWhenShown","client","usePlaybillClient","releases","current","isLoading","error","unreadVersions","markSeen","usePlaybill","resolved","useMemo","resolveLabels","picked","setPicked","useState","version","data","note","isLoadingNote","noteError","useRelease","isUnread","candidate","undefined","includes","selectedIsUnread","useEffect","catch","select","next","_jsx","p","className","role","failed","loading","length","empty","_jsxs","div","nav","aria-label","ul","map","summary","date","formatReleaseDate","releasedAt","isSelected","li","button","type","aria-current","onClick","span","unread","assetBase","PlaybillMarkdown","isCurrent"],"mappings":";;;;;;;;;;;;AA+BA;;;;UAKaA,QAAAA,GAAW,CAAC,EACrBC,OAAAA,EAASC,OAAAA,GAAUC,+BAAe,EAClCC,QAAQ,EACRC,MAAM,EACNC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACRC,iBAAAA,GAAoB,IAAI,EACZ,GAAA;AACZ,IAAA,MAAMC,MAAAA,GAASC,kCAAAA,EAAAA;AACf,IAAA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,EAAEC,KAAK,EAAEC,cAAc,EAAEC,QAAQ,EAAE,GAAGC,uBAAAA,EAAAA;AAC1E,IAAA,MAAMC,QAAAA,GAAWC,aAAAA,CAAQ,IAAMC,2BAAAA,CA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wBACtB7D,MAAAA,EAAQA,MAAAA;wBACRyB,QAAAA,EAAUI,gBAAAA;wBACViC,SAAAA,EAAWzC,IAAAA,CAAKF,OAAO,KAAKZ;;;;;;AAKpD;;"}
|
|
1
|
+
{"version":3,"file":"Playbill.js","sources":["../../Playbill.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentType, useEffect, useMemo, useState } from 'react';\nimport { usePlaybillClient } from './Configuration/index.js';\nimport { PlaybillLabels, resolveLabels } from './Labels/index.js';\nimport { PlaybillMarkdown, PlaybillMarkdownProps } from './Markdown/index.js';\nimport { formatReleaseDate, IssueRepository, issueRepositoryFor, ReleaseNoteView, ReleaseNoteViewProps } from './Release/index.js';\nimport { usePlaybill } from './usePlaybill.js';\nimport { useRelease } from './useReleases.js';\n\n/**\n * Props for {@link Playbill}.\n */\nexport interface PlaybillProps {\n /** Replaces how the selected release is drawn. */\n release?: ComponentType<ReleaseNoteViewProps>;\n /** Replaces the Markdown renderer the default release view uses, and that a custom one is given. */\n markdown?: ComponentType<PlaybillMarkdownProps>;\n /** The texts to replace; the rest stay English. */\n labels?: Partial<PlaybillLabels>;\n /** The locale to write the dates in; the browser's when not given. */\n locale?: string | string[];\n /** Where the issues of the releases are tracked, so `#123` in a note links to one. A function answers for each version. Not linked when not given. */\n issues?: IssueRepository;\n /** The version to show. Give it, with `onSelect`, to keep the selection in the address; by default the newest is selected. */\n selected?: string;\n /** Called when the person picks another release. */\n onSelect?: (version: string) => void;\n /** Records that the person has seen a release when it is shown. On by default; turn it off to leave what is unread to a dialog. */\n markSeenWhenShown?: boolean;\n}\n\n/**\n * The release notes of the application as a page: the releases newest first on one side and the selected release on the\n * other. It marks what the person has not seen with a tag, and records a release as seen when it is shown. Place it\n * where the application has room for a page, inside Arc's context. It draws no heading of its own.\n */\nexport const Playbill = ({\n release: Release = ReleaseNoteView,\n markdown,\n labels,\n locale,\n issues,\n selected,\n onSelect,\n markSeenWhenShown = true\n}: PlaybillProps) => {\n const client = usePlaybillClient();\n const { releases, current, isLoading, error, unreadVersions, markSeen } = usePlaybill();\n const resolved = useMemo(() => resolveLabels(labels), [labels]);\n const [picked, setPicked] = useState<string>();\n const version = selected ?? picked ?? releases[0]?.version;\n const { data: note, isLoading: isLoadingNote, error: noteError } = useRelease(version);\n const isUnread = (candidate?: string) => candidate !== undefined && unreadVersions.includes(candidate);\n const selectedIsUnread = isUnread(version);\n\n useEffect(() => {\n if (markSeenWhenShown && note && selectedIsUnread) {\n // Failing to remember it must not keep a person from reading on.\n markSeen(note.version).catch(() => undefined);\n }\n }, [markSeenWhenShown, note, selectedIsUnread, markSeen]);\n\n const select = (next: string) => {\n setPicked(next);\n onSelect?.(next);\n };\n\n if (error || noteError) {\n return <p className='playbill-status playbill-status--failed' role='alert'>{resolved.failed}</p>;\n }\n\n if (isLoading) {\n return <p className='playbill-status' role='status'>{resolved.loading}</p>;\n }\n\n if (releases.length === 0) {\n return <p className='playbill-status'>{resolved.empty}</p>;\n }\n\n return (\n <div className='playbill'>\n <nav className='playbill__list' aria-label={resolved.releases}>\n <ul>\n {releases.map(summary => {\n const date = formatReleaseDate(summary.releasedAt, locale);\n const isSelected = summary.version === version;\n return (\n <li key={summary.version}>\n <button\n type='button'\n className={isSelected ? 'playbill-item playbill-item--selected' : 'playbill-item'}\n aria-current={isSelected ? 'true' : undefined}\n onClick={() => select(summary.version)}>\n <span className='playbill-item__heading'>\n <span className='playbill-item__version'>{summary.version}</span>\n {summary.version === current && <span className='playbill-tag playbill-tag--current'>{resolved.current}</span>}\n {isUnread(summary.version) && <span className='playbill-tag playbill-tag--unread'>{resolved.unread}</span>}\n </span>\n {date && <span className='playbill-item__date'>{date}</span>}\n {summary.summary && <span className='playbill-item__summary'>{summary.summary}</span>}\n </button>\n </li>\n );\n })}\n </ul>\n </nav>\n <div className='playbill__content'>\n {isLoadingNote && <p className='playbill-status' role='status'>{resolved.loading}</p>}\n {!isLoadingNote && note && (\n <Release\n release={note}\n assetBase={client.assetBase(note.version)}\n labels={resolved}\n markdown={markdown ?? PlaybillMarkdown}\n locale={locale}\n issueRepository={issueRepositoryFor(issues, note.version)}\n isUnread={selectedIsUnread}\n isCurrent={note.version === current} />\n )}\n </div>\n </div>\n );\n};\n"],"names":["Playbill","release","Release","ReleaseNoteView","markdown","labels","locale","issues","selected","onSelect","markSeenWhenShown","client","usePlaybillClient","releases","current","isLoading","error","unreadVersions","markSeen","usePlaybill","resolved","useMemo","resolveLabels","picked","setPicked","useState","version","data","note","isLoadingNote","noteError","useRelease","isUnread","candidate","undefined","includes","selectedIsUnread","useEffect","catch","select","next","_jsx","p","className","role","failed","loading","length","empty","_jsxs","div","nav","aria-label","ul","map","summary","date","formatReleaseDate","releasedAt","isSelected","li","button","type","aria-current","onClick","span","unread","assetBase","PlaybillMarkdown","issueRepository","issueRepositoryFor","isCurrent"],"mappings":";;;;;;;;;;;;;AAiCA;;;;UAKaA,QAAAA,GAAW,CAAC,EACrBC,OAAAA,EAASC,OAAAA,GAAUC,+BAAe,EAClCC,QAAQ,EACRC,MAAM,EACNC,MAAM,EACNC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACRC,iBAAAA,GAAoB,IAAI,EACZ,GAAA;AACZ,IAAA,MAAMC,MAAAA,GAASC,kCAAAA,EAAAA;AACf,IAAA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,EAAEC,KAAK,EAAEC,cAAc,EAAEC,QAAQ,EAAE,GAAGC,uBAAAA,EAAAA;AAC1E,IAAA,MAAMC,QAAAA,GAAWC,aAAAA,CAAQ,IAAMC,2BAAAA,CAAcjB,MAAAA,CAAAA,EAAS;AAACA,QAAAA;AAAO,KAAA,CAAA;IAC9D,MAAM,CAACkB,MAAAA,EAAQC,SAAAA,CAAU,GAAGC,cAAAA,EAAAA;AAC5B,IAAA,MAAMC,UAAUlB,QAAAA,IAAYe,MAAAA,IAAUV,QAAQ,CAAC,EAAE,E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;;AAKpD;;"}
|
|
@@ -10,7 +10,8 @@ export interface ReleaseNoteViewProps {
|
|
|
10
10
|
locale?: string | string[];
|
|
11
11
|
isUnread?: boolean;
|
|
12
12
|
isCurrent?: boolean;
|
|
13
|
+
issueRepository?: string;
|
|
13
14
|
headingLevel?: 2 | 3 | 4;
|
|
14
15
|
}
|
|
15
|
-
export declare const ReleaseNoteView: ({ release, assetBase, labels, markdown: Markdown, locale, isUnread, isCurrent, headingLevel }: ReleaseNoteViewProps) => import("react").JSX.Element;
|
|
16
|
+
export declare const ReleaseNoteView: ({ release, assetBase, labels, markdown: Markdown, locale, isUnread, isCurrent, issueRepository, headingLevel }: ReleaseNoteViewProps) => import("react").JSX.Element;
|
|
16
17
|
//# sourceMappingURL=ReleaseNoteView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReleaseNoteView.d.ts","sourceRoot":"","sources":["../../../Release/ReleaseNoteView.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"ReleaseNoteView.d.ts","sourceRoot":"","sources":["../../../Release/ReleaseNoteView.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAyC,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAQpG,MAAM,WAAW,oBAAoB;IAEjC,OAAO,EAAE,OAAO,CAAC;IAEjB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,MAAM,EAAE,cAAc,CAAC;IAEvB,QAAQ,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAEhD,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CAC5B;AAMD,eAAO,MAAM,eAAe,GAAI,gHAU7B,oBAAoB,gCAiCtB,CAAC"}
|