@cloudgrid-io/ui 0.66.0 → 0.68.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/dist/badge/owner.js +1 -1
- package/dist/badge/owner.js.map +1 -1
- package/dist/blocks/add-tile.d.ts +34 -1
- package/dist/blocks/add-tile.d.ts.map +1 -1
- package/dist/blocks/add-tile.js +34 -1
- package/dist/blocks/add-tile.js.map +1 -1
- package/dist/blocks/creation-search.d.ts +10 -1
- package/dist/blocks/creation-search.d.ts.map +1 -1
- package/dist/blocks/creation-search.js +5 -1
- package/dist/blocks/creation-search.js.map +1 -1
- package/dist/blocks/entity-card.d.ts.map +1 -1
- package/dist/blocks/entity-card.js +2 -2
- package/dist/blocks/entity-card.js.map +1 -1
- package/dist/blocks/entity-identity.d.ts +24 -1
- package/dist/blocks/entity-identity.d.ts.map +1 -1
- package/dist/blocks/entity-identity.js +19 -0
- package/dist/blocks/entity-identity.js.map +1 -1
- package/dist/blocks/header-menu.d.ts +6 -3
- package/dist/blocks/header-menu.d.ts.map +1 -1
- package/dist/blocks/header-menu.js +18 -11
- package/dist/blocks/header-menu.js.map +1 -1
- package/dist/blocks/home-bento.d.ts +1 -1
- package/dist/blocks/home-bento.js +1 -1
- package/dist/blocks/home-pinned.d.ts +144 -42
- package/dist/blocks/home-pinned.d.ts.map +1 -1
- package/dist/blocks/home-pinned.js +149 -28
- package/dist/blocks/home-pinned.js.map +1 -1
- package/dist/blocks/image-adjust-dialog.d.ts.map +1 -1
- package/dist/blocks/image-adjust-dialog.js +1 -1
- package/dist/blocks/image-adjust-dialog.js.map +1 -1
- package/dist/blocks/inspiration-cards.d.ts +98 -36
- package/dist/blocks/inspiration-cards.d.ts.map +1 -1
- package/dist/blocks/inspiration-cards.js +146 -27
- package/dist/blocks/inspiration-cards.js.map +1 -1
- package/dist/blocks/recent-plugs.d.ts +12 -0
- package/dist/blocks/recent-plugs.d.ts.map +1 -1
- package/dist/blocks/recent-plugs.js +4 -1
- package/dist/blocks/recent-plugs.js.map +1 -1
- package/dist/blocks/top-creations.d.ts +10 -0
- package/dist/blocks/top-creations.d.ts.map +1 -1
- package/dist/blocks/top-creations.js +6 -1
- package/dist/blocks/top-creations.js.map +1 -1
- package/dist/lib/thumbnail-identity.d.ts +47 -0
- package/dist/lib/thumbnail-identity.d.ts.map +1 -0
- package/dist/lib/thumbnail-identity.js +59 -0
- package/dist/lib/thumbnail-identity.js.map +1 -0
- package/package.json +2 -2
|
@@ -21,6 +21,12 @@ import * as React from "react";
|
|
|
21
21
|
* the names stay in one column. The thumbnail is decoration: the name beside
|
|
22
22
|
* it says what it is.
|
|
23
23
|
*
|
|
24
|
+
* A plug with a `seed` (its creation's id) fills that place with the
|
|
25
|
+
* creation's identity tile instead (ui#573), as the creation's card does; with
|
|
26
|
+
* a picture, the identity is under it, so a picture that fails to load shows
|
|
27
|
+
* the identity rather than a blank. The seeded thumbnail is a 48 by 36 box with
|
|
28
|
+
* the identity and the picture in it; without a `seed`, the row is as before.
|
|
29
|
+
*
|
|
24
30
|
* ## Empty
|
|
25
31
|
*
|
|
26
32
|
* No "See all": the CloudGrid plug joined to a creation tile with a live dot
|
|
@@ -53,6 +59,12 @@ type RecentPlug = {
|
|
|
53
59
|
thumbnailSrc?: string;
|
|
54
60
|
/** Where the row goes: the plug's progress or logs. */
|
|
55
61
|
href?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The creation's stable id, the one its card passes as `seed`, not the
|
|
64
|
+
* plug's (ui#573). With it, no picture (or one that fails to load) shows the
|
|
65
|
+
* creation's identity tile, from this and `name`, rather than a blank.
|
|
66
|
+
*/
|
|
67
|
+
seed?: string;
|
|
56
68
|
};
|
|
57
69
|
declare function RecentPlugs({ items, seeAllHref, title, seeAllLabel, emptyText, emptyPicture, hint, className, ...props }: Omit<React.ComponentProps<"section">, "title" | "children"> & {
|
|
58
70
|
/** The plugs, latest first. None is the empty state. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recent-plugs.d.ts","sourceRoot":"","sources":["../../src/blocks/recent-plugs.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"recent-plugs.d.ts","sourceRoot":"","sources":["../../src/blocks/recent-plugs.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAU9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,KAAK,UAAU,GAAG;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,0CAA0C;IAC1C,MAAM,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,8BAA8B;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AA8DD,iBAAS,WAAW,CAAC,EACnB,KAAK,EACL,UAAU,EACV,KAAsB,EACtB,WAAuB,EACvB,SAA6D,EAC7D,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,GAAG;IAC/D,wDAAwD;IACxD,KAAK,EAAE,SAAS,UAAU,EAAE,CAAA;IAC5B,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,iFAAiF;IACjF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,2FAA2F;IAC3F,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;CAClB,qBAoCA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA;AACtB,YAAY,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -7,9 +7,12 @@ import { BentoCard } from "./bento-card.js";
|
|
|
7
7
|
import { PlugToLiveIllustration } from "./home-empty-illustrations.js";
|
|
8
8
|
import { ForwardIcon } from "./icons.js";
|
|
9
9
|
import { StaggerReveal } from "./motion.js";
|
|
10
|
+
import { PictureOverIdentity, THUMBNAIL_WITH_IDENTITY, ThumbnailIdentity } from "../lib/thumbnail-identity.js";
|
|
10
11
|
const ROW_CLASS = "flex min-h-16.25 min-w-0 items-center gap-3";
|
|
11
12
|
function RecentPlugRow({ plug }) {
|
|
12
|
-
const content = (_jsxs(_Fragment, { children: [plug.
|
|
13
|
+
const content = (_jsxs(_Fragment, { children: [plug.seed !== undefined ? (_jsxs("span", { "data-slot": "recent-plugs-thumbnail", "aria-hidden": "true", className: cn("h-9 w-12 shrink-0 overflow-hidden rounded-xs bg-page", THUMBNAIL_WITH_IDENTITY), children: [_jsx(ThumbnailIdentity, { seed: plug.seed, name: plug.name, size: "thumb" }), plug.thumbnailSrc ? (
|
|
14
|
+
// Taken out if it fails, so the identity shows.
|
|
15
|
+
_jsx(PictureOverIdentity, { "data-slot": "recent-plugs-picture", src: plug.thumbnailSrc, alt: "", className: "block size-full object-cover" })) : null] })) : plug.thumbnailSrc ? (_jsx("img", { "data-slot": "recent-plugs-thumbnail", src: plug.thumbnailSrc, alt: "", className: "h-9 w-12 shrink-0 rounded-xs object-cover" })) : (_jsx("span", { "data-slot": "recent-plugs-thumbnail", "aria-hidden": "true", className: "h-9 w-12 shrink-0 rounded-xs bg-page" })), _jsxs("span", { className: "grid min-w-0 flex-1 gap-0.5", children: [_jsx("span", { "data-slot": "recent-plugs-name", className: cn("truncate text-body-sm font-medium text-ink", plug.href !== undefined && "group-hover/plug:underline"), children: plug.version === undefined || plug.version === null ? plug.name : `${plug.name} · v${plug.version}` }), _jsx("span", { "data-slot": "recent-plugs-status", className: "text-caption text-faint-strong", children: plug.status })] })] }));
|
|
13
16
|
return (_jsx("li", { "data-slot": "recent-plugs-item", children: plug.href !== undefined ? (_jsx("a", { "data-slot": "recent-plugs-row", href: plug.href, className: cn(ROW_CLASS, "group/plug rounded-xs text-inherit no-underline underline-offset-4 outline-none focus-line"), children: content })) : (_jsx("div", { "data-slot": "recent-plugs-row", className: ROW_CLASS, children: content })) }));
|
|
14
17
|
}
|
|
15
18
|
function RecentPlugs({ items, seeAllHref, title = "Recent plugs", seeAllLabel = "See all", emptyText = "Your plugs and build progress will appear here.", emptyPicture, hint, className, ...props }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recent-plugs.js","sourceRoot":"","sources":["../../src/blocks/recent-plugs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAA;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"recent-plugs.js","sourceRoot":"","sources":["../../src/blocks/recent-plugs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,UAA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,IAAI,EAAE,UAAU,EAAE,SAAS,EAAC,SAAS,aAC7F,WAAW,EACZ,KAAC,WAAW,IAAC,SAAS,EAAC,QAAQ,GAAG,IACvB,CACd,CAAC,CAAC,CAAC,SAAS,EAEf,SAAS,EAAE,EAAE,CAAC,KAAK,IAAI,OAAO,EAAE,SAAS,CAAC,EAC1C,IAAI,EAAE,IAAI,KACN,KAAK,YAER,KAAK,CAAC,CAAC,CAAC,CACP,MAAC,aAAa,IAAC,SAAS,EAAC,kCAAkC,aACzD,KAAC,sBAAsB,IAAC,OAAO,EAAE,YAAY,GAAI,EACjD,yBAAa,yBAAyB,EAAC,SAAS,EAAC,gDAAgD,YAC9F,SAAS,GACR,IACU,CACjB,CAAC,CAAC,CAAC,CACF,0BAAc,mBAAmB,EAAC,SAAS,EAAC,gCAAgC,YACzE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,KAAC,aAAa,IAAe,IAAI,EAAE,IAAI,IAAnB,IAAI,CAAC,EAAE,CAAgB,CAC5C,CAAC,GACC,CACN,GACS,CACb,CAAA;AACH,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -26,6 +26,10 @@ import * as React from "react";
|
|
|
26
26
|
* empty the picture (224 by 157: three small creations, each with a
|
|
27
27
|
* ranked bar), 24, then the line in Body, `text-faint-strong`
|
|
28
28
|
*
|
|
29
|
+
* A row with a `seed` and no picture shows the creation's identity tile in the
|
|
30
|
+
* thumbnail (ui#573), as its card does; with a picture the identity is under
|
|
31
|
+
* it, for a picture that fails to load. Without a `seed`, the blank as before.
|
|
32
|
+
*
|
|
29
33
|
* The meters are `aria-hidden`, as in `RankedList`: the count is printed
|
|
30
34
|
* beside the name, and the list is an `<ol>`, so the rank is its position.
|
|
31
35
|
*/
|
|
@@ -40,6 +44,12 @@ export type TopCreation = {
|
|
|
40
44
|
thumbnailSrc?: string;
|
|
41
45
|
/** Where the row goes. */
|
|
42
46
|
href?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The creation's stable id, the one its card passes as `seed` (ui#573). With
|
|
49
|
+
* it, no picture (or one that fails to load) shows its identity tile, from
|
|
50
|
+
* this and `name`, rather than a blank.
|
|
51
|
+
*/
|
|
52
|
+
seed?: string;
|
|
43
53
|
};
|
|
44
54
|
/** Three small creations, each with a ranked bar: the empty My top creations. */
|
|
45
55
|
declare function TopCreationsIllustration({ className, ...props }: Omit<React.ComponentProps<"div">, "children">): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"top-creations.d.ts","sourceRoot":"","sources":["../../src/blocks/top-creations.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"top-creations.d.ts","sourceRoot":"","sources":["../../src/blocks/top-creations.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAU9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,uCAAuC;AACvC,MAAM,MAAM,WAAW,GAAG;IACxB,sDAAsD;IACtD,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAmBD,iFAAiF;AACjF,iBAAS,wBAAwB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,qBA0DvG;AAmED,iBAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,GAAG,EACH,WAA+B,EAC/B,QAAe,EACf,aAAa,EACb,UAAkE,EAClE,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+7,9 @@ import { chartValue, formatChartNumber } from "./chart-parts.js";
|
|
|
7
7
|
import { EMPTY_CREATIONS_PREVIEWS } from "./empty-creations-previews.js";
|
|
8
8
|
import { Meter } from "./meter.js";
|
|
9
9
|
import { AnimatedNumber, MeterFill } from "./motion.js";
|
|
10
|
+
import { PictureOverIdentity, THUMBNAIL_WITH_IDENTITY, ThumbnailIdentity } from "../lib/thumbnail-identity.js";
|
|
11
|
+
/** A row's picture: 48 by 34 at radius 8. */
|
|
12
|
+
const THUMBNAIL = "block h-8.5 w-12 shrink-0 overflow-hidden rounded-xs bg-raised";
|
|
10
13
|
/** The empty picture's three creations: the covers, top to bottom. */
|
|
11
14
|
const EMPTY_PICTURES = [EMPTY_CREATIONS_PREVIEWS[2], EMPTY_CREATIONS_PREVIEWS[0], EMPTY_CREATIONS_PREVIEWS[1]];
|
|
12
15
|
/** The empty picture, on its 224 by 156.8 box, as the design draws it. */
|
|
@@ -27,7 +30,9 @@ function TopCreationsIllustration({ className, ...props }) {
|
|
|
27
30
|
function TopCreationsRow({ item, max, formatCount, animated, linkComponent, }) {
|
|
28
31
|
const count = chartValue(item.count);
|
|
29
32
|
const bar = _jsx(Meter, { "aria-hidden": "true", size: "sm", tone: "home", value: count, max: max });
|
|
30
|
-
const content = (_jsxs(_Fragment, { children: [
|
|
33
|
+
const content = (_jsxs(_Fragment, { children: [_jsxs("span", { "data-slot": "top-creations-thumbnail", className: item.seed === undefined ? THUMBNAIL : `${THUMBNAIL} ${THUMBNAIL_WITH_IDENTITY}`, children: [item.seed !== undefined ? _jsx(ThumbnailIdentity, { seed: item.seed, name: item.name, size: "thumb" }) : null, item.thumbnailSrc !== undefined && item.seed !== undefined ? (
|
|
34
|
+
// Taken out if it fails, so the identity shows (ui#573).
|
|
35
|
+
_jsx(PictureOverIdentity, { src: item.thumbnailSrc, alt: "", decoding: "async", draggable: false, className: "block size-full object-cover" })) : item.thumbnailSrc !== undefined ? (_jsx("img", { src: item.thumbnailSrc, alt: "", decoding: "async", draggable: false, className: "block size-full object-cover" })) : null] }), _jsxs("span", { "data-slot": "top-creations-text", className: "grid min-w-0 flex-1 gap-1.5", children: [_jsxs("span", { className: "flex min-w-0 items-center justify-between gap-3 text-caption", children: [_jsx("span", { "data-slot": "top-creations-name", className: "min-w-0 truncate text-caption font-medium", children: item.name }), _jsx("span", { "data-slot": "top-creations-count", className: "shrink-0 text-end text-caption tabular-nums", children: animated ? _jsx(AnimatedNumber, { value: formatCount(count) }) : formatCount(count) })] }), animated ? _jsx(MeterFill, { children: bar }) : bar] })] }));
|
|
31
36
|
const row = "flex min-h-13 min-w-0 items-center gap-3";
|
|
32
37
|
if (item.href === undefined) {
|
|
33
38
|
return (_jsx("li", { "data-slot": "top-creations-row", className: row, children: content }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"top-creations.js","sourceRoot":"","sources":["../../src/blocks/top-creations.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAA;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"top-creations.js","sourceRoot":"","sources":["../../src/blocks/top-creations.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAA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,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,EAAE,SAAS,CAAC,KAAM,KAAK,YACzG,KAAC,gBAAgB,IACf,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,GACtB,GACQ,CACb,CAAA;AACH,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type EntityIdentitySize } from "../blocks/entity-identity.js";
|
|
3
|
+
/**
|
|
4
|
+
* THE IDENTITY UNDER A HOME THUMBNAIL (ui#573).
|
|
5
|
+
*
|
|
6
|
+
* A Home thumbnail (Pinned, Continue where you left off, My top creations,
|
|
7
|
+
* Recent plugs, the search window's rows) is a box with an `<img>` in it, or
|
|
8
|
+
* nothing. An item with a `seed` puts the creation's identity tile in that box
|
|
9
|
+
* too, from the seed and the name, as its card in My creations does: it fills
|
|
10
|
+
* the box, BEHIND the picture. A picture that paints covers it; no picture, or
|
|
11
|
+
* one that fails to load, shows it. The picture element is untouched.
|
|
12
|
+
*
|
|
13
|
+
* Behind, because the picture is an `<img>` in the flow and the identity is
|
|
14
|
+
* positioned, and a positioned element would otherwise paint over it: so the
|
|
15
|
+
* identity is `-z-10` and the box takes `THUMBNAIL_WITH_IDENTITY`, which makes it
|
|
16
|
+
* the stacking context that keeps the identity above the box's own ground.
|
|
17
|
+
*
|
|
18
|
+
* A picture that fails to load is taken out (`PictureOverIdentity`), because
|
|
19
|
+
* a broken `<img>` with a size is not always nothing: Chromium and WebKit both
|
|
20
|
+
* draw their broken-picture mark in it, alt="" or not, over the identity.
|
|
21
|
+
*
|
|
22
|
+
* Not exported from the package: the pieces' `seed` is the API.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ThumbnailIdentity({ seed, name, size, className, }: {
|
|
25
|
+
seed: string;
|
|
26
|
+
name: string;
|
|
27
|
+
size: EntityIdentitySize;
|
|
28
|
+
className?: string;
|
|
29
|
+
}): React.JSX.Element;
|
|
30
|
+
/** What a thumbnail's box adds when it holds an identity: positioned, and its own stacking context. */
|
|
31
|
+
export declare const THUMBNAIL_WITH_IDENTITY = "relative isolate";
|
|
32
|
+
/**
|
|
33
|
+
* A thumbnail's picture over its identity: the `<img>` the piece already drew,
|
|
34
|
+
* with the same attributes in the same order (so the server's markup is the
|
|
35
|
+
* same), taken out once it fails to load, so the identity under it shows
|
|
36
|
+
* rather than the browser's broken-picture mark.
|
|
37
|
+
*
|
|
38
|
+
* Two ways a failure is heard: `onError`, and, for a picture that failed
|
|
39
|
+
* before the page hydrated (whose error event no handler was there to hear),
|
|
40
|
+
* a check when the element mounts: complete with no size, and `decode()`
|
|
41
|
+
* refusing it, so a picture that is merely sizeless (an SVG without a width)
|
|
42
|
+
* is not mistaken for a broken one.
|
|
43
|
+
*/
|
|
44
|
+
export declare function PictureOverIdentity(props: React.ComponentProps<"img"> & {
|
|
45
|
+
src: string;
|
|
46
|
+
}): React.JSX.Element | null;
|
|
47
|
+
//# sourceMappingURL=thumbnail-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thumbnail-identity.d.ts","sourceRoot":"","sources":["../../src/lib/thumbnail-identity.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAwC,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAE7G;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,SAAS,GACV,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,kBAAkB,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,qBAEA;AAED,uGAAuG;AACvG,eAAO,MAAM,uBAAuB,qBAAqB,CAAA;AAEzD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,4BAevF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/cloudgrid-cn.js";
|
|
5
|
+
import { ENTITY_IDENTITY_FILL, EntityIdentity } from "../blocks/entity-identity.js";
|
|
6
|
+
/**
|
|
7
|
+
* THE IDENTITY UNDER A HOME THUMBNAIL (ui#573).
|
|
8
|
+
*
|
|
9
|
+
* A Home thumbnail (Pinned, Continue where you left off, My top creations,
|
|
10
|
+
* Recent plugs, the search window's rows) is a box with an `<img>` in it, or
|
|
11
|
+
* nothing. An item with a `seed` puts the creation's identity tile in that box
|
|
12
|
+
* too, from the seed and the name, as its card in My creations does: it fills
|
|
13
|
+
* the box, BEHIND the picture. A picture that paints covers it; no picture, or
|
|
14
|
+
* one that fails to load, shows it. The picture element is untouched.
|
|
15
|
+
*
|
|
16
|
+
* Behind, because the picture is an `<img>` in the flow and the identity is
|
|
17
|
+
* positioned, and a positioned element would otherwise paint over it: so the
|
|
18
|
+
* identity is `-z-10` and the box takes `THUMBNAIL_WITH_IDENTITY`, which makes it
|
|
19
|
+
* the stacking context that keeps the identity above the box's own ground.
|
|
20
|
+
*
|
|
21
|
+
* A picture that fails to load is taken out (`PictureOverIdentity`), because
|
|
22
|
+
* a broken `<img>` with a size is not always nothing: Chromium and WebKit both
|
|
23
|
+
* draw their broken-picture mark in it, alt="" or not, over the identity.
|
|
24
|
+
*
|
|
25
|
+
* Not exported from the package: the pieces' `seed` is the API.
|
|
26
|
+
*/
|
|
27
|
+
export function ThumbnailIdentity({ seed, name, size, className, }) {
|
|
28
|
+
return _jsx(EntityIdentity, { seed: seed, name: name, size: size, className: cn(ENTITY_IDENTITY_FILL, "-z-10", className) });
|
|
29
|
+
}
|
|
30
|
+
/** What a thumbnail's box adds when it holds an identity: positioned, and its own stacking context. */
|
|
31
|
+
export const THUMBNAIL_WITH_IDENTITY = "relative isolate";
|
|
32
|
+
/**
|
|
33
|
+
* A thumbnail's picture over its identity: the `<img>` the piece already drew,
|
|
34
|
+
* with the same attributes in the same order (so the server's markup is the
|
|
35
|
+
* same), taken out once it fails to load, so the identity under it shows
|
|
36
|
+
* rather than the browser's broken-picture mark.
|
|
37
|
+
*
|
|
38
|
+
* Two ways a failure is heard: `onError`, and, for a picture that failed
|
|
39
|
+
* before the page hydrated (whose error event no handler was there to hear),
|
|
40
|
+
* a check when the element mounts: complete with no size, and `decode()`
|
|
41
|
+
* refusing it, so a picture that is merely sizeless (an SVG without a width)
|
|
42
|
+
* is not mistaken for a broken one.
|
|
43
|
+
*/
|
|
44
|
+
export function PictureOverIdentity(props) {
|
|
45
|
+
const { src } = props;
|
|
46
|
+
const [failed, setFailed] = React.useState(null);
|
|
47
|
+
const fail = React.useCallback(() => setFailed(src), [src]);
|
|
48
|
+
const check = React.useCallback((img) => {
|
|
49
|
+
if (img && img.complete && img.naturalWidth === 0)
|
|
50
|
+
img.decode().catch(fail);
|
|
51
|
+
}, [fail]);
|
|
52
|
+
if (failed === src)
|
|
53
|
+
return null;
|
|
54
|
+
// `alt` restated (the caller's, "": the name is beside the picture) so the
|
|
55
|
+
// a11y rule can see it; a key a spread already set keeps its place, so the
|
|
56
|
+
// attributes stay in the caller's order.
|
|
57
|
+
return _jsx("img", { ...props, alt: props.alt, ref: check, onError: fail });
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=thumbnail-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thumbnail-identity.js","sourceRoot":"","sources":["../../src/lib/th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I,CAAA;IAC/B,2EAA2E;IAC3E,2EAA2E;IAC3E,yCAAyC;IACzC,OAAO,iBAAS,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,GAAI,CAAA;AACtE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudgrid-io/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.68.0",
|
|
4
4
|
"description": "CloudGrid design system: React components, brand design tokens, Tailwind theme, self-hosted fonts.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"react-dom": "19.3.1",
|
|
115
115
|
"react-is": "19.3.1",
|
|
116
116
|
"typescript": "^5.9.3",
|
|
117
|
-
"typescript-eslint": "^8.
|
|
117
|
+
"typescript-eslint": "^8.73.0"
|
|
118
118
|
},
|
|
119
119
|
"scripts": {
|
|
120
120
|
"build": "node scripts/build.mjs && tsc -p tsconfig.build.json && node scripts/rewrite-aliases.mjs",
|