@uibot/renderer-react 0.0.0-stage → 0.2.1

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 (81) hide show
  1. package/dist/HtmlSourceEditor.d.ts +60 -0
  2. package/dist/collection-activity.d.ts +12 -0
  3. package/dist/collection-ai.d.ts +17 -0
  4. package/dist/collection-application.d.ts +5 -0
  5. package/dist/collection-application.js +25 -0
  6. package/dist/collection-approval.d.ts +7 -0
  7. package/dist/collection-attachments.d.ts +10 -0
  8. package/dist/collection-automation.d.ts +10 -0
  9. package/dist/collection-calendar-view.d.ts +2 -0
  10. package/dist/collection-computed.d.ts +4 -0
  11. package/dist/collection-conversion.d.ts +6 -0
  12. package/dist/collection-editors.d.ts +40 -0
  13. package/dist/collection-editors.js +10 -0
  14. package/dist/collection-form-view.d.ts +2 -0
  15. package/dist/collection-formula/evaluate.d.ts +18 -0
  16. package/dist/collection-formula/index.d.ts +1 -0
  17. package/dist/collection-gallery-view.d.ts +2 -0
  18. package/dist/collection-grid/cell-display.d.ts +24 -0
  19. package/dist/collection-grid/cells.d.ts +29 -0
  20. package/dist/collection-grid/column-color.d.ts +5 -0
  21. package/dist/collection-grid/date-value.d.ts +13 -0
  22. package/dist/collection-grid/features.d.ts +76 -0
  23. package/dist/collection-grid/field-format.d.ts +17 -0
  24. package/dist/collection-grid/fill.d.ts +10 -0
  25. package/dist/collection-grid/filter-labels.d.ts +6 -0
  26. package/dist/collection-grid/footer-aggregate.d.ts +6 -0
  27. package/dist/collection-grid/footer-stats.d.ts +5 -0
  28. package/dist/collection-grid/grouping.d.ts +51 -0
  29. package/dist/collection-grid/index.d.ts +9 -0
  30. package/dist/collection-grid/paged-field-input.d.ts +22 -0
  31. package/dist/collection-grid/paged-locale.d.ts +3 -0
  32. package/dist/collection-grid/paged-model.d.ts +25 -0
  33. package/dist/collection-grid/relation-editor.d.ts +14 -0
  34. package/dist/collection-grid/relation-options.d.ts +4 -0
  35. package/dist/collection-grid/selection.d.ts +4 -0
  36. package/dist/collection-interaction-state.d.ts +26 -0
  37. package/dist/collection-kanban-view.d.ts +2 -0
  38. package/dist/collection-live-changes.d.ts +8 -0
  39. package/dist/collection-relations.d.ts +20 -0
  40. package/dist/collection-sharing.d.ts +10 -0
  41. package/dist/collection-table-view.d.ts +2 -0
  42. package/dist/collection-transfer.d.ts +12 -0
  43. package/dist/collection-ui.d.ts +152 -0
  44. package/dist/collection-views/aggregate.d.ts +39 -0
  45. package/dist/collection-views/ai-fill-drawer.d.ts +28 -0
  46. package/dist/collection-views/ai-fill-model.d.ts +35 -0
  47. package/dist/collection-views/board.d.ts +2 -0
  48. package/dist/collection-views/calendar.d.ts +4 -0
  49. package/dist/collection-views/field-config.d.ts +16 -0
  50. package/dist/collection-views/filter-builder.d.ts +23 -0
  51. package/dist/collection-views/gallery.d.ts +2 -0
  52. package/dist/collection-views/icons.d.ts +43 -0
  53. package/dist/collection-views/menu.d.ts +16 -0
  54. package/dist/collection-views/model.d.ts +22 -0
  55. package/dist/collection-views/record-creator.d.ts +31 -0
  56. package/dist/collection-views/schema-editor.d.ts +38 -0
  57. package/dist/collection-views/schema-field-settings.d.ts +22 -0
  58. package/dist/collection-views/schema-styles.d.ts +4 -0
  59. package/dist/collection-views/shared.d.ts +110 -0
  60. package/dist/collection-views/table-nav.d.ts +52 -0
  61. package/dist/collection-views/toolbar-popover.d.ts +24 -0
  62. package/dist/collection-views/ui.d.ts +45 -0
  63. package/dist/collection-views/view-settings-sections.d.ts +39 -0
  64. package/dist/collection-views/view-tabs.d.ts +35 -0
  65. package/dist/collection-views.d.ts +35 -0
  66. package/dist/collection-views.js +10 -0
  67. package/dist/collection-workspace.d.ts +128 -0
  68. package/dist/collection-workspace.js +26 -0
  69. package/dist/define-component.d.ts +35 -0
  70. package/dist/document-collection.d.ts +30 -0
  71. package/dist/document-view.d.ts +1 -0
  72. package/dist/html-source-editor.css +84 -0
  73. package/dist/index.d.ts +121 -0
  74. package/dist/index.js +25 -0
  75. package/dist/live-renderer.d.ts +60 -0
  76. package/dist/paged-collection-grid.d.ts +95 -0
  77. package/dist/paged-collection-grid.js +25 -0
  78. package/dist/paged-collection-views.d.ts +15 -0
  79. package/dist/renderer.d.ts +20 -0
  80. package/package.json +69 -4
  81. package/README.md +0 -3
