@contember/bindx-react 0.1.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 (194) hide show
  1. package/dist/batching/QueryBatcher.d.ts +31 -0
  2. package/dist/batching/QueryBatcher.d.ts.map +1 -0
  3. package/dist/batching/index.d.ts +2 -0
  4. package/dist/batching/index.d.ts.map +1 -0
  5. package/dist/components/EntityScope.d.ts +28 -0
  6. package/dist/components/EntityScope.d.ts.map +1 -0
  7. package/dist/dataview/DataGrid.d.ts +45 -0
  8. package/dist/dataview/DataGrid.d.ts.map +1 -0
  9. package/dist/dataview/DataGridPagination.d.ts +24 -0
  10. package/dist/dataview/DataGridPagination.d.ts.map +1 -0
  11. package/dist/dataview/DataGridToolbar.d.ts +16 -0
  12. package/dist/dataview/DataGridToolbar.d.ts.map +1 -0
  13. package/dist/dataview/DataViewContext.d.ts +32 -0
  14. package/dist/dataview/DataViewContext.d.ts.map +1 -0
  15. package/dist/dataview/columns.d.ts +115 -0
  16. package/dist/dataview/columns.d.ts.map +1 -0
  17. package/dist/dataview/contextHooks.d.ts +48 -0
  18. package/dist/dataview/contextHooks.d.ts.map +1 -0
  19. package/dist/dataview/dataAttribute.d.ts +6 -0
  20. package/dist/dataview/dataAttribute.d.ts.map +1 -0
  21. package/dist/dataview/export.d.ts +46 -0
  22. package/dist/dataview/export.d.ts.map +1 -0
  23. package/dist/dataview/filterComponents.d.ts +127 -0
  24. package/dist/dataview/filterComponents.d.ts.map +1 -0
  25. package/dist/dataview/filterContext.d.ts +10 -0
  26. package/dist/dataview/filterContext.d.ts.map +1 -0
  27. package/dist/dataview/filterHooks.d.ts +74 -0
  28. package/dist/dataview/filterHooks.d.ts.map +1 -0
  29. package/dist/dataview/filterScope.d.ts +54 -0
  30. package/dist/dataview/filterScope.d.ts.map +1 -0
  31. package/dist/dataview/filterWrappers.d.ts +65 -0
  32. package/dist/dataview/filterWrappers.d.ts.map +1 -0
  33. package/dist/dataview/index.d.ts +21 -0
  34. package/dist/dataview/index.d.ts.map +1 -0
  35. package/dist/dataview/infiniteLoad.d.ts +32 -0
  36. package/dist/dataview/infiniteLoad.d.ts.map +1 -0
  37. package/dist/dataview/loaderComponents.d.ts +80 -0
  38. package/dist/dataview/loaderComponents.d.ts.map +1 -0
  39. package/dist/dataview/pagingComponents.d.ts +50 -0
  40. package/dist/dataview/pagingComponents.d.ts.map +1 -0
  41. package/dist/dataview/renderCellValue.d.ts +9 -0
  42. package/dist/dataview/renderCellValue.d.ts.map +1 -0
  43. package/dist/dataview/selectionComponents.d.ts +62 -0
  44. package/dist/dataview/selectionComponents.d.ts.map +1 -0
  45. package/dist/dataview/sortingComponents.d.ts +39 -0
  46. package/dist/dataview/sortingComponents.d.ts.map +1 -0
  47. package/dist/dataview/stateStorage.d.ts +19 -0
  48. package/dist/dataview/stateStorage.d.ts.map +1 -0
  49. package/dist/dataview/useDataView.d.ts +58 -0
  50. package/dist/dataview/useDataView.d.ts.map +1 -0
  51. package/dist/dataview/useDataViewState.d.ts +89 -0
  52. package/dist/dataview/useDataViewState.d.ts.map +1 -0
  53. package/dist/hooks/BackendAdapterContext.d.ts +110 -0
  54. package/dist/hooks/BackendAdapterContext.d.ts.map +1 -0
  55. package/dist/hooks/ContemberBindxProvider.d.ts +67 -0
  56. package/dist/hooks/ContemberBindxProvider.d.ts.map +1 -0
  57. package/dist/hooks/createBindx.d.ts +39 -0
  58. package/dist/hooks/createBindx.d.ts.map +1 -0
  59. package/dist/hooks/index.d.ts +10 -0
  60. package/dist/hooks/index.d.ts.map +1 -0
  61. package/dist/hooks/useBindxEvents.d.ts +83 -0
  62. package/dist/hooks/useBindxEvents.d.ts.map +1 -0
  63. package/dist/hooks/useEntity.d.ts +123 -0
  64. package/dist/hooks/useEntity.d.ts.map +1 -0
  65. package/dist/hooks/useEntityBeforePersist.d.ts +22 -0
  66. package/dist/hooks/useEntityBeforePersist.d.ts.map +1 -0
  67. package/dist/hooks/useEntityCore.d.ts +52 -0
  68. package/dist/hooks/useEntityCore.d.ts.map +1 -0
  69. package/dist/hooks/useEntityImpl.d.ts +105 -0
  70. package/dist/hooks/useEntityImpl.d.ts.map +1 -0
  71. package/dist/hooks/useEntityList.d.ts +102 -0
  72. package/dist/hooks/useEntityList.d.ts.map +1 -0
  73. package/dist/hooks/useEntityListCore.d.ts +49 -0
  74. package/dist/hooks/useEntityListCore.d.ts.map +1 -0
  75. package/dist/hooks/useEntityListImpl.d.ts +70 -0
  76. package/dist/hooks/useEntityListImpl.d.ts.map +1 -0
  77. package/dist/hooks/useErrors.d.ts +72 -0
  78. package/dist/hooks/useErrors.d.ts.map +1 -0
  79. package/dist/hooks/usePersist.d.ts +115 -0
  80. package/dist/hooks/usePersist.d.ts.map +1 -0
  81. package/dist/hooks/useSelectionCollection.d.ts +41 -0
  82. package/dist/hooks/useSelectionCollection.d.ts.map +1 -0
  83. package/dist/hooks/useSelectionCollectionForList.d.ts +40 -0
  84. package/dist/hooks/useSelectionCollectionForList.d.ts.map +1 -0
  85. package/dist/hooks/useStableSelectionMeta.d.ts +11 -0
  86. package/dist/hooks/useStableSelectionMeta.d.ts.map +1 -0
  87. package/dist/hooks/useStoreSubscription.d.ts +19 -0
  88. package/dist/hooks/useStoreSubscription.d.ts.map +1 -0
  89. package/dist/hooks/useUndo.d.ts +45 -0
  90. package/dist/hooks/useUndo.d.ts.map +1 -0
  91. package/dist/index.d.ts +17 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/jsx/SelectionMeta.d.ts +2 -0
  94. package/dist/jsx/SelectionMeta.d.ts.map +1 -0
  95. package/dist/jsx/analyzer.d.ts +22 -0
  96. package/dist/jsx/analyzer.d.ts.map +1 -0
  97. package/dist/jsx/collectorProxy.d.ts +14 -0
  98. package/dist/jsx/collectorProxy.d.ts.map +1 -0
  99. package/dist/jsx/componentBuilder.d.ts +51 -0
  100. package/dist/jsx/componentBuilder.d.ts.map +1 -0
  101. package/dist/jsx/componentBuilder.types.d.ts +268 -0
  102. package/dist/jsx/componentBuilder.types.d.ts.map +1 -0
  103. package/dist/jsx/componentBuilderCompat.d.ts +17 -0
  104. package/dist/jsx/componentBuilderCompat.d.ts.map +1 -0
  105. package/dist/jsx/componentFactory.d.ts +39 -0
  106. package/dist/jsx/componentFactory.d.ts.map +1 -0
  107. package/dist/jsx/components/Entity.d.ts +82 -0
  108. package/dist/jsx/components/Entity.d.ts.map +1 -0
  109. package/dist/jsx/components/EntityList.d.ts +48 -0
  110. package/dist/jsx/components/EntityList.d.ts.map +1 -0
  111. package/dist/jsx/components/Field.d.ts +27 -0
  112. package/dist/jsx/components/Field.d.ts.map +1 -0
  113. package/dist/jsx/components/HasMany.d.ts +34 -0
  114. package/dist/jsx/components/HasMany.d.ts.map +1 -0
  115. package/dist/jsx/components/HasOne.d.ts +25 -0
  116. package/dist/jsx/components/HasOne.d.ts.map +1 -0
  117. package/dist/jsx/components/HasRole.d.ts +51 -0
  118. package/dist/jsx/components/HasRole.d.ts.map +1 -0
  119. package/dist/jsx/components/If.d.ts +51 -0
  120. package/dist/jsx/components/If.d.ts.map +1 -0
  121. package/dist/jsx/components/Show.d.ts +33 -0
  122. package/dist/jsx/components/Show.d.ts.map +1 -0
  123. package/dist/jsx/components/index.d.ts +8 -0
  124. package/dist/jsx/components/index.d.ts.map +1 -0
  125. package/dist/jsx/conditions.d.ts +310 -0
  126. package/dist/jsx/conditions.d.ts.map +1 -0
  127. package/dist/jsx/createComponent.d.ts +44 -0
  128. package/dist/jsx/createComponent.d.ts.map +1 -0
  129. package/dist/jsx/index.d.ts +19 -0
  130. package/dist/jsx/index.d.ts.map +1 -0
  131. package/dist/jsx/inlineProxy.d.ts +14 -0
  132. package/dist/jsx/inlineProxy.d.ts.map +1 -0
  133. package/dist/jsx/legacyTypes.d.ts +26 -0
  134. package/dist/jsx/legacyTypes.d.ts.map +1 -0
  135. package/dist/jsx/proxy.d.ts +2 -0
  136. package/dist/jsx/proxy.d.ts.map +1 -0
  137. package/dist/jsx/proxyShared.d.ts +14 -0
  138. package/dist/jsx/proxyShared.d.ts.map +1 -0
  139. package/dist/jsx/runtimeProxy.d.ts +11 -0
  140. package/dist/jsx/runtimeProxy.d.ts.map +1 -0
  141. package/dist/jsx/standaloneCreateComponent.d.ts +30 -0
  142. package/dist/jsx/standaloneCreateComponent.d.ts.map +1 -0
  143. package/dist/jsx/types.d.ts +109 -0
  144. package/dist/jsx/types.d.ts.map +1 -0
  145. package/dist/jsx/withCollector.d.ts +39 -0
  146. package/dist/jsx/withCollector.d.ts.map +1 -0
  147. package/dist/roles/RoleContext.d.ts +31 -0
  148. package/dist/roles/RoleContext.d.ts.map +1 -0
  149. package/dist/roles/index.d.ts +2 -0
  150. package/dist/roles/index.d.ts.map +1 -0
  151. package/package.json +34 -0
  152. package/src/batching/QueryBatcher.ts +114 -0
  153. package/src/batching/index.ts +1 -0
  154. package/src/components/EntityScope.tsx +43 -0
  155. package/src/hooks/BackendAdapterContext.tsx +214 -0
  156. package/src/hooks/ContemberBindxProvider.tsx +158 -0
  157. package/src/hooks/index.ts +61 -0
  158. package/src/hooks/useBindxEvents.ts +229 -0
  159. package/src/hooks/useEntity.ts +489 -0
  160. package/src/hooks/useEntityBeforePersist.ts +32 -0
  161. package/src/hooks/useEntityList.ts +444 -0
  162. package/src/hooks/useErrors.ts +150 -0
  163. package/src/hooks/usePersist.ts +377 -0
  164. package/src/hooks/useSelectionCollection.ts +122 -0
  165. package/src/hooks/useStoreSubscription.ts +51 -0
  166. package/src/hooks/useUndo.ts +83 -0
  167. package/src/index.ts +357 -0
  168. package/src/jsx/SelectionMeta.ts +2 -0
  169. package/src/jsx/analyzer.ts +261 -0
  170. package/src/jsx/collectorProxy.ts +282 -0
  171. package/src/jsx/componentBuilder.ts +180 -0
  172. package/src/jsx/componentBuilder.types.ts +463 -0
  173. package/src/jsx/componentBuilderCompat.ts +39 -0
  174. package/src/jsx/componentFactory.ts +400 -0
  175. package/src/jsx/components/Entity.tsx +383 -0
  176. package/src/jsx/components/EntityList.tsx +147 -0
  177. package/src/jsx/components/Field.tsx +79 -0
  178. package/src/jsx/components/HasMany.tsx +109 -0
  179. package/src/jsx/components/HasOne.tsx +78 -0
  180. package/src/jsx/components/HasRole.tsx +95 -0
  181. package/src/jsx/components/If.tsx +127 -0
  182. package/src/jsx/components/Show.tsx +56 -0
  183. package/src/jsx/components/index.ts +20 -0
  184. package/src/jsx/conditions.ts +472 -0
  185. package/src/jsx/createComponent.ts +175 -0
  186. package/src/jsx/index.ts +135 -0
  187. package/src/jsx/legacyTypes.ts +30 -0
  188. package/src/jsx/proxy.ts +1 -0
  189. package/src/jsx/proxyShared.ts +42 -0
  190. package/src/jsx/standaloneCreateComponent.ts +47 -0
  191. package/src/jsx/types.ts +192 -0
  192. package/src/jsx/withCollector.ts +45 -0
  193. package/src/roles/RoleContext.tsx +57 -0
  194. package/src/roles/index.ts +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentBuilderCompat.d.ts","sourceRoot":"","sources":["../../src/jsx/componentBuilderCompat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAIpE;;;GAGG;AACH,wBAAgB,wBAAwB,CAEvC,SAAS,EAAE,aAAa,CAAC,GAAG,CAAC,EAC7B,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAC3C,IAAI,CAKN;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAErC,SAAS,EAAE,aAAa,CAAC,GAAG,CAAC,EAC7B,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAC3C,IAAI,CAKN"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Component factory - builds React components with bindx selection metadata.
