@glimstone/react 4.8.1 → 4.8.3
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/dist/AboutCard.d.ts +62 -26
- package/dist/AboutCard.js +49 -40
- package/package.json +2 -2
package/dist/AboutCard.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type OpenUrl, type
|
|
3
|
-
export type { UpdateCheck, VersionRow } from "@glimstone/core";
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type ComponentRow, type ComponentsCardText, type OpenUrl, type UpdateRoute, type UpdateState, type VersionCardText } from "@glimstone/core";
|
|
3
|
+
export type { ComponentRow, ComponentsCardText, UpdateCheck, UpdateRoute, UpdateState, VersionCardText, VersionRow } from "@glimstone/core";
|
|
4
4
|
export interface InfoAboutCardProps {
|
|
5
5
|
text: {
|
|
6
6
|
title: string;
|
|
@@ -35,30 +35,65 @@ export interface InfoAboutCardProps {
|
|
|
35
35
|
/** The last card of the Info tile: who made the app, then the give row. */
|
|
36
36
|
export declare function InfoAboutCard({ text, onCoffee, coffeeArt, onPaypal, paypalGlyph, onCrypto, cryptoGlyph, hueIndex, }: InfoAboutCardProps): import("react").JSX.Element;
|
|
37
37
|
export interface InfoVersionCardProps {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
/** `componentText(lang).versionCard`, or the app's own words in its shape. */
|
|
39
|
+
text: VersionCardText;
|
|
40
|
+
/** The app's name, which fills "{app}" in the card's sentences. */
|
|
41
|
+
name: string;
|
|
42
|
+
/** Read from the build, never typed in. */
|
|
43
|
+
version: string;
|
|
44
|
+
/** The repository whose newest release the number opens. */
|
|
45
|
+
repoUrl?: string;
|
|
46
|
+
/** How the app gets a new version, which decides the one action. */
|
|
47
|
+
route: UpdateRoute;
|
|
48
|
+
/** Where the updates stand. The app finds out; the card shows it. */
|
|
49
|
+
state: UpdateState;
|
|
50
|
+
/** "Check for updates". A store app passes none. */
|
|
51
|
+
onCheck?: () => void;
|
|
52
|
+
/** Fetches and installs the new version, or leads to the host's plugin page. */
|
|
53
|
+
onUpdate?: () => void;
|
|
54
|
+
/** Starts the downloaded version. */
|
|
55
|
+
onRestart?: () => void;
|
|
56
|
+
/** Where a container's update instructions live. */
|
|
57
|
+
guideUrl?: string;
|
|
58
|
+
/** Opens the app's window of what changed, a card per release with its notes. */
|
|
59
|
+
onWhatsNew: () => void;
|
|
60
|
+
/** How many marked changes are still unseen. */
|
|
61
|
+
unseen?: number;
|
|
62
|
+
/** The switch under the state. Left out, the card draws none. */
|
|
63
|
+
autoUpdate?: boolean;
|
|
64
|
+
onAutoUpdateChange?: (on: boolean) => void;
|
|
65
|
+
openUrl?: OpenUrl;
|
|
66
|
+
hueIndex?: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The first card: the app's name and version, the switch, and a last row with
|
|
70
|
+
* where the updates stand at its start and the buttons at its end: "What's
|
|
71
|
+
* new", "Check for updates" while there is something to look for, and the one
|
|
72
|
+
* action once there is something to do.
|
|
73
|
+
*/
|
|
74
|
+
export declare function InfoVersionCard({ text, name, version, repoUrl, route, state, onCheck, onUpdate, onRestart, guideUrl, onWhatsNew, unseen, autoUpdate, onAutoUpdateChange, openUrl, hueIndex, }: InfoVersionCardProps): import("react").JSX.Element;
|
|
75
|
+
export interface InfoComponentsCardProps {
|
|
76
|
+
/** `componentText(lang).componentsCard`, or the app's own words in its shape. */
|
|
77
|
+
text: ComponentsCardText;
|
|
78
|
+
/** The app's name, which fills "{app}" in the card's sentences. */
|
|
79
|
+
name: string;
|
|
80
|
+
/** The app's own parts, the programs it brings along and, for a desktop
|
|
81
|
+
* build, its installer. The card adds the design language and sorts them. */
|
|
82
|
+
rows: ComponentRow[];
|
|
83
|
+
/** The switch for updating the components. Left out, the card draws none. */
|
|
84
|
+
autoUpdate?: boolean;
|
|
85
|
+
onAutoUpdateChange?: (on: boolean) => void;
|
|
86
|
+
/** "Update components" at the foot of the card. Omit it where the app updates none. */
|
|
87
|
+
onUpdate?: () => void;
|
|
88
|
+
updating?: boolean;
|
|
57
89
|
openUrl?: OpenUrl;
|
|
58
90
|
hueIndex?: number;
|
|
59
91
|
}
|
|
60
|
-
/**
|
|
61
|
-
|
|
92
|
+
/**
|
|
93
|
+
* The second card: every version the app is made of or brings along, as plain
|
|
94
|
+
* numbers in a fixed order, with a status and one action on a row that needs one.
|
|
95
|
+
*/
|
|
96
|
+
export declare function InfoComponentsCard({ text, name, rows, autoUpdate, onAutoUpdateChange, onUpdate, updating, openUrl, hueIndex, }: InfoComponentsCardProps): import("react").JSX.Element;
|
|
62
97
|
export interface InfoHelpCardProps {
|
|
63
98
|
text: {
|
|
64
99
|
title?: string;
|
|
@@ -109,6 +144,7 @@ export interface InfoHelpCardProps {
|
|
|
109
144
|
export declare function InfoHelpCard({ text, repoUrl, repoGlyph, discordUrl, discordGlyph, mailAddress, mailGlyph, manualUrl, manualGlyph, onBugReport, bugGlyph, openUrl, hueIndex, }: InfoHelpCardProps): import("react").JSX.Element;
|
|
110
145
|
export interface InfoTileProps {
|
|
111
146
|
version: Omit<InfoVersionCardProps, "hueIndex">;
|
|
147
|
+
components: Omit<InfoComponentsCardProps, "hueIndex">;
|
|
112
148
|
help: Omit<InfoHelpCardProps, "hueIndex">;
|
|
113
149
|
about: Omit<InfoAboutCardProps, "hueIndex">;
|
|
114
150
|
/** The Version card's rainbow position; the cards after it take the next ones. */
|
|
@@ -116,8 +152,8 @@ export interface InfoTileProps {
|
|
|
116
152
|
/** Data attributes for the tile, so a component built on it can name itself. */
|
|
117
153
|
[data: `data-${string}`]: string | undefined;
|
|
118
154
|
}
|
|
119
|
-
/** The Info tile's cards in their fixed order, for the page that stacks them. */
|
|
120
|
-
export declare function InfoTile({ version, help, about, hueIndex, ...data }: InfoTileProps): import("react").JSX.Element;
|
|
155
|
+
/** The Info tile's cards in their fixed order, Version, Components, Help and About, for the page that stacks them. */
|
|
156
|
+
export declare function InfoTile({ version, components, help, about, hueIndex, ...data }: InfoTileProps): import("react").JSX.Element;
|
|
121
157
|
/**
|
|
122
158
|
* The 3.2.0 props of the single About card, laid out as the Info tile: the
|
|
123
159
|
* About card under `text.title`, the Version card under `text.version` with the
|
package/dist/AboutCard.js
CHANGED
|
@@ -1,35 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { mailHref, offersDiscord, offersMail, openInBrowser, runUpdateCheck, updateFace, updateStage, versionLink, warnDeprecated, } from "@glimstone/core";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { autoSwitch, checkButton, componentRows, designRow, mailHref, numberLink, offersDiscord, offersMail, openInBrowser, updateAction, updateLine, versionLink, warnDeprecated, whatsNewLabel, withApp, } from "@glimstone/core";
|
|
4
3
|
import { Button } from "./Button.js";
|
|
5
4
|
import { Card } from "./Card.js";
|
|
5
|
+
import { FieldRow } from "./FieldRow.js";
|
|
6
|
+
import { InfoBubble } from "./InfoBubble.js";
|
|
6
7
|
import { ReadmeButton } from "./ReadmeButton.js";
|
|
8
|
+
import { Toggle } from "./Toggle.js";
|
|
7
9
|
/** The last card of the Info tile: who made the app, then the give row. */
|
|
8
10
|
export function InfoAboutCard({ text, onCoffee, coffeeArt, onPaypal, paypalGlyph, onCrypto, cryptoGlyph, hueIndex, }) {
|
|
9
11
|
return (_jsxs(Card, { "data-glim": "InfoAboutCard", title: text.title, hueIndex: hueIndex, children: [_jsx("p", { className: "glim-info-text", children: text.body }), _jsx("p", { className: "glim-info-text", children: text.coffee }), _jsxs("div", { className: "glim-readme-btn-rows glim-about-give", children: [_jsx(ReadmeButton, { brand: "coffee", parts: [{ name: text.coffeeButton, onClick: onCoffee }], art: coffeeArt }), onPaypal && text.paypalButton && (_jsx(ReadmeButton, { brand: "paypal", parts: [{ name: text.paypalButton, onClick: onPaypal }], mark: paypalGlyph, markClass: "glim-paypal-mark" })), onCrypto && text.cryptoButton && (_jsx(ReadmeButton, { brand: "bitcoin", parts: [{ name: text.cryptoButton, onClick: onCrypto }], mark: cryptoGlyph, markClass: "glim-bitcoin-mark" }))] })] }));
|
|
10
12
|
}
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The first card: the app's name and version, the switch, and a last row with
|
|
15
|
+
* where the updates stand at its start and the buttons at its end: "What's
|
|
16
|
+
* new", "Check for updates" while there is something to look for, and the one
|
|
17
|
+
* action once there is something to do.
|
|
18
|
+
*/
|
|
19
|
+
export function InfoVersionCard({ text, name, version, repoUrl, route, state, onCheck, onUpdate, onRestart, guideUrl, onWhatsNew, unseen = 0, autoUpdate, onAutoUpdateChange, openUrl = openInBrowser, hueIndex, }) {
|
|
20
|
+
const face = updateLine(state, text);
|
|
21
|
+
const action = updateAction(route, state, text);
|
|
22
|
+
const toggle = autoSwitch(route, text);
|
|
23
|
+
const check = checkButton(route, state);
|
|
24
|
+
const press = () => {
|
|
25
|
+
if (action?.kind === "restart")
|
|
26
|
+
onRestart?.();
|
|
27
|
+
else if (action?.kind === "guide")
|
|
28
|
+
guideUrl && openUrl(guideUrl);
|
|
29
|
+
else
|
|
30
|
+
onUpdate?.();
|
|
31
|
+
};
|
|
32
|
+
return (_jsxs(Card, { "data-glim": "InfoVersionCard", title: text.title, hint: withApp(text.hint, name), hueIndex: hueIndex, children: [_jsxs("div", { className: "glim-version-head", children: [_jsx("span", { className: "glim-version-app", children: name }), _jsx(VersionNumber, { row: { name, version, repoUrl }, unreleased: text.unreleased, openUrl: openUrl })] }), toggle && autoUpdate !== undefined && (_jsx(FieldRow, { label: toggle.label, hint: withApp(toggle.hint, name), children: _jsx(Toggle, { checked: autoUpdate, onChange: (on) => onAutoUpdateChange?.(on), label: toggle.label, hideLabel: true }) })), state.kind === "downloading" && (_jsx("div", { className: "glim-version-progress", role: "progressbar", "aria-label": face.line, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": state.percent, children: _jsx("span", { style: { width: `${state.percent}%` } }) })), _jsxs("div", { className: "glim-version-foot", children: [_jsxs("p", { className: "glim-version-state", "data-tone": face.tone, role: "status", children: [_jsx("span", { className: "glim-version-line", children: face.line }), face.note && _jsx("span", { className: "glim-version-note", children: face.note })] }), _jsxs("div", { className: "glim-version-actions", children: [_jsx(Button, { label: whatsNewLabel(text, unseen), labelKey: "version.whatsNew", before: _jsx("span", { className: "glim-version-dot", "data-unseen": unseen > 0 ? "" : undefined, "aria-hidden": "true" }), onClick: onWhatsNew }), check && onCheck && _jsx(Button, { label: text.check, labelKey: "version.check", busy: check.busy, disabled: check.busy, onClick: onCheck }), action && _jsx(Button, { label: action.label, labelKey: action.labelKey, tone: action.kind === "guide" ? "neutral" : "accent", onClick: press })] })] })] }));
|
|
15
33
|
}
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return (_jsxs(
|
|
22
|
-
setVerdict(v);
|
|
23
|
-
if (v.kind === "failed")
|
|
24
|
-
setShake((n) => n + 1);
|
|
25
|
-
}), className: shake > 0 ? "glim-shake" : "" }, shake), _jsx("span", { role: "status", className: "glim-sr-only", children: face.announced })] }));
|
|
34
|
+
/**
|
|
35
|
+
* The second card: every version the app is made of or brings along, as plain
|
|
36
|
+
* numbers in a fixed order, with a status and one action on a row that needs one.
|
|
37
|
+
*/
|
|
38
|
+
export function InfoComponentsCard({ text, name, rows, autoUpdate, onAutoUpdateChange, onUpdate, updating = false, openUrl = openInBrowser, hueIndex, }) {
|
|
39
|
+
return (_jsxs(Card, { "data-glim": "InfoComponentsCard", title: text.title, hint: withApp(text.hint, name), hueIndex: hueIndex, children: [_jsx("ul", { className: "glim-version-rows", children: componentRows([...rows, designRow(text)]).map((row) => (_jsxs("li", { className: "glim-version-row", children: [_jsxs("span", { className: "glim-version-name", children: [_jsx("span", { className: "glim-version-part", children: row.name }), row.hint && _jsx(InfoBubble, { tip: row.hint })] }), _jsxs("span", { className: "glim-version-end", children: [row.status && (_jsx("span", { className: "glim-version-status", "data-tone": row.tone, children: row.status })), _jsxs("span", { className: "glim-version-tail", children: [row.action && _jsx(Button, { label: row.action.label, labelKey: row.action.labelKey, onClick: row.action.onClick }), _jsx(VersionNumber, { row: row, unreleased: text.unreleased, openUrl: openUrl })] })] })] }, row.name))) }), autoUpdate !== undefined && (_jsx(FieldRow, { label: text.auto, hint: withApp(text.autoHint, name), children: _jsx(Toggle, { checked: autoUpdate, onChange: (on) => onAutoUpdateChange?.(on), label: text.auto, hideLabel: true }) })), onUpdate && (_jsx("div", { className: "glim-version-actions", children: _jsx(Button, { label: text.update, labelKey: "components.update", busy: updating, onClick: onUpdate }) }))] }));
|
|
26
40
|
}
|
|
27
41
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
42
|
+
* A number that reads as plain text and opens the newest release of its
|
|
43
|
+
* project. It takes the accent's ink under the pointer, never an underline.
|
|
30
44
|
*/
|
|
31
45
|
function VersionNumber({ row, unreleased, openUrl }) {
|
|
32
|
-
const { shown, released, href } =
|
|
46
|
+
const { shown, released, href } = numberLink(row);
|
|
33
47
|
if (!href)
|
|
34
48
|
return _jsx("span", { className: "glim-num glim-version-number", children: released ? shown : unreleased(shown) });
|
|
35
49
|
return (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", onClick: (e) => {
|
|
@@ -48,10 +62,10 @@ export function InfoHelpCard({ text, repoUrl, repoGlyph, discordUrl, discordGlyp
|
|
|
48
62
|
},
|
|
49
63
|
], mark: mailGlyph, markClass: "glim-house-mark" })), manualUrl && text.manual && (_jsx(ReadmeButton, { brand: "docs", parts: [{ name: text.manual, sub: text.manualSub, onClick: () => openUrl(manualUrl) }], mark: manualGlyph, markClass: "glim-docs-mark" })), onBugReport && text.bugReport && (_jsx(ReadmeButton, { brand: "github", parts: [{ name: text.bugReport, sub: text.bugReportSub, onClick: onBugReport }], mark: bugGlyph }))] })] }));
|
|
50
64
|
}
|
|
51
|
-
/** The Info tile's cards in their fixed order, for the page that stacks them. */
|
|
52
|
-
export function InfoTile({ version, help, about, hueIndex, ...data }) {
|
|
65
|
+
/** The Info tile's cards in their fixed order, Version, Components, Help and About, for the page that stacks them. */
|
|
66
|
+
export function InfoTile({ version, components, help, about, hueIndex, ...data }) {
|
|
53
67
|
const at = (offset) => (hueIndex === undefined ? undefined : hueIndex + offset);
|
|
54
|
-
return (_jsxs("div", { "data-glim": "InfoTile", ...data, style: { display: "contents" }, children: [_jsx(InfoVersionCard, { ...version, hueIndex: at(0) }), _jsx(InfoHelpCard, { ...help, hueIndex: at(
|
|
68
|
+
return (_jsxs("div", { "data-glim": "InfoTile", ...data, style: { display: "contents" }, children: [_jsx(InfoVersionCard, { ...version, hueIndex: at(0) }), _jsx(InfoComponentsCard, { ...components, hueIndex: at(1) }), _jsx(InfoHelpCard, { ...help, hueIndex: at(2) }), _jsx(InfoAboutCard, { ...about, hueIndex: at(3) })] }));
|
|
55
69
|
}
|
|
56
70
|
/**
|
|
57
71
|
* The 3.2.0 props of the single About card, laid out as the Info tile: the
|
|
@@ -67,21 +81,16 @@ export function AboutCard({ text, version, glimstoneVersion, repoUrl, repoGlyph,
|
|
|
67
81
|
...(version ? [{ name: text.version, version, repoUrl }] : []),
|
|
68
82
|
{ name: "GlimStone", version: glimstoneVersion, repoUrl: glimstoneRepoUrl },
|
|
69
83
|
];
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
discordGlyph,
|
|
83
|
-
mailAddress,
|
|
84
|
-
mailGlyph,
|
|
85
|
-
openUrl,
|
|
86
|
-
} }));
|
|
84
|
+
const at = (offset) => (hueIndex === undefined ? undefined : hueIndex + offset);
|
|
85
|
+
return (_jsxs("div", { "data-glim": "AboutCard", style: { display: "contents" }, children: [_jsx(Card, { title: text.version, hueIndex: at(0), children: _jsx("ul", { className: "glim-version-rows", children: rows.map((row) => {
|
|
86
|
+
const { shown, released, href } = versionLink(row);
|
|
87
|
+
return (_jsxs("li", { className: "glim-version-row", children: [_jsx("span", { className: "glim-version-name", children: _jsx("span", { className: "glim-version-part", children: row.name }) }), href ? (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", className: "glim-num glim-version-number", children: shown })) : (_jsx("span", { className: "glim-num glim-version-number", children: released ? shown : text.unreleased(shown) }))] }, row.name));
|
|
88
|
+
}) }) }), _jsx(InfoHelpCard, { hueIndex: at(1), text: {
|
|
89
|
+
title: text.helpTitle,
|
|
90
|
+
report: text.report,
|
|
91
|
+
repoButton: text.repoButton,
|
|
92
|
+
discordButton: text.discordButton,
|
|
93
|
+
mailButton: text.mailButton,
|
|
94
|
+
mailSubject: text.mailSubject,
|
|
95
|
+
}, repoUrl: repoUrl, repoGlyph: repoGlyph, discordUrl: discordUrl, discordGlyph: discordGlyph, mailAddress: mailAddress, mailGlyph: mailGlyph, openUrl: openUrl }), _jsx(InfoAboutCard, { hueIndex: at(2), text: text, onCoffee: onCoffee, coffeeArt: coffeeArt, onPaypal: onPaypal, paypalGlyph: paypalGlyph, onCrypto: onCrypto, cryptoGlyph: cryptoGlyph })] }));
|
|
87
96
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glimstone/react",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.3",
|
|
4
4
|
"description": "GlimStone's components for React",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": { "type": "git", "url": "git+https://github.com/junkerderprovinz/glimstone.git", "directory": "packages/react" },
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"build": "tsc -p tsconfig.build.json"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@glimstone/core": "4.8.
|
|
19
|
+
"@glimstone/core": "4.8.3"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@internationalized/date": "^3.12.4",
|