@pantheon-systems/puck-css 0.8.0 → 0.10.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 (484) hide show
  1. package/README.md +87 -0
  2. package/dist/agent/useAgentEdit.d.ts.map +1 -1
  3. package/dist/agent/useAgentEdit.js.map +1 -1
  4. package/dist/agent/useAgentTrigger.d.ts.map +1 -1
  5. package/dist/agent/useAgentTrigger.js.map +1 -1
  6. package/dist/auth/AuthGate.d.ts +1 -1
  7. package/dist/auth/AuthGate.d.ts.map +1 -1
  8. package/dist/auth/P1AuthProvider.d.ts.map +1 -1
  9. package/dist/auth/P1AuthProvider.js +52 -1
  10. package/dist/auth/P1AuthProvider.js.map +1 -1
  11. package/dist/collaboration/components/CollaboratorAvatars.d.ts.map +1 -1
  12. package/dist/collaboration/components/CollaboratorAvatars.js +1 -1
  13. package/dist/collaboration/components/CollaboratorAvatars.js.map +1 -1
  14. package/dist/collaboration/utils/avatarColor.d.ts +2 -8
  15. package/dist/collaboration/utils/avatarColor.d.ts.map +1 -1
  16. package/dist/collaboration/utils/avatarColor.js +4 -31
  17. package/dist/collaboration/utils/avatarColor.js.map +1 -1
  18. package/dist/collaboration/utils/focusHighlightConfig.d.ts.map +1 -1
  19. package/dist/collaboration/utils/focusHighlightConfig.js.map +1 -1
  20. package/dist/collaboration/utils/initials.d.ts +2 -0
  21. package/dist/collaboration/utils/initials.d.ts.map +1 -0
  22. package/dist/collaboration/utils/initials.js +27 -0
  23. package/dist/collaboration/utils/initials.js.map +1 -0
  24. package/dist/collaboration/utils/presenceIdentity.d.ts +29 -0
  25. package/dist/collaboration/utils/presenceIdentity.d.ts.map +1 -0
  26. package/dist/collaboration/utils/presenceIdentity.js +42 -0
  27. package/dist/collaboration/utils/presenceIdentity.js.map +1 -0
  28. package/dist/core/PuckConfigContext.d.ts +7 -0
  29. package/dist/core/PuckConfigContext.d.ts.map +1 -0
  30. package/dist/core/PuckConfigContext.js +11 -0
  31. package/dist/core/PuckConfigContext.js.map +1 -0
  32. package/dist/core/config.d.ts +1 -1
  33. package/dist/core/config.d.ts.map +1 -1
  34. package/dist/core/config.js.map +1 -1
  35. package/dist/core/index.d.ts +1 -0
  36. package/dist/core/index.d.ts.map +1 -1
  37. package/dist/core/index.js +1 -0
  38. package/dist/core/index.js.map +1 -1
  39. package/dist/core/types.d.ts +36 -3
  40. package/dist/core/types.d.ts.map +1 -1
  41. package/dist/data/collection-operators.d.ts +19 -0
  42. package/dist/data/collection-operators.d.ts.map +1 -0
  43. package/dist/data/collection-operators.js +97 -0
  44. package/dist/data/collection-operators.js.map +1 -0
  45. package/dist/data/css-queries/css-query-registry.d.ts +11 -0
  46. package/dist/data/css-queries/css-query-registry.d.ts.map +1 -0
  47. package/dist/data/css-queries/css-query-registry.js +30 -0
  48. package/dist/data/css-queries/css-query-registry.js.map +1 -0
  49. package/dist/data/dal/index.d.ts +1 -1
  50. package/dist/data/dal/index.d.ts.map +1 -1
  51. package/dist/data/dal/init.d.ts +5 -0
  52. package/dist/data/dal/init.d.ts.map +1 -1
  53. package/dist/data/dal/init.js +31 -4
  54. package/dist/data/dal/init.js.map +1 -1
  55. package/dist/data/dal/p1-store.d.ts +23 -0
  56. package/dist/data/dal/p1-store.d.ts.map +1 -1
  57. package/dist/data/dal/p1-store.js.map +1 -1
  58. package/dist/data/data-list-block/DataListFieldsGrouper.d.ts +7 -0
  59. package/dist/data/data-list-block/DataListFieldsGrouper.d.ts.map +1 -0
  60. package/dist/data/data-list-block/DataListFieldsGrouper.js +72 -0
  61. package/dist/data/data-list-block/DataListFieldsGrouper.js.map +1 -0
  62. package/dist/data/data-list-block/builtin-components/cards.d.ts +8 -0
  63. package/dist/data/data-list-block/builtin-components/cards.d.ts.map +1 -0
  64. package/dist/data/data-list-block/builtin-components/cards.js +35 -0
  65. package/dist/data/data-list-block/builtin-components/cards.js.map +1 -0
  66. package/dist/data/data-list-block/builtin-components/listing.d.ts +8 -0
  67. package/dist/data/data-list-block/builtin-components/listing.d.ts.map +1 -0
  68. package/dist/data/data-list-block/builtin-components/listing.js +11 -0
  69. package/dist/data/data-list-block/builtin-components/listing.js.map +1 -0
  70. package/dist/data/data-list-block/builtin-components/rows.d.ts +8 -0
  71. package/dist/data/data-list-block/builtin-components/rows.d.ts.map +1 -0
  72. package/dist/data/data-list-block/builtin-components/rows.js +9 -0
  73. package/dist/data/data-list-block/builtin-components/rows.js.map +1 -0
  74. package/dist/data/data-list-block/builtin-modes.d.ts +3 -0
  75. package/dist/data/data-list-block/builtin-modes.d.ts.map +1 -0
  76. package/dist/data/data-list-block/builtin-modes.js +53 -0
  77. package/dist/data/data-list-block/builtin-modes.js.map +1 -0
  78. package/dist/data/data-list-block/create-data-list-block.d.ts +3 -0
  79. package/dist/data/data-list-block/create-data-list-block.d.ts.map +1 -0
  80. package/dist/data/data-list-block/create-data-list-block.js +305 -0
  81. package/dist/data/data-list-block/create-data-list-block.js.map +1 -0
  82. package/dist/data/data-list-block/field-groups.d.ts +4 -0
  83. package/dist/data/data-list-block/field-groups.d.ts.map +1 -0
  84. package/dist/data/data-list-block/field-groups.js +28 -0
  85. package/dist/data/data-list-block/field-groups.js.map +1 -0
  86. package/dist/data/data-list-block/index.d.ts +8 -0
  87. package/dist/data/data-list-block/index.d.ts.map +1 -0
  88. package/dist/data/data-list-block/index.js +7 -0
  89. package/dist/data/data-list-block/index.js.map +1 -0
  90. package/dist/data/data-list-block/types.d.ts +53 -0
  91. package/dist/data/data-list-block/types.d.ts.map +1 -0
  92. package/dist/data/data-list-block/types.js +2 -0
  93. package/dist/data/data-list-block/types.js.map +1 -0
  94. package/dist/data/data-list-block/utils.d.ts +14 -0
  95. package/dist/data/data-list-block/utils.d.ts.map +1 -0
  96. package/dist/data/data-list-block/utils.js +65 -0
  97. package/dist/data/data-list-block/utils.js.map +1 -0
  98. package/dist/data/fields/datasource-select-field.d.ts +29 -0
  99. package/dist/data/fields/datasource-select-field.d.ts.map +1 -0
  100. package/dist/data/fields/datasource-select-field.js +40 -0
  101. package/dist/data/fields/datasource-select-field.js.map +1 -0
  102. package/dist/data/fields/field-section.d.ts +11 -0
  103. package/dist/data/fields/field-section.d.ts.map +1 -0
  104. package/dist/data/fields/field-section.js +6 -0
  105. package/dist/data/fields/field-section.js.map +1 -0
  106. package/dist/data/fields/image-position-field.d.ts +28 -0
  107. package/dist/data/fields/image-position-field.d.ts.map +1 -0
  108. package/dist/data/fields/image-position-field.js +69 -0
  109. package/dist/data/fields/image-position-field.js.map +1 -0
  110. package/dist/data/fields/pds-field-helpers.d.ts +34 -0
  111. package/dist/data/fields/pds-field-helpers.d.ts.map +1 -0
  112. package/dist/data/fields/pds-field-helpers.js +55 -0
  113. package/dist/data/fields/pds-field-helpers.js.map +1 -0
  114. package/dist/data/fields/schema-select-field.d.ts +32 -0
  115. package/dist/data/fields/schema-select-field.d.ts.map +1 -0
  116. package/dist/data/fields/schema-select-field.js +134 -0
  117. package/dist/data/fields/schema-select-field.js.map +1 -0
  118. package/dist/data/fields/template-select-field.d.ts +16 -0
  119. package/dist/data/fields/template-select-field.d.ts.map +1 -0
  120. package/dist/data/fields/template-select-field.js +31 -0
  121. package/dist/data/fields/template-select-field.js.map +1 -0
  122. package/dist/data/fields/view-mode-field.d.ts +21 -0
  123. package/dist/data/fields/view-mode-field.d.ts.map +1 -0
  124. package/dist/data/fields/view-mode-field.js +14 -0
  125. package/dist/data/fields/view-mode-field.js.map +1 -0
  126. package/dist/data/fields.d.ts +12 -0
  127. package/dist/data/fields.d.ts.map +1 -1
  128. package/dist/data/fields.js +10 -0
  129. package/dist/data/fields.js.map +1 -1
  130. package/dist/data/page-editor-meta.d.ts.map +1 -1
  131. package/dist/data/page-editor-meta.js +0 -1
  132. package/dist/data/page-editor-meta.js.map +1 -1
  133. package/dist/data/query-provider.d.ts +1 -1
  134. package/dist/data/query-provider.d.ts.map +1 -1
  135. package/dist/data/remote-datasources/fetch-http-json.d.ts.map +1 -1
  136. package/dist/data/remote-datasources/fetch-http-json.js.map +1 -1
  137. package/dist/data/remote-datasources/loader.d.ts.map +1 -1
  138. package/dist/data/remote-datasources/loader.js +3 -1
  139. package/dist/data/remote-datasources/loader.js.map +1 -1
  140. package/dist/data/resolve-data-templates.d.ts.map +1 -1
  141. package/dist/data/resolve-data-templates.js +31 -4
  142. package/dist/data/resolve-data-templates.js.map +1 -1
  143. package/dist/data/schema-heuristics.d.ts +5 -0
  144. package/dist/data/schema-heuristics.d.ts.map +1 -0
  145. package/dist/data/schema-heuristics.js +46 -0
  146. package/dist/data/schema-heuristics.js.map +1 -0
  147. package/dist/editor/P1App.d.ts.map +1 -1
  148. package/dist/editor/P1App.js +1 -1
  149. package/dist/editor/P1App.js.map +1 -1
  150. package/dist/editor/P1PuckProvider.d.ts.map +1 -1
  151. package/dist/editor/P1PuckProvider.js +170 -41
  152. package/dist/editor/P1PuckProvider.js.map +1 -1
  153. package/dist/editor/aiPanelStore.d.ts +15 -0
  154. package/dist/editor/aiPanelStore.d.ts.map +1 -0
  155. package/dist/editor/aiPanelStore.js +43 -0
  156. package/dist/editor/aiPanelStore.js.map +1 -0
  157. package/dist/editor/components/CollapsibleFieldSection.d.ts +10 -0
  158. package/dist/editor/components/CollapsibleFieldSection.d.ts.map +1 -0
  159. package/dist/editor/components/CollapsibleFieldSection.js +9 -0
  160. package/dist/editor/components/CollapsibleFieldSection.js.map +1 -0
  161. package/dist/editor/components/CollapsibleSection.module.css +70 -0
  162. package/dist/editor/components/CollapsibleSectionHeader.d.ts +20 -0
  163. package/dist/editor/components/CollapsibleSectionHeader.d.ts.map +1 -0
  164. package/dist/editor/components/CollapsibleSectionHeader.js +10 -0
  165. package/dist/editor/components/CollapsibleSectionHeader.js.map +1 -0
  166. package/dist/editor/components/DraggableRow.d.ts +13 -0
  167. package/dist/editor/components/DraggableRow.d.ts.map +1 -0
  168. package/dist/editor/components/DraggableRow.js +20 -0
  169. package/dist/editor/components/DraggableRow.js.map +1 -0
  170. package/dist/editor/components/FieldHelpText.d.ts +6 -0
  171. package/dist/editor/components/FieldHelpText.d.ts.map +1 -0
  172. package/dist/editor/components/FieldHelpText.js +6 -0
  173. package/dist/editor/components/FieldHelpText.js.map +1 -0
  174. package/dist/editor/components/FieldHelpText.module.css +13 -0
  175. package/dist/editor/components/InspectorTabHeader.js +1 -1
  176. package/dist/editor/components/InspectorTabHeader.js.map +1 -1
  177. package/dist/editor/components/OutlinePanel.d.ts +10 -0
  178. package/dist/editor/components/OutlinePanel.d.ts.map +1 -0
  179. package/dist/editor/components/OutlinePanel.js +64 -0
  180. package/dist/editor/components/OutlinePanel.js.map +1 -0
  181. package/dist/editor/components/OutlinePanel.module.css +111 -0
  182. package/dist/editor/components/P1InspectorFields.d.ts.map +1 -1
  183. package/dist/editor/components/P1InspectorFields.js +24 -5
  184. package/dist/editor/components/P1InspectorFields.js.map +1 -1
  185. package/dist/editor/components/PanelHeader.d.ts +25 -0
  186. package/dist/editor/components/PanelHeader.d.ts.map +1 -0
  187. package/dist/editor/components/PanelHeader.js +12 -0
  188. package/dist/editor/components/PanelHeader.js.map +1 -0
  189. package/dist/editor/components/PanelHeader.module.css +34 -0
  190. package/dist/editor/components/PanelShell.d.ts +10 -0
  191. package/dist/editor/components/PanelShell.d.ts.map +1 -0
  192. package/dist/editor/components/PanelShell.js +7 -0
  193. package/dist/editor/components/PanelShell.js.map +1 -0
  194. package/dist/editor/components/PanelShell.module.css +15 -0
  195. package/dist/editor/components/PreviewPanelOverlay.d.ts +12 -0
  196. package/dist/editor/components/PreviewPanelOverlay.d.ts.map +1 -0
  197. package/dist/editor/components/PreviewPanelOverlay.js +7 -0
  198. package/dist/editor/components/PreviewPanelOverlay.js.map +1 -0
  199. package/dist/editor/components/PublishedStatusBadge.d.ts +1 -1
  200. package/dist/editor/components/PublishedStatusBadge.d.ts.map +1 -1
  201. package/dist/editor/components/VersionBannerOverride.d.ts +5 -1
  202. package/dist/editor/components/VersionBannerOverride.d.ts.map +1 -1
  203. package/dist/editor/components/VersionBannerOverride.js +54 -5
  204. package/dist/editor/components/VersionBannerOverride.js.map +1 -1
  205. package/dist/editor/components/VersionTimeline.d.ts +20 -0
  206. package/dist/editor/components/VersionTimeline.d.ts.map +1 -0
  207. package/dist/editor/components/VersionTimeline.js +42 -0
  208. package/dist/editor/components/VersionTimeline.js.map +1 -0
  209. package/dist/editor/components/collapsibleSectionContext.d.ts +17 -0
  210. package/dist/editor/components/collapsibleSectionContext.d.ts.map +1 -0
  211. package/dist/editor/components/collapsibleSectionContext.js +13 -0
  212. package/dist/editor/components/collapsibleSectionContext.js.map +1 -0
  213. package/dist/editor/components/componentIconName.d.ts +15 -0
  214. package/dist/editor/components/componentIconName.d.ts.map +1 -0
  215. package/dist/editor/components/componentIconName.js +68 -0
  216. package/dist/editor/components/componentIconName.js.map +1 -0
  217. package/dist/editor/components/connectable.d.ts +1 -1
  218. package/dist/editor/components/connectable.d.ts.map +1 -1
  219. package/dist/editor/components/merge-preview/MergePreviewPanel.d.ts.map +1 -1
  220. package/dist/editor/components/merge-preview/MergePreviewPanel.js.map +1 -1
  221. package/dist/editor/components/merge-preview/MergePreviewRenderer.js +3 -15
  222. package/dist/editor/components/merge-preview/MergePreviewRenderer.js.map +1 -1
  223. package/dist/editor/components/outlineTree.d.ts +68 -0
  224. package/dist/editor/components/outlineTree.d.ts.map +1 -0
  225. package/dist/editor/components/outlineTree.js +72 -0
  226. package/dist/editor/components/outlineTree.js.map +1 -0
  227. package/dist/editor/components/useDragReorder.d.ts +16 -0
  228. package/dist/editor/components/useDragReorder.d.ts.map +1 -0
  229. package/dist/editor/components/useDragReorder.js +35 -0
  230. package/dist/editor/components/useDragReorder.js.map +1 -0
  231. package/dist/editor/index.d.ts +13 -0
  232. package/dist/editor/index.d.ts.map +1 -1
  233. package/dist/editor/index.js +8 -0
  234. package/dist/editor/index.js.map +1 -1
  235. package/dist/editor/plugin/P1Plugin.d.ts +19 -3
  236. package/dist/editor/plugin/P1Plugin.d.ts.map +1 -1
  237. package/dist/editor/plugin/P1Plugin.js +121 -98
  238. package/dist/editor/plugin/P1Plugin.js.map +1 -1
  239. package/dist/editor/plugin/context-sync-key.d.ts.map +1 -1
  240. package/dist/editor/plugin/context-sync-key.js +5 -5
  241. package/dist/editor/plugin/context-sync-key.js.map +1 -1
  242. package/dist/editor/plugin/createP1Overrides.d.ts +31 -43
  243. package/dist/editor/plugin/createP1Overrides.d.ts.map +1 -1
  244. package/dist/editor/plugin/createP1Overrides.js +47 -43
  245. package/dist/editor/plugin/createP1Overrides.js.map +1 -1
  246. package/dist/editor/plugin/document-sync-plugin.d.ts +23 -5
  247. package/dist/editor/plugin/document-sync-plugin.d.ts.map +1 -1
  248. package/dist/editor/plugin/document-sync-plugin.js +13 -6
  249. package/dist/editor/plugin/document-sync-plugin.js.map +1 -1
  250. package/dist/editor/plugin/fieldGuidance.d.ts +45 -0
  251. package/dist/editor/plugin/fieldGuidance.d.ts.map +1 -0
  252. package/dist/editor/plugin/fieldGuidance.js +24 -0
  253. package/dist/editor/plugin/fieldGuidance.js.map +1 -0
  254. package/dist/editor/plugin/mergePreviewPlugin.d.ts.map +1 -1
  255. package/dist/editor/plugin/mergePreviewPlugin.js.map +1 -1
  256. package/dist/editor/plugin/selectHeaderCollaborators.d.ts +12 -0
  257. package/dist/editor/plugin/selectHeaderCollaborators.d.ts.map +1 -0
  258. package/dist/editor/plugin/selectHeaderCollaborators.js +15 -0
  259. package/dist/editor/plugin/selectHeaderCollaborators.js.map +1 -0
  260. package/dist/editor/thumbnails/LiveThumbnail.d.ts +47 -0
  261. package/dist/editor/thumbnails/LiveThumbnail.d.ts.map +1 -0
  262. package/dist/editor/thumbnails/LiveThumbnail.js +120 -0
  263. package/dist/editor/thumbnails/LiveThumbnail.js.map +1 -0
  264. package/dist/editor/thumbnails/ThumbnailCard.d.ts +37 -0
  265. package/dist/editor/thumbnails/ThumbnailCard.d.ts.map +1 -0
  266. package/dist/editor/thumbnails/ThumbnailCard.js +91 -0
  267. package/dist/editor/thumbnails/ThumbnailCard.js.map +1 -0
  268. package/dist/editor/thumbnails/buildLiveThumbnailDrawer.d.ts +33 -0
  269. package/dist/editor/thumbnails/buildLiveThumbnailDrawer.d.ts.map +1 -0
  270. package/dist/editor/thumbnails/buildLiveThumbnailDrawer.js +79 -0
  271. package/dist/editor/thumbnails/buildLiveThumbnailDrawer.js.map +1 -0
  272. package/dist/editor/thumbnails/humanizeComponentName.d.ts +18 -0
  273. package/dist/editor/thumbnails/humanizeComponentName.d.ts.map +1 -0
  274. package/dist/editor/thumbnails/humanizeComponentName.js +32 -0
  275. package/dist/editor/thumbnails/humanizeComponentName.js.map +1 -0
  276. package/dist/editor/thumbnails/resolveLiveThumbnailDrawer.d.ts +15 -0
  277. package/dist/editor/thumbnails/resolveLiveThumbnailDrawer.d.ts.map +1 -0
  278. package/dist/editor/thumbnails/resolveLiveThumbnailDrawer.js +19 -0
  279. package/dist/editor/thumbnails/resolveLiveThumbnailDrawer.js.map +1 -0
  280. package/dist/editor/thumbnails/thumbnailCache.d.ts +39 -0
  281. package/dist/editor/thumbnails/thumbnailCache.d.ts.map +1 -0
  282. package/dist/editor/thumbnails/thumbnailCache.js +97 -0
  283. package/dist/editor/thumbnails/thumbnailCache.js.map +1 -0
  284. package/dist/editor/useP1Editor.d.ts +14 -4
  285. package/dist/editor/useP1Editor.d.ts.map +1 -1
  286. package/dist/editor/useP1Editor.js +81 -37
  287. package/dist/editor/useP1Editor.js.map +1 -1
  288. package/dist/editor/useP1Overrides.d.ts +1 -1
  289. package/dist/editor/useP1Overrides.d.ts.map +1 -1
  290. package/dist/editor/useP1Overrides.js.map +1 -1
  291. package/dist/editor/useP1Plugin.d.ts +15 -3
  292. package/dist/editor/useP1Plugin.d.ts.map +1 -1
  293. package/dist/editor/useP1Plugin.js +4 -0
  294. package/dist/editor/useP1Plugin.js.map +1 -1
  295. package/dist/editor/useRealtime.d.ts +2 -2
  296. package/dist/editor/useRealtime.d.ts.map +1 -1
  297. package/dist/editor/useRealtime.js.map +1 -1
  298. package/dist/editor/useResponsivePanels.d.ts +29 -0
  299. package/dist/editor/useResponsivePanels.d.ts.map +1 -0
  300. package/dist/editor/useResponsivePanels.js +175 -0
  301. package/dist/editor/useResponsivePanels.js.map +1 -0
  302. package/dist/editor/useSidebarScrollPreservation.d.ts +10 -0
  303. package/dist/editor/useSidebarScrollPreservation.d.ts.map +1 -0
  304. package/dist/editor/useSidebarScrollPreservation.js +39 -0
  305. package/dist/editor/useSidebarScrollPreservation.js.map +1 -0
  306. package/dist/editor/utils/componentRegistry.d.ts +4 -4
  307. package/dist/editor/utils/componentRegistry.d.ts.map +1 -1
  308. package/dist/editor/utils/componentRegistry.js +0 -1
  309. package/dist/editor/utils/componentRegistry.js.map +1 -1
  310. package/dist/editor/utils/restoreDocumentVersion.d.ts +18 -0
  311. package/dist/editor/utils/restoreDocumentVersion.d.ts.map +1 -0
  312. package/dist/editor/utils/restoreDocumentVersion.js +49 -0
  313. package/dist/editor/utils/restoreDocumentVersion.js.map +1 -0
  314. package/dist/editor/utils/sanitizeRichtextDefaults.d.ts +22 -0
  315. package/dist/editor/utils/sanitizeRichtextDefaults.d.ts.map +1 -0
  316. package/dist/editor/utils/sanitizeRichtextDefaults.js +98 -0
  317. package/dist/editor/utils/sanitizeRichtextDefaults.js.map +1 -0
  318. package/dist/features/content-type-templates/permissions/createPuckPermissions.d.ts +1 -3
  319. package/dist/features/content-type-templates/permissions/createPuckPermissions.d.ts.map +1 -1
  320. package/dist/features/content-type-templates/permissions/createPuckPermissions.js.map +1 -1
  321. package/dist/features/content-type-templates/stores/template-store-api.d.ts.map +1 -1
  322. package/dist/features/content-type-templates/ui/ActionBarPinButton.d.ts.map +1 -1
  323. package/dist/features/content-type-templates/ui/ActionBarPinButton.js +1 -1
  324. package/dist/features/content-type-templates/ui/ActionBarPinButton.js.map +1 -1
  325. package/dist/index.d.ts +14 -1
  326. package/dist/index.d.ts.map +1 -1
  327. package/dist/index.js +13 -1
  328. package/dist/index.js.map +1 -1
  329. package/dist/merge/components/merge-resolution/CherryPickVisualPanel.js +1 -3
  330. package/dist/merge/components/merge-resolution/CherryPickVisualPanel.js.map +1 -1
  331. package/dist/merge/components/merge-resolution/DocumentResolutionDetail.js +2 -2
  332. package/dist/merge/components/merge-resolution/DocumentResolutionDetail.js.map +1 -1
  333. package/dist/p1/editor/client.d.ts +1 -5
  334. package/dist/p1/editor/client.d.ts.map +1 -1
  335. package/dist/p1/editor/client.js +11 -12
  336. package/dist/p1/editor/client.js.map +1 -1
  337. package/dist/p1/editor/connect/connect-field-modal.d.ts +1 -1
  338. package/dist/p1/editor/connect/connect-field-modal.d.ts.map +1 -1
  339. package/dist/p1/editor/connect/connect-field-modal.js +1 -1
  340. package/dist/p1/editor/connect/connect-field-modal.js.map +1 -1
  341. package/dist/p1/editor/connect/connect-preview-config.d.ts +1 -1
  342. package/dist/p1/editor/connect/connect-preview-config.d.ts.map +1 -1
  343. package/dist/p1/editor/connect/field-connect-plugin.js +1 -1
  344. package/dist/p1/editor/connect/field-connect-plugin.js.map +1 -1
  345. package/dist/p1/editor/editor-preview-resolve.d.ts +15 -4
  346. package/dist/p1/editor/editor-preview-resolve.d.ts.map +1 -1
  347. package/dist/p1/editor/editor-preview-resolve.js +30 -8
  348. package/dist/p1/editor/editor-preview-resolve.js.map +1 -1
  349. package/dist/p1/editor/hooks/api-hooks.d.ts +4 -4
  350. package/dist/p1/editor/hooks/api-hooks.d.ts.map +1 -1
  351. package/dist/p1/editor/hooks/api-hooks.js +57 -30
  352. package/dist/p1/editor/hooks/api-hooks.js.map +1 -1
  353. package/dist/p1/editor/hooks/index.d.ts +1 -0
  354. package/dist/p1/editor/hooks/index.d.ts.map +1 -1
  355. package/dist/p1/editor/hooks/index.js +1 -0
  356. package/dist/p1/editor/hooks/index.js.map +1 -1
  357. package/dist/p1/editor/hooks/useEditorContext.d.ts +1 -1
  358. package/dist/p1/editor/hooks/useEditorContext.d.ts.map +1 -1
  359. package/dist/p1/editor/hooks/useEditorContext.js +12 -3
  360. package/dist/p1/editor/hooks/useEditorContext.js.map +1 -1
  361. package/dist/p1/editor/hooks/useLiveRemoteDatasources.d.ts +31 -0
  362. package/dist/p1/editor/hooks/useLiveRemoteDatasources.d.ts.map +1 -0
  363. package/dist/p1/editor/hooks/useLiveRemoteDatasources.js +45 -0
  364. package/dist/p1/editor/hooks/useLiveRemoteDatasources.js.map +1 -0
  365. package/dist/p1/editor/hooks/useP1Plugins.d.ts.map +1 -1
  366. package/dist/p1/editor/hooks/useP1Plugins.js +6 -12
  367. package/dist/p1/editor/hooks/useP1Plugins.js.map +1 -1
  368. package/dist/p1/editor/icons/button-block-icon.d.ts +1 -1
  369. package/dist/p1/editor/icons/button-block-icon.d.ts.map +1 -1
  370. package/dist/p1/editor/icons/data-list-block-icon.d.ts +2 -0
  371. package/dist/p1/editor/icons/data-list-block-icon.d.ts.map +1 -0
  372. package/dist/p1/editor/icons/data-list-block-icon.js +5 -0
  373. package/dist/p1/editor/icons/data-list-block-icon.js.map +1 -0
  374. package/dist/p1/editor/icons/default-block-icon.d.ts +1 -1
  375. package/dist/p1/editor/icons/default-block-icon.d.ts.map +1 -1
  376. package/dist/p1/editor/icons/divider-block-icon.d.ts +1 -1
  377. package/dist/p1/editor/icons/divider-block-icon.d.ts.map +1 -1
  378. package/dist/p1/editor/icons/grid-block-icon.d.ts +1 -1
  379. package/dist/p1/editor/icons/grid-block-icon.d.ts.map +1 -1
  380. package/dist/p1/editor/icons/heading-block-icon.d.ts +1 -1
  381. package/dist/p1/editor/icons/heading-block-icon.d.ts.map +1 -1
  382. package/dist/p1/editor/icons/image-block-icon.d.ts +1 -1
  383. package/dist/p1/editor/icons/image-block-icon.d.ts.map +1 -1
  384. package/dist/p1/editor/icons/list-block-icon.d.ts +1 -1
  385. package/dist/p1/editor/icons/list-block-icon.d.ts.map +1 -1
  386. package/dist/p1/editor/icons/paragraph-block-icon.d.ts +1 -1
  387. package/dist/p1/editor/icons/paragraph-block-icon.d.ts.map +1 -1
  388. package/dist/p1/editor/icons/quote-block-icon.d.ts +1 -1
  389. package/dist/p1/editor/icons/quote-block-icon.d.ts.map +1 -1
  390. package/dist/p1/editor/icons/spacer-block-icon.d.ts +1 -1
  391. package/dist/p1/editor/icons/spacer-block-icon.d.ts.map +1 -1
  392. package/dist/p1/editor/index.d.ts +1 -1
  393. package/dist/p1/editor/index.d.ts.map +1 -1
  394. package/dist/p1/editor/index.js +1 -1
  395. package/dist/p1/editor/index.js.map +1 -1
  396. package/dist/p1/editor/remote-datasources/remote-datasource-explorer-plugin.d.ts +6 -7
  397. package/dist/p1/editor/remote-datasources/remote-datasource-explorer-plugin.d.ts.map +1 -1
  398. package/dist/p1/editor/remote-datasources/remote-datasource-explorer-plugin.js +77 -73
  399. package/dist/p1/editor/remote-datasources/remote-datasource-explorer-plugin.js.map +1 -1
  400. package/dist/p1/editor/remote-datasources/remote-datasource-form-helpers.d.ts +4 -4
  401. package/dist/p1/editor/remote-datasources/remote-datasource-form-helpers.d.ts.map +1 -1
  402. package/dist/p1/editor/remote-datasources/remote-datasource-form-helpers.js.map +1 -1
  403. package/dist/p1/editor/remote-datasources/remote-datasource-manager.d.ts +1 -1
  404. package/dist/p1/editor/remote-datasources/remote-datasource-manager.d.ts.map +1 -1
  405. package/dist/p1/editor/remote-datasources/remote-datasource-manager.js +1 -1
  406. package/dist/p1/editor/remote-datasources/remote-datasource-manager.js.map +1 -1
  407. package/dist/p1/editor/remote-datasources/template-preview-params-toolbar.d.ts +1 -1
  408. package/dist/p1/editor/remote-datasources/template-preview-params-toolbar.d.ts.map +1 -1
  409. package/dist/p1/editor/remote-datasources/template-preview-params-toolbar.js +1 -1
  410. package/dist/p1/editor/remote-datasources/template-preview-params-toolbar.js.map +1 -1
  411. package/dist/p1/editor/template-autocomplete-layer.d.ts +2 -2
  412. package/dist/p1/editor/template-autocomplete-layer.d.ts.map +1 -1
  413. package/dist/p1/editor/template-autocomplete-layer.js +23 -3
  414. package/dist/p1/editor/template-autocomplete-layer.js.map +1 -1
  415. package/dist/p1/pages/render-client.d.ts +1 -1
  416. package/dist/p1/pages/render-client.d.ts.map +1 -1
  417. package/dist/p1/pages/render-client.js +2 -1
  418. package/dist/p1/pages/render-client.js.map +1 -1
  419. package/dist/pds/components/AgentChip.d.ts.map +1 -1
  420. package/dist/pds/components/AgentChip.js +1 -2
  421. package/dist/pds/components/AgentChip.js.map +1 -1
  422. package/dist/pds/components/CreatePageModal.d.ts +10 -1
  423. package/dist/pds/components/CreatePageModal.d.ts.map +1 -1
  424. package/dist/pds/components/CreatePageModal.js +29 -9
  425. package/dist/pds/components/CreatePageModal.js.map +1 -1
  426. package/dist/pds/components/CreatePageModal.module.css +34 -0
  427. package/dist/pds/components/DocStateBadge.d.ts +1 -1
  428. package/dist/pds/components/DocStateBadge.d.ts.map +1 -1
  429. package/dist/pds/components/DocStateBadge.js +1 -1
  430. package/dist/pds/components/DocStateBadge.js.map +1 -1
  431. package/dist/pds/components/NavIcon.js +1 -1
  432. package/dist/pds/components/NavIcon.js.map +1 -1
  433. package/dist/pds/components/P1EditorHeader.d.ts +10 -2
  434. package/dist/pds/components/P1EditorHeader.d.ts.map +1 -1
  435. package/dist/pds/components/P1EditorHeader.js +16 -7
  436. package/dist/pds/components/P1EditorHeader.js.map +1 -1
  437. package/dist/pds/components/P1EditorHeader.module.css +113 -35
  438. package/dist/pds/components/P1EditorSubheader.d.ts +1 -4
  439. package/dist/pds/components/P1EditorSubheader.d.ts.map +1 -1
  440. package/dist/pds/components/P1EditorSubheader.js +10 -21
  441. package/dist/pds/components/P1EditorSubheader.js.map +1 -1
  442. package/dist/pds/components/P1EditorSubheader.module.css +7 -5
  443. package/dist/pds/components/PageNavigator.d.ts.map +1 -1
  444. package/dist/pds/components/PageNavigator.js.map +1 -1
  445. package/dist/pds/components/PresenceStack.d.ts +6 -5
  446. package/dist/pds/components/PresenceStack.d.ts.map +1 -1
  447. package/dist/pds/components/PresenceStack.js +43 -4
  448. package/dist/pds/components/PresenceStack.js.map +1 -1
  449. package/dist/pds/components/PresenceStack.module.css +52 -7
  450. package/dist/pds/components/PublishControl.js +2 -2
  451. package/dist/pds/components/PublishControl.js.map +1 -1
  452. package/dist/pds/components/WorkstreamSwitcher.d.ts +7 -2
  453. package/dist/pds/components/WorkstreamSwitcher.d.ts.map +1 -1
  454. package/dist/pds/components/WorkstreamSwitcher.js +5 -3
  455. package/dist/pds/components/WorkstreamSwitcher.js.map +1 -1
  456. package/dist/server.d.ts +3 -1
  457. package/dist/server.d.ts.map +1 -1
  458. package/dist/server.js +4 -1
  459. package/dist/server.js.map +1 -1
  460. package/dist/versioning/components/HistoricalVersionBanner.d.ts +19 -21
  461. package/dist/versioning/components/HistoricalVersionBanner.d.ts.map +1 -1
  462. package/dist/versioning/components/HistoricalVersionBanner.js +9 -21
  463. package/dist/versioning/components/HistoricalVersionBanner.js.map +1 -1
  464. package/dist/versioning/components/HistoricalVersionBanner.module.css +174 -0
  465. package/dist/versioning/components/VersionBannerActions.d.ts +15 -0
  466. package/dist/versioning/components/VersionBannerActions.d.ts.map +1 -0
  467. package/dist/versioning/components/VersionBannerActions.js +38 -0
  468. package/dist/versioning/components/VersionBannerActions.js.map +1 -0
  469. package/dist/versioning/components/VersionPublishedBadge.d.ts +1 -1
  470. package/dist/versioning/components/VersionPublishedBadge.d.ts.map +1 -1
  471. package/dist/versioning/components/version-compare/VisualVersionCompare.d.ts +2 -2
  472. package/dist/versioning/components/version-compare/VisualVersionCompare.d.ts.map +1 -1
  473. package/dist/versioning/utils/formatVersionDate.d.ts +15 -0
  474. package/dist/versioning/utils/formatVersionDate.d.ts.map +1 -0
  475. package/dist/versioning/utils/formatVersionDate.js +41 -0
  476. package/dist/versioning/utils/formatVersionDate.js.map +1 -0
  477. package/dist/versioning/utils/versionKind.d.ts +19 -0
  478. package/dist/versioning/utils/versionKind.d.ts.map +1 -0
  479. package/dist/versioning/utils/versionKind.js +30 -0
  480. package/dist/versioning/utils/versionKind.js.map +1 -0
  481. package/package.json +11 -7
  482. package/src/pds/theme/PuckEditorTheme.css +81 -0
  483. package/src/pds/theme/PuckEditorTheme.test.ts +50 -1
  484. package/src/styles.css +609 -84
