@rebasepro/cms 0.29.1 → 0.29.3
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/collection_editor/serializable_types.d.ts +2 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRelationsTab.d.ts +1 -1
- package/dist/components/CollectionPanel.js +22 -13
- package/dist/components/CollectionPanel.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js +1 -1
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +39 -14
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewContent.d.ts +11 -0
- package/dist/components/CollectionViewBinding/CollectionViewContent.js +19 -2
- package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +1 -1
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +1 -1
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/SlotValue.js.map +1 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +19 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +18 -7
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
- package/dist/components/EntityPreviewBinding.d.ts +20 -0
- package/dist/components/EntityPreviewBinding.js +121 -18
- package/dist/components/EntityPreviewBinding.js.map +1 -1
- package/dist/components/HomePage/ContentHomePage.js +2 -3
- package/dist/components/HomePage/ContentHomePage.js.map +1 -1
- package/dist/components/RecordForm.d.ts +25 -4
- package/dist/components/RecordForm.js +21 -3
- package/dist/components/RecordForm.js.map +1 -1
- package/dist/components/RelationSelector.js.map +1 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.d.ts +13 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +19 -3
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -1
- package/dist/components/history/EntityHistoryEntry.js.map +1 -1
- package/dist/data_import/utils/save_entities.d.ts +10 -2
- package/dist/data_import/utils/save_entities.js.map +1 -1
- package/dist/editor/markdown.d.ts +10 -0
- package/dist/editor/markdown.js.map +1 -1
- package/dist/form/PropertyFieldBinding.js +4 -2
- package/dist/form/PropertyFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -1
- package/dist/hooks/useBuildSidePanel.d.ts +10 -0
- package/dist/hooks/useBuildSidePanel.js +43 -4
- package/dist/hooks/useBuildSidePanel.js.map +1 -1
- package/dist/hooks/useResolvedNavigationFrom.d.ts +14 -2
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +4 -2
- package/dist/mcp_view/app_modules.js +4 -2
- package/dist/mcp_view/app_modules.js.map +1 -1
- package/dist/mcp_view/bridge.d.ts +21 -1
- package/dist/mcp_view/bridge.js.map +1 -1
- package/dist/mcp_view/index.d.ts +7 -7
- package/dist/mcp_view/index.js +7 -2
- package/dist/mcp_view/index.js.map +1 -1
- package/dist/mcp_view/payload.js +7 -2
- package/dist/mcp_view/payload.js.map +1 -1
- package/dist/mcp_view/screen.d.ts +6 -4
- package/dist/mcp_view/screen.js +15 -43
- package/dist/mcp_view/screen.js.map +1 -1
- package/dist/mcp_view/tool_driver.d.ts +58 -6
- package/dist/mcp_view/tool_driver.js +256 -117
- package/dist/mcp_view/tool_driver.js.map +1 -1
- package/dist/mcp_view/write_review.d.ts +35 -0
- package/dist/mcp_view/write_review.js +144 -0
- package/dist/mcp_view/write_review.js.map +1 -0
- package/dist/preview/compact_text.d.ts +1 -1
- package/dist/preview/compact_text.js.map +1 -1
- package/dist/preview/components/RelationPreview.js +7 -2
- package/dist/preview/components/RelationPreview.js.map +1 -1
- package/dist/saved_apps/SavedAppsView.d.ts +17 -0
- package/dist/saved_apps/SavedAppsView.js +167 -0
- package/dist/saved_apps/SavedAppsView.js.map +1 -0
- package/dist/saved_apps/admin_apps_client.d.ts +24 -0
- package/dist/saved_apps/admin_apps_client.js +46 -0
- package/dist/saved_apps/admin_apps_client.js.map +1 -0
- package/dist/saved_apps/saved_app_frame.d.ts +20 -0
- package/dist/saved_apps/saved_app_frame.js +143 -0
- package/dist/saved_apps/saved_app_frame.js.map +1 -0
- package/dist/selection/resolve_selection.d.ts +10 -2
- package/dist/selection/resolve_selection.js.map +1 -1
- package/dist/util/property_utils.d.ts +2 -2
- package/dist/util/property_utils.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property_utils.js","names":[],"sources":["../../src/util/property_utils.tsx"],"sourcesContent":["\nimport type { Properties } from \"@rebasepro/types\";\nimport type { MapProperty, Property } from \"@rebasepro/types\";\nimport type { PropertyConfig, AdminCollection } from \"@rebasepro/cms-types\";\nimport React from \"react\";\n\nimport { isPropertyBuilder } from \"@rebasepro/common\";\nimport {\n AlignLeftIcon,\n CalendarIcon,\n CircleIcon,\n FlagIcon,\n FunctionSquareIcon,\n GlobeIcon,\n HashIcon,\n iconSize,\n LinkIcon,\n MailIcon,\n RepeatIcon,\n Rows3Icon,\n TextIcon,\n UploadIcon,\n VoteIcon\n} from \"@rebasepro/ui\";\nimport type { IconSize, LucideIcon } from \"@rebasepro/ui\";\n\n/**\n * Resolve a size value (string token or number) to a numeric pixel value\n * suitable for passing to Lucide icons.\n */\nfunction resolveSize(size: IconSize | number): number {\n if (typeof size === \"number\") return size;\n return iconSize[size];\n}\n\nexport function isReferenceProperty(property: Property) {\n\n if (!property) return null;\n if (property.type === \"reference\") {\n return true;\n }\n if (property.type === \"array\") {\n if (Array.isArray(property.of)) return false;\n else return property.of?.type === \"reference\"\n }\n return false;\n}\n\nexport function isRelationProperty(property: Property) {\n if (!property) return null;\n if (property.type === \"relation\") {\n return true;\n }\n if (property.type === \"array\") {\n if (Array.isArray(property.of)) return false;\n else return property.of?.type === \"relation\"\n }\n return false;\n}\n\nexport function getIconForWidget(widget: PropertyConfig | undefined,\n size: IconSize | number) {\n const Icon = widget?.Icon ?? CircleIcon;\n const px = resolveSize(size);\n return <Icon size={px}/>;\n}\n\n/**\n * Returns a default Lucide icon component based on property type.\n * This provides a sensible fallback when no PropertyConfig is available.\n */\nfunction getDefaultIconForProperty(property: Property): LucideIcon {\n switch (property.type) {\n case \"string\": {\n if (property.storage) return UploadIcon;\n if (property.admin?.urlPreview) return GlobeIcon;\n if (property.email) return MailIcon;\n if (property.admin?.multiline || property.admin?.markdown) return AlignLeftIcon;\n return TextIcon;\n }\n case \"number\":\n return HashIcon;\n case \"boolean\":\n return FlagIcon;\n case \"date\":\n return CalendarIcon;\n case \"map\":\n return VoteIcon;\n case \"array\": {\n const of = property.of;\n const oneOf = property.oneOf;\n if (oneOf) return Rows3Icon;\n if (of && !Array.isArray(of)) {\n if (of.type === \"reference\") return LinkIcon;\n if (of.type === \"string\" && of.storage) return UploadIcon;\n }\n return RepeatIcon;\n }\n case \"reference\":\n return LinkIcon;\n case \"relation\":\n return LinkIcon;\n case \"vector\":\n return HashIcon;\n default:\n return CircleIcon;\n }\n}\n\nexport function getIconForProperty(\n property: Property,\n size: IconSize | number = \"small\",\n fields: Record<string, PropertyConfig> = {}\n): React.ReactNode {\n const px = resolveSize(size);\n\n if (isPropertyBuilder(property)) {\n return <FunctionSquareIcon size={px}/>;\n }\n\n // Try to look up a custom PropertyConfig icon first\n const configId = property.propertyConfig || undefined;\n const widget = configId ? fields[configId] : undefined;\n if (widget?.Icon) {\n return getIconForWidget(widget, size);\n }\n\n // Fall back to a type-based default icon\n const Icon = getDefaultIconForProperty(property);\n return <Icon size={px}/>;\n}\n\n/**\n * Get a property in a property tree from a path like\n * `address.street`\n * @param properties\n * @param path\n */\nexport function getPropertyInPath(properties: Properties, path: string): Property | undefined {\n if (typeof properties === \"object\") {\n if (path in properties) {\n return (properties as Record<string, Property>)[path];\n }\n if (path.includes(\".\")) {\n const pathSegments = path.split(\".\");\n const childProperty = (properties as Record<string, Property>)[pathSegments[0]];\n if (typeof childProperty === \"object\" && childProperty.type === \"map\" && childProperty.properties) {\n return getPropertyInPath(childProperty.properties, pathSegments.slice(1).join(\".\"))\n }\n }\n }\n return undefined;\n}\n\nexport function getResolvedPropertyInPath(properties: Record<string, Property>, path: string): Property | undefined {\n if (typeof properties === \"object\") {\n if (path in properties) {\n return properties[path];\n }\n if (path.includes(\".\")) {\n const pathSegments = path.split(\".\");\n // A path whose root is not a property at all is simply not found.\n // Reading `.type` off the miss threw a TypeError instead, which\n // turned one unresolvable column key into a crash for whatever was\n // walking the properties — see `propertiesToColumns`, where that is\n // the whole table. `getPropertyInPath` above already guards this.\n const childProperty = properties[pathSegments[0]];\n if (childProperty?.type === \"map\" && childProperty.properties) {\n return getResolvedPropertyInPath(childProperty.properties, pathSegments.slice(1).join(\".\"))\n }\n }\n }\n return undefined;\n}\n\n// replace the dot notation with brackets\n// address.street => address[street]\nexport function getBracketNotation(path: string): string {\n return path.replace(/\\.([^.]*)/g, \"[$1]\");\n}\n\n/**\n * Get properties sorted by their order, but include ALL properties.\n * Nested keys (like \"data.mode\") in propertiesOrder are ignored - they're for column ordering.\n * @param properties\n * @param propertiesOrder\n */\nexport function getPropertiesWithPropertiesOrder(properties: Properties, propertiesOrder?: string[]): Properties {\n if (!propertiesOrder) return properties;\n\n const propertyKeys = Object.keys(properties);\n\n // Filter propertiesOrder to only include top-level keys (no dots) that exist\n const validOrderKeys = (propertiesOrder as string[]).filter(\n key => !key.includes(\".\") && properties[key]\n );\n\n const result: Properties = {};\n\n // First add properties in the specified order\n validOrderKeys.forEach(key => {\n const property = properties[key];\n if (typeof property === \"object\" && property.type === \"map\" && (property as MapProperty).properties) {\n const mapProp = property as MapProperty;\n result[key] = {\n ...mapProp,\n properties: getPropertiesWithPropertiesOrder(mapProp.properties!, mapProp.propertiesOrder ?? [])\n } as Property;\n } else if (property) {\n result[key] = property;\n }\n });\n\n // Then add any missing properties (so they don't disappear!)\n propertyKeys.forEach(key => {\n if (!result[key]) {\n const property = properties[key];\n if (typeof property === \"object\" && property.type === \"map\" && (property as MapProperty).properties) {\n const mapProp = property as MapProperty;\n result[key] = {\n ...mapProp,\n properties: getPropertiesWithPropertiesOrder(mapProp.properties!, mapProp.propertiesOrder ?? [])\n } as Property;\n } else if (property) {\n result[key] = property;\n }\n }\n });\n\n return result;\n}\n\nexport function getDefaultPropertiesOrder(collection: AdminCollection): string[] {\n if (collection.propertiesOrder) return collection.propertiesOrder;\n return [...Object.keys(collection.properties), ...(collection.additionalFields ?? []).map(field => field.key)];\n}\n"],"mappings":";;;;;;;;;AA8BA,SAAS,YAAY,MAAiC;CAClD,IAAI,OAAO,SAAS,UAAU,OAAO;CACrC,OAAO,SAAS;AACpB;AAEA,SAAgB,oBAAoB,UAAoB;CAEpD,IAAI,CAAC,UAAU,OAAO;CACtB,IAAI,SAAS,SAAS,aAClB,OAAO;CAEX,IAAI,SAAS,SAAS,SAClB,IAAI,MAAM,QAAQ,SAAS,EAAE,GAAG,OAAO;MAClC,OAAO,SAAS,IAAI,SAAS;CAEtC,OAAO;AACX;AAEA,SAAgB,mBAAmB,UAAoB;CACnD,IAAI,CAAC,UAAU,OAAO;CACtB,IAAI,SAAS,SAAS,YAClB,OAAO;CAEX,IAAI,SAAS,SAAS,SAClB,IAAI,MAAM,QAAQ,SAAS,EAAE,GAAG,OAAO;MAClC,OAAO,SAAS,IAAI,SAAS;CAEtC,OAAO;AACX;AAEA,SAAgB,i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CAAC,OAAO,MAAM;GACd,MAAM,WAAW,WAAW;GAC5B,IAAI,OAAO,aAAa,YAAY,SAAS,SAAS,SAAU,SAAyB,YAAY;IACjG,MAAM,UAAU;IAChB,OAAO,OAAO;KACV,GAAG;KACH,YAAY,iCAAiC,QAAQ,YAAa,QAAQ,mBAAmB,CAAC,CAAC;IACnG;GACJ,OAAO,IAAI,UACP,OAAO,OAAO;EAEtB;CACJ,CAAC;CAED,OAAO;AACX;AAEA,SAAgB,0BAA0B,YAAuC;CAC7E,IAAI,WAAW,iBAAiB,OAAO,WAAW;CAClD,OAAO,CAAC,GAAG,OAAO,KAAK,WAAW,UAAU,GAAG,IAAI,WAAW,oBAAoB,CAAC,EAAA,CAAG,KAAI,UAAS,MAAM,GAAG,CAAC;AACjH"}
|
|
1
|
+
{"version":3,"file":"property_utils.js","names":[],"sources":["../../src/util/property_utils.tsx"],"sourcesContent":["\nimport type { Properties } from \"@rebasepro/types\";\nimport type { MapProperty, Property } from \"@rebasepro/types\";\nimport type { PropertyConfig, AdminCollection } from \"@rebasepro/cms-types\";\nimport React from \"react\";\n\nimport { isPropertyBuilder } from \"@rebasepro/common\";\nimport {\n AlignLeftIcon,\n CalendarIcon,\n CircleIcon,\n FlagIcon,\n FunctionSquareIcon,\n GlobeIcon,\n HashIcon,\n iconSize,\n LinkIcon,\n MailIcon,\n RepeatIcon,\n Rows3Icon,\n TextIcon,\n UploadIcon,\n VoteIcon\n} from \"@rebasepro/ui\";\nimport type { IconSize, LucideIcon } from \"@rebasepro/ui\";\n\n/**\n * Resolve a size value (string token or number) to a numeric pixel value\n * suitable for passing to Lucide icons.\n */\nfunction resolveSize(size: IconSize | number): number {\n if (typeof size === \"number\") return size;\n return iconSize[size];\n}\n\nexport function isReferenceProperty(property: Property | null | undefined) {\n\n if (!property) return null;\n if (property.type === \"reference\") {\n return true;\n }\n if (property.type === \"array\") {\n if (Array.isArray(property.of)) return false;\n else return property.of?.type === \"reference\"\n }\n return false;\n}\n\nexport function isRelationProperty(property: Property | null | undefined) {\n if (!property) return null;\n if (property.type === \"relation\") {\n return true;\n }\n if (property.type === \"array\") {\n if (Array.isArray(property.of)) return false;\n else return property.of?.type === \"relation\"\n }\n return false;\n}\n\nexport function getIconForWidget(widget: PropertyConfig | undefined,\n size: IconSize | number) {\n const Icon = widget?.Icon ?? CircleIcon;\n const px = resolveSize(size);\n return <Icon size={px}/>;\n}\n\n/**\n * Returns a default Lucide icon component based on property type.\n * This provides a sensible fallback when no PropertyConfig is available.\n */\nfunction getDefaultIconForProperty(property: Property): LucideIcon {\n switch (property.type) {\n case \"string\": {\n if (property.storage) return UploadIcon;\n if (property.admin?.urlPreview) return GlobeIcon;\n if (property.email) return MailIcon;\n if (property.admin?.multiline || property.admin?.markdown) return AlignLeftIcon;\n return TextIcon;\n }\n case \"number\":\n return HashIcon;\n case \"boolean\":\n return FlagIcon;\n case \"date\":\n return CalendarIcon;\n case \"map\":\n return VoteIcon;\n case \"array\": {\n const of = property.of;\n const oneOf = property.oneOf;\n if (oneOf) return Rows3Icon;\n if (of && !Array.isArray(of)) {\n if (of.type === \"reference\") return LinkIcon;\n if (of.type === \"string\" && of.storage) return UploadIcon;\n }\n return RepeatIcon;\n }\n case \"reference\":\n return LinkIcon;\n case \"relation\":\n return LinkIcon;\n case \"vector\":\n return HashIcon;\n default:\n return CircleIcon;\n }\n}\n\nexport function getIconForProperty(\n property: Property,\n size: IconSize | number = \"small\",\n fields: Record<string, PropertyConfig> = {}\n): React.ReactNode {\n const px = resolveSize(size);\n\n if (isPropertyBuilder(property)) {\n return <FunctionSquareIcon size={px}/>;\n }\n\n // Try to look up a custom PropertyConfig icon first\n const configId = property.propertyConfig || undefined;\n const widget = configId ? fields[configId] : undefined;\n if (widget?.Icon) {\n return getIconForWidget(widget, size);\n }\n\n // Fall back to a type-based default icon\n const Icon = getDefaultIconForProperty(property);\n return <Icon size={px}/>;\n}\n\n/**\n * Get a property in a property tree from a path like\n * `address.street`\n * @param properties\n * @param path\n */\nexport function getPropertyInPath(properties: Properties, path: string): Property | undefined {\n if (typeof properties === \"object\") {\n if (path in properties) {\n return (properties as Record<string, Property>)[path];\n }\n if (path.includes(\".\")) {\n const pathSegments = path.split(\".\");\n const childProperty = (properties as Record<string, Property>)[pathSegments[0]];\n if (typeof childProperty === \"object\" && childProperty.type === \"map\" && childProperty.properties) {\n return getPropertyInPath(childProperty.properties, pathSegments.slice(1).join(\".\"))\n }\n }\n }\n return undefined;\n}\n\nexport function getResolvedPropertyInPath(properties: Record<string, Property>, path: string): Property | undefined {\n if (typeof properties === \"object\") {\n if (path in properties) {\n return properties[path];\n }\n if (path.includes(\".\")) {\n const pathSegments = path.split(\".\");\n // A path whose root is not a property at all is simply not found.\n // Reading `.type` off the miss threw a TypeError instead, which\n // turned one unresolvable column key into a crash for whatever was\n // walking the properties — see `propertiesToColumns`, where that is\n // the whole table. `getPropertyInPath` above already guards this.\n const childProperty = properties[pathSegments[0]];\n if (childProperty?.type === \"map\" && childProperty.properties) {\n return getResolvedPropertyInPath(childProperty.properties, pathSegments.slice(1).join(\".\"))\n }\n }\n }\n return undefined;\n}\n\n// replace the dot notation with brackets\n// address.street => address[street]\nexport function getBracketNotation(path: string): string {\n return path.replace(/\\.([^.]*)/g, \"[$1]\");\n}\n\n/**\n * Get properties sorted by their order, but include ALL properties.\n * Nested keys (like \"data.mode\") in propertiesOrder are ignored - they're for column ordering.\n * @param properties\n * @param propertiesOrder\n */\nexport function getPropertiesWithPropertiesOrder(properties: Properties, propertiesOrder?: string[]): Properties {\n if (!propertiesOrder) return properties;\n\n const propertyKeys = Object.keys(properties);\n\n // Filter propertiesOrder to only include top-level keys (no dots) that exist\n const validOrderKeys = (propertiesOrder as string[]).filter(\n key => !key.includes(\".\") && properties[key]\n );\n\n const result: Properties = {};\n\n // First add properties in the specified order\n validOrderKeys.forEach(key => {\n const property = properties[key];\n if (typeof property === \"object\" && property.type === \"map\" && (property as MapProperty).properties) {\n const mapProp = property as MapProperty;\n result[key] = {\n ...mapProp,\n properties: getPropertiesWithPropertiesOrder(mapProp.properties!, mapProp.propertiesOrder ?? [])\n } as Property;\n } else if (property) {\n result[key] = property;\n }\n });\n\n // Then add any missing properties (so they don't disappear!)\n propertyKeys.forEach(key => {\n if (!result[key]) {\n const property = properties[key];\n if (typeof property === \"object\" && property.type === \"map\" && (property as MapProperty).properties) {\n const mapProp = property as MapProperty;\n result[key] = {\n ...mapProp,\n properties: getPropertiesWithPropertiesOrder(mapProp.properties!, mapProp.propertiesOrder ?? [])\n } as Property;\n } else if (property) {\n result[key] = property;\n }\n }\n });\n\n return result;\n}\n\nexport function getDefaultPropertiesOrder(collection: AdminCollection): string[] {\n if (collection.propertiesOrder) return collection.propertiesOrder;\n return [...Object.keys(collection.properties), ...(collection.additionalFields ?? []).map(field => field.key)];\n}\n"],"mappings":";;;;;;;;;AA8BA,SAAS,YAAY,MAAiC;CAClD,IAAI,OAAO,SAAS,UAAU,OAAO;CACrC,OAAO,SAAS;AACpB;AAEA,SAAgB,oBAAoB,UAAuC;CAEvE,IAAI,CAAC,UAAU,OAAO;CACtB,IAAI,SAAS,SAAS,aAClB,OAAO;CAEX,IAAI,SAAS,SAAS,SAClB,IAAI,MAAM,QAAQ,SAAS,EAAE,GAAG,OAAO;MAClC,OAAO,SAAS,IAAI,SAAS;CAEtC,OAAO;AACX;AAEA,SAAgB,mBAAmB,UAAuC;CACtE,IAAI,CAAC,UAAU,OAAO;CACtB,IAAI,SAAS,SAAS,YAClB,OAAO;CAEX,IAAI,SAAS,SAAS,SAClB,IAAI,MAAM,QAAQ,SAAS,EAAE,GAAG,OAAO;MAClC,OAAO,SAAS,IAAI,SAAS;CAEtC,OAAO;AACX;AAEA,SAAgB,iBAAiB,QAC7B,MAAyB;CAGzB,OAAO,oBAFM,QAAQ,QAAQ,YAEtB,EAAM,MADF,YAAY,IACJ,EAAI,CAAA;AAC3B;;;;;AAMA,SAAS,0BAA0B,UAAgC;CAC/D,QAAQ,SAAS,MAAjB;EACI,KAAK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,YAAa,QAAQ,mBAAmB,CAAC,CAAC;IACnG;GACJ,OAAO,IAAI,UACP,OAAO,OAAO;EAEtB;CACJ,CAAC;CAED,OAAO;AACX;AAEA,SAAgB,0BAA0B,YAAuC;CAC7E,IAAI,WAAW,iBAAiB,OAAO,WAAW;CAClD,OAAO,CAAC,GAAG,OAAO,KAAK,WAAW,UAAU,GAAG,IAAI,WAAW,oBAAoB,CAAC,EAAA,CAAG,KAAI,UAAS,MAAM,GAAG,CAAC;AACjH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/cms",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.3",
|
|
4
4
|
"description": "Rebase CMS — content management views, forms, and routing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rebase",
|
|
@@ -99,14 +99,14 @@
|
|
|
99
99
|
"react-use-measure": "^2.1.7",
|
|
100
100
|
"read-excel-file": "^9.3.10",
|
|
101
101
|
"zod": "^4.4.3",
|
|
102
|
-
"@rebasepro/app": "0.29.
|
|
103
|
-
"@rebasepro/
|
|
104
|
-
"@rebasepro/
|
|
105
|
-
"@rebasepro/forms": "0.29.
|
|
106
|
-
"@rebasepro/inference": "0.29.
|
|
107
|
-
"@rebasepro/types": "0.29.
|
|
108
|
-
"@rebasepro/utils": "0.29.
|
|
109
|
-
"@rebasepro/ui": "0.29.
|
|
102
|
+
"@rebasepro/app": "0.29.3",
|
|
103
|
+
"@rebasepro/cms-types": "0.29.3",
|
|
104
|
+
"@rebasepro/common": "0.29.3",
|
|
105
|
+
"@rebasepro/forms": "0.29.3",
|
|
106
|
+
"@rebasepro/inference": "0.29.3",
|
|
107
|
+
"@rebasepro/types": "0.29.3",
|
|
108
|
+
"@rebasepro/utils": "0.29.3",
|
|
109
|
+
"@rebasepro/ui": "0.29.3"
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
112
112
|
"react": "^19.2.7",
|