3
+ *
4
+ * This module handles the actual component creation, including:
5
+ * - Building React components with selection metadata
6
+ * - Implicit selection collection from JSX
7
+ * - Fragment creation
8
+ * - Selection provider interface
9
+ */
10
+ import type { ReactNode } from 'react';
11
+ import type { SelectionBuilder, SchemaDefinition } from '@contember/bindx';
12
+ import { SchemaRegistry } from '@contember/bindx';
13
+ import { type Condition } from './conditions.js';
14
+ /**
15
+ * Marker symbol for identifying components created with createComponent
16
+ */
17
+ export declare const COMPONENT_MARKER: unique symbol;
18
+ /**
19
+ * Symbol for storing component brand on the component
20
+ */
21
+ export declare const COMPONENT_BRAND: unique symbol;
22
+ /**
23
+ * Symbol for stored selection metadata
24
+ */
25
+ export declare const COMPONENT_SELECTIONS: unique symbol;
26
+ export interface EntityConfig {
27
+ readonly entityName: string | null;
28
+ readonly selector?: (builder: SelectionBuilder<object>) => SelectionBuilder<object, object, object>;
29
+ readonly isInterface?: boolean;
30
+ readonly schema?: SchemaDefinition<Record<string, object>>;
31
+ }
32
+ /**
33
+ * Builds a bindx component from entity configs and render function.
34
+ *
35
+ * Note: Implicit selection collection is deferred (lazy) to avoid TDZ errors
36
+ * when components reference other components defined later in the same file.
37
+ */
38
+ export declare function buildComponent<TProps extends object>(entityConfigs: Map<string, EntityConfig>, roles: readonly string[], renderFn: (props: TProps) => ReactNode, hasInterfacesMode: boolean, schemaRegistry: SchemaRegistry<Record<string, object>> | null, conditionFn: ((props: TProps) => Condition) | null): unknown;
39
+ //# sourceMappingURL=componentFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentFactory.d.ts","sourceRoot":"","sources":["../../src/jsx/componentFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAGX,gBAAgB,EAEhB,gBAAgB,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACN,cAAc,EAKd,MAAM,kBAAkB,CAAA;AAQzB,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,iBAAiB,CAAA;AAMnE;;GAEG;AACH,eAAO,MAAM,gBAAgB,eAA4B,CAAA;AAEzD;;GAEG;AACH,eAAO,MAAM,eAAe,eAA4B,CAAA;AAExD;;GAEG;AACH,eAAO,MAAM,oBAAoB,eAAiC,CAAA;AAMlE,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,KAAK,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACnG,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAC1D;AAMD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,SAAS,MAAM,EACnD,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EACxC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,EACtC,iBAAiB,EAAE,OAAO,EAC1B,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,EAC7D,WAAW,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC,GAAG,IAAI,GAChD,OAAO,CAsHT"}
@@ -0,0 +1,82 @@
1
+ import React, { type ReactElement } from 'react';
2
+ import type { EntityAccessor } from '../types.js';
3
+ import { type EntityDef, type EntityUniqueWhere, type FieldError, type CommonEntity } from '@contember/bindx';
4
+ /**
5
+ * Base props shared by both edit and create modes.
6
+ * TRoleMap is the role map from EntityDef — entity type resolved as CommonEntity<TRoleMap>.
7
+ */
8
+ interface EntityBaseProps<TRoleMap extends Record<string, object>> {
9
+ /** Entity definition reference */
10
+ entity: EntityDef<TRoleMap>;
11
+ /** Render function receiving typed entity accessor with direct field access */
12
+ children: (entity: EntityAccessor<CommonEntity<TRoleMap>>) => React.ReactNode;
13
+ /** Error fallback */
14
+ error?: (error: FieldError) => React.ReactNode;
15
+ }
16
+ /**
17
+ * Props for editing an existing entity (fetched by unique field)
18
+ */
19
+ interface EntityByProps<TRoleMap extends Record<string, object>> extends EntityBaseProps<TRoleMap> {
20
+ /** Unique field(s) to identify the entity (e.g., { id: '...' } or { slug: '...' }) */
21
+ by: EntityUniqueWhere;
22
+ create?: never;
23
+ onPersisted?: never;
24
+ /** Loading fallback */
25
+ loading?: React.ReactNode;
26
+ /** Not found fallback */
27
+ notFound?: React.ReactNode;
28
+ }
29
+ /**
30
+ * Props for creating a new entity
31
+ */
32
+ interface EntityCreateProps<TRoleMap extends Record<string, object>> extends EntityBaseProps<TRoleMap> {
33
+ by?: never;
34
+ /** Create a new entity instead of fetching an existing one */
35
+ create: true;
36
+ /** Callback when entity is persisted and receives server-assigned ID */
37
+ onPersisted?: (id: string) => void;
38
+ loading?: never;
39
+ notFound?: never;
40
+ }
41
+ /**
42
+ * Props for Entity component - union of edit mode (by) and create mode
43
+ */
44
+ export type EntityProps<TRoleMap extends Record<string, object> = Record<string, object>> = EntityByProps<TRoleMap> | EntityCreateProps<TRoleMap>;
45
+ /**
46
+ * Entity component - orchestrates the two-pass rendering approach.
47
+ *
48
+ * Supports two modes:
49
+ * - Edit mode: Fetches an existing entity by unique field(s)
50
+ * - Create mode: Creates a new entity locally
51
+ *
52
+ * @example Edit mode
53
+ * ```tsx
54
+ * <Entity entity={schema.Author} by={{ id: 'author-1' }}>
55
+ * {author => (
56
+ * <>
57
+ * <Field field={author.fields.name} />
58
+ * <HasMany field={author.fields.articles}>
59
+ * {article => <Field field={article.fields.title} />}
60
+ * </HasMany>
61
+ * </>
62
+ * )}
63
+ * </Entity>
64
+ * ```
65
+ *
66
+ * @example Create mode
67
+ * ```tsx
68
+ * <Entity entity={schema.Author} create onPersisted={id => navigate(`/authors/${id}`)}>
69
+ * {author => (
70
+ * <>
71
+ * <Field field={author.fields.name} />
72
+ * {author.isNew && <span>New author</span>}
73
+ * {author.persistedId && <span>Saved as {author.persistedId}</span>}
74
+ * </>
75
+ * )}
76
+ * </Entity>
77
+ * ```
78
+ */
79
+ declare function EntityImpl<TRoleMap extends Record<string, object>>(props: EntityProps<TRoleMap>): ReactElement | null;
80
+ export declare const Entity: typeof EntityImpl;
81
+ export {};
82
+ //# sourceMappingURL=Entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/Entity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAuE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AAIrH,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAAiB,KAAK,UAAU,EAAgF,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAI1M;;;GAGG;AACH,UAAU,eAAe,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAChE,kCAAkC;IAClC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAA;IAC3B,+EAA+E;IAC/E,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,CAAA;IAC7E,qBAAqB;IACrB,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,KAAK,CAAC,SAAS,CAAA;CAC9C;AAED;;GAEG;AACH,UAAU,aAAa,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAE,SAAQ,eAAe,CAAC,QAAQ,CAAC;IACjG,sFAAsF;IACtF,EAAE,EAAE,iBAAiB,CAAA;IACrB,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,uBAAuB;IACvB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED;;GAEG;AACH,UAAU,iBAAiB,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAE,SAAQ,eAAe,CAAC,QAAQ,CAAC;IACrG,EAAE,CAAC,EAAE,KAAK,CAAA;IACV,8DAA8D;IAC9D,MAAM,EAAE,IAAI,CAAA;IACZ,wEAAwE;IACxE,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,OAAO,CAAC,EAAE,KAAK,CAAA;IACf,QAAQ,CAAC,EAAE,KAAK,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IACrF,aAAa,CAAC,QAAQ,CAAC,GACvB,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AAuO9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,iBAAS,UAAU,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1D,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC,GAC1B,YAAY,GAAG,IAAI,CA0BrB;AAGD,eAAO,MAAM,MAAM,EAAkC,OAAO,UAAU,CAAA"}
@@ -0,0 +1,48 @@
1
+ import React, { type ReactElement } from 'react';
2
+ import { type EntityDef, type EntityWhere, type EntityOrderBy, type FieldError, type CommonEntity } from '@contember/bindx';
3
+ import type { EntityAccessor } from '../types.js';
4
+ /**
5
+ * Props for EntityList component
6
+ */
7
+ export interface EntityListProps<TRoleMap extends Record<string, object> = Record<string, object>> {
8
+ /** Entity definition reference */
9
+ entity: EntityDef<TRoleMap>;
10
+ /** Optional filter criteria - type-safe based on entity schema */
11
+ filter?: EntityWhere<CommonEntity<TRoleMap>>;
12
+ /** Optional ordering - type-safe based on entity schema */
13
+ orderBy?: readonly EntityOrderBy<CommonEntity<TRoleMap>>[];
14
+ /** Optional limit */
15
+ limit?: number;
16
+ /** Optional offset */
17
+ offset?: number;
18
+ /** Render function receiving typed entity accessor with direct field access */
19
+ children: (entity: EntityAccessor<CommonEntity<TRoleMap>>, index: number) => React.ReactNode;
20
+ /** Loading fallback */
21
+ loading?: React.ReactNode;
22
+ /** Error fallback */
23
+ error?: (error: FieldError) => React.ReactNode;
24
+ /** Empty state fallback (when list has no items) */
25
+ empty?: React.ReactNode;
26
+ }
27
+ /**
28
+ * EntityList component - orchestrates the two-pass rendering approach for lists.
29
+ *
30
+ * Phase 1 (Collection): Renders children once with collector proxy to determine which fields are needed
31
+ * Phase 2 (Loading): Fetches data based on collected selection
32
+ * Phase 3 (Runtime): Renders children for each item with real data accessors
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * <EntityList entity={schema.Article} filter={{ published: true }} orderBy={[{ createdAt: 'desc' }]} limit={10}>
37
+ * {(article, index) => (
38
+ * <div key={article.id}>
39
+ * <Field field={article.fields.title} />
40
+ * </div>
41
+ * )}
42
+ * </EntityList>
43
+ * ```
44
+ */
45
+ declare function EntityListComponent<TRoleMap extends Record<string, object>>({ entity, filter, orderBy, limit, offset, children, loading, error: errorFallback, empty, }: EntityListProps<TRoleMap>): ReactElement | null;
46
+ export declare const EntityList: typeof EntityListComponent;
47
+ export {};
48
+ //# sourceMappingURL=EntityList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityList.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/EntityList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAQ,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAG3H,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAChG,kCAAkC;IAClC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAA;IAC3B,kEAAkE;IAClE,MAAM,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAA;IAC5C,2DAA2D;IAC3D,OAAO,CAAC,EAAE,SAAS,aAAa,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAA;IAC1D,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,+EAA+E;IAC/E,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAA;IAC5F,uBAAuB;IACvB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,qBAAqB;IACrB,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,KAAK,CAAC,SAAS,CAAA;IAC9C,oDAAoD;IACpD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,mBAAmB,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EACrE,MAAM,EACN,MAAM,EACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,KAAK,EAAE,aAAa,EACpB,KAAK,GACL,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,YAAY,GAAG,IAAI,CAwDjD;AAGD,eAAO,MAAM,UAAU,EAA2C,OAAO,mBAAmB,CAAA"}
@@ -0,0 +1,27 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { FieldProps, SelectionProvider } from '../types.js';
3
+ import { BINDX_COMPONENT } from '../types.js';
4
+ /**
5
+ * Field component - renders a scalar field value
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * // Basic usage - renders value as string
10
+ * <Field field={entity.fields.name} />
11
+ *
12
+ * // With custom render function
13
+ * <Field field={entity.fields.email}>
14
+ * {field => <a href={`mailto:${field.value}`}>{field.value}</a>}
15
+ * </Field>
16
+ *
17
+ * // With format function
18
+ * <Field field={entity.fields.date} format={d => d?.toLocaleDateString()} />
19
+ * ```
20
+ */
21
+ declare function FieldImpl<T>({ field, children, format }: FieldProps<T>): ReactElement | null;
22
+ export declare const Field: typeof FieldImpl;
23
+ declare const fieldWithSelection: typeof Field & SelectionProvider & {
24
+ [BINDX_COMPONENT]: true;
25
+ };
26
+ export { fieldWithSelection as FieldWithMeta };
27
+ //# sourceMappingURL=Field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/Field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAsB,iBAAiB,EAAY,MAAM,aAAa,CAAA;AAC9F,OAAO,EAAkB,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7D;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAS,SAAS,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,IAAI,CAwBrF;AAED,eAAO,MAAM,KAAK,EAAsB,OAAO,SAAS,CAAA;AAGxD,QAAA,MAAM,kBAAkB,EAAY,OAAO,KAAK,GAAG,iBAAiB,GAAG;IAAE,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA;AA4BlG,OAAO,EAAE,kBAAkB,IAAI,aAAa,EAAE,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { HasManyProps, SelectionProvider, AnyBrand } from '../types.js';
3
+ import { BINDX_COMPONENT } from '../types.js';
4
+ /**
5
+ * HasMany component - renders a has-many relation
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * // Basic usage
10
+ * <HasMany field={author.fields.articles}>
11
+ * {article => (
12
+ * <div>
13
+ * <Field field={article.fields.title} />
14
+ * </div>
15
+ * )}
16
+ * </HasMany>
17
+ *
18
+ * // With query parameters
19
+ * <HasMany field={author.fields.articles} limit={5} orderBy={{ publishedAt: 'desc' }}>
20
+ * {(article, index) => (
21
+ * <div key={article.id}>
22
+ * {index + 1}. <Field field={article.fields.title} />
23
+ * </div>
24
+ * )}
25
+ * </HasMany>
26
+ * ```
27
+ */
28
+ declare function HasManyImpl<TEntity, TSelected = TEntity, TBrand extends AnyBrand = AnyBrand, TEntityName extends string = string, TSchema extends Record<string, object> = Record<string, object>>({ field, children }: HasManyProps<TEntity, TSelected, TBrand, TEntityName, TSchema>): ReactElement;
29
+ export declare const HasMany: typeof HasManyImpl;
30
+ declare const hasManyWithSelection: typeof HasMany & SelectionProvider & {
31
+ [BINDX_COMPONENT]: true;
32
+ };
33
+ export { hasManyWithSelection as HasManyWithMeta };
34
+ //# sourceMappingURL=HasMany.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HasMany.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/HasMany.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAQ,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAA;AACtE,OAAO,KAAK,EAAE,YAAY,EAAqC,iBAAiB,EAAa,QAAQ,EAAc,MAAM,aAAa,CAAA;AACtI,OAAO,EAAkB,eAAe,EAAa,MAAM,aAAa,CAAA;AAIxE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,iBAAS,WAAW,CACnB,OAAO,EACP,SAAS,GAAG,OAAO,EACnB,MAAM,SAAS,QAAQ,GAAG,QAAQ,EAClC,WAAW,SAAS,MAAM,GAAG,MAAM,EACnC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9D,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,GAAG,YAAY,CASnG;AAED,eAAO,MAAM,OAAO,EAAwB,OAAO,WAAW,CAAA;AAG9D,QAAA,MAAM,oBAAoB,EAAc,OAAO,OAAO,GAAG,iBAAiB,GAAG;IAAE,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA;AA0DxG,OAAO,EAAE,oBAAoB,IAAI,eAAe,EAAE,CAAA"}
@@ -0,0 +1,25 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { HasOneProps, SelectionProvider, AnyBrand } from '../types.js';
3
+ import { BINDX_COMPONENT } from '../types.js';
4
+ /**
5
+ * HasOne component - renders a has-one relation
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <HasOne field={article.fields.author}>
10
+ * {author => (
11
+ * <div>
12
+ * <Field field={author.fields.name} />
13
+ * <Field field={author.fields.email} />
14
+ * </div>
15
+ * )}
16
+ * </HasOne>
17
+ * ```
18
+ */
19
+ declare function HasOneImpl<TEntity, TSelected = TEntity, TBrand extends AnyBrand = AnyBrand, TEntityName extends string = string, TSchema extends Record<string, object> = Record<string, object>>({ field, children }: HasOneProps<TEntity, TSelected, TBrand, TEntityName, TSchema>): ReactElement;
20
+ export declare const HasOne: typeof HasOneImpl;
21
+ declare const hasOneWithSelection: typeof HasOne & SelectionProvider & {
22
+ [BINDX_COMPONENT]: true;
23
+ };
24
+ export { hasOneWithSelection as HasOneWithMeta };
25
+ //# sourceMappingURL=HasOne.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HasOne.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/HasOne.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAQ,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAA;AACtE,OAAO,KAAK,EAAE,WAAW,EAAqC,iBAAiB,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAA;AACzH,OAAO,EAAkB,eAAe,EAAa,MAAM,aAAa,CAAA;AAIxE;;;;;;;;;;;;;;GAcG;AACH,iBAAS,UAAU,CAClB,OAAO,EACP,SAAS,GAAG,OAAO,EACnB,MAAM,SAAS,QAAQ,GAAG,QAAQ,EAClC,WAAW,SAAS,MAAM,GAAG,MAAM,EACnC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9D,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,GAAG,YAAY,CAMlG;AAED,eAAO,MAAM,MAAM,EAAuB,OAAO,UAAU,CAAA;AAG3D,QAAA,MAAM,mBAAmB,EAAa,OAAO,MAAM,GAAG,iBAAiB,GAAG;IAAE,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA;AAuCrG,OAAO,EAAE,mBAAmB,IAAI,cAAc,EAAE,CAAA"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * HasRole component — runtime role gating with optional entity type narrowing.
3
+ *
4
+ * Mode 1 (context gate): Renders children only if user has at least one specified role.
5
+ * Mode 2 (entity re-typing): Narrows entity accessor type to the role-specific entity type.
6
+ */
7
+ import { type ReactNode, type ReactElement } from 'react';
8
+ import type { EntityAccessor, EntityForRoles, RoleNames } from '@contember/bindx';
9
+ /**
10
+ * Props for HasRole in context-gate mode (no entity).
11
+ */
12
+ interface HasRoleGateProps<TRoles extends string> {
13
+ /** Roles to check — renders if user has at least one */
14
+ roles: readonly TRoles[];
15
+ /** Children to render if role check passes */
16
+ children: ReactNode;
17
+ entity?: never;
18
+ }
19
+ /**
20
+ * Props for HasRole in entity-narrowing mode.
21
+ * TRoleMap is inferred from the entity accessor's __roleMap phantom type.
22
+ */
23
+ interface HasRoleEntityProps<TRoleMap extends Record<string, object>, TRoles extends RoleNames<TRoleMap>> {
24
+ /** Roles to expand to */
25
+ roles: readonly TRoles[];
26
+ /** Entity accessor to narrow */
27
+ entity: EntityAccessor<any, any, any, any, any, TRoleMap>;
28
+ /** Render function receiving the role-expanded entity */
29
+ children: (entity: EntityAccessor<EntityForRoles<TRoleMap, TRoles>>) => ReactNode;
30
+ }
31
+ export type HasRoleProps<TRoleMap extends Record<string, object> = Record<string, object>, TRoles extends RoleNames<TRoleMap> = RoleNames<TRoleMap>> = HasRoleGateProps<TRoles> | HasRoleEntityProps<TRoleMap, TRoles>;
32
+ /**
33
+ * HasRole component — conditionally renders based on user roles.
34
+ *
35
+ * @example Context gate mode
36
+ * ```tsx
37
+ * <HasRole roles={['admin']}>
38
+ * <AdminPanel />
39
+ * </HasRole>
40
+ * ```
41
+ *
42
+ * @example Entity narrowing mode
43
+ * ```tsx
44
+ * <HasRole roles={['admin']} entity={article}>
45
+ * {adminArticle => <span>{adminArticle.internalNotes.value}</span>}
46
+ * </HasRole>
47
+ * ```
48
+ */
49
+ export declare function HasRole<TRoleMap extends Record<string, object>, TRoles extends RoleNames<TRoleMap>>(props: HasRoleProps<TRoleMap, TRoles>): ReactElement | null;
50
+ export {};
51
+ //# sourceMappingURL=HasRole.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HasRole.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/HasRole.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,KAAK,EACX,cAAc,EACd,cAAc,EACd,SAAS,EAET,MAAM,kBAAkB,CAAA;AAOzB;;GAEG;AACH,UAAU,gBAAgB,CAAC,MAAM,SAAS,MAAM;IAC/C,wDAAwD;IACxD,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,8CAA8C;IAC9C,QAAQ,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,KAAK,CAAA;CACd;AAED;;;GAGG;AACH,UAAU,kBAAkB,CAC3B,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,MAAM,SAAS,SAAS,CAAC,QAAQ,CAAC;IAElC,yBAAyB;IACzB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,gCAAgC;IAChC,MAAM,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;IACzD,yDAAyD;IACzD,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,KAAK,SAAS,CAAA;CACjF;AAED,MAAM,MAAM,YAAY,CACvB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChE,MAAM,SAAS,SAAS,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,IACrD,gBAAgB,CAAC,MAAM,CAAC,GAAG,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;AAMnE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CACtB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,MAAM,SAAS,SAAS,CAAC,QAAQ,CAAC,EACjC,KAAK,EAAE,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,YAAY,GAAG,IAAI,CAkB5D"}
@@ -0,0 +1,51 @@
1
+ import React, { type ReactElement } from 'react';
2
+ import type { IfProps, SelectionProvider } from '../types.js';
3
+ import { BINDX_COMPONENT } from '../types.js';
4
+ /**
5
+ * If component - conditional rendering that ensures both branches are analyzed
6
+ *
7
+ * During collection phase, BOTH branches are analyzed to capture all required fields.
8
+ * During runtime, only the matching branch is rendered.
9
+ *
10
+ * Supports three types of conditions:
11
+ * 1. Boolean literals: `condition={true}` or `condition={someBoolean}`
12
+ * 2. FieldRef<boolean>: `condition={task.isActive}` - field value is used
13
+ * 3. Condition objects: `condition={cond.hasItems(task.developers)}` - composable DSL
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * // With boolean condition
18
+ * <If condition={showBio} then={
19
+ * <Field field={author.bio} />
20
+ * } />
21
+ *
22
+ * // With field condition
23
+ * <If
24
+ * condition={author.isPublished}
25
+ * then={<Field field={author.publishedAt} />}
26
+ * else={<span>Draft</span>}
27
+ * />
28
+ *
29
+ * // With condition DSL
30
+ * <If
31
+ * condition={cond.hasItems(task.developers)}
32
+ * then={<HasMany field={task.developers}>{dev => ...}</HasMany>}
33
+ * />
34
+ *
35
+ * // Complex conditions
36
+ * <If
37
+ * condition={cond.and(
38
+ * cond.hasItems(task.developers),
39
+ * cond.eq(task.status, 'active')
40
+ * )}
41
+ * then={<span>Ready to work</span>}
42
+ * />
43
+ * ```
44
+ */
45
+ declare function IfImpl({ condition, then: thenBranch, else: elseBranch }: IfProps): ReactElement | null;
46
+ export declare const If: React.MemoExoticComponent<typeof IfImpl>;
47
+ declare const ifWithSelection: typeof If & SelectionProvider & {
48
+ [BINDX_COMPONENT]: true;
49
+ };
50
+ export { ifWithSelection as IfWithMeta };
51
+ //# sourceMappingURL=If.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"If.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/If.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAQ,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAA;AACtE,OAAO,KAAK,EAAE,OAAO,EAAqC,iBAAiB,EAAY,MAAM,aAAa,CAAA;AAC1G,OAAO,EAAkB,eAAe,EAAE,MAAM,aAAa,CAAA;AAU7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,iBAAS,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAe/F;AAED,eAAO,MAAM,EAAE,0CAAe,CAAA;AAG9B,QAAA,MAAM,eAAe,EAAS,OAAO,EAAE,GAAG,iBAAiB,GAAG;IAAE,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA;AAqDzF,OAAO,EAAE,eAAe,IAAI,UAAU,EAAE,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { type ReactElement, type ReactNode } from 'react';
2
+ import type { FieldRef, SelectionProvider } from '../types.js';
3
+ import { BINDX_COMPONENT } from '../types.js';
4
+ /**
5
+ * Props for Show component
6
+ */
7
+ export interface ShowProps<T> {
8
+ field: FieldRef<T>;
9
+ children: (value: NonNullable<T>) => ReactNode;
10
+ fallback?: ReactNode;
11
+ }
12
+ /**
13
+ * Show component - renders content only if field has a value
14
+ * Useful for nullable fields.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <Show field={article.fields.publishedAt}>
19
+ * {value => <time>{value.toISOString()}</time>}
20
+ * </Show>
21
+ *
22
+ * <Show field={author.fields.bio} fallback={<span>No bio</span>}>
23
+ * {bio => <p>{bio}</p>}
24
+ * </Show>
25
+ * ```
26
+ */
27
+ declare function ShowImpl<T>({ field, children, fallback }: ShowProps<T>): ReactElement | null;
28
+ export declare const Show: typeof ShowImpl;
29
+ declare const showWithSelection: typeof Show & SelectionProvider & {
30
+ [BINDX_COMPONENT]: true;
31
+ };
32
+ export { showWithSelection as ShowWithMeta };
33
+ //# sourceMappingURL=Show.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Show.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/Show.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAQ,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAqC,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACjG,OAAO,EAAkB,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7D;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,SAAS,CAAA;IAC9C,QAAQ,CAAC,EAAE,SAAS,CAAA;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,iBAAS,QAAQ,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,IAAI,CAMrF;AAED,eAAO,MAAM,IAAI,EAAqB,OAAO,QAAQ,CAAA;AAGrD,QAAA,MAAM,iBAAiB,EAAW,OAAO,IAAI,GAAG,iBAAiB,GAAG;IAAE,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA;AAgB/F,OAAO,EAAE,iBAAiB,IAAI,YAAY,EAAE,CAAA"}
@@ -0,0 +1,8 @@
1
+ export { Field, FieldWithMeta } from './Field.js';
2
+ export { HasMany, HasManyWithMeta } from './HasMany.js';
3
+ export { HasOne, HasOneWithMeta } from './HasOne.js';
4
+ export { If, IfWithMeta } from './If.js';
5
+ export { Show, ShowWithMeta, type ShowProps } from './Show.js';
6
+ export { Entity, type EntityProps } from './Entity.js';
7
+ export { EntityList, type EntityListProps } from './EntityList.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAGjD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGvD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGpD,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGxC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAA;AAG9D,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAGtD,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA"}