@servicetitan/json-render-react 0.1.1 → 0.3.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/catalog/context/catalog-prompt.md +229 -0
- package/dist/catalog/context/schema.json +56 -0
- package/dist/catalog/core/catalog-prompt.md +103 -87
- package/dist/catalog/core/schema.json +1 -1
- package/dist/catalog/marketing/catalog-prompt.md +103 -87
- package/dist/catalog/marketing/schema.json +1 -1
- package/dist/context/catalog/catalog-def.d.ts +50 -0
- package/dist/context/catalog/context-card.catalog.d.ts +19 -0
- package/dist/context/catalog/context-card.d.ts +8 -0
- package/dist/context/catalog/context-data-table.catalog.d.ts +34 -0
- package/dist/context/catalog/context-data-table.css.d.ts +2 -0
- package/dist/context/catalog/context-data-table.d.ts +6 -0
- package/dist/context/catalog/context-file-list.catalog.d.ts +11 -0
- package/dist/context/catalog/context-file-list.css.d.ts +16 -0
- package/dist/context/catalog/context-file-list.d.ts +6 -0
- package/dist/context/catalog/context-list.catalog.d.ts +48 -0
- package/dist/context/catalog/context-list.css.d.ts +16 -0
- package/dist/context/catalog/context-list.d.ts +6 -0
- package/dist/context/catalog/context-metric-grid.catalog.d.ts +22 -0
- package/dist/context/catalog/context-metric-grid.css.d.ts +13 -0
- package/dist/context/catalog/context-metric-grid.d.ts +6 -0
- package/dist/context/catalog/context-note-list.catalog.d.ts +15 -0
- package/dist/context/catalog/context-note-list.d.ts +6 -0
- package/dist/context/catalog/context-overview.catalog.d.ts +8 -0
- package/dist/context/catalog/context-overview.css.d.ts +2 -0
- package/dist/context/catalog/context-overview.d.ts +6 -0
- package/dist/context/catalog/context-panel.catalog.d.ts +6 -0
- package/dist/context/catalog/context-panel.css.d.ts +1 -0
- package/dist/context/catalog/context-panel.d.ts +6 -0
- package/dist/context/catalog/context-tabular-list.catalog.d.ts +19 -0
- package/dist/context/catalog/context-tabular-list.css.d.ts +17 -0
- package/dist/context/catalog/context-tabular-list.d.ts +6 -0
- package/dist/context/catalog/index.d.ts +10 -0
- package/dist/context/catalog/schemas.d.ts +151 -0
- package/dist/context/components/collapsible-card.css.d.ts +41 -0
- package/dist/context/components/collapsible-card.d.ts +14 -0
- package/dist/context/components/context-ai-summary.css.d.ts +5 -0
- package/dist/context/components/context-ai-summary.d.ts +4 -0
- package/dist/context/components/context-chip-tone.d.ts +10 -0
- package/dist/context/components/context-note-list.css.d.ts +10 -0
- package/dist/context/components/context-render-error-boundary.d.ts +21 -0
- package/dist/context/constants.d.ts +6 -0
- package/dist/context/index.d.ts +4 -0
- package/dist/context/validate-context-spec-deep.d.ts +9 -0
- package/dist/context/validate-context-spec.d.ts +11 -0
- package/dist/core/actions.d.ts +8 -0
- package/dist/core/catalog/alert.catalog.d.ts +2 -0
- package/dist/core/catalog/button.catalog.d.ts +3 -0
- package/dist/core/catalog/card.catalog.d.ts +2 -0
- package/dist/core/catalog/catalog-def.d.ts +53 -19
- package/dist/core/catalog/chart.css.d.ts +1 -0
- package/dist/core/catalog/checkbox.catalog.d.ts +1 -0
- package/dist/core/catalog/chip.catalog.d.ts +1 -0
- package/dist/core/catalog/flex.catalog.d.ts +13 -0
- package/dist/core/catalog/grid.catalog.d.ts +4 -0
- package/dist/core/catalog/grid.css.d.ts +4 -0
- package/dist/core/catalog/input.catalog.d.ts +1 -0
- package/dist/core/catalog/link.catalog.d.ts +2 -0
- package/dist/core/catalog/listbox.catalog.d.ts +1 -0
- package/dist/core/catalog/listbox.css.d.ts +9 -0
- package/dist/core/catalog/radio-group.catalog.d.ts +1 -0
- package/dist/core/catalog/schemas.d.ts +46 -19
- package/dist/core/catalog/switch.catalog.d.ts +1 -0
- package/dist/core/catalog/text.catalog.d.ts +0 -8
- package/dist/core/catalog/textarea.catalog.d.ts +15 -0
- package/dist/core/catalog/textarea.d.ts +8 -0
- package/dist/generate.d.ts +4 -4
- package/dist/index.d.ts +7 -4
- package/dist/json-render-react.js +1913 -10747
- package/dist/json-render-react.js.map +1 -1
- package/dist/marketing/catalog/catalog.d.ts +1 -1
- package/dist/marketing/catalog/components/revenue-card.css.d.ts +15 -0
- package/dist/marketing/catalog/index.d.ts +1 -1
- package/dist/marketing/catalog/scoped-catalogs.d.ts +4 -0
- package/dist/registry-utils.d.ts +1 -1
- package/dist/registry.d.ts +1 -0
- package/dist/renderers/context-spec-renderer.d.ts +6 -0
- package/dist/renderers/sectioned-context-renderer.css.d.ts +1 -0
- package/dist/renderers/sectioned-context-renderer.d.ts +36 -0
- package/dist/renderers/spec-renderer.d.ts +21 -6
- package/dist/renderers/types.d.ts +2 -1
- package/dist/renderers/wrap-context-registry.d.ts +3 -0
- package/dist/scoped-catalog.d.ts +64 -0
- package/dist/styles.css +2 -0
- package/dist/test/setup-dom.d.ts +1 -0
- package/dist/types.d.ts +6 -3
- package/package.json +14 -3
- package/dist/core/catalog/badge.catalog.d.ts +0 -12
- package/dist/core/catalog/badge.d.ts +0 -8
- package/dist/marketing/catalog/teams.d.ts +0 -4
- package/dist/team-catalog.d.ts +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const marketingCatalog: import('../..').
|
|
1
|
+
export declare const marketingCatalog: import('../..').ScopedCatalogDef;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RecipeVariants } from '@vanilla-extract/recipes';
|
|
2
|
+
export declare const trendText: import('@vanilla-extract/recipes').RuntimeFn<{
|
|
3
|
+
trend: {
|
|
4
|
+
up: {
|
|
5
|
+
color: `var(--${string})`;
|
|
6
|
+
};
|
|
7
|
+
down: {
|
|
8
|
+
color: `var(--${string})`;
|
|
9
|
+
};
|
|
10
|
+
flat: {
|
|
11
|
+
color: `var(--${string})`;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}>;
|
|
15
|
+
export type TrendTextVariants = RecipeVariants<typeof trendText>;
|
|
@@ -3,4 +3,4 @@ import { marketingCatalog } from './catalog';
|
|
|
3
3
|
export { marketingRenderers } from './components';
|
|
4
4
|
export { marketingCatalog };
|
|
5
5
|
export declare const marketingCatalogEntries: CatalogEntry[];
|
|
6
|
-
export {
|
|
6
|
+
export { scopedCatalogs } from './scoped-catalogs';
|
package/dist/registry-utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AllComponentRenderers } from './renderers/types';
|
|
2
|
-
import { ComponentCatalogDef } from './
|
|
2
|
+
import { ComponentCatalogDef } from './scoped-catalog';
|
|
3
3
|
import { CatalogEntry, RendererContext } from './types';
|
|
4
4
|
export declare function filterCatalogEntries(entries: CatalogEntry[], renderer: RendererContext): CatalogEntry[];
|
|
5
5
|
export declare function toComponentCatalogMap(entries: CatalogEntry[]): Record<string, ComponentCatalogDef>;
|
package/dist/registry.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export declare function getRegistry(renderer?: RendererContext): import('@json-r
|
|
|
4
4
|
export declare const registry: import('@json-render/react').ComponentRegistry;
|
|
5
5
|
export declare const handlers: (getSetState: () => import('@json-render/react').SetState | undefined, getState: () => import('@json-render/core').StateModel) => Record<string, (params: Record<string, unknown>) => Promise<void>>;
|
|
6
6
|
export declare const executeAction: (actionName: string, params: Record<string, unknown> | undefined, setState: import('@json-render/react').SetState, state?: import('@json-render/core').StateModel) => Promise<void>;
|
|
7
|
+
export declare function getContextRegistry(): import('@json-render/react').DefineRegistryResult;
|
|
7
8
|
/** Core catalog used for schema generation and prompt artifacts. */
|
|
8
9
|
export { coreCatalog as catalog };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ContextRenderErrorInfo } from '../context/components/context-render-error-boundary';
|
|
2
|
+
import { SpecRendererProps } from './spec-renderer';
|
|
3
|
+
export type ContextSpecRendererProps = Omit<SpecRendererProps, "registry" | "handlers"> & Partial<Pick<SpecRendererProps, "registry" | "handlers">> & {
|
|
4
|
+
onRenderError?: (info: ContextRenderErrorInfo) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const ContextSpecRenderer: ({ spec, registry, handlers, actions, onRenderError, loading, }: ContextSpecRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sectionLoadingTail: string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Spec } from '@json-render/core';
|
|
2
|
+
import { ComponentRegistry, DefineRegistryResult } from '@json-render/react';
|
|
3
|
+
import { ContextRenderErrorInfo } from '../context/components/context-render-error-boundary';
|
|
4
|
+
import { SpecRendererProps } from './spec-renderer';
|
|
5
|
+
export type ContextSectionStatus = "loading" | "ready" | "error";
|
|
6
|
+
/** A single top-level context section rendered by its own SpecRenderer + store. */
|
|
7
|
+
export interface ContextSection {
|
|
8
|
+
id: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
spec: Spec | null;
|
|
11
|
+
status: ContextSectionStatus;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SectionedContextRendererProps {
|
|
15
|
+
/** Combined ContextPanel spec — split client-side into per-section slots. */
|
|
16
|
+
spec?: Spec | null;
|
|
17
|
+
/** Explicit ordered section slots (parallel per-section streams). Wins over `spec`. */
|
|
18
|
+
sections?: ContextSection[];
|
|
19
|
+
/** Global streaming flag — the last in-progress section shows a loading state. */
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
registry?: ComponentRegistry;
|
|
22
|
+
handlers?: DefineRegistryResult["handlers"];
|
|
23
|
+
actions?: SpecRendererProps["actions"];
|
|
24
|
+
onRenderError?: (info: ContextRenderErrorInfo) => void;
|
|
25
|
+
}
|
|
26
|
+
/** Build a standalone `{ root, elements, state }` spec for one section. */
|
|
27
|
+
export declare function extractSectionSpec(spec: Spec, sectionId: string): {
|
|
28
|
+
spec: Spec;
|
|
29
|
+
hasMissingRefs: boolean;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Renders a context panel as independent per-section renderers. Each section
|
|
33
|
+
* owns its own SpecRenderer + state store, so streaming in (or parallel-loading)
|
|
34
|
+
* later sections never resets an already-expanded section.
|
|
35
|
+
*/
|
|
36
|
+
export declare const SectionedContextRenderer: ({ spec, sections, loading, registry, handlers, actions, onRenderError, }: SectionedContextRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
import { Spec } from '@json-render/core';
|
|
2
2
|
import { ComponentRegistry, DefineRegistryResult } from '@json-render/react';
|
|
3
3
|
type SetState = (path: string, value: unknown) => void;
|
|
4
|
+
export interface SpecActionHelpers {
|
|
5
|
+
setState: SetState;
|
|
6
|
+
getSnapshot: () => Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export type SpecActionHandler = (params: unknown) => void | Promise<void>;
|
|
9
|
+
export type SpecActionsFactory = (helpers: SpecActionHelpers) => Record<string, SpecActionHandler>;
|
|
4
10
|
export interface SpecRendererProps {
|
|
5
11
|
spec: Spec;
|
|
6
12
|
registry: ComponentRegistry;
|
|
7
13
|
handlers: DefineRegistryResult["handlers"];
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Build the runtime action handlers for this spec. Called with helpers that
|
|
16
|
+
* expose the spec's local state store (`setState` for writing back,
|
|
17
|
+
* `getSnapshot` for reading the current form data). Handlers returned here
|
|
18
|
+
* are merged on top of the catalog defaults from `handlers`, so hosts can
|
|
19
|
+
* implement any action declared in the catalog (e.g. `atlas.submitUserAction`,
|
|
20
|
+
* `atlas.navigate`, `atlas.toolCall`) without changes to this package.
|
|
21
|
+
*/
|
|
22
|
+
actions?: SpecActionsFactory;
|
|
23
|
+
/**
|
|
24
|
+
* True while the spec is still streaming in. Renders partial trees and
|
|
25
|
+
* suppresses "missing child" warnings for elements that have not arrived yet.
|
|
26
|
+
*/
|
|
27
|
+
loading?: boolean;
|
|
13
28
|
}
|
|
14
|
-
export declare const SpecRenderer: ({ spec, registry, handlers,
|
|
29
|
+
export declare const SpecRenderer: ({ spec, registry, handlers, actions, loading }: SpecRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
30
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { contextContentRenderers, contextShellRenderers } from '../context/catalog';
|
|
1
2
|
import { baseRenderers } from '../core/catalog';
|
|
2
3
|
import { marketingRenderers } from '../marketing/catalog/components';
|
|
3
|
-
export type AllComponentRenderers = typeof baseRenderers & typeof marketingRenderers;
|
|
4
|
+
export type AllComponentRenderers = typeof baseRenderers & typeof marketingRenderers & typeof contextShellRenderers & typeof contextContentRenderers;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ComponentRegistry } from '@json-render/react';
|
|
2
|
+
import { ContextRenderErrorInfo } from '../context/components/context-render-error-boundary';
|
|
3
|
+
export declare function wrapContextRegistryWithErrorFallback(registry: ComponentRegistry, onRenderError?: (info: ContextRenderErrorInfo) => void): ComponentRegistry;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Catalog } from '@json-render/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { baseComponents } from './core/catalog/schemas';
|
|
4
|
+
export interface ComponentCatalogDef {
|
|
5
|
+
props: z.ZodType;
|
|
6
|
+
slots: string[];
|
|
7
|
+
description: string;
|
|
8
|
+
/**
|
|
9
|
+
* Events this component emits, surfaced to the LLM as `[events: ...]` in the
|
|
10
|
+
* generated prompt so it knows which event names are valid in an element's
|
|
11
|
+
* `on` map (e.g. `{ "press": { "action": "..." } }`).
|
|
12
|
+
*/
|
|
13
|
+
events?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface ActionCatalogDef {
|
|
16
|
+
params: z.ZodType;
|
|
17
|
+
description: string;
|
|
18
|
+
}
|
|
19
|
+
/** Names of the components available in the core catalog. */
|
|
20
|
+
export type CoreComponentName = keyof typeof baseComponents;
|
|
21
|
+
/** Replace or append to a component's catalog description (prompt + JSON schema). */
|
|
22
|
+
export interface DescriptionOverride {
|
|
23
|
+
/** Replace the component's description entirely. */
|
|
24
|
+
description?: string;
|
|
25
|
+
/** Append to the existing description (joined with a space). */
|
|
26
|
+
append?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ComposeCatalogComponentsOptions {
|
|
29
|
+
/** Core components to include: an array of names, or "all" (default). */
|
|
30
|
+
core?: CoreComponentName[] | "all";
|
|
31
|
+
/** Per-component description overrides/appends — applies to core and own components. */
|
|
32
|
+
overrides?: Partial<Record<string, DescriptionOverride>>;
|
|
33
|
+
/** This catalog's own (non-core) components. */
|
|
34
|
+
components?: Record<string, ComponentCatalogDef>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build the component map for a catalog: pick a subset of core components (or
|
|
38
|
+
* all), merge in the catalog's own components, and apply per-component
|
|
39
|
+
* description overrides. Descriptions feed both `defineCatalog(...).prompt()`
|
|
40
|
+
* and `.jsonSchema()`, so this controls what an agent sees for the catalog.
|
|
41
|
+
*
|
|
42
|
+
* Overrides are applied immutably — the shared `baseComponents` definitions
|
|
43
|
+
* (also used by the core catalog/registry) are never mutated.
|
|
44
|
+
*/
|
|
45
|
+
export declare function composeCatalogComponents(opts?: ComposeCatalogComponentsOptions): Record<string, ComponentCatalogDef>;
|
|
46
|
+
export interface ScopedCatalogDef {
|
|
47
|
+
prefix: string;
|
|
48
|
+
components?: Record<string, ComponentCatalogDef>;
|
|
49
|
+
actions?: Record<string, ActionCatalogDef>;
|
|
50
|
+
/** Core components to include: an array of names, or "all" (default). */
|
|
51
|
+
core?: CoreComponentName[] | "all";
|
|
52
|
+
/** Per-component description overrides/appends — applies to core and own components. */
|
|
53
|
+
overrides?: Partial<Record<string, DescriptionOverride>>;
|
|
54
|
+
/** Appended to base rules in generated prompt */
|
|
55
|
+
rules?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface MergedCatalog {
|
|
58
|
+
prefix: string;
|
|
59
|
+
catalog: Catalog;
|
|
60
|
+
prompt(baseRules: string): string;
|
|
61
|
+
jsonSchema(): object;
|
|
62
|
+
}
|
|
63
|
+
export declare function createScopedCatalog(def: ScopedCatalogDef): ScopedCatalogDef;
|
|
64
|
+
export declare function mergeCatalogs(scopedDef: ScopedCatalogDef): MergedCatalog;
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
._7hazmf0{width:100%}._7hazmf1{gap:var(--gpbfm95y);flex-direction:column;display:flex;overflow:visible}._7hazmf2{flex-direction:column;width:100%;display:flex}._7hazmf3{transition:grid-template-rows var(--m8lxqj1i) var(--m8lxqj1t), margin-top var(--m8lxqj1i) var(--m8lxqj1t), opacity var(--m8lxqj1i) var(--m8lxqj1t);display:grid;overflow:visible}._7hazmf4{margin-top:var(--gpbfm95y);opacity:1;grid-template-rows:1fr}._7hazmf5{opacity:0;grid-template-rows:0fr;margin-top:0}._7hazmf6{min-height:0;transition:padding var(--m8lxqj1i) var(--m8lxqj1t), margin var(--m8lxqj1i) var(--m8lxqj1t);overflow:hidden}._7hazmf7{padding:var(--gpbfm95y);margin:calc(-1 * var(--gpbfm95y))}._7hazmf8{margin:0;padding:0}._7hazmf9{justify-content:space-between;align-items:center;gap:var(--gpbfm95w);cursor:pointer;width:100%;color:inherit;font:inherit;text-align:left;background:0 0;border:none;margin:0;padding:0;display:flex}._7hazmfa{align-items:center;gap:var(--gpbfm95w);flex:1;min-width:0;display:flex}._7hazmfb{flex-shrink:0;align-items:center;min-width:0;display:inline-flex}._7hazmfc{transition:transform var(--m8lxqj1i) var(--m8lxqj1t);transform-origin:50%;flex-shrink:0}._7hazmfd{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){._7hazmf3,._7hazmf6,._7hazmfc{transition:none}}._1b4fiav0{width:100%;overflow-x:auto}._1b4fiav1{font-variant-numeric:tabular-nums;font-weight:500}._1afcqze0{gap:var(--gpbfm95w);flex-direction:column;width:100%;display:flex}._1afcqze1{width:100%}._1afcqze2{align-items:center;gap:var(--gpbfm95x);min-width:0;display:flex}._1afcqze3{width:var(--gpbfm962);height:var(--gpbfm962);background-color:var(--m8lxqjb);border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;display:flex}._1afcqze4{gap:var(--gpbfm95x);flex-direction:column;width:100%;display:flex}._1afcqze5{justify-content:center;align-items:center;width:100%;display:flex}._1afcqze6{object-fit:contain;border-radius:var(--m8lxqj1);max-width:100%;max-height:65vh}._1afcqze7{width:100%;min-height:var(--gpbfm968);justify-content:center;align-items:center;display:flex}._1afcqze8{text-align:left;width:100%}.blgld0{flex-direction:column;width:100%;display:flex}.blgld1{color:var(--m8lxqj12)}.blgld2{padding:var(--gpbfm95x)}.blgld3{column-gap:var(--gpbfm95x);row-gap:var(--gpbfm95v);grid-template-columns:minmax(0,1fr) max-content;align-items:start;width:100%;display:grid}.blgld4{gap:var(--gpbfm95v);flex-direction:column;min-width:0;display:flex}.blgld5{align-items:center;gap:var(--gpbfm95w);min-width:0;display:flex}.blgld6{width:var(--gpbfm95s);background-color:var(--m8lxqjw);flex-shrink:0;align-self:stretch}.blgld7{align-items:flex-end;gap:var(--gpbfm95v);flex-direction:column;flex-shrink:0;display:flex}._16tl57e0{gap:var(--gpbfm95y);width:100%;display:grid}._16tl57e1{grid-template-columns:repeat(3,minmax(0,1fr))}._16tl57e2{grid-template-columns:repeat(4,minmax(0,1fr))}._16tl57e3{color:var(--m8lxqj12)}._16tl57e4{gap:var(--gpbfm95v);flex-direction:column;min-width:0;display:flex}._2pn4ri0{isolation:isolate;width:100%;position:relative;overflow:visible}._4l9lye0{flex-direction:column;width:100%;display:flex}._4l9lye1{margin-bottom:var(--gpbfm95x)}._4l9lye2{padding-block:var(--gpbfm95w);gap:var(--gpbfm95v);flex-direction:column;display:flex}._4l9lye2:first-child{padding-top:0}._4l9lye3{justify-content:space-between;align-items:baseline;gap:var(--gpbfm95w);display:flex}._4l9lye4{color:var(--m8lxqj12)}._1ysu3qn0{gap:var(--gpbfm95w);flex-direction:column;display:flex}._1ysu3qn1{align-items:center;gap:var(--gpbfm95w);display:flex}._19nljxi0{gap:var(--gpbfm95x);flex-direction:column;max-width:800px;margin:0 auto;display:flex}._5kl5rv0{flex-direction:column;width:100%;display:flex}._5kl5rv1{background-color:var(--gpbfm9a);border-radius:var(--m8lxqj2);padding:var(--gpbfm95x);flex-direction:column;display:flex}._5kl5rv1:not(:first-child){margin-top:var(--gpbfm95x)}._5kl5rv2{margin-bottom:var(--gpbfm95w)}._5kl5rv3{color:var(--m8lxqj12)}._5kl5rv4{align-content:start;justify-items:start;width:100%;display:grid}._5kl5rv5{width:100%;margin-top:var(--gpbfm95x);margin-bottom:var(--gpbfm95x);height:var(--gpbfm95s);background-color:var(--m8lxqjw);grid-column:1/-1}._5kl5rv6{align-items:flex-start;gap:var(--gpbfm95v);flex-direction:column;justify-self:start;min-width:0;display:flex}.zf6dad0{width:100%}._1v76lkh0{border-width:var(--gpbfm95s);border-style:solid;border-color:var(--m8lxqjw);border-radius:var(--m8lxqj1);display:grid;overflow:hidden}._1v76lkh1{padding-block:var(--gpbfm95w);padding-inline:var(--gpbfm95x)}._1v76lkh2{border-bottom-width:var(--gpbfm95s);border-bottom-style:solid;border-bottom-color:var(--m8lxqjw)}._1le8ba61{pointer-events:none;opacity:var(--m8lxqj1w)}.cy2dbi0{font-weight:var(--gpbfm94r);font-size:13px}.cy2dbi1{color:var(--gpbfm91m)}.cy2dbi2{color:var(--gpbfm91a)}.cy2dbi3{color:var(--m8lxqj12)}.nilaa0{padding-top:var(--gpbfm95w)}
|
|
2
|
+
/*$vite$:1*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ComponentCatalogDef } from './
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { ComponentCatalogDef } from './scoped-catalog';
|
|
3
|
+
/**
|
|
4
|
+
* Surfaces a catalog component can render on. `"all"` is a wildcard that matches
|
|
5
|
+
* every surface; `"panel"` and `"app"` are reserved for future use.
|
|
6
|
+
*/
|
|
7
|
+
export type RendererContext = "all" | "chat" | "panel" | "app" | "context";
|
|
5
8
|
export interface CatalogEntry {
|
|
6
9
|
name: string;
|
|
7
10
|
catalog: ComponentCatalogDef;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/json-render-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Generative UI catalog, registry, and renderers for json-render",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,11 +14,15 @@
|
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"import": "./dist/index.js"
|
|
16
16
|
},
|
|
17
|
+
"./styles.css": "./dist/styles.css",
|
|
17
18
|
"./catalog/*": "./dist/catalog/*"
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
20
21
|
"dist"
|
|
21
22
|
],
|
|
23
|
+
"sideEffects": [
|
|
24
|
+
"**/*.css"
|
|
25
|
+
],
|
|
22
26
|
"dependencies": {
|
|
23
27
|
"@json-render/core": "^0.15.0",
|
|
24
28
|
"@json-render/react": "^0.15.0",
|
|
@@ -28,6 +32,7 @@
|
|
|
28
32
|
"@amcharts/amcharts5": "^5.0.0",
|
|
29
33
|
"@servicetitan/anvil2": ">=1.0.0",
|
|
30
34
|
"@servicetitan/anvil2-ext-charts": "0.1.7",
|
|
35
|
+
"@servicetitan/carto-react-kit": ">=0.3.0",
|
|
31
36
|
"react": ">=18 <20",
|
|
32
37
|
"react-dom": ">=18 <20"
|
|
33
38
|
},
|
|
@@ -35,7 +40,7 @@
|
|
|
35
40
|
"@amcharts/amcharts5": "^5.0.0",
|
|
36
41
|
"@biomejs/biome": "^2.4.15",
|
|
37
42
|
"@chromatic-com/storybook": "^5.2.1",
|
|
38
|
-
"@servicetitan/anvil2": "^3.0
|
|
43
|
+
"@servicetitan/anvil2": "^3.3.0",
|
|
39
44
|
"@servicetitan/anvil2-ext-charts": "0.1.7",
|
|
40
45
|
"@storybook/addon-a11y": "^10.4.1",
|
|
41
46
|
"@storybook/addon-docs": "^10.4.1",
|
|
@@ -46,6 +51,9 @@
|
|
|
46
51
|
"@types/prismjs": "^1.26.6",
|
|
47
52
|
"@types/react": "^18.3.28",
|
|
48
53
|
"@types/react-dom": "^18.3.7",
|
|
54
|
+
"@vanilla-extract/css": "^1.20.1",
|
|
55
|
+
"@vanilla-extract/recipes": "^0.5.7",
|
|
56
|
+
"@vanilla-extract/vite-plugin": "^5.2.2",
|
|
49
57
|
"@vitejs/plugin-react": "^6.0.1",
|
|
50
58
|
"@vitest/browser": "^4.1.6",
|
|
51
59
|
"@vitest/browser-playwright": "^4.1.6",
|
|
@@ -63,7 +71,10 @@
|
|
|
63
71
|
"vite-plugin-svgr": "^4.5.0",
|
|
64
72
|
"vitest": "^4.1.6",
|
|
65
73
|
"@carto-internal/biome-config": "0.0.0",
|
|
66
|
-
"@carto-internal/
|
|
74
|
+
"@carto-internal/tools": "0.0.0",
|
|
75
|
+
"@carto-internal/tsconfig": "0.0.0",
|
|
76
|
+
"@servicetitan/carto-react-kit": "0.3.3",
|
|
77
|
+
"@servicetitan/carto-tokens": "0.2.0"
|
|
67
78
|
},
|
|
68
79
|
"scripts": {
|
|
69
80
|
"build": "vite build && pnpm schema:gen",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const badgeCatalog: {
|
|
3
|
-
props: z.ZodObject<{
|
|
4
|
-
content: z.ZodOptional<z.ZodString>;
|
|
5
|
-
offset: z.ZodOptional<z.ZodObject<{
|
|
6
|
-
x: z.ZodOptional<z.ZodString>;
|
|
7
|
-
y: z.ZodOptional<z.ZodString>;
|
|
8
|
-
}, z.core.$strip>>;
|
|
9
|
-
}, z.core.$strip>;
|
|
10
|
-
slots: string[];
|
|
11
|
-
description: string;
|
|
12
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { badgeCatalog } from './badge.catalog';
|
|
4
|
-
export { badgeCatalog };
|
|
5
|
-
export declare const BadgeRenderer: ({ props, children, }: {
|
|
6
|
-
props: z.infer<typeof badgeCatalog.props>;
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
package/dist/team-catalog.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Catalog } from '@json-render/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export interface ComponentCatalogDef {
|
|
4
|
-
props: z.ZodType;
|
|
5
|
-
slots: string[];
|
|
6
|
-
description: string;
|
|
7
|
-
}
|
|
8
|
-
export interface ActionCatalogDef {
|
|
9
|
-
params: z.ZodType;
|
|
10
|
-
description: string;
|
|
11
|
-
}
|
|
12
|
-
export interface TeamCatalogDef {
|
|
13
|
-
prefix: string;
|
|
14
|
-
components?: Record<string, ComponentCatalogDef>;
|
|
15
|
-
actions?: Record<string, ActionCatalogDef>;
|
|
16
|
-
/** Appended to base rules in generated prompt */
|
|
17
|
-
rules?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface MergedCatalog {
|
|
20
|
-
prefix: string;
|
|
21
|
-
catalog: Catalog;
|
|
22
|
-
prompt(baseRules: string): string;
|
|
23
|
-
jsonSchema(): object;
|
|
24
|
-
}
|
|
25
|
-
export declare function createTeamCatalog(def: TeamCatalogDef): TeamCatalogDef;
|
|
26
|
-
export declare function mergeCatalogs(teamDef: TeamCatalogDef): MergedCatalog;
|