@@ -0,0 +1,35 @@
1
+ import type { CatalogEntry, SchemaLike } from "@uibot/contracts";
2
+ import type { RendererComponent, RendererComponentContext } from "./index.js";
3
+ type SchemaValue<S> = S extends {
4
+ enum: readonly (infer E)[];
5
+ } ? E : S extends {
6
+ type: "array";
7
+ items: infer I;
8
+ } ? Array<SchemaValue<I>> : S extends {
9
+ type: "object";
10
+ properties: infer P extends Record<string, unknown>;
11
+ } ? {
12
+ [K in keyof P]: SchemaValue<P[K]>;
13
+ } : S extends {
14
+ type: "string";
15
+ } ? string : S extends {
16
+ type: "number";
17
+ } ? number : S extends {
18
+ type: "boolean";
19
+ } ? boolean : unknown;
20
+ /** Props inferred from a catalog entry's schema. Literal schemas stay specific. */
21
+ export type PropsOf<E extends {
22
+ props?: Record<string, SchemaLike> | undefined;
23
+ }> = {
24
+ [K in keyof NonNullable<E["props"]>]: SchemaValue<NonNullable<E["props"]>[K]>;
25
+ };
26
+ /** Coerce raw spec props to the shapes declared by a catalog entry. */
27
+ export declare function coerceProps<E extends {
28
+ props?: Record<string, SchemaLike> | undefined;
29
+ }>(entry: E, props: Record<string, unknown>): PropsOf<E>;
30
+ /**
31
+ * Bind a render function to a catalog entry. Props are coerced at runtime and
32
+ * inferred from the entry schema at compile time.
33
+ */
34
+ export declare function defineComponent<const E extends CatalogEntry>(entry: E, render: (props: PropsOf<E>, context: RendererComponentContext) => unknown): RendererComponent<Record<string, unknown>>;
35
+ export {};
@@ -0,0 +1,30 @@
1
+ import type { Catalog, UIBotSpec } from "@uibot/contracts";
2
+ import { CollectionCalendarView } from "./collection-calendar-view.js";
3
+ import { CollectionFormView } from "./collection-form-view.js";
4
+ import { CollectionGalleryView } from "./collection-gallery-view.js";
5
+ import { CollectionKanbanView } from "./collection-kanban-view.js";
6
+ import { CollectionTableView } from "./collection-table-view.js";
7
+ import { DocumentView } from "./document-view.js";
8
+ export declare const DOCUMENT_COLLECTION_CATALOG: Catalog;
9
+ export declare function documentCollectionEntries(): {
10
+ DocumentView: {
11
+ component: typeof DocumentView;
12
+ };
13
+ CollectionTableView: {
14
+ component: typeof CollectionTableView;
15
+ };
16
+ CollectionKanbanView: {
17
+ component: typeof CollectionKanbanView;
18
+ };
19
+ CollectionGalleryView: {
20
+ component: typeof CollectionGalleryView;
21
+ };
22
+ CollectionCalendarView: {
23
+ component: typeof CollectionCalendarView;
24
+ };
25
+ CollectionFormView: {
26
+ component: typeof CollectionFormView;
27
+ };
28
+ };
29
+ export declare function documentReadSpec(): UIBotSpec;
30
+ export declare function collectionTableSpec(): UIBotSpec;
@@ -0,0 +1 @@
1
+ export declare function DocumentView(props: Record<string, unknown>): unknown;
@@ -0,0 +1,84 @@
1
+ [data-uibot="html-source-editor"] {
2
+ --uibot-html-editor-gap: 1rem;
3
+ --uibot-html-editor-border: var(--uibot-border, #cbd5e1);
4
+ --uibot-html-editor-surface: var(--uibot-surface, #fff);
5
+ --uibot-html-editor-text: var(--uibot-text, #0f172a);
6
+ --uibot-html-editor-focus: var(--uibot-focus, #2563eb);
7
+ --uibot-html-editor-error: var(--uibot-error, #b91c1c);
8
+ display: grid;
9
+ grid-template-columns: minmax(0, 1fr);
10
+ gap: var(--uibot-html-editor-gap);
11
+ min-width: 0;
12
+ color: var(--uibot-html-editor-text);
13
+ }
14
+
15
+ [data-uibot="html-source-editor"][data-view="split"] {
16
+ grid-template-columns: repeat(2, minmax(0, 1fr));
17
+ }
18
+
19
+ [data-uibot="html-source-editor"][data-view="split"] > iframe {
20
+ grid-column: 2;
21
+ grid-row: 1;
22
+ }
23
+
24
+ [data-uibot="html-source-editor"][data-view="split"] > label {
25
+ grid-column: 1;
26
+ grid-row: 1;
27
+ }
28
+
29
+ [data-uibot="html-source-editor"] > iframe,
30
+ [data-uibot="html-source-editor"] > label {
31
+ box-sizing: border-box;
32
+ width: 100%;
33
+ min-width: 0;
34
+ }
35
+
36
+ [data-uibot="html-source-editor"] > iframe {
37
+ min-height: 28rem;
38
+ border: 1px solid var(--uibot-html-editor-border);
39
+ border-radius: 0.5rem;
40
+ background: var(--uibot-html-editor-surface);
41
+ }
42
+
43
+ [data-uibot="html-source-editor"] textarea {
44
+ box-sizing: border-box;
45
+ display: block;
46
+ width: 100%;
47
+ min-height: 28rem;
48
+ resize: vertical;
49
+ border: 1px solid var(--uibot-html-editor-border);
50
+ border-radius: 0.5rem;
51
+ padding: 0.75rem;
52
+ background: var(--uibot-html-editor-surface);
53
+ color: var(--uibot-html-editor-text);
54
+ font: 0.875rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
55
+ tab-size: 2;
56
+ }
57
+
58
+ [data-uibot="html-source-editor"] textarea:focus-visible {
59
+ outline: 2px solid var(--uibot-html-editor-focus);
60
+ outline-offset: 2px;
61
+ }
62
+
63
+ [data-uibot="html-source-editor"] > [role="alert"] {
64
+ grid-column: 1 / -1;
65
+ margin: 0;
66
+ color: var(--uibot-html-editor-error);
67
+ }
68
+
69
+ @media (max-width: 48rem) {
70
+ [data-uibot="html-source-editor"][data-view="split"] {
71
+ grid-template-columns: minmax(0, 1fr);
72
+ }
73
+
74
+ [data-uibot="html-source-editor"][data-view="split"] > iframe,
75
+ [data-uibot="html-source-editor"][data-view="split"] > label {
76
+ grid-column: 1;
77
+ grid-row: auto;
78
+ }
79
+
80
+ [data-uibot="html-source-editor"] > iframe,
81
+ [data-uibot="html-source-editor"] textarea {
82
+ min-height: 20rem;
83
+ }
84
+ }
@@ -0,0 +1,121 @@
1
+ import type { ActionChain, ActionEventScope, CapabilityDescriptor, CompiledUIBotSpec, PropValue, UIElement, VisibilityCondition } from "@uibot/contracts";
2
+ /**
3
+ * Dispatches an event ActionChain (e.g. a block's `onChange` → SetState).
4
+ * Injected by the live host via {@link UIBotRuntimeAdapter}; optional so that
5
+ * static (non-interactive) rendering stays dependency-free.
6
+ */
7
+ export type RendererDispatch = (chain: ActionChain, scope?: {
8
+ event?: ActionEventScope;
9
+ }) => void | Promise<void>;
10
+ export interface RendererResolveContext {
11
+ readonly spec: CompiledUIBotSpec;
12
+ readonly state: Record<string, unknown>;
13
+ resolveProp(value: PropValue | undefined): unknown;
14
+ getState(path: string): unknown;
15
+ }
16
+ export interface RenderPlanNode {
17
+ key: string;
18
+ type: string;
19
+ status: "ready" | "missing";
20
+ visible: boolean;
21
+ props?: UIElement["props"];
22
+ children: RenderPlanNode[];
23
+ slots?: Record<string, RenderPlanNode[]>;
24
+ }
25
+ export interface RendererComponentContext {
26
+ readonly elementKey: string;
27
+ readonly element: UIElement;
28
+ readonly status: RenderPlanNode["status"];
29
+ readonly visible: boolean;
30
+ readonly children: unknown[];
31
+ readonly slots: Record<string, unknown[]>;
32
+ readonly registry: ReactRegistry;
33
+ readonly resolve: RendererResolveContext;
34
+ /**
35
+ * Dispatch an event ActionChain (e.g. `onChange` → SetState). Present only
36
+ * when a live host injects it; `undefined` for static rendering.
37
+ */
38
+ readonly dispatch?: RendererDispatch;
39
+ }
40
+ export type RendererComponent<TProps = Record<string, unknown>> = (props: TProps, context: RendererComponentContext) => unknown;
41
+ export interface RegistryEntry {
42
+ category?: string;
43
+ sourcePlugin?: string;
44
+ component: RendererComponent;
45
+ }
46
+ export interface MissingComponentRenderInput {
47
+ readonly node: RenderPlanNode;
48
+ readonly element?: UIElement;
49
+ readonly children: unknown[];
50
+ readonly slots: Record<string, unknown[]>;
51
+ readonly resolve: RendererResolveContext;
52
+ }
53
+ export type MissingComponentRenderer = (input: MissingComponentRenderInput) => unknown;
54
+ export interface RendererPlugin {
55
+ pluginId: string;
56
+ entries?: Record<string, RegistryEntry>;
57
+ fallback?: MissingComponentRenderer;
58
+ }
59
+ export interface RendererCapabilityContribution {
60
+ entries?: Record<string, RegistryEntry>;
61
+ fallback?: MissingComponentRenderer;
62
+ }
63
+ export interface DefineRegistryOptions {
64
+ fallback?: MissingComponentRenderer;
65
+ }
66
+ export interface CreateRenderPlanOptions {
67
+ state?: Record<string, unknown>;
68
+ /** Which page to render (defaults to first page) */
69
+ pageId?: string;
70
+ /** Route path of the page to render. Used when pageId is not provided. */
71
+ pagePath?: string;
72
+ }
73
+ export interface RenderSpecOptions extends CreateRenderPlanOptions {
74
+ includeHidden?: boolean;
75
+ /** Event dispatcher passed through to component contexts (live rendering). */
76
+ dispatch?: RendererDispatch;
77
+ /**
78
+ * When true (default), stamp each rendered non-Fragment React element root with
79
+ * `data-uibot-block-id` equal to the compiled block id / element key.
80
+ * Builder annotation / canvas click-select bind via this attribute — never
81
+ * by searching description text.
82
+ */
83
+ stampBlockIdentity?: boolean;
84
+ }
85
+ export declare class ReactRegistry {
86
+ private readonly entries;
87
+ private readonly fallback;
88
+ constructor(entries: Record<string, RegistryEntry>, fallback?: MissingComponentRenderer);
89
+ get(type: string): RegistryEntry | undefined;
90
+ getFallback(): MissingComponentRenderer;
91
+ merge(input: ReactRegistry | RendererPlugin | Record<string, RegistryEntry>): ReactRegistry;
92
+ }
93
+ export declare function defineRegistry(entries: Record<string, RegistryEntry>, options?: DefineRegistryOptions): ReactRegistry;
94
+ export declare function defineRendererPlugin(plugin: RendererPlugin): RendererPlugin;
95
+ export declare function defineRendererCapabilityContribution(contribution: RendererCapabilityContribution): RendererCapabilityContribution;
96
+ export declare function composeRegistry(inputs: Array<ReactRegistry | RendererPlugin | Record<string, RegistryEntry>>, options?: DefineRegistryOptions): ReactRegistry;
97
+ export declare function createRegistryFromCapabilities(capabilities: CapabilityDescriptor<RendererCapabilityContribution>[], options?: DefineRegistryOptions): ReactRegistry;
98
+ export declare function createRenderPlan(spec: CompiledUIBotSpec, registry: ReactRegistry, options?: CreateRenderPlanOptions): RenderPlanNode;
99
+ export declare function createRenderPlans(spec: CompiledUIBotSpec, registry: ReactRegistry, options?: CreateRenderPlanOptions): RenderPlanNode[];
100
+ export declare function renderSpec(spec: CompiledUIBotSpec, registry: ReactRegistry, options?: RenderSpecOptions): unknown;
101
+ export declare function evaluateRendererProp(value: PropValue | undefined, state: Record<string, unknown>): unknown;
102
+ export declare function evaluateRendererVisibility(condition: VisibilityCondition | undefined, state: Record<string, unknown>): boolean;
103
+ export { UIBotRenderer } from "./renderer.js";
104
+ export type { UIBotRendererProps } from "./renderer.js";
105
+ export { UIBotLiveRenderer, UIBotMountError } from "./live-renderer.js";
106
+ export type { UIBotRuntimeAdapter, UIBotLiveRendererProps, UIBotMountErrorInfo, } from "./live-renderer.js";
107
+ export { defineComponent, coerceProps } from "./define-component.js";
108
+ export type { PropsOf } from "./define-component.js";
109
+ export { CollectionTableView } from "./collection-table-view.js";
110
+ export { PagedCollectionGrid } from "./paged-collection-grid.js";
111
+ export type { PagedCollectionGridProps } from "./paged-collection-grid.js";
112
+ export { PagedCollectionKanban, PagedCollectionForm } from "./paged-collection-views.js";
113
+ export type { PagedCollectionKanbanProps, PagedCollectionFormProps, } from "./paged-collection-views.js";
114
+ export { DocumentView } from "./document-view.js";
115
+ export { HtmlSourceEditor } from "./HtmlSourceEditor.js";
116
+ export type { HtmlSourceEditorProps, HtmlSourcePreviewBinding, HtmlSourcePreviewIdentity, HtmlSourcePreviewResult, HtmlSourceSaveInput, HtmlSourceSaveResult, } from "./HtmlSourceEditor.js";
117
+ export { DOCUMENT_COLLECTION_CATALOG, collectionTableSpec, documentCollectionEntries, documentReadSpec, } from "./document-collection.js";
118
+ export declare function createDocumentCollectionRegistry(): ReactRegistry;
119
+ export { PagedCollectionFilterBuilder } from "./collection-views/filter-builder.js";
120
+ export type { PagedFilterBuilderProps } from "./collection-views/filter-builder.js";
121
+ export { pagedFilterSummary } from "./collection-grid/filter-labels.js";