@@ -0,0 +1,120 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * LiveThumbnail
4
+ *
5
+ * Renders a real, scaled-down preview of a single Puck component using the
6
+ * component's own `defaultProps`, via Puck's <Render>. The preview is clipped
7
+ * to a fixed height and made non-interactive so it reads as a static thumbnail
8
+ * inside the visual component sidebar.
9
+ *
10
+ * Rendering is cached (see thumbnailCache): on a miss we render live and
11
+ * capture the resulting HTML; on a hit we re-inject the cached HTML instead of
12
+ * re-rendering the component. The cache survives editor remounts within a
13
+ * page load, avoiding re-rendering identical previews on every document
14
+ * switch.
15
+ *
16
+ * The initial capture happens right after the component's first commit, but a
17
+ * component that renders its own content asynchronously (e.g. after a fetch,
18
+ * in its own effect) may still be showing a loading state at that point. A
19
+ * MutationObserver keeps watching the live render and re-captures on every
20
+ * DOM change, so the cache converges on the settled output instead of
21
+ * permanently freezing whatever was on screen first.
22
+ *
23
+ * The config handed to Puck's <Render> has its `root` swapped for a
24
+ * pass-through: this preview is a single component, not a page, so it must
25
+ * not run the site's real page-root wrapper (e.g. a title `<h1>`) — that
26
+ * wrapper reflects the actual document currently open in the editor, not
27
+ * this isolated stub, and would otherwise leak into every preview.
28
+ *
29
+ * Unlike the exploratory spike this does NOT self-measure its height — grid
30
+ * cards want a uniform, fixed size, so we clip overflow instead.
31
+ */
32
+ import React from 'react';
33
+ import { Render } from '@puckeditor/core';
34
+ import { getCachedThumbnail, setCachedThumbnail, getThumbnailCacheKey } from './thumbnailCache.js';
35
+ import { DEFAULT_THUMBNAIL_HEIGHT } from './ThumbnailCard.js';
36
+ function LiveThumbnailImpl({ config, name, scale = 0.2, height = DEFAULT_THUMBNAIL_HEIGHT }) {
37
+ const defaultProps = config?.components?.[name]?.defaultProps ?? {};
38
+ const cacheKey = getThumbnailCacheKey(config, name);
39
+ // Read once at mount: a hit lets us skip the live render entirely.
40
+ const [cached] = React.useState(() => getCachedThumbnail(cacheKey));
41
+ const innerRef = React.useRef(null);
42
+ // Isolated document: this preview is the one component, not a page — the
43
+ // real root wrapper is swapped for a pass-through below.
44
+ const data = {
45
+ root: { props: {} },
46
+ content: [
47
+ {
48
+ type: name,
49
+ props: { id: `thumb-${name}`, ...defaultProps },
50
+ },
51
+ ],
52
+ zones: {},
53
+ };
54
+ const isolatedConfig = React.useMemo(() => ({ ...config, root: { render: ({ children }) => children } }), [config]);
55
+ // On a miss, capture the live-rendered HTML once it has committed, then
56
+ // keep re-capturing on any further mutation so a component that finishes
57
+ // rendering asynchronously (its own effect, a fetch, an image swap) doesn't
58
+ // get an incomplete snapshot cached permanently.
59
+ //
60
+ // Mutations are debounced through requestAnimationFrame so a burst of DOM
61
+ // changes (e.g. a component updating several nodes at once) produces one
62
+ // capture per frame. Attribute mutations are excluded — they fire continuously
63
+ // for animations and class toggles without changing rendered content.
64
+ // The observer disconnects after 500 ms of DOM quiet so it doesn't run for
65
+ // the drawer's entire lifetime.
66
+ React.useEffect(() => {
67
+ if (cached !== undefined)
68
+ return;
69
+ const node = innerRef.current;
70
+ if (!node)
71
+ return;
72
+ const capture = () => {
73
+ const html = node.innerHTML;
74
+ if (html)
75
+ setCachedThumbnail(cacheKey, html);
76
+ };
77
+ let rafId = null;
78
+ let settleTimer = null;
79
+ const onMutation = () => {
80
+ if (rafId !== null)
81
+ cancelAnimationFrame(rafId);
82
+ rafId = requestAnimationFrame(() => {
83
+ capture();
84
+ rafId = null;
85
+ });
86
+ if (settleTimer !== null)
87
+ clearTimeout(settleTimer);
88
+ settleTimer = setTimeout(() => observer.disconnect(), 500);
89
+ };
90
+ capture();
91
+ const observer = new MutationObserver(onMutation);
92
+ observer.observe(node, { childList: true, subtree: true, characterData: true });
93
+ return () => {
94
+ observer.disconnect();
95
+ if (rafId !== null)
96
+ cancelAnimationFrame(rafId);
97
+ if (settleTimer !== null)
98
+ clearTimeout(settleTimer);
99
+ };
100
+ }, [cached, cacheKey]);
101
+ const boxStyle = {
102
+ width: '100%',
103
+ height,
104
+ overflow: 'hidden',
105
+ background: '#fff',
106
+ pointerEvents: 'none',
107
+ };
108
+ const innerStyle = {
109
+ transform: `scale(${scale})`,
110
+ transformOrigin: 'top left',
111
+ width: `${100 / scale}%`,
112
+ };
113
+ return (_jsx("div", { style: boxStyle, children: cached !== undefined ? (
114
+ // Trusted source: this HTML was produced by our own <Render> of the
115
+ // component's defaultProps — never user input.
116
+ _jsx("div", { style: innerStyle, dangerouslySetInnerHTML: { __html: cached } })) : (_jsx("div", { style: innerStyle, ref: innerRef, children: _jsx(Render, { config: isolatedConfig, data: data }) })) }));
117
+ }
118
+ /** Memoized so re-expanding a category doesn't re-render existing previews. */
119
+ export const LiveThumbnail = React.memo(LiveThumbnailImpl);
120
+ //# sourceMappingURL=LiveThumbnail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveThumbnail.js","sourceRoot":"","sources":["../../../src/editor/thumbnails/LiveThumbnail.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAe9D,SAAS,iBAAiB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,GAAG,EAAE,MAAM,GAAG,wBAAwB,EAAsB;IAC7G,MAAM,YAAY,GAA4B,MAAM,EAAE,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,YAAY,IAAI,EAAE,CAAC;IAC7F,MAAM,QAAQ,GAAG,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEpD,mEAAmE;IACnE,M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AAC;IAEF,OAAO,CACL,cAAK,KAAK,EAAE,QAAQ,YACjB,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC;QACtB,oEAAoE;QACpE,+CAA+C;QAC/C,cAAK,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAI,CACxE,CAAC,CAAC,CAAC,CACF,cAAK,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,YACnC,KAAC,MAAM,IAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,IAA4C,GAAI,GAClF,CACP,GACG,CACP,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * ThumbnailCard
3
+ *
4
+ * One card in the visual component sidebar grid: a live preview above a
5
+ * centered, human-readable name.
6
+ *
7
+ * To keep opening a category feeling instant, the expensive live <Render> is
8
+ * NOT mounted on the first commit unless a preview is already cached.
9
+ * Otherwise, a lightweight skeleton paints immediately and the real preview
10
+ * is scheduled on idle time, then swapped in. The preview is wrapped in an
11
+ * error boundary so a single misbehaving component degrades to a placeholder
12
+ * rather than taking down the drawer.
13
+ *
14
+ * Seeding `ready` from the cache matters beyond the first paint: Puck's own
15
+ * <Drawer>/<Drawer.Item> primitives remount on unrelated editor state changes
16
+ * (e.g. typing in any field), which remounts every ThumbnailCard too. Without
17
+ * the cache check, `ready` would reset to false on every one of those
18
+ * remounts, flashing the skeleton back in even for previews already rendered.
19
+ */
20
+ import React from 'react';
21
+ type RenderConfig = any;
22
+ /** Default preview-card height in pixels, shared across LiveThumbnail, ThumbnailCard, and the drawer. */
23
+ export declare const DEFAULT_THUMBNAIL_HEIGHT = 96;
24
+ export interface ThumbnailCardProps {
25
+ config: RenderConfig;
26
+ name: string;
27
+ /** Preferred display name; falls back to a humanized component key. */
28
+ label?: string;
29
+ scale?: number;
30
+ /** Fixed height of the preview area, in pixels. */
31
+ height?: number;
32
+ }
33
+ declare function ThumbnailCardImpl({ config, name, label, scale, height }: ThumbnailCardProps): React.JSX.Element;
34
+ /** Memoized so a category re-expand keeps already-rendered cards mounted. */
35
+ export declare const ThumbnailCard: React.MemoExoticComponent<typeof ThumbnailCardImpl>;
36
+ export {};
37
+ //# sourceMappingURL=ThumbnailCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThumbnailCard.d.ts","sourceRoot":"","sources":["../../../src/editor/thumbnails/ThumbnailCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,KAAK,YAAY,GAAG,GAAG,CAAC;AAExB,yGAAyG;AACzG,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAwED,iBAAS,iBAAiB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAiC,EAAE,EAAE,kBAAkB,qBA+B/G;AAED,6EAA6E;AAC7E,eAAO,MAAM,aAAa,qDAAgC,CAAC"}
@@ -0,0 +1,91 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * ThumbnailCard
4
+ *
5
+ * One card in the visual component sidebar grid: a live preview above a
6
+ * centered, human-readable name.
7
+ *
8
+ * To keep opening a category feeling instant, the expensive live <Render> is
9
+ * NOT mounted on the first commit unless a preview is already cached.
10
+ * Otherwise, a lightweight skeleton paints immediately and the real preview
11
+ * is scheduled on idle time, then swapped in. The preview is wrapped in an
12
+ * error boundary so a single misbehaving component degrades to a placeholder
13
+ * rather than taking down the drawer.
14
+ *
15
+ * Seeding `ready` from the cache matters beyond the first paint: Puck's own
16
+ * <Drawer>/<Drawer.Item> primitives remount on unrelated editor state changes
17
+ * (e.g. typing in any field), which remounts every ThumbnailCard too. Without
18
+ * the cache check, `ready` would reset to false on every one of those
19
+ * remounts, flashing the skeleton back in even for previews already rendered.
20
+ */
21
+ import React from 'react';
22
+ import { LiveThumbnail } from './LiveThumbnail.js';
23
+ import { humanizeComponentName } from './humanizeComponentName.js';
24
+ import { getCachedThumbnail, getThumbnailCacheKey } from './thumbnailCache.js';
25
+ /** Default preview-card height in pixels, shared across LiveThumbnail, ThumbnailCard, and the drawer. */
26
+ export const DEFAULT_THUMBNAIL_HEIGHT = 96;
27
+ // ─── Idle scheduling (with a jsdom/SSR-safe fallback) ───────────────────────
28
+ function scheduleIdle(cb) {
29
+ const ric = globalThis.requestIdleCallback;
30
+ if (ric)
31
+ return ric(cb);
32
+ return setTimeout(cb, 1);
33
+ }
34
+ function cancelIdle(id) {
35
+ const cic = globalThis.cancelIdleCallback;
36
+ if (cic)
37
+ cic(id);
38
+ else
39
+ clearTimeout(id);
40
+ }
41
+ // ─── Error boundary ─────────────────────────────────────────────────────────
42
+ class PreviewErrorBoundary extends React.Component {
43
+ state = { hasError: false };
44
+ static getDerivedStateFromError() {
45
+ return { hasError: true };
46
+ }
47
+ render() {
48
+ return this.state.hasError ? this.props.fallback : this.props.children;
49
+ }
50
+ }
51
+ // ─── Pieces ─────────────────────────────────────────────────────────────────
52
+ function Skeleton({ height }) {
53
+ return (_jsx("div", { role: "status", "aria-label": "Loading preview", style: {
54
+ height,
55
+ background: 'linear-gradient(90deg, #f1f3f5 25%, #e9ecef 37%, #f1f3f5 63%)',
56
+ backgroundSize: '400% 100%',
57
+ animation: 'p1-thumb-shimmer 1.2s ease-in-out infinite',
58
+ } }));
59
+ }
60
+ function PreviewUnavailable({ height }) {
61
+ return (_jsx("div", { role: "img", "aria-label": "Preview unavailable", style: {
62
+ height,
63
+ display: 'grid',
64
+ placeItems: 'center',
65
+ background: '#f8f9fa',
66
+ color: '#adb5bd',
67
+ fontSize: 11,
68
+ }, children: "No preview" }));
69
+ }
70
+ // ─── Card ─────────────────────────────────────────────────────────────────────
71
+ function ThumbnailCardImpl({ config, name, label, scale, height = DEFAULT_THUMBNAIL_HEIGHT }) {
72
+ const [ready, setReady] = React.useState(() => getCachedThumbnail(getThumbnailCacheKey(config, name)) !== undefined);
73
+ React.useEffect(() => {
74
+ if (ready)
75
+ return;
76
+ let cancelled = false;
77
+ const id = scheduleIdle(() => {
78
+ if (!cancelled)
79
+ setReady(true);
80
+ });
81
+ return () => {
82
+ cancelled = true;
83
+ cancelIdle(id);
84
+ };
85
+ }, [ready]);
86
+ const displayName = label ?? humanizeComponentName(name);
87
+ return (_jsxs("div", { className: "p1-thumb-card", children: [ready ? (_jsx(PreviewErrorBoundary, { fallback: _jsx(PreviewUnavailable, { height: height }), children: _jsx(LiveThumbnail, { config: config, name: name, scale: scale, height: height }) })) : (_jsx(Skeleton, { height: height })), _jsx("div", { className: "p1-thumb-card__label", title: displayName, children: displayName })] }));
88
+ }
89
+ /** Memoized so a category re-expand keeps already-rendered cards mounted. */
90
+ export const ThumbnailCard = React.memo(ThumbnailCardImpl);
91
+ //# sourceMappingURL=ThumbnailCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThumbnailCard.js","sourceRoot":"","sources":["../../../src/editor/thumbnails/ThumbnailCard.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAK/E,yGAAyG;AACzG,MAAM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,IAAC,MAAM,EAAE,MAAM,GAAI,CAC7B,EACD,cAAK,SAAS,EAAC,sBAAsB,EAAC,KAAK,EAAE,WAAW,YAAG,WAAW,GAAO,IACzE,CACP,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * buildLiveThumbnailDrawer
3
+ *
4
+ * Builds a Puck `drawer` override that replaces the default component list
5
+ * with a visual, thumbnail-driven sidebar:
6
+ *
7
+ * - components are grouped into collapsible category sections
8
+ * (from `config.categories`, plus an "Other" bucket for anything
9
+ * uncategorized);
10
+ * - the first category is expanded by default, the rest collapsed, so the
11
+ * initial paint mounts as few live previews as possible;
12
+ * - each category renders a 2-column grid of ThumbnailCards, each wrapped in
13
+ * Puck's <Drawer.Item> so it stays draggable onto the canvas.
14
+ *
15
+ * Pass the result to useP1Editor's `additionalOverrides`.
16
+ */
17
+ import type { PuckOverrides } from '../plugin/index.js';
18
+ type RenderConfig = any;
19
+ export interface LiveThumbnailDrawerOptions {
20
+ /** Zoom factor for each preview. */
21
+ scale?: number;
22
+ /** Height of each preview area, in pixels. */
23
+ cardHeight?: number;
24
+ /** Optional callback to close/collapse the blocks panel. */
25
+ onClose?: () => void;
26
+ }
27
+ /**
28
+ * Returns a `drawer` override rendering the visual thumbnail sidebar for the
29
+ * given Puck config.
30
+ */
31
+ export declare function buildLiveThumbnailDrawer(config: RenderConfig, options?: LiveThumbnailDrawerOptions): Partial<PuckOverrides>;
32
+ export {};
33
+ //# sourceMappingURL=buildLiveThumbnailDrawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildLiveThumbnailDrawer.d.ts","sourceRoot":"","sources":["../../../src/editor/thumbnails/buildLiveThumbnailDrawer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAOxD,KAAK,YAAY,GAAG,GAAG,CAAC;AAExB,MAAM,WAAW,0BAA0B;IACzC,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAmID;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,aAAa,CAAC,CAIxB"}
@@ -0,0 +1,79 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * buildLiveThumbnailDrawer
4
+ *
5
+ * Builds a Puck `drawer` override that replaces the default component list
6
+ * with a visual, thumbnail-driven sidebar:
7
+ *
8
+ * - components are grouped into collapsible category sections
9
+ * (from `config.categories`, plus an "Other" bucket for anything
10
+ * uncategorized);
11
+ * - the first category is expanded by default, the rest collapsed, so the
12
+ * initial paint mounts as few live previews as possible;
13
+ * - each category renders a 2-column grid of ThumbnailCards, each wrapped in
14
+ * Puck's <Drawer.Item> so it stays draggable onto the canvas.
15
+ *
16
+ * Pass the result to useP1Editor's `additionalOverrides`.
17
+ */
18
+ import React from 'react';
19
+ import { Drawer } from '@puckeditor/core';
20
+ import { Icon } from '@pantheon-systems/pds-toolkit-react';
21
+ import { PanelShell } from '../components/PanelShell.js';
22
+ import { useP1Puck } from '../../core/P1PuckContext.js';
23
+ import { PreviewPanelOverlay } from '../components/PreviewPanelOverlay.js';
24
+ import { CollapsibleSectionHeader } from '../components/CollapsibleSectionHeader.js';
25
+ import { ThumbnailCard, DEFAULT_THUMBNAIL_HEIGHT } from './ThumbnailCard.js';
26
+ const OTHER_KEY = '__other';
27
+ function computeSections(config) {
28
+ const categories = config?.categories ?? {};
29
+ const components = config?.components ?? {};
30
+ const categorized = new Set();
31
+ const sections = [];
32
+ for (const [key, category] of Object.entries(categories)) {
33
+ const names = (category.components ?? []).filter((name) => name in components);
34
+ names.forEach((name) => categorized.add(name));
35
+ if (names.length)
36
+ sections.push({ key, title: category.title ?? key, names });
37
+ }
38
+ const uncategorized = Object.keys(components).filter((name) => !categorized.has(name));
39
+ if (uncategorized.length) {
40
+ sections.push({ key: OTHER_KEY, title: 'Other', names: uncategorized });
41
+ }
42
+ return sections;
43
+ }
44
+ // ─── Drawer ─────────────────────────────────────────────────────────────────
45
+ function LiveThumbnailDrawer({ config, options, }) {
46
+ const { isViewingHistoricalVersion, viewingVersion, returnToLatest } = useP1Puck();
47
+ const sections = React.useMemo(() => computeSections(config), [config]);
48
+ const [expanded, setExpanded] = React.useState(() => {
49
+ const first = sections[0];
50
+ return first ? { [first.key]: true } : {};
51
+ });
52
+ const toggle = (key) => setExpanded((prev) => ({ ...prev, [key]: !prev[key] }));
53
+ const allOpen = sections.length > 0 && sections.every((s) => !!expanded[s.key]);
54
+ const toggleAll = () => {
55
+ if (allOpen) {
56
+ setExpanded({});
57
+ }
58
+ else {
59
+ setExpanded(Object.fromEntries(sections.map((s) => [s.key, true])));
60
+ }
61
+ };
62
+ const components = config?.components ?? {};
63
+ return (_jsx(PreviewPanelOverlay, { isViewingHistoricalVersion: isViewingHistoricalVersion, versionNumber: viewingVersion?.versionNumber ?? undefined, onExitPreview: returnToLatest, children: _jsxs(PanelShell, { title: "Blocks", onCollapse: options.onClose, children: [sections.length > 0 && (_jsxs("div", { className: "p1-blocks-drawer__toolbar", children: [_jsxs("span", { className: "p1-blocks-drawer__toolbar-label", children: [sections.length, " ", sections.length === 1 ? 'category' : 'categories'] }), _jsxs("button", { type: "button", className: "p1-blocks-drawer__expand-btn", onClick: toggleAll, "aria-label": allOpen ? 'Collapse all categories' : 'Expand all categories', children: [_jsx(Icon, { iconName: allOpen ? 'angleUp' : 'angleDown', size: "s" }), allOpen ? 'Collapse all' : 'Expand all'] })] })), sections.map((section) => {
64
+ const open = !!expanded[section.key];
65
+ const btnId = `p1-cat-btn-${section.key}`;
66
+ const gridId = `p1-cat-grid-${section.key}`;
67
+ return (_jsxs("section", { "aria-labelledby": btnId, children: [_jsx(CollapsibleSectionHeader, { id: btnId, controlsId: gridId, title: section.title, count: section.names.length, open: open, onToggle: () => toggle(section.key) }), open && (_jsx(Drawer, { children: _jsx("div", { id: gridId, className: "p1-blocks-drawer__grid", children: section.names.map((name) => (_jsx(Drawer.Item, { name: name, children: () => (_jsx(ThumbnailCard, { config: config, name: name, label: components[name]?.label, scale: options.scale, height: options.cardHeight ?? DEFAULT_THUMBNAIL_HEIGHT })) }, name))) }) }))] }, section.key));
68
+ })] }) }));
69
+ }
70
+ /**
71
+ * Returns a `drawer` override rendering the visual thumbnail sidebar for the
72
+ * given Puck config.
73
+ */
74
+ export function buildLiveThumbnailDrawer(config, options = {}) {
75
+ return {
76
+ drawer: () => _jsx(LiveThumbnailDrawer, { config: config, options: options }),
77
+ };
78
+ }
79
+ //# sourceMappingURL=buildLiveThumbnailDrawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildLiveThumbnailDrawer.js","sourceRoot":"","sources":["../../../src/editor/thumbnails/buildLiveThumbnailDrawer.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAc7E,MAAM,SAAS,GAA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OAAO,CAAC,KAAK,CAAC,MAAM,EAC3B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GACnC,EACD,IAAI,IAAI,CACP,KAAC,MAAM,cACL,cAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAC,wBAAwB,YAChD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC3B,KAAC,MAAM,CAAC,IAAI,IAAY,IAAI,EAAE,IAAI,YAC/B,GAAG,EAAE,CAAC,CACL,KAAC,aAAa,IACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,EAC9B,KAAK,EAAE,OAAO,CAAC,KAAK,EACpB,MAAM,EAAE,OAAO,CAAC,UAAU,IAAI,wBAAwB,GACtD,CACH,IATe,IAAI,CAUR,CACf,CAAC,GACE,GACC,CACV,KA3BW,OAAO,CAAC,GAAG,CA4Bf,CACX,CAAC;gBACJ,CAAC,CAAC,IACO,GACS,CACvB,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAoB,EACpB,UAAsC,EAAE;IAExC,OAAO;QACL,MAAM,EAAE,GAAG,EAAE,CAAC,KAAC,mBAAmB,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAI;KACxE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * humanizeComponentName
3
+ *
4
+ * Derives a human-readable label from a Puck component key for display in the
5
+ * visual component sidebar. Callers should prefer a component's explicit
6
+ * `label` when one exists and fall back to this for the raw key.
7
+ *
8
+ * Transform: strip a trailing "Block" suffix, split PascalCase (and
9
+ * digit→capital boundaries) into words, and upper-case known acronyms.
10
+ *
11
+ * "HeroBlock" -> "Hero"
12
+ * "CardGridBlock" -> "Card Grid"
13
+ * "P1WelcomeBlock" -> "P1 Welcome"
14
+ * "CtaBannerBlock" -> "CTA Banner"
15
+ * "FaqBlock" -> "FAQ"
16
+ */
17
+ export declare function humanizeComponentName(name: string): string;
18
+ //# sourceMappingURL=humanizeComponentName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humanizeComponentName.d.ts","sourceRoot":"","sources":["../../../src/editor/thumbnails/humanizeComponentName.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAQH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAS1D"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * humanizeComponentName
3
+ *
4
+ * Derives a human-readable label from a Puck component key for display in the
5
+ * visual component sidebar. Callers should prefer a component's explicit
6
+ * `label` when one exists and fall back to this for the raw key.
7
+ *
8
+ * Transform: strip a trailing "Block" suffix, split PascalCase (and
9
+ * digit→capital boundaries) into words, and upper-case known acronyms.
10
+ *
11
+ * "HeroBlock" -> "Hero"
12
+ * "CardGridBlock" -> "Card Grid"
13
+ * "P1WelcomeBlock" -> "P1 Welcome"
14
+ * "CtaBannerBlock" -> "CTA Banner"
15
+ * "FaqBlock" -> "FAQ"
16
+ */
17
+ /** Words (lower-cased) that should render fully upper-cased. */
18
+ const ACRONYMS = {
19
+ cta: 'CTA',
20
+ faq: 'FAQ',
21
+ };
22
+ export function humanizeComponentName(name) {
23
+ return name
24
+ .replace(/Block$/, '')
25
+ .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
26
+ .trim()
27
+ .split(/\s+/)
28
+ .filter(Boolean)
29
+ .map((word) => ACRONYMS[word.toLowerCase()] ?? word)
30
+ .join(' ');
31
+ }
32
+ //# sourceMappingURL=humanizeComponentName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humanizeComponentName.js","sourceRoot":"","sources":["../../../src/editor/thumbnails/humanizeComponentName.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,gEAAgE;AAChE,MAAM,QAAQ,GAA2B;IACvC,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;CACX,CAAC;AAEF,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,OAAO,IAAI;SACR,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,IAAI,EAAE;SACN,KAAK,CAAC,KAAK,CAAC;SACZ,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,IAAI,CAAC;SACnD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * resolveLiveThumbnailDrawer
3
+ *
4
+ * Decides whether useP1Editor should apply the live thumbnail component drawer,
5
+ * turning the `liveThumbnailDrawer` option into a Puck override layer (or null).
6
+ *
7
+ * The drawer is ON by default — passing `undefined` or `true` builds it, an
8
+ * options object builds it with those settings, and `false` opts out (Puck's
9
+ * default drawer is kept). Kept as a pure function so the default-on / opt-out
10
+ * policy is unit-testable independently of the drawer's rendering internals.
11
+ */
12
+ import type { PuckOverrides } from '../plugin/index.js';
13
+ import { type LiveThumbnailDrawerOptions } from './buildLiveThumbnailDrawer.js';
14
+ export declare function resolveLiveThumbnailDrawer(config: unknown, option: boolean | LiveThumbnailDrawerOptions | undefined): Partial<PuckOverrides> | null;
15
+ //# sourceMappingURL=resolveLiveThumbnailDrawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveLiveThumbnailDrawer.d.ts","sourceRoot":"","sources":["../../../src/editor/thumbnails/resolveLiveThumbnailDrawer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAA4B,KAAK,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE1G,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,OAAO,GAAG,0BAA0B,GAAG,SAAS,GACvD,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAI/B"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * resolveLiveThumbnailDrawer
3
+ *
4
+ * Decides whether useP1Editor should apply the live thumbnail component drawer,
5
+ * turning the `liveThumbnailDrawer` option into a Puck override layer (or null).
6
+ *
7
+ * The drawer is ON by default — passing `undefined` or `true` builds it, an
8
+ * options object builds it with those settings, and `false` opts out (Puck's
9
+ * default drawer is kept). Kept as a pure function so the default-on / opt-out
10
+ * policy is unit-testable independently of the drawer's rendering internals.
11
+ */
12
+ import { buildLiveThumbnailDrawer } from './buildLiveThumbnailDrawer.js';
13
+ export function resolveLiveThumbnailDrawer(config, option) {
14
+ if (option === false)
15
+ return null;
16
+ const options = typeof option === 'object' ? option : undefined;
17
+ return buildLiveThumbnailDrawer(config, options);
18
+ }
19
+ //# sourceMappingURL=resolveLiveThumbnailDrawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveLiveThumbnailDrawer.js","sourceRoot":"","sources":["../../../src/editor/thumbnails/resolveLiveThumbnailDrawer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,wBAAwB,EAAmC,MAAM,+BAA+B,CAAC;AAE1G,MAAM,UAAU,0BAA0B,CACxC,MAAe,EACf,MAAwD;IAExD,IAAI,MAAM,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IAClC,MAAM,OAAO,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAChE,OAAO,wBAAwB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * thumbnailCache
3
+ *
4
+ * In-memory, client-side cache for rendered component-preview HTML: a
5
+ * module-level Map that survives editor/document remounts within a single
6
+ * page load (Puck is force-remounted via `key` on every document switch,
7
+ * which would otherwise re-render every preview from scratch).
8
+ *
9
+ * Deliberately NOT persisted to localStorage: the cached value is later
10
+ * injected via `dangerouslySetInnerHTML` (see LiveThumbnail), and localStorage
11
+ * is writable by any same-origin script. Persisting it would let a same-origin
12
+ * write to a `p1-thumb:*` key plant markup that gets trusted and replayed on a
13
+ * future load. Keeping the cache in-memory only means an attacker would need
14
+ * live script execution in this exact session to influence it — at which
15
+ * point they already have full DOM control and this cache buys them nothing.
16
+ *
17
+ * A preview depends only on component name + defaultProps, NOT on the document
18
+ * being edited, so entries are reused across every page. The key embeds a hash
19
+ * of the defaultProps plus a caller-supplied version so stale entries
20
+ * invalidate when a component's inputs change.
21
+ */
22
+ /**
23
+ * Build a cache key for a component preview. Changing `defaultProps` or
24
+ * `version` yields a different key, so cached previews invalidate.
25
+ */
26
+ export declare function makeThumbnailKey(name: string, defaultProps: unknown, version?: string): string;
27
+ /** Cache key for a component preview, shared by LiveThumbnail and ThumbnailCard. */
28
+ export declare function getThumbnailCacheKey(config: {
29
+ components?: Record<string, {
30
+ defaultProps?: unknown;
31
+ }>;
32
+ } | undefined, name: string, version?: string): string;
33
+ /** Read a cached preview (in-memory only — see file header for why). */
34
+ export declare function getCachedThumbnail(key: string): string | undefined;
35
+ /** Write a preview to the in-memory cache. */
36
+ export declare function setCachedThumbnail(key: string, html: string): void;
37
+ /** Clear the in-memory cache, plus any stray entries left by an older, localStorage-backed version of this cache. */
38
+ export declare function clearThumbnailCache(): void;
39
+ //# sourceMappingURL=thumbnailCache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thumbnailCache.d.ts","sourceRoot":"","sources":["../../../src/editor/thumbnails/thumbnailCache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA8BH;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,SAAM,GAAG,MAAM,CAS3F;AAUD,oFAAoF;AACpF,wBAAgB,oBAAoB,CAClC,MAAM,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,SAAS,EAC/E,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAER;AAED,wEAAwE;AACxE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAElE;AAED,8CAA8C;AAC9C,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAElE;AAED,qHAAqH;AACrH,wBAAgB,mBAAmB,IAAI,IAAI,CAgB1C"}