@principal-ai/subsystems-react 0.56.40 → 0.56.41

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 (59) hide show
  1. package/dist/index.d.ts +7 -3
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +4 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/subsystem/C4ContainersPanel.d.ts +32 -2
  6. package/dist/subsystem/C4ContainersPanel.d.ts.map +1 -1
  7. package/dist/subsystem/C4ContainersPanel.js +89 -21
  8. package/dist/subsystem/C4ContainersPanel.js.map +1 -1
  9. package/dist/subsystem/C4Graph.d.ts +13 -0
  10. package/dist/subsystem/C4Graph.d.ts.map +1 -1
  11. package/dist/subsystem/C4Graph.js +19 -2
  12. package/dist/subsystem/C4Graph.js.map +1 -1
  13. package/dist/subsystem/C4NodeCard.d.ts +15 -2
  14. package/dist/subsystem/C4NodeCard.d.ts.map +1 -1
  15. package/dist/subsystem/C4NodeCard.js +124 -7
  16. package/dist/subsystem/C4NodeCard.js.map +1 -1
  17. package/dist/subsystem/C4ProjectionView.d.ts +8 -1
  18. package/dist/subsystem/C4ProjectionView.d.ts.map +1 -1
  19. package/dist/subsystem/C4ProjectionView.js +3 -3
  20. package/dist/subsystem/C4ProjectionView.js.map +1 -1
  21. package/dist/subsystem/C4SketchView.d.ts +9 -1
  22. package/dist/subsystem/C4SketchView.d.ts.map +1 -1
  23. package/dist/subsystem/C4SketchView.js +2 -2
  24. package/dist/subsystem/C4SketchView.js.map +1 -1
  25. package/dist/subsystem/__fixtures__/c4Deployments.d.ts +18 -0
  26. package/dist/subsystem/__fixtures__/c4Deployments.d.ts.map +1 -0
  27. package/dist/subsystem/__fixtures__/c4Deployments.js +185 -0
  28. package/dist/subsystem/__fixtures__/c4Deployments.js.map +1 -0
  29. package/dist/subsystem/c4.d.ts +63 -0
  30. package/dist/subsystem/c4.d.ts.map +1 -1
  31. package/dist/subsystem/c4.js.map +1 -1
  32. package/dist/subsystem/c4Deployment.d.ts +78 -0
  33. package/dist/subsystem/c4Deployment.d.ts.map +1 -0
  34. package/dist/subsystem/c4Deployment.js +68 -0
  35. package/dist/subsystem/c4Deployment.js.map +1 -0
  36. package/dist/subsystem/techIcons/cloudflare.d.ts +15 -0
  37. package/dist/subsystem/techIcons/cloudflare.d.ts.map +1 -0
  38. package/dist/subsystem/techIcons/cloudflare.js +15 -0
  39. package/dist/subsystem/techIcons/cloudflare.js.map +1 -0
  40. package/dist/subsystem/techIcons/index.d.ts +14 -1
  41. package/dist/subsystem/techIcons/index.d.ts.map +1 -1
  42. package/dist/subsystem/techIcons/index.js +17 -0
  43. package/dist/subsystem/techIcons/index.js.map +1 -1
  44. package/package.json +1 -1
  45. package/src/index.ts +25 -1
  46. package/src/stories/Canvases/C4/C4Sketch.stories.tsx +51 -0
  47. package/src/subsystem/C4ContainersPanel.test.tsx +90 -2
  48. package/src/subsystem/C4ContainersPanel.tsx +142 -35
  49. package/src/subsystem/C4Graph.tsx +49 -3
  50. package/src/subsystem/C4NodeCard.tsx +217 -7
  51. package/src/subsystem/C4ProjectionView.tsx +12 -0
  52. package/src/subsystem/C4SketchView.tsx +13 -0
  53. package/src/subsystem/__fixtures__/c4Deployments.ts +196 -0
  54. package/src/subsystem/c4.ts +62 -0
  55. package/src/subsystem/c4Deployment.test.tsx +211 -0
  56. package/src/subsystem/c4Deployment.tsx +137 -0
  57. package/src/subsystem/techIcons/cloudflare.ts +14 -0
  58. package/src/subsystem/techIcons/index.tsx +30 -1
  59. package/src/subsystem/techIcons/techIcons.test.ts +12 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"c4Deployment.d.ts","sourceRoot":"","sources":["../../src/subsystem/c4Deployment.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAE7E,oCAAoC;AACpC,MAAM,MAAM,oBAAoB,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BAAqB,KAAK,IAAI,CAAC;CAC3D;AAID,eAAO,MAAM,mBAAmB,mDAAiD,CAAC;AAElF,wBAAgB,gBAAgB,IAAI,wBAAwB,CAE3D"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Deployment state for C4 cards — the join between a container's configured
3
+ * anchor and what the host observed live, and the context that carries the
4
+ * observations to the cards.
5
+ *
6
+ * A context rather than node data: observations arrive and refresh on their
7
+ * own clock, and threading them through the graph's node build would re-run
8
+ * layout every time one changed. The card box does not depend on them.
9
+ */
10
+ import { createContext, useContext } from 'react';
11
+ /** Only http(s) is ever handed to the host to open — an observation is data, not trusted markup. */
12
+ export function safeExternalUrl(url) {
13
+ if (!url)
14
+ return undefined;
15
+ try {
16
+ const parsed = new URL(url);
17
+ return parsed.protocol === 'https:' || parsed.protocol === 'http:' ? parsed.href : undefined;
18
+ }
19
+ catch {
20
+ return undefined;
21
+ }
22
+ }
23
+ /** The deployment anchor an element carries, if it is a container with one. */
24
+ export function elementDeployment(element) {
25
+ return element.kind === 'container' ? element.deployment : undefined;
26
+ }
27
+ /**
28
+ * Resolve what a card should show for a deployment anchor.
29
+ *
30
+ * A live URL is offered only when the resource was observed deployed: a URL
31
+ * for something we could not find is a link to nowhere. The console link
32
+ * survives `not-found` and `unknown`, since the dashboard is where a reader
33
+ * goes to find out why.
34
+ */
35
+ export function resolveDeploymentView(deployment, observation) {
36
+ const phase = observation?.status === 'deployed'
37
+ ? 'deployed'
38
+ : observation?.status === 'not-found'
39
+ ? 'not-found'
40
+ : 'configured';
41
+ const liveUrl = phase === 'deployed'
42
+ ? observation?.liveUrls?.map(safeExternalUrl).find((url) => !!url)
43
+ : undefined;
44
+ const consoleUrl = safeExternalUrl(observation?.consoleUrl);
45
+ return {
46
+ deployment,
47
+ phase,
48
+ ...(observation ? { observation } : {}),
49
+ ...(liveUrl ? { liveUrl } : {}),
50
+ ...(consoleUrl ? { consoleUrl } : {}),
51
+ };
52
+ }
53
+ export function elementStanding(element, observation) {
54
+ if (element.state !== 'proposed')
55
+ return element.state;
56
+ const deployment = elementDeployment(element);
57
+ return deployment &&
58
+ observation?.resourceKey === deployment.resourceKey &&
59
+ observation.status === 'deployed'
60
+ ? 'deployed'
61
+ : 'proposed';
62
+ }
63
+ const EMPTY = {};
64
+ export const C4DeploymentContext = createContext(EMPTY);
65
+ export function useC4Deployments() {
66
+ return useContext(C4DeploymentContext);
67
+ }
68
+ //# sourceMappingURL=c4Deployment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"c4Deployment.js","sourceRoot":"","sources":["../../src/subsystem/c4Deployment.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AA0BlD,oGAAoG;AACpG,MAAM,UAAU,eAAe,CAAC,GAAuB;IACrD,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,IAAI;QACF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;KAC9F;IAAC,MAAM;QACN,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,OAAkB;IAClD,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAwB,EACxB,WAAgD;IAEhD,MAAM,KAAK,GACT,WAAW,EAAE,MAAM,KAAK,UAAU;QAChC,CAAC,CAAC,UAAU;QACZ,CAAC,CAAC,WAAW,EAAE,MAAM,KAAK,WAAW;YACnC,CAAC,CA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Cloudflare mark — the cloud from the official logo, without the wordmark.
3
+ *
4
+ * Source: https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg.
5
+ * The two cloud paths and their fills are taken unmodified; the wordmark, the backing rectangle and the
6
+ * Illustrator wrapper are dropped, and the viewBox is cropped to the cloud so
7
+ * the mark fills a square slot.
8
+ *
9
+ * Cloudflare and the Cloudflare logo are trademarks of Cloudflare, Inc. Used
10
+ * here for identification only, with no endorsement implied.
11
+ *
12
+ * Root sized to 100% so the card's wrapper controls the box.
13
+ */
14
+ export declare const cloudflareSvg = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"126.8 24.5 91.2 42.3\"><path fill=\"#F48220\" d=\"M189.1,63.6c0.5-1.9,0.3-3.6-0.6-4.9c-0.8-1.2-2.2-1.9-3.9-1.9l-32.2-0.4c-0.2,0-0.4-0.1-0.5-0.3 c-0.1-0.2-0.1-0.4-0.1-0.6c0.1-0.3,0.4-0.6,0.7-0.6l32.5-0.4c3.9-0.2,8-3.3,9.5-7.1l1.9-4.8c0.1-0.2,0.1-0.4,0.1-0.6 c-2.1-9.5-10.5-16.5-20.6-16.5c-9.3,0-17.2,6-20,14.3c-1.8-1.4-4.2-2.1-6.7-1.8c-4.5,0.4-8,4-8.5,8.5c-0.1,1.2,0,2.3,0.2,3.3 c-7.3,0.2-13.1,6.2-13.1,13.5c0,0.7,0.1,1.3,0.1,2c0,0.3,0.3,0.5,0.6,0.5l59.4,0c0.3,0,0.7-0.2,0.8-0.6L189.1,63.6z\"/><path fill=\"#FBAD40\" d=\"M199.3,42.9c-0.3,0-0.6,0-0.9,0c-0.2,0-0.4,0.2-0.5,0.4l-1.3,4.4c-0.5,1.9-0.3,3.6,0.6,4.9 c0.8,1.2,2.2,1.9,3.9,1.9l6.9,0.4c0.2,0,0.4,0.1,0.5,0.3c0.1,0.2,0.1,0.4,0.1,0.6c-0.1,0.3-0.4,0.6-0.7,0.6l-7.1,0.4 c-3.9,0.2-8,3.3-9.5,7.1l-0.5,1.3c-0.1,0.2,0.1,0.5,0.4,0.5h24.5c0.3,0,0.6-0.2,0.6-0.5c0.4-1.5,0.7-3.1,0.7-4.8 C216.9,50.8,209,42.9,199.3,42.9\"/></svg>";
15
+ //# sourceMappingURL=cloudflare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../../../src/subsystem/techIcons/cloudflare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,+7BAA+6B,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Cloudflare mark — the cloud from the official logo, without the wordmark.
3
+ *
4
+ * Source: https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg.
5
+ * The two cloud paths and their fills are taken unmodified; the wordmark, the backing rectangle and the
6
+ * Illustrator wrapper are dropped, and the viewBox is cropped to the cloud so
7
+ * the mark fills a square slot.
8
+ *
9
+ * Cloudflare and the Cloudflare logo are trademarks of Cloudflare, Inc. Used
10
+ * here for identification only, with no endorsement implied.
11
+ *
12
+ * Root sized to 100% so the card's wrapper controls the box.
13
+ */
14
+ export const cloudflareSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="126.8 24.5 91.2 42.3"><path fill="#F48220" d="M189.1,63.6c0.5-1.9,0.3-3.6-0.6-4.9c-0.8-1.2-2.2-1.9-3.9-1.9l-32.2-0.4c-0.2,0-0.4-0.1-0.5-0.3 c-0.1-0.2-0.1-0.4-0.1-0.6c0.1-0.3,0.4-0.6,0.7-0.6l32.5-0.4c3.9-0.2,8-3.3,9.5-7.1l1.9-4.8c0.1-0.2,0.1-0.4,0.1-0.6 c-2.1-9.5-10.5-16.5-20.6-16.5c-9.3,0-17.2,6-20,14.3c-1.8-1.4-4.2-2.1-6.7-1.8c-4.5,0.4-8,4-8.5,8.5c-0.1,1.2,0,2.3,0.2,3.3 c-7.3,0.2-13.1,6.2-13.1,13.5c0,0.7,0.1,1.3,0.1,2c0,0.3,0.3,0.5,0.6,0.5l59.4,0c0.3,0,0.7-0.2,0.8-0.6L189.1,63.6z"/><path fill="#FBAD40" d="M199.3,42.9c-0.3,0-0.6,0-0.9,0c-0.2,0-0.4,0.2-0.5,0.4l-1.3,4.4c-0.5,1.9-0.3,3.6,0.6,4.9 c0.8,1.2,2.2,1.9,3.9,1.9l6.9,0.4c0.2,0,0.4,0.1,0.5,0.3c0.1,0.2,0.1,0.4,0.1,0.6c-0.1,0.3-0.4,0.6-0.7,0.6l-7.1,0.4 c-3.9,0.2-8,3.3-9.5,7.1l-0.5,1.3c-0.1,0.2,0.1,0.5,0.4,0.5h24.5c0.3,0,0.6-0.2,0.6-0.5c0.4-1.5,0.7-3.1,0.7-4.8 C216.9,50.8,209,42.9,199.3,42.9"/></svg>`;
15
+ //# sourceMappingURL=cloudflare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudflare.js","sourceRoot":"","sources":["../../../src/subsystem/techIcons/cloudflare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,46BAA46B,CAAC"}
@@ -33,9 +33,22 @@ export interface TechBrand {
33
33
  export declare const TECH_BRANDS: readonly TechBrand[];
34
34
  /** The official mark for a technology string, or undefined when we hold none. */
35
35
  export declare function technologyBrand(technology: string | undefined): TechBrand | undefined;
36
+ /**
37
+ * A hosting provider's mark — where a container is deployed, as opposed to
38
+ * what it is built with. Kept out of `TECH_BRANDS` on purpose: "built with
39
+ * Bun" and "runs on Cloudflare" are different facts drawn in different slots,
40
+ * and a provider is matched by its exact id, not by scanning free text.
41
+ */
42
+ export interface ProviderBrand extends Omit<TechBrand, 'match'> {
43
+ /** The provider id a deployment carries, lowercase: `cloudflare`. */
44
+ provider: string;
45
+ }
46
+ export declare const PROVIDER_BRANDS: readonly ProviderBrand[];
47
+ /** The official mark for a provider id, or undefined when we hold none. */
48
+ export declare function providerBrand(provider: string | undefined): ProviderBrand | undefined;
36
49
  /** A brand mark sized to the top row. Full-colour, not tinted by state. */
37
50
  export declare function TechMark({ brand, size, showTitle, }: {
38
- brand: TechBrand;
51
+ brand: Pick<TechBrand, 'name' | 'source' | 'svg'>;
39
52
  size?: number;
40
53
  /** Render the attribution tooltip. Off inside rows that already explain themselves. */
41
54
  showTitle?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/subsystem/techIcons/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;AAMH,MAAM,WAAW,SAAS;IACxB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAwB3C,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAGrF;AAED,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,IAAS,EACT,SAAgB,GACjB,EAAE;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,+BAUA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/subsystem/techIcons/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;AAOH,MAAM,WAAW,SAAS;IACxB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAwB3C,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAGrF;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC;IAC7D,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAQnD,CAAC;AAEF,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAIrF;AAED,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,IAAS,EACT,SAAgB,GACjB,EAAE;IACD,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC,CAAC;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,+BAUA"}
@@ -12,6 +12,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
12
12
  * identification only, under each owner's trademark policy.
13
13
  */
14
14
  import { bunSvg } from './bun';
15
+ import { cloudflareSvg } from './cloudflare';
15
16
  import { nodeSvg } from './node';
16
17
  import { reactSvg } from './react';
17
18
  /**
@@ -49,6 +50,22 @@ export function technologyBrand(technology) {
49
50
  return undefined;
50
51
  return TECH_BRANDS.find((brand) => brand.match.test(technology));
51
52
  }
53
+ export const PROVIDER_BRANDS = [
54
+ {
55
+ provider: 'cloudflare',
56
+ name: 'Cloudflare',
57
+ source: 'https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg',
58
+ svg: cloudflareSvg,
59
+ color: '#f48220',
60
+ },
61
+ ];
62
+ /** The official mark for a provider id, or undefined when we hold none. */
63
+ export function providerBrand(provider) {
64
+ if (!provider)
65
+ return undefined;
66
+ const id = provider.toLowerCase();
67
+ return PROVIDER_BRANDS.find((brand) => brand.provider === id);
68
+ }
52
69
  /** A brand mark sized to the top row. Full-colour, not tinted by state. */
53
70
  export function TechMark({ brand, size = 14, showTitle = true, }) {
54
71
  return (_jsx("span", { ...(showTitle ? { title: `${brand.name} — ${brand.source}` } : {}), "aria-label": brand.name, style: { display: 'inline-flex', width: size, height: size, flexShrink: 0 },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/subsystem/techIcons/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAkBnC;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAyB;IAC/C;QACE,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,mBAAmB;QAC3B,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,SAAS;KACjB;IACD;QACE,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,yBAAyB;QACjC,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE,SAAS;KACjB;IACD;QACE,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,+CAA+C;QACvD,GAAG,EAAE,OAAO;QACZ,yEAAyE;QACzE,gCAAgC;QAChC,KAAK,EAAE,kBAAkB;QACzB,KAAK,EAAE,SAAS;KACjB;CACF,CAAC;AAEF,iFAAiF;AACjF,MAAM,UAAU,eAAe,CAAC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AC,CAAC,EAAE,CAAC,gBACvD,KAAK,CAAC,IAAI,EACtB,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE;QAC3E,2DAA2D;QAC3D,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,GAC9C,CACH,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ai/subsystems-react",
3
- "version": "0.56.40",
3
+ "version": "0.56.41",
4
4
  "description": "React UI for Subsystem Models — graph, Pierre code views, and session-event feeds",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -315,10 +315,11 @@ export type { C4ProjectionViewProps } from './subsystem/C4ProjectionView';
315
315
  export { C4SketchView } from './subsystem/C4SketchView';
316
316
  export type { C4SketchViewProps } from './subsystem/C4SketchView';
317
317
  export { ShareButton } from './subsystem/ShareButton';
318
- export { C4ContainersPanel } from './subsystem/C4ContainersPanel';
318
+ export { C4ContainersPanel, groupContainersByDeployment } from './subsystem/C4ContainersPanel';
319
319
  export type {
320
320
  C4ContainerListItem,
321
321
  C4ContainersPanelProps,
322
+ C4ContainerGroup,
322
323
  } from './subsystem/C4ContainersPanel';
323
324
  export { DescriptionPreview } from './subsystem/DescriptionPreview';
324
325
  export type { DescriptionPreviewProps } from './subsystem/DescriptionPreview';
@@ -345,6 +346,26 @@ export type { TechBrand } from './subsystem/techIcons';
345
346
  export type { C4NodeCardProps, NodeStyle, NodeShape, C4ShapeKind } from './subsystem/C4NodeCard';
346
347
  export { ContainerCardHeader, OPEN_HEADER_PAD, OPEN_SIDE_PAD, OPEN_FOOTER_PAD } from './subsystem/containerCard';
347
348
  export type { ContainerCardHeaderProps } from './subsystem/containerCard';
349
+ // --- C4 deployment: configured anchor + live observation ---------------
350
+ export {
351
+ C4DeploymentContext,
352
+ elementDeployment,
353
+ elementStanding,
354
+ resolveDeploymentView,
355
+ safeExternalUrl,
356
+ useC4Deployments,
357
+ } from './subsystem/c4Deployment';
358
+ export type {
359
+ C4DeploymentContextValue,
360
+ C4DeploymentLinkKind,
361
+ C4DeploymentPhase,
362
+ C4DeploymentView,
363
+ C4OpenExternalRequest,
364
+ C4Standing,
365
+ } from './subsystem/c4Deployment';
366
+ export { PROVIDER_BRANDS, providerBrand } from './subsystem/techIcons';
367
+ export type { ProviderBrand } from './subsystem/techIcons';
368
+
348
369
  // --- C4 elements: authored, not derived -------------------------------
349
370
  export {
350
371
  labelFromPurl,
@@ -361,6 +382,9 @@ export type {
361
382
  C4Model,
362
383
  C4ContainerKind,
363
384
  C4Container,
385
+ C4Deployment,
386
+ C4DeploymentObservation,
387
+ C4DeploymentStatus,
364
388
  C4Component,
365
389
  C4ExternalSystem,
366
390
  C4Person,
@@ -5,6 +5,11 @@ import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme
5
5
  import { C4SketchView } from '../../../subsystem/C4SketchView';
6
6
  import type { C4Sketch } from '../../../subsystem/c4Sketch';
7
7
  import { SKETCH_FIXTURE } from '../../../subsystem/__fixtures__/c4Sketch';
8
+ import {
9
+ DEPLOYMENT_OBSERVATIONS,
10
+ DEPLOYMENT_SKETCH,
11
+ } from '../../../subsystem/__fixtures__/c4Deployments';
12
+ import type { C4OpenExternalRequest } from '../../../subsystem/c4Deployment';
8
13
  import {
9
14
  CONTAINER_MATRIX_SKETCH,
10
15
  DESCRIPTION_BOUNDARY_SKETCH,
@@ -92,3 +97,49 @@ export const DescriptionBoundary: Story = {
92
97
  export const NotesOnly: Story = {
93
98
  render: () => <Demo sketch={NOTES_ONLY_SKETCH} />,
94
99
  };
100
+
101
+ function DeploymentsDemo({ observed }: { observed: boolean }) {
102
+ const [last, setLast] = React.useState<C4OpenExternalRequest | null>(null);
103
+ return (
104
+ <div style={{ width: '100%', height: '100vh', position: 'relative' }}>
105
+ <C4SketchView
106
+ sketch={DEPLOYMENT_SKETCH}
107
+ deployments={observed ? DEPLOYMENT_OBSERVATIONS : undefined}
108
+ onOpenExternal={setLast}
109
+ />
110
+ {last && (
111
+ <pre
112
+ style={{
113
+ position: 'absolute',
114
+ right: 12,
115
+ bottom: 12,
116
+ margin: 0,
117
+ padding: '8px 10px',
118
+ borderRadius: 6,
119
+ background: 'rgba(0,0,0,0.75)',
120
+ color: '#fff',
121
+ fontSize: 11,
122
+ }}
123
+ >
124
+ {`onOpenExternal(${JSON.stringify(last, null, 2)})`}
125
+ </pre>
126
+ )}
127
+ </div>
128
+ );
129
+ }
130
+
131
+ /**
132
+ * Containers proposed from wrangler configs, with live observations joined in.
133
+ * Every badge state is on screen: deployed with live + console links, deployed
134
+ * store with a console link only, declared-but-missing, could-not-check, never
135
+ * checked, and a provider we hold no mark for. The story stands in for the
136
+ * host: a click reports the request instead of opening a browser.
137
+ */
138
+ export const Deployments: Story = {
139
+ render: () => <DeploymentsDemo observed />,
140
+ };
141
+
142
+ /** The same sketch before any credentialed check has run: every mark is configured-only. */
143
+ export const DeploymentsConfiguredOnly: Story = {
144
+ render: () => <DeploymentsDemo observed={false} />,
145
+ };
@@ -3,7 +3,12 @@ import { createElement } from 'react';
3
3
  import { Window } from 'happy-dom';
4
4
  import { cleanup, fireEvent, render } from '@testing-library/react/pure';
5
5
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
- import { C4ContainersPanel, type C4ContainerListItem } from './C4ContainersPanel';
6
+ import {
7
+ C4ContainersPanel,
8
+ groupContainersByDeployment,
9
+ type C4ContainerListItem,
10
+ } from './C4ContainersPanel';
11
+ import type { C4DeploymentObservation } from './c4';
7
12
 
8
13
  // Bun's happy-dom test environment isn't registered (no @happy-dom/global-
9
14
  // registrator), so wire the DOM primitives React DOM needs before rendering.
@@ -86,7 +91,13 @@ describe('C4ContainersPanel', () => {
86
91
  expect(view.getByText('2 containers')).toBeTruthy();
87
92
  expect(view.getByText('Host')).toBeTruthy();
88
93
  expect(view.getByText('Session store')).toBeTruthy();
89
- expect(view.getByText('proposed')).toBeTruthy();
94
+ // The proposed container sits under a Proposed heading; the accepted one
95
+ // needs no heading and is listed first.
96
+ expect(view.getByText('Proposed')).toBeTruthy();
97
+ const labels = [...view.container.querySelectorAll('li')].map((li) => li.textContent);
98
+ expect(labels[0]).toContain('Host');
99
+ expect(labels[1]).toContain('Proposed');
100
+ expect(labels[2]).toContain('Session store');
90
101
  expect(view.queryByText('Host API')).toBeNull();
91
102
  const row = view.getByText('Host').closest('li');
92
103
  expect(row?.className).toContain('c4-containers-row');
@@ -149,3 +160,80 @@ describe('C4ContainersPanel', () => {
149
160
  expect(view.getByText('No containers.')).toBeTruthy();
150
161
  });
151
162
  });
163
+
164
+ describe('groupContainersByDeployment', () => {
165
+ const worker = (name: string, state: 'proposed' | 'accepted' = 'proposed'): C4ContainerListItem => ({
166
+ container: {
167
+ kind: 'container',
168
+ id: `container:${name}`,
169
+ label: name,
170
+ containerKind: 'application',
171
+ technology: 'Cloudflare Worker',
172
+ state,
173
+ deployment: {
174
+ resourceKey: `cloudflare:worker:${name}`,
175
+ provider: 'cloudflare',
176
+ resourceType: 'worker',
177
+ name,
178
+ },
179
+ },
180
+ open: false,
181
+ members: [],
182
+ });
183
+ const observed = (name: string, status: C4DeploymentObservation['status']) =>
184
+ [
185
+ `cloudflare:worker:${name}`,
186
+ {
187
+ resourceKey: `cloudflare:worker:${name}`,
188
+ status,
189
+ observedAt: '2026-11-29T00:00:00.000Z',
190
+ source: 'cloudflare-api',
191
+ },
192
+ ] as const;
193
+
194
+ test('observed-running containers group under their provider; the rest are proposed', () => {
195
+ const groups = groupContainersByDeployment(
196
+ [worker('live'), worker('declared'), worker('missing'), worker('unchecked')],
197
+ new Map([observed('live', 'deployed'), observed('missing', 'not-found'), observed('unchecked', 'unknown')]),
198
+ );
199
+ expect(groups.map((g) => [g.kind, g.provider, g.items.map((i) => i.container.label)])).toEqual([
200
+ ['provider', 'cloudflare', ['live']],
201
+ ['proposed', undefined, ['declared', 'missing', 'unchecked']],
202
+ ]);
203
+ });
204
+
205
+ test('an accepted container that is running still groups by where it runs', () => {
206
+ const groups = groupContainersByDeployment(
207
+ [worker('live', 'accepted'), worker('idle', 'accepted')],
208
+ new Map([observed('live', 'deployed')]),
209
+ );
210
+ expect(groups.map((g) => [g.kind, g.items.map((i) => i.container.label)])).toEqual([
211
+ ['settled', ['idle']],
212
+ ['provider', ['live']],
213
+ ]);
214
+ });
215
+
216
+ test('with no observations nothing is under a provider', () => {
217
+ expect(groupContainersByDeployment([worker('a')]).map((g) => g.kind)).toEqual(['proposed']);
218
+ });
219
+
220
+ test('the panel draws the provider heading with its mark, and no per-row tags', () => {
221
+ const view = renderPanel([worker('live'), worker('declared')], {
222
+ deployments: new Map([observed('live', 'deployed')]),
223
+ });
224
+ const heading = view.container.querySelector('[data-container-group="provider:cloudflare"]')!;
225
+ expect(heading.textContent).toContain('Cloudflare');
226
+ expect(heading.querySelector('[aria-label="Cloudflare"]')).not.toBeNull();
227
+ expect(view.queryByText('deployed')).toBeNull();
228
+ expect(view.queryByText('proposed')).toBeNull();
229
+ expect(view.getByText('Proposed')).toBeTruthy();
230
+ });
231
+ });
232
+
233
+ describe('C4ContainersPanel technology', () => {
234
+ test('each row names its technology under the label', () => {
235
+ const view = renderPanel(ITEMS);
236
+ const row = view.getByText('Host').closest('li')!;
237
+ expect(row.querySelector('[data-container-technology]')?.textContent).toBe('Bun');
238
+ });
239
+ });