@cloudgrid-io/ui 0.66.0 → 0.67.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.
Files changed (39) hide show
  1. package/dist/badge/owner.js +1 -1
  2. package/dist/badge/owner.js.map +1 -1
  3. package/dist/blocks/creation-search.d.ts +10 -1
  4. package/dist/blocks/creation-search.d.ts.map +1 -1
  5. package/dist/blocks/creation-search.js +5 -1
  6. package/dist/blocks/creation-search.js.map +1 -1
  7. package/dist/blocks/entity-card.d.ts.map +1 -1
  8. package/dist/blocks/entity-card.js +2 -2
  9. package/dist/blocks/entity-card.js.map +1 -1
  10. package/dist/blocks/entity-identity.d.ts +24 -1
  11. package/dist/blocks/entity-identity.d.ts.map +1 -1
  12. package/dist/blocks/entity-identity.js +19 -0
  13. package/dist/blocks/entity-identity.js.map +1 -1
  14. package/dist/blocks/home-bento.d.ts +1 -1
  15. package/dist/blocks/home-bento.js +1 -1
  16. package/dist/blocks/home-pinned.d.ts +19 -0
  17. package/dist/blocks/home-pinned.d.ts.map +1 -1
  18. package/dist/blocks/home-pinned.js +14 -2
  19. package/dist/blocks/home-pinned.js.map +1 -1
  20. package/dist/blocks/image-adjust-dialog.d.ts.map +1 -1
  21. package/dist/blocks/image-adjust-dialog.js +1 -1
  22. package/dist/blocks/image-adjust-dialog.js.map +1 -1
  23. package/dist/blocks/inspiration-cards.d.ts +80 -24
  24. package/dist/blocks/inspiration-cards.d.ts.map +1 -1
  25. package/dist/blocks/inspiration-cards.js +145 -25
  26. package/dist/blocks/inspiration-cards.js.map +1 -1
  27. package/dist/blocks/recent-plugs.d.ts +12 -0
  28. package/dist/blocks/recent-plugs.d.ts.map +1 -1
  29. package/dist/blocks/recent-plugs.js +4 -1
  30. package/dist/blocks/recent-plugs.js.map +1 -1
  31. package/dist/blocks/top-creations.d.ts +10 -0
  32. package/dist/blocks/top-creations.d.ts.map +1 -1
  33. package/dist/blocks/top-creations.js +6 -1
  34. package/dist/blocks/top-creations.js.map +1 -1
  35. package/dist/lib/thumbnail-identity.d.ts +47 -0
  36. package/dist/lib/thumbnail-identity.d.ts.map +1 -0
  37. package/dist/lib/thumbnail-identity.js +59 -0
  38. package/dist/lib/thumbnail-identity.js.map +1 -0
  39. package/package.json +2 -2
@@ -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/thumbnail-identity.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAA2B,MAAM,+BAA+B,CAAA;AAE7G;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,SAAS,GAMV;IACC,OAAO,KAAC,cAAc,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,OAAO,EAAE,SAAS,CAAC,GAAI,CAAA;AACxH,CAAC;AAED,uGAAuG;AACvG,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAA;AAEzD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAoD;IACtF,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAA;IACrB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAA;IAC/D,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;IAC3D,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAC7B,CAAC,GAA4B,EAAE,EAAE;QAC/B,IAAI,GAAG,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,YAAY,KAAK,CAAC;YAAE,GAAG,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC7E,CAAC,EACD,CAAC,IAAI,CAAC,CACP,CAAA;IACD,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,IAAI,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.66.0",
3
+ "version": "0.67.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.72.2"
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",