@elytracms/core 0.0.6

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 (521) hide show
  1. package/LICENSE +21 -0
  2. package/dist/clipboard/build.d.ts +77 -0
  3. package/dist/clipboard/build.js +128 -0
  4. package/dist/clipboard/build.js.map +1 -0
  5. package/dist/clipboard/clipboard.d.ts +33 -0
  6. package/dist/clipboard/clipboard.js +45 -0
  7. package/dist/clipboard/clipboard.js.map +1 -0
  8. package/dist/clipboard/fragment.d.ts +112 -0
  9. package/dist/clipboard/fragment.js +79 -0
  10. package/dist/clipboard/fragment.js.map +1 -0
  11. package/dist/clipboard/html.d.ts +26 -0
  12. package/dist/clipboard/html.js +82 -0
  13. package/dist/clipboard/html.js.map +1 -0
  14. package/dist/clipboard/index.d.ts +15 -0
  15. package/dist/clipboard/index.js +16 -0
  16. package/dist/clipboard/index.js.map +1 -0
  17. package/dist/clipboard/references.d.ts +50 -0
  18. package/dist/clipboard/references.js +0 -0
  19. package/dist/clipboard/references.js.map +1 -0
  20. package/dist/clipboard/serialize.d.ts +69 -0
  21. package/dist/clipboard/serialize.js +130 -0
  22. package/dist/clipboard/serialize.js.map +1 -0
  23. package/dist/cms-core/collections.d.ts +82 -0
  24. package/dist/cms-core/collections.js +187 -0
  25. package/dist/cms-core/collections.js.map +1 -0
  26. package/dist/cms-core/documents.d.ts +71 -0
  27. package/dist/cms-core/documents.js +67 -0
  28. package/dist/cms-core/documents.js.map +1 -0
  29. package/dist/cms-core/envelopes.d.ts +80 -0
  30. package/dist/cms-core/envelopes.js +124 -0
  31. package/dist/cms-core/envelopes.js.map +1 -0
  32. package/dist/cms-core/fields.d.ts +220 -0
  33. package/dist/cms-core/fields.js +250 -0
  34. package/dist/cms-core/fields.js.map +1 -0
  35. package/dist/cms-core/fixtures.d.ts +92 -0
  36. package/dist/cms-core/fixtures.js +357 -0
  37. package/dist/cms-core/fixtures.js.map +1 -0
  38. package/dist/cms-core/hierarchy.d.ts +113 -0
  39. package/dist/cms-core/hierarchy.js +223 -0
  40. package/dist/cms-core/hierarchy.js.map +1 -0
  41. package/dist/cms-core/index.d.ts +25 -0
  42. package/dist/cms-core/index.js +26 -0
  43. package/dist/cms-core/index.js.map +1 -0
  44. package/dist/cms-core/infer.d.ts +103 -0
  45. package/dist/cms-core/infer.js +57 -0
  46. package/dist/cms-core/infer.js.map +1 -0
  47. package/dist/cms-core/issues.d.ts +92 -0
  48. package/dist/cms-core/issues.js +74 -0
  49. package/dist/cms-core/issues.js.map +1 -0
  50. package/dist/cms-core/json-schema.d.ts +25 -0
  51. package/dist/cms-core/json-schema.js +110 -0
  52. package/dist/cms-core/json-schema.js.map +1 -0
  53. package/dist/cms-core/localization.d.ts +51 -0
  54. package/dist/cms-core/localization.js +89 -0
  55. package/dist/cms-core/localization.js.map +1 -0
  56. package/dist/cms-core/routes.d.ts +76 -0
  57. package/dist/cms-core/routes.js +220 -0
  58. package/dist/cms-core/routes.js.map +1 -0
  59. package/dist/cms-core/self-type.d.ts +41 -0
  60. package/dist/cms-core/self-type.js +191 -0
  61. package/dist/cms-core/self-type.js.map +1 -0
  62. package/dist/cms-core/url-for-document.d.ts +39 -0
  63. package/dist/cms-core/url-for-document.js +138 -0
  64. package/dist/cms-core/url-for-document.js.map +1 -0
  65. package/dist/cms-core/validate-document.d.ts +121 -0
  66. package/dist/cms-core/validate-document.js +871 -0
  67. package/dist/cms-core/validate-document.js.map +1 -0
  68. package/dist/cms-core/versions.d.ts +75 -0
  69. package/dist/cms-core/versions.js +97 -0
  70. package/dist/cms-core/versions.js.map +1 -0
  71. package/dist/collaboration/approval.d.ts +68 -0
  72. package/dist/collaboration/approval.js +104 -0
  73. package/dist/collaboration/approval.js.map +1 -0
  74. package/dist/collaboration/collaboration.d.ts +49 -0
  75. package/dist/collaboration/collaboration.js +56 -0
  76. package/dist/collaboration/collaboration.js.map +1 -0
  77. package/dist/collaboration/comments.d.ts +72 -0
  78. package/dist/collaboration/comments.js +118 -0
  79. package/dist/collaboration/comments.js.map +1 -0
  80. package/dist/collaboration/core.d.ts +25 -0
  81. package/dist/collaboration/core.js +26 -0
  82. package/dist/collaboration/core.js.map +1 -0
  83. package/dist/collaboration/index.d.ts +14 -0
  84. package/dist/collaboration/index.js +15 -0
  85. package/dist/collaboration/index.js.map +1 -0
  86. package/dist/collaboration/presence.d.ts +62 -0
  87. package/dist/collaboration/presence.js +85 -0
  88. package/dist/collaboration/presence.js.map +1 -0
  89. package/dist/collaboration/publishing.d.ts +60 -0
  90. package/dist/collaboration/publishing.js +93 -0
  91. package/dist/collaboration/publishing.js.map +1 -0
  92. package/dist/collaboration/versions.d.ts +52 -0
  93. package/dist/collaboration/versions.js +81 -0
  94. package/dist/collaboration/versions.js.map +1 -0
  95. package/dist/component-registry/index.d.ts +3 -0
  96. package/dist/component-registry/index.js +4 -0
  97. package/dist/component-registry/index.js.map +1 -0
  98. package/dist/component-registry/issues.d.ts +6 -0
  99. package/dist/component-registry/issues.js +2 -0
  100. package/dist/component-registry/issues.js.map +1 -0
  101. package/dist/component-registry/manifest.d.ts +164 -0
  102. package/dist/component-registry/manifest.js +129 -0
  103. package/dist/component-registry/manifest.js.map +1 -0
  104. package/dist/component-registry/registry.d.ts +33 -0
  105. package/dist/component-registry/registry.js +90 -0
  106. package/dist/component-registry/registry.js.map +1 -0
  107. package/dist/content/__fixtures__/filterable-collections.d.ts +14 -0
  108. package/dist/content/__fixtures__/filterable-collections.js +15 -0
  109. package/dist/content/__fixtures__/filterable-collections.js.map +1 -0
  110. package/dist/content/__fixtures__/sample-accessor-types.d.ts +56 -0
  111. package/dist/content/__fixtures__/sample-accessor-types.js +5 -0
  112. package/dist/content/__fixtures__/sample-accessor-types.js.map +1 -0
  113. package/dist/content/__fixtures__/sample-delivery-types.d.ts +122 -0
  114. package/dist/content/__fixtures__/sample-delivery-types.js +5 -0
  115. package/dist/content/__fixtures__/sample-delivery-types.js.map +1 -0
  116. package/dist/content/assets.d.ts +53 -0
  117. package/dist/content/assets.js +38 -0
  118. package/dist/content/assets.js.map +1 -0
  119. package/dist/content/binding-sources.d.ts +53 -0
  120. package/dist/content/binding-sources.js +73 -0
  121. package/dist/content/binding-sources.js.map +1 -0
  122. package/dist/content/client.d.ts +90 -0
  123. package/dist/content/client.js +383 -0
  124. package/dist/content/client.js.map +1 -0
  125. package/dist/content/codegen.d.ts +54 -0
  126. package/dist/content/codegen.js +305 -0
  127. package/dist/content/codegen.js.map +1 -0
  128. package/dist/content/context.d.ts +38 -0
  129. package/dist/content/context.js +21 -0
  130. package/dist/content/context.js.map +1 -0
  131. package/dist/content/cursor.d.ts +33 -0
  132. package/dist/content/cursor.js +104 -0
  133. package/dist/content/cursor.js.map +1 -0
  134. package/dist/content/index.d.ts +28 -0
  135. package/dist/content/index.js +29 -0
  136. package/dist/content/index.js.map +1 -0
  137. package/dist/content/locale.d.ts +30 -0
  138. package/dist/content/locale.js +26 -0
  139. package/dist/content/locale.js.map +1 -0
  140. package/dist/content/perspective.d.ts +29 -0
  141. package/dist/content/perspective.js +31 -0
  142. package/dist/content/perspective.js.map +1 -0
  143. package/dist/content/populate.d.ts +25 -0
  144. package/dist/content/populate.js +22 -0
  145. package/dist/content/populate.js.map +1 -0
  146. package/dist/content/query.d.ts +122 -0
  147. package/dist/content/query.js +257 -0
  148. package/dist/content/query.js.map +1 -0
  149. package/dist/content/raw.d.ts +13 -0
  150. package/dist/content/raw.js +14 -0
  151. package/dist/content/raw.js.map +1 -0
  152. package/dist/content/resolve.d.ts +97 -0
  153. package/dist/content/resolve.js +261 -0
  154. package/dist/content/resolve.js.map +1 -0
  155. package/dist/content/serialize.d.ts +30 -0
  156. package/dist/content/serialize.js +57 -0
  157. package/dist/content/serialize.js.map +1 -0
  158. package/dist/content/tags.d.ts +54 -0
  159. package/dist/content/tags.js +40 -0
  160. package/dist/content/tags.js.map +1 -0
  161. package/dist/data-binding/fixtures.d.ts +20 -0
  162. package/dist/data-binding/fixtures.js +47 -0
  163. package/dist/data-binding/fixtures.js.map +1 -0
  164. package/dist/data-binding/index.d.ts +14 -0
  165. package/dist/data-binding/index.js +15 -0
  166. package/dist/data-binding/index.js.map +1 -0
  167. package/dist/data-binding/issues.d.ts +45 -0
  168. package/dist/data-binding/issues.js +46 -0
  169. package/dist/data-binding/issues.js.map +1 -0
  170. package/dist/data-binding/resolve.d.ts +87 -0
  171. package/dist/data-binding/resolve.js +204 -0
  172. package/dist/data-binding/resolve.js.map +1 -0
  173. package/dist/data-binding/sample.d.ts +21 -0
  174. package/dist/data-binding/sample.js +23 -0
  175. package/dist/data-binding/sample.js.map +1 -0
  176. package/dist/data-binding/sources.d.ts +225 -0
  177. package/dist/data-binding/sources.js +154 -0
  178. package/dist/data-binding/sources.js.map +1 -0
  179. package/dist/data-binding/tokens.d.ts +62 -0
  180. package/dist/data-binding/tokens.js +150 -0
  181. package/dist/data-binding/tokens.js.map +1 -0
  182. package/dist/design-tokens/css.d.ts +34 -0
  183. package/dist/design-tokens/css.js +51 -0
  184. package/dist/design-tokens/css.js.map +1 -0
  185. package/dist/design-tokens/index.d.ts +10 -0
  186. package/dist/design-tokens/index.js +11 -0
  187. package/dist/design-tokens/index.js.map +1 -0
  188. package/dist/design-tokens/style-guide.d.ts +30 -0
  189. package/dist/design-tokens/style-guide.js +31 -0
  190. package/dist/design-tokens/style-guide.js.map +1 -0
  191. package/dist/design-tokens/tokens.d.ts +89 -0
  192. package/dist/design-tokens/tokens.js +112 -0
  193. package/dist/design-tokens/tokens.js.map +1 -0
  194. package/dist/export-sync/builder-source.d.ts +85 -0
  195. package/dist/export-sync/builder-source.js +124 -0
  196. package/dist/export-sync/builder-source.js.map +1 -0
  197. package/dist/export-sync/check.d.ts +61 -0
  198. package/dist/export-sync/check.js +126 -0
  199. package/dist/export-sync/check.js.map +1 -0
  200. package/dist/export-sync/cli.d.ts +89 -0
  201. package/dist/export-sync/cli.js +323 -0
  202. package/dist/export-sync/cli.js.map +1 -0
  203. package/dist/export-sync/core.d.ts +58 -0
  204. package/dist/export-sync/core.js +41 -0
  205. package/dist/export-sync/core.js.map +1 -0
  206. package/dist/export-sync/eject.d.ts +28 -0
  207. package/dist/export-sync/eject.js +21 -0
  208. package/dist/export-sync/eject.js.map +1 -0
  209. package/dist/export-sync/fixtures.d.ts +25 -0
  210. package/dist/export-sync/fixtures.js +87 -0
  211. package/dist/export-sync/fixtures.js.map +1 -0
  212. package/dist/export-sync/generate.d.ts +7 -0
  213. package/dist/export-sync/generate.js +505 -0
  214. package/dist/export-sync/generate.js.map +1 -0
  215. package/dist/export-sync/index.d.ts +37 -0
  216. package/dist/export-sync/index.js +39 -0
  217. package/dist/export-sync/index.js.map +1 -0
  218. package/dist/export-sync/init.d.ts +123 -0
  219. package/dist/export-sync/init.js +234 -0
  220. package/dist/export-sync/init.js.map +1 -0
  221. package/dist/export-sync/manifest-host.d.ts +48 -0
  222. package/dist/export-sync/manifest-host.js +73 -0
  223. package/dist/export-sync/manifest-host.js.map +1 -0
  224. package/dist/export-sync/node.d.ts +20 -0
  225. package/dist/export-sync/node.js +101 -0
  226. package/dist/export-sync/node.js.map +1 -0
  227. package/dist/export-sync/push.d.ts +76 -0
  228. package/dist/export-sync/push.js +197 -0
  229. package/dist/export-sync/push.js.map +1 -0
  230. package/dist/export-sync/registry-sync-client.d.ts +59 -0
  231. package/dist/export-sync/registry-sync-client.js +97 -0
  232. package/dist/export-sync/registry-sync-client.js.map +1 -0
  233. package/dist/export-sync/sync.d.ts +47 -0
  234. package/dist/export-sync/sync.js +47 -0
  235. package/dist/export-sync/sync.js.map +1 -0
  236. package/dist/export-sync/typegen.d.ts +40 -0
  237. package/dist/export-sync/typegen.js +45 -0
  238. package/dist/export-sync/typegen.js.map +1 -0
  239. package/dist/export-sync/validate.d.ts +19 -0
  240. package/dist/export-sync/validate.js +102 -0
  241. package/dist/export-sync/validate.js.map +1 -0
  242. package/dist/export-sync/watch.d.ts +66 -0
  243. package/dist/export-sync/watch.js +70 -0
  244. package/dist/export-sync/watch.js.map +1 -0
  245. package/dist/operations/assets.d.ts +198 -0
  246. package/dist/operations/assets.js +75 -0
  247. package/dist/operations/assets.js.map +1 -0
  248. package/dist/operations/authorization.d.ts +49 -0
  249. package/dist/operations/authorization.js +128 -0
  250. package/dist/operations/authorization.js.map +1 -0
  251. package/dist/operations/changesets.d.ts +160 -0
  252. package/dist/operations/changesets.js +442 -0
  253. package/dist/operations/changesets.js.map +1 -0
  254. package/dist/operations/client.d.ts +49 -0
  255. package/dist/operations/client.js +57 -0
  256. package/dist/operations/client.js.map +1 -0
  257. package/dist/operations/core.d.ts +238 -0
  258. package/dist/operations/core.js +269 -0
  259. package/dist/operations/core.js.map +1 -0
  260. package/dist/operations/documents.d.ts +432 -0
  261. package/dist/operations/documents.js +344 -0
  262. package/dist/operations/documents.js.map +1 -0
  263. package/dist/operations/graph.d.ts +138 -0
  264. package/dist/operations/graph.js +78 -0
  265. package/dist/operations/graph.js.map +1 -0
  266. package/dist/operations/index.d.ts +19 -0
  267. package/dist/operations/index.js +20 -0
  268. package/dist/operations/index.js.map +1 -0
  269. package/dist/operations/members.d.ts +87 -0
  270. package/dist/operations/members.js +56 -0
  271. package/dist/operations/members.js.map +1 -0
  272. package/dist/operations/publishing.d.ts +89 -0
  273. package/dist/operations/publishing.js +57 -0
  274. package/dist/operations/publishing.js.map +1 -0
  275. package/dist/operations/references.d.ts +222 -0
  276. package/dist/operations/references.js +177 -0
  277. package/dist/operations/references.js.map +1 -0
  278. package/dist/operations/schema.d.ts +413 -0
  279. package/dist/operations/schema.js +138 -0
  280. package/dist/operations/schema.js.map +1 -0
  281. package/dist/operations/tokens.d.ts +79 -0
  282. package/dist/operations/tokens.js +102 -0
  283. package/dist/operations/tokens.js.map +1 -0
  284. package/dist/persistence/adapter.d.ts +79 -0
  285. package/dist/persistence/adapter.js +55 -0
  286. package/dist/persistence/adapter.js.map +1 -0
  287. package/dist/persistence/assets.d.ts +120 -0
  288. package/dist/persistence/assets.js +141 -0
  289. package/dist/persistence/assets.js.map +1 -0
  290. package/dist/persistence/backend-validation.d.ts +43 -0
  291. package/dist/persistence/backend-validation.js +57 -0
  292. package/dist/persistence/backend-validation.js.map +1 -0
  293. package/dist/persistence/cli-tokens.d.ts +50 -0
  294. package/dist/persistence/cli-tokens.js +66 -0
  295. package/dist/persistence/cli-tokens.js.map +1 -0
  296. package/dist/persistence/cms.d.ts +148 -0
  297. package/dist/persistence/cms.js +232 -0
  298. package/dist/persistence/cms.js.map +1 -0
  299. package/dist/persistence/contract-scenarios.d.ts +73 -0
  300. package/dist/persistence/contract-scenarios.js +496 -0
  301. package/dist/persistence/contract-scenarios.js.map +1 -0
  302. package/dist/persistence/core.d.ts +96 -0
  303. package/dist/persistence/core.js +110 -0
  304. package/dist/persistence/core.js.map +1 -0
  305. package/dist/persistence/graph.d.ts +61 -0
  306. package/dist/persistence/graph.js +98 -0
  307. package/dist/persistence/graph.js.map +1 -0
  308. package/dist/persistence/index.d.ts +22 -0
  309. package/dist/persistence/index.js +23 -0
  310. package/dist/persistence/index.js.map +1 -0
  311. package/dist/persistence/members.d.ts +70 -0
  312. package/dist/persistence/members.js +0 -0
  313. package/dist/persistence/members.js.map +1 -0
  314. package/dist/persistence/publishing.d.ts +59 -0
  315. package/dist/persistence/publishing.js +95 -0
  316. package/dist/persistence/publishing.js.map +1 -0
  317. package/dist/persistence/reference-extraction.d.ts +44 -0
  318. package/dist/persistence/reference-extraction.js +204 -0
  319. package/dist/persistence/reference-extraction.js.map +1 -0
  320. package/dist/persistence/reference-indexing.d.ts +68 -0
  321. package/dist/persistence/reference-indexing.js +112 -0
  322. package/dist/persistence/reference-indexing.js.map +1 -0
  323. package/dist/persistence/references.d.ts +257 -0
  324. package/dist/persistence/references.js +0 -0
  325. package/dist/persistence/references.js.map +1 -0
  326. package/dist/persistence/seed.d.ts +55 -0
  327. package/dist/persistence/seed.js +102 -0
  328. package/dist/persistence/seed.js.map +1 -0
  329. package/dist/persistence/self-maintaining-adapter.d.ts +41 -0
  330. package/dist/persistence/self-maintaining-adapter.js +79 -0
  331. package/dist/persistence/self-maintaining-adapter.js.map +1 -0
  332. package/dist/plugins/asset-storage.d.ts +76 -0
  333. package/dist/plugins/asset-storage.js +104 -0
  334. package/dist/plugins/asset-storage.js.map +1 -0
  335. package/dist/plugins/component-package.d.ts +54 -0
  336. package/dist/plugins/component-package.js +92 -0
  337. package/dist/plugins/component-package.js.map +1 -0
  338. package/dist/plugins/data-sources.d.ts +78 -0
  339. package/dist/plugins/data-sources.js +99 -0
  340. package/dist/plugins/data-sources.js.map +1 -0
  341. package/dist/plugins/examples.d.ts +47 -0
  342. package/dist/plugins/examples.js +205 -0
  343. package/dist/plugins/examples.js.map +1 -0
  344. package/dist/plugins/export-targets.d.ts +47 -0
  345. package/dist/plugins/export-targets.js +78 -0
  346. package/dist/plugins/export-targets.js.map +1 -0
  347. package/dist/plugins/field-types.d.ts +86 -0
  348. package/dist/plugins/field-types.js +93 -0
  349. package/dist/plugins/field-types.js.map +1 -0
  350. package/dist/plugins/hooks.d.ts +60 -0
  351. package/dist/plugins/hooks.js +94 -0
  352. package/dist/plugins/hooks.js.map +1 -0
  353. package/dist/plugins/index.d.ts +27 -0
  354. package/dist/plugins/index.js +28 -0
  355. package/dist/plugins/index.js.map +1 -0
  356. package/dist/plugins/marketplace.d.ts +90 -0
  357. package/dist/plugins/marketplace.js +110 -0
  358. package/dist/plugins/marketplace.js.map +1 -0
  359. package/dist/plugins/plugin.d.ts +107 -0
  360. package/dist/plugins/plugin.js +122 -0
  361. package/dist/plugins/plugin.js.map +1 -0
  362. package/dist/plugins/templates.d.ts +66 -0
  363. package/dist/plugins/templates.js +74 -0
  364. package/dist/plugins/templates.js.map +1 -0
  365. package/dist/project-graph/binding.d.ts +68 -0
  366. package/dist/project-graph/binding.js +39 -0
  367. package/dist/project-graph/binding.js.map +1 -0
  368. package/dist/project-graph/container.d.ts +126 -0
  369. package/dist/project-graph/container.js +221 -0
  370. package/dist/project-graph/container.js.map +1 -0
  371. package/dist/project-graph/edit.d.ts +66 -0
  372. package/dist/project-graph/edit.js +201 -0
  373. package/dist/project-graph/edit.js.map +1 -0
  374. package/dist/project-graph/fixtures.d.ts +51 -0
  375. package/dist/project-graph/fixtures.js +224 -0
  376. package/dist/project-graph/fixtures.js.map +1 -0
  377. package/dist/project-graph/ids.d.ts +17 -0
  378. package/dist/project-graph/ids.js +19 -0
  379. package/dist/project-graph/ids.js.map +1 -0
  380. package/dist/project-graph/index.d.ts +12 -0
  381. package/dist/project-graph/index.js +13 -0
  382. package/dist/project-graph/index.js.map +1 -0
  383. package/dist/project-graph/issues.d.ts +61 -0
  384. package/dist/project-graph/issues.js +44 -0
  385. package/dist/project-graph/issues.js.map +1 -0
  386. package/dist/project-graph/json.d.ts +6 -0
  387. package/dist/project-graph/json.js +10 -0
  388. package/dist/project-graph/json.js.map +1 -0
  389. package/dist/project-graph/node.d.ts +48 -0
  390. package/dist/project-graph/node.js +42 -0
  391. package/dist/project-graph/node.js.map +1 -0
  392. package/dist/project-graph/normalize.d.ts +17 -0
  393. package/dist/project-graph/normalize.js +110 -0
  394. package/dist/project-graph/normalize.js.map +1 -0
  395. package/dist/project-graph/serialize.d.ts +36 -0
  396. package/dist/project-graph/serialize.js +51 -0
  397. package/dist/project-graph/serialize.js.map +1 -0
  398. package/dist/project-graph/structure.d.ts +40 -0
  399. package/dist/project-graph/structure.js +36 -0
  400. package/dist/project-graph/structure.js.map +1 -0
  401. package/dist/project-graph/validate.d.ts +84 -0
  402. package/dist/project-graph/validate.js +158 -0
  403. package/dist/project-graph/validate.js.map +1 -0
  404. package/dist/rich-text/adapter.d.ts +43 -0
  405. package/dist/rich-text/adapter.js +24 -0
  406. package/dist/rich-text/adapter.js.map +1 -0
  407. package/dist/rich-text/dom-editor.d.ts +101 -0
  408. package/dist/rich-text/dom-editor.js +482 -0
  409. package/dist/rich-text/dom-editor.js.map +1 -0
  410. package/dist/rich-text/embed.d.ts +70 -0
  411. package/dist/rich-text/embed.js +70 -0
  412. package/dist/rich-text/embed.js.map +1 -0
  413. package/dist/rich-text/fixtures.d.ts +25 -0
  414. package/dist/rich-text/fixtures.js +115 -0
  415. package/dist/rich-text/fixtures.js.map +1 -0
  416. package/dist/rich-text/html.d.ts +5 -0
  417. package/dist/rich-text/html.js +309 -0
  418. package/dist/rich-text/html.js.map +1 -0
  419. package/dist/rich-text/index.d.ts +19 -0
  420. package/dist/rich-text/index.js +20 -0
  421. package/dist/rich-text/index.js.map +1 -0
  422. package/dist/rich-text/markdown.d.ts +7 -0
  423. package/dist/rich-text/markdown.js +235 -0
  424. package/dist/rich-text/markdown.js.map +1 -0
  425. package/dist/rich-text/portable-text.d.ts +50 -0
  426. package/dist/rich-text/portable-text.js +223 -0
  427. package/dist/rich-text/portable-text.js.map +1 -0
  428. package/dist/rich-text/registry.d.ts +48 -0
  429. package/dist/rich-text/registry.js +16 -0
  430. package/dist/rich-text/registry.js.map +1 -0
  431. package/dist/rich-text/render.d.ts +69 -0
  432. package/dist/rich-text/render.js +205 -0
  433. package/dist/rich-text/render.js.map +1 -0
  434. package/dist/rich-text/schema.d.ts +86 -0
  435. package/dist/rich-text/schema.js +80 -0
  436. package/dist/rich-text/schema.js.map +1 -0
  437. package/dist/rich-text/test-support.d.ts +7 -0
  438. package/dist/rich-text/test-support.js +8 -0
  439. package/dist/rich-text/test-support.js.map +1 -0
  440. package/dist/runtime-renderer/client.d.ts +14 -0
  441. package/dist/runtime-renderer/client.js +15 -0
  442. package/dist/runtime-renderer/client.js.map +1 -0
  443. package/dist/runtime-renderer/condition.d.ts +8 -0
  444. package/dist/runtime-renderer/condition.js +48 -0
  445. package/dist/runtime-renderer/condition.js.map +1 -0
  446. package/dist/runtime-renderer/content-client.d.ts +62 -0
  447. package/dist/runtime-renderer/content-client.js +37 -0
  448. package/dist/runtime-renderer/content-client.js.map +1 -0
  449. package/dist/runtime-renderer/context.d.ts +185 -0
  450. package/dist/runtime-renderer/context.js +7 -0
  451. package/dist/runtime-renderer/context.js.map +1 -0
  452. package/dist/runtime-renderer/fallback.d.ts +39 -0
  453. package/dist/runtime-renderer/fallback.js +45 -0
  454. package/dist/runtime-renderer/fallback.js.map +1 -0
  455. package/dist/runtime-renderer/index.d.ts +13 -0
  456. package/dist/runtime-renderer/index.js +13 -0
  457. package/dist/runtime-renderer/index.js.map +1 -0
  458. package/dist/runtime-renderer/primitives.d.ts +85 -0
  459. package/dist/runtime-renderer/primitives.js +442 -0
  460. package/dist/runtime-renderer/primitives.js.map +1 -0
  461. package/dist/runtime-renderer/render.d.ts +138 -0
  462. package/dist/runtime-renderer/render.js +825 -0
  463. package/dist/runtime-renderer/render.js.map +1 -0
  464. package/dist/runtime-renderer/rich-text.d.ts +26 -0
  465. package/dist/runtime-renderer/rich-text.js +113 -0
  466. package/dist/runtime-renderer/rich-text.js.map +1 -0
  467. package/dist/starter-kits/index.d.ts +13 -0
  468. package/dist/starter-kits/index.js +14 -0
  469. package/dist/starter-kits/index.js.map +1 -0
  470. package/dist/starter-kits/instantiate.d.ts +29 -0
  471. package/dist/starter-kits/instantiate.js +24 -0
  472. package/dist/starter-kits/instantiate.js.map +1 -0
  473. package/dist/starter-kits/kit.d.ts +61 -0
  474. package/dist/starter-kits/kit.js +37 -0
  475. package/dist/starter-kits/kit.js.map +1 -0
  476. package/dist/starter-kits/kits.d.ts +7 -0
  477. package/dist/starter-kits/kits.js +201 -0
  478. package/dist/starter-kits/kits.js.map +1 -0
  479. package/dist/starter-kits/manifests.d.ts +7 -0
  480. package/dist/starter-kits/manifests.js +111 -0
  481. package/dist/starter-kits/manifests.js.map +1 -0
  482. package/dist/starter-kits/upgrade.d.ts +39 -0
  483. package/dist/starter-kits/upgrade.js +54 -0
  484. package/dist/starter-kits/upgrade.js.map +1 -0
  485. package/dist/starter-kits/validate.d.ts +16 -0
  486. package/dist/starter-kits/validate.js +77 -0
  487. package/dist/starter-kits/validate.js.map +1 -0
  488. package/dist/studio-core/context.d.ts +27 -0
  489. package/dist/studio-core/context.js +44 -0
  490. package/dist/studio-core/context.js.map +1 -0
  491. package/dist/studio-core/errors.d.ts +58 -0
  492. package/dist/studio-core/errors.js +74 -0
  493. package/dist/studio-core/errors.js.map +1 -0
  494. package/dist/studio-core/fixtures.d.ts +18 -0
  495. package/dist/studio-core/fixtures.js +83 -0
  496. package/dist/studio-core/fixtures.js.map +1 -0
  497. package/dist/studio-core/ids.d.ts +22 -0
  498. package/dist/studio-core/ids.js +33 -0
  499. package/dist/studio-core/ids.js.map +1 -0
  500. package/dist/studio-core/index.d.ts +11 -0
  501. package/dist/studio-core/index.js +12 -0
  502. package/dist/studio-core/index.js.map +1 -0
  503. package/dist/studio-core/issues.d.ts +50 -0
  504. package/dist/studio-core/issues.js +33 -0
  505. package/dist/studio-core/issues.js.map +1 -0
  506. package/dist/studio-core/metadata.d.ts +109 -0
  507. package/dist/studio-core/metadata.js +74 -0
  508. package/dist/studio-core/metadata.js.map +1 -0
  509. package/dist/studio-core/repository.d.ts +73 -0
  510. package/dist/studio-core/repository.js +202 -0
  511. package/dist/studio-core/repository.js.map +1 -0
  512. package/dist/studio-core/sections.d.ts +73 -0
  513. package/dist/studio-core/sections.js +68 -0
  514. package/dist/studio-core/sections.js.map +1 -0
  515. package/dist/studio-core/validate.d.ts +15 -0
  516. package/dist/studio-core/validate.js +119 -0
  517. package/dist/studio-core/validate.js.map +1 -0
  518. package/dist/studio-core/workspace-config.d.ts +587 -0
  519. package/dist/studio-core/workspace-config.js +434 -0
  520. package/dist/studio-core/workspace-config.js.map +1 -0
  521. package/package.json +104 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 finaldream
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,77 @@
1
+ import type { ComponentNode, ProjectGraph } from '@elytracms/core/project-graph';
2
+ import type { ComponentFixture, ComponentManifest } from '@elytracms/core/component-registry';
3
+ import type { ClipboardFragment, FragmentSource } from './fragment';
4
+ /**
5
+ * Fragment construction. Two entry points feed the same builder so they produce
6
+ * the same fragment shape by construction:
7
+ *
8
+ * - `buildFragmentFromGraph` — copy a live canvas subtree by node id, and
9
+ * - `buildFragmentFromRegistryFixture` — materialize a manifest fixture
10
+ * (the blocks panel's "copy exact configuration") as a node,
11
+ *
12
+ * both delegating to {@link buildFragmentFromSubtree}. Builders return typed
13
+ * results for addressing failures (missing node / fixture) so a later paste
14
+ * changeset (EC-175 over `@elytracms/core/operations` changesets) can map them onto
15
+ * structured issues instead of catching exceptions.
16
+ */
17
+ /**
18
+ * Manifest version used when no resolver is supplied. Registry manifests do not
19
+ * carry a version yet; once they do, callers pass `resolveVersion` and this
20
+ * default disappears from real fragments.
21
+ */
22
+ export declare const DEFAULT_MANIFEST_VERSION = "0.0.0";
23
+ /** Default root node id for fixture-materialized fragments (deterministic). */
24
+ export declare const FIXTURE_ROOT_NODE_ID = "fragment-root";
25
+ export interface BuildFragmentOptions {
26
+ /** Source project/locale metadata stamped onto the fragment. */
27
+ source: FragmentSource;
28
+ /** Resolve a component id to its manifest version (defaults to {@link DEFAULT_MANIFEST_VERSION}). */
29
+ resolveVersion?: (componentId: string) => string | undefined;
30
+ /** Extra asset ids the caller knows about (merged and de-duplicated with detected ones). */
31
+ extraAssetIds?: readonly string[];
32
+ }
33
+ export type BuildFragmentError = {
34
+ code: 'node-not-found';
35
+ nodeId: string;
36
+ message: string;
37
+ } | {
38
+ code: 'fixture-not-found';
39
+ componentId: string;
40
+ fixtureName: string;
41
+ message: string;
42
+ };
43
+ export type BuildFragmentResult = {
44
+ ok: true;
45
+ fragment: ClipboardFragment;
46
+ } | {
47
+ ok: false;
48
+ error: BuildFragmentError;
49
+ };
50
+ /**
51
+ * Build a fragment from a subtree root. The node is detached (deep-copied via
52
+ * schema parse) and every reference list is collected, sorted, and de-duplicated
53
+ * — the single code path both the graph and fixture builders share.
54
+ */
55
+ export declare function buildFragmentFromSubtree(root: ComponentNode, options: BuildFragmentOptions): ClipboardFragment;
56
+ /**
57
+ * Build a fragment from a graph subtree addressed by node id. Searches every
58
+ * layout root (EC-187: the graph is layouts-only; page bodies are CMS document
59
+ * compositions, searched via the composition editor, not here).
60
+ */
61
+ export declare function buildFragmentFromGraph(graph: ProjectGraph, nodeId: string, options: BuildFragmentOptions): BuildFragmentResult;
62
+ /**
63
+ * Materialize a registry fixture as a component node: fixture props become
64
+ * static prop values; `slotChildren` component ids become bare child nodes with
65
+ * deterministic ids (`<rootId>.<slot>.<index>`).
66
+ */
67
+ export declare function nodeFromFixture(componentId: string, fixture: ComponentFixture, nodeId?: string): ComponentNode;
68
+ export interface FixtureFragmentOptions extends BuildFragmentOptions {
69
+ /** Root node id for the materialized fixture (defaults to {@link FIXTURE_ROOT_NODE_ID}). */
70
+ nodeId?: string;
71
+ }
72
+ /**
73
+ * Build a fragment from a component manifest's preview fixture (by name or as
74
+ * an object). Produces exactly the same fragment shape as copying an equivalent
75
+ * live canvas instance — both paths go through {@link buildFragmentFromSubtree}.
76
+ */
77
+ export declare function buildFragmentFromRegistryFixture(manifest: ComponentManifest, fixture: string | ComponentFixture, options: FixtureFragmentOptions): BuildFragmentResult;
@@ -0,0 +1,128 @@
1
+ import { componentNodeSchema, getNode, staticProp } from '@elytracms/core/project-graph';
2
+ import { CLIPBOARD_FRAGMENT_FORMAT, CLIPBOARD_FRAGMENT_VERSION } from './fragment';
3
+ import { collectAssetIds, collectBindingDeclarations, collectComponentIds } from './references';
4
+ /**
5
+ * Fragment construction. Two entry points feed the same builder so they produce
6
+ * the same fragment shape by construction:
7
+ *
8
+ * - `buildFragmentFromGraph` — copy a live canvas subtree by node id, and
9
+ * - `buildFragmentFromRegistryFixture` — materialize a manifest fixture
10
+ * (the blocks panel's "copy exact configuration") as a node,
11
+ *
12
+ * both delegating to {@link buildFragmentFromSubtree}. Builders return typed
13
+ * results for addressing failures (missing node / fixture) so a later paste
14
+ * changeset (EC-175 over `@elytracms/core/operations` changesets) can map them onto
15
+ * structured issues instead of catching exceptions.
16
+ */
17
+ /**
18
+ * Manifest version used when no resolver is supplied. Registry manifests do not
19
+ * carry a version yet; once they do, callers pass `resolveVersion` and this
20
+ * default disappears from real fragments.
21
+ */
22
+ export const DEFAULT_MANIFEST_VERSION = '0.0.0';
23
+ /** Default root node id for fixture-materialized fragments (deterministic). */
24
+ export const FIXTURE_ROOT_NODE_ID = 'fragment-root';
25
+ /**
26
+ * Build a fragment from a subtree root. The node is detached (deep-copied via
27
+ * schema parse) and every reference list is collected, sorted, and de-duplicated
28
+ * — the single code path both the graph and fixture builders share.
29
+ */
30
+ export function buildFragmentFromSubtree(root, options) {
31
+ const detached = componentNodeSchema.parse(root);
32
+ const componentIds = collectComponentIds(detached);
33
+ const assetIds = new Set(collectAssetIds(detached));
34
+ for (const id of options.extraAssetIds ?? [])
35
+ assetIds.add(id);
36
+ return {
37
+ format: CLIPBOARD_FRAGMENT_FORMAT,
38
+ version: CLIPBOARD_FRAGMENT_VERSION,
39
+ payload: {
40
+ root: detached,
41
+ components: componentIds.map((id) => ({
42
+ name: id,
43
+ version: options.resolveVersion?.(id) ?? DEFAULT_MANIFEST_VERSION,
44
+ })),
45
+ bindings: collectBindingDeclarations(detached),
46
+ assets: [...assetIds].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)).map((id) => ({ id })),
47
+ source: {
48
+ projectId: options.source.projectId,
49
+ ...(options.source.locale !== undefined ? { locale: options.source.locale } : {}),
50
+ },
51
+ },
52
+ };
53
+ }
54
+ /**
55
+ * Build a fragment from a graph subtree addressed by node id. Searches every
56
+ * layout root (EC-187: the graph is layouts-only; page bodies are CMS document
57
+ * compositions, searched via the composition editor, not here).
58
+ */
59
+ export function buildFragmentFromGraph(graph, nodeId, options) {
60
+ for (const owner of graph.layouts) {
61
+ const node = getNode(owner.root, nodeId);
62
+ if (node)
63
+ return { ok: true, fragment: buildFragmentFromSubtree(node, options) };
64
+ }
65
+ return {
66
+ ok: false,
67
+ error: {
68
+ code: 'node-not-found',
69
+ nodeId,
70
+ message: `No node "${nodeId}" exists in any page or layout of graph "${graph.id}".`,
71
+ },
72
+ };
73
+ }
74
+ /**
75
+ * Materialize a registry fixture as a component node: fixture props become
76
+ * static prop values; `slotChildren` component ids become bare child nodes with
77
+ * deterministic ids (`<rootId>.<slot>.<index>`).
78
+ */
79
+ export function nodeFromFixture(componentId, fixture, nodeId = FIXTURE_ROOT_NODE_ID) {
80
+ const propEntries = Object.entries(fixture.props ?? {});
81
+ const slotEntries = Object.entries(fixture.slotChildren ?? {});
82
+ return {
83
+ id: nodeId,
84
+ componentId,
85
+ ...(propEntries.length > 0
86
+ ? { props: Object.fromEntries(propEntries.map(([name, value]) => [name, staticProp(value)])) }
87
+ : {}),
88
+ ...(slotEntries.length > 0
89
+ ? {
90
+ slots: Object.fromEntries(slotEntries.map(([slot, childIds]) => [
91
+ slot,
92
+ childIds.map((childComponentId, index) => ({
93
+ id: `${nodeId}.${slot}.${index}`,
94
+ componentId: childComponentId,
95
+ })),
96
+ ])),
97
+ }
98
+ : {}),
99
+ };
100
+ }
101
+ /**
102
+ * Build a fragment from a component manifest's preview fixture (by name or as
103
+ * an object). Produces exactly the same fragment shape as copying an equivalent
104
+ * live canvas instance — both paths go through {@link buildFragmentFromSubtree}.
105
+ */
106
+ export function buildFragmentFromRegistryFixture(manifest, fixture, options) {
107
+ let resolved;
108
+ if (typeof fixture === 'string') {
109
+ resolved = manifest.fixtures?.find((candidate) => candidate.name === fixture);
110
+ if (!resolved) {
111
+ return {
112
+ ok: false,
113
+ error: {
114
+ code: 'fixture-not-found',
115
+ componentId: manifest.id,
116
+ fixtureName: fixture,
117
+ message: `Component "${manifest.id}" declares no fixture named "${fixture}".`,
118
+ },
119
+ };
120
+ }
121
+ }
122
+ else {
123
+ resolved = fixture;
124
+ }
125
+ const node = nodeFromFixture(manifest.id, resolved, options.nodeId);
126
+ return { ok: true, fragment: buildFragmentFromSubtree(node, options) };
127
+ }
128
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/clipboard/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAGxF,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAElF,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAE/F;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAA;AAE/C,+EAA+E;AAC/E,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAA;AAmBnD;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAmB,EACnB,OAA6B;IAE7B,MAAM,QAAQ,GAAG,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAChD,MAAM,YAAY,GAAG,mBAAmB,CA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
+ * OS-clipboard representation helpers. A copy writes three representations of
5
+ * the same fragment; a paste tries them in fidelity order. No DOM/Clipboard API
6
+ * usage here — EC-175 wires these strings into `ClipboardItem`/`DataTransfer`.
7
+ */
8
+ /**
9
+ * Clipboard types for each representation. The async Clipboard API requires the
10
+ * `web ` prefix for custom formats; `DataTransfer` consumers can strip it.
11
+ */
12
+ export declare const FRAGMENT_CLIPBOARD_TYPES: {
13
+ readonly json: "web application/json";
14
+ readonly text: "text/plain";
15
+ readonly html: "text/html";
16
+ };
17
+ export interface ClipboardRepresentations {
18
+ /** Canonical fragment JSON (the `web application/json` entry). */
19
+ json: string;
20
+ /** `text/plain` — the same canonical JSON, for plain-text-only targets. */
21
+ text: string;
22
+ /** `text/html` — readable fallback with the JSON embedded losslessly. */
23
+ html: string;
24
+ }
25
+ /** Render every clipboard representation of a fragment in one pass. */
26
+ export declare function toClipboardRepresentations(fragment: ClipboardFragment): ClipboardRepresentations;
27
+ /**
28
+ * Restore a fragment from whichever representations a clipboard offers, in
29
+ * fidelity order: canonical JSON, then HTML (lossless embed), then plain text.
30
+ * Returns the first successful parse, or the highest-fidelity structured error.
31
+ * Never throws.
32
+ */
33
+ export declare function parseFragmentFromClipboard(data: Partial<ClipboardRepresentations>): ParseFragmentResult;
@@ -0,0 +1,45 @@
1
+ import { fragmentToHtml, parseFragmentFromHtml } from './html';
2
+ import { parseFragment, serializeFragment } from './serialize';
3
+ /**
4
+ * OS-clipboard representation helpers. A copy writes three representations of
5
+ * the same fragment; a paste tries them in fidelity order. No DOM/Clipboard API
6
+ * usage here — EC-175 wires these strings into `ClipboardItem`/`DataTransfer`.
7
+ */
8
+ /**
9
+ * Clipboard types for each representation. The async Clipboard API requires the
10
+ * `web ` prefix for custom formats; `DataTransfer` consumers can strip it.
11
+ */
12
+ export const FRAGMENT_CLIPBOARD_TYPES = {
13
+ json: 'web application/json',
14
+ text: 'text/plain',
15
+ html: 'text/html',
16
+ };
17
+ /** Render every clipboard representation of a fragment in one pass. */
18
+ export function toClipboardRepresentations(fragment) {
19
+ const json = serializeFragment(fragment);
20
+ return { json, text: json, html: fragmentToHtml(fragment) };
21
+ }
22
+ /**
23
+ * Restore a fragment from whichever representations a clipboard offers, in
24
+ * fidelity order: canonical JSON, then HTML (lossless embed), then plain text.
25
+ * Returns the first successful parse, or the highest-fidelity structured error.
26
+ * Never throws.
27
+ */
28
+ export function parseFragmentFromClipboard(data) {
29
+ const attempts = [];
30
+ if (data.json !== undefined)
31
+ attempts.push(parseFragment(data.json));
32
+ if (data.html !== undefined)
33
+ attempts.push(parseFragmentFromHtml(data.html));
34
+ if (data.text !== undefined)
35
+ attempts.push(parseFragment(data.text));
36
+ return (attempts.find((attempt) => attempt.ok) ??
37
+ attempts[0] ?? {
38
+ ok: false,
39
+ error: {
40
+ code: 'foreign-format',
41
+ message: 'Clipboard offers no representation to restore a fragment from.',
42
+ },
43
+ });
44
+ }
45
+ //# sourceMappingURL=clipboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/clipboard/clipboard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAG9D;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,WAAW;CACT,CAAA;AAWV,uEAAuE;AACvE,MAAM,UAAU,0BAA0B,CAAC,QAA2B;IACpE,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;IACxC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAA;AAC7D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,IAAuC;IAEvC,MAAM,QAAQ,GAA0B,EAAE,CAAA;IAC1C,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;QAAE,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACpE,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;QAAE,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC5E,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;QAAE,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACpE,OAAO,CACL,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,QAAQ,CAAC,CAAC,CAAC,IAAI;QACb,EAAE,EAAE,KAAK;QACT,KAAK,EAAE;YACL,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,gEAAgE;SAC1E;KACF,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,112 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The clipboard fragment (EC-174, vision 3.7): a spec'd, versioned interchange
4
+ * envelope that makes copy/paste a real format instead of an app-internal
5
+ * buffer. One Zod-validated envelope carries everything a paste target needs to
6
+ * reconstruct a subtree:
7
+ *
8
+ * - the graph subtree itself (`payload.root`),
9
+ * - component manifest references (`name` + `version`, renderable as
10
+ * `name@version`) for every component the subtree uses,
11
+ * - the binding declarations the subtree's props/conditions point at,
12
+ * - asset references, and
13
+ * - source metadata (project id, optional locale).
14
+ *
15
+ * The envelope is deliberately permissive about *semantics*: a fragment whose
16
+ * components are unknown to the receiving registry, or whose bindings cannot be
17
+ * resolved, still parses — flagging mismatches is the consumer's job (EC-175
18
+ * diffing the enumerated references against its registry). Only structural
19
+ * problems (foreign format, unsupported version, schema violations) are parse
20
+ * errors, and those are structured results, never exceptions (see
21
+ * `serialize.ts`).
22
+ */
23
+ /** Format identifier — foreign clipboard payloads are detected, not guessed at. */
24
+ export declare const CLIPBOARD_FRAGMENT_FORMAT = "elytra-canvas/fragment";
25
+ /** Spec version this package reads and writes. Newer payloads parse to a structured error. */
26
+ export declare const CLIPBOARD_FRAGMENT_VERSION = 1;
27
+ /**
28
+ * A component manifest reference: registry component id (`name`) plus the
29
+ * manifest version it was copied against. Rendered as `name@version`.
30
+ */
31
+ export declare const manifestRefSchema: z.ZodObject<{
32
+ name: z.ZodString;
33
+ version: z.ZodString;
34
+ }, z.core.$strip>;
35
+ export type ManifestRef = z.infer<typeof manifestRefSchema>;
36
+ /** Render a manifest reference as its canonical `name@version` spec string. */
37
+ export declare function manifestRefSpec(ref: ManifestRef): string;
38
+ /** Parse a `name@version` spec string back into a manifest reference (or `undefined`). */
39
+ export declare function parseManifestRefSpec(spec: string): ManifestRef | undefined;
40
+ /** A reference to a project asset used by the subtree (e.g. images bound to props). */
41
+ export declare const assetRefSchema: z.ZodObject<{
42
+ id: z.ZodString;
43
+ }, z.core.$strip>;
44
+ export type AssetRef = z.infer<typeof assetRefSchema>;
45
+ /** Where the fragment was copied from — lets paste targets detect cross-project/locale pastes. */
46
+ export declare const fragmentSourceSchema: z.ZodObject<{
47
+ projectId: z.ZodString;
48
+ locale: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$strip>;
50
+ export type FragmentSource = z.infer<typeof fragmentSourceSchema>;
51
+ /**
52
+ * The fragment payload: the subtree plus everything needed to reconcile it at
53
+ * the paste target. Reference lists are sorted and de-duplicated at build time
54
+ * so equal subtrees produce byte-identical fragments.
55
+ */
56
+ export declare const fragmentPayloadSchema: z.ZodObject<{
57
+ root: z.ZodType<import("@elytracms/core/project-graph").ComponentNode, unknown, z.core.$ZodTypeInternals<import("@elytracms/core/project-graph").ComponentNode, unknown>>;
58
+ components: z.ZodArray<z.ZodObject<{
59
+ name: z.ZodString;
60
+ version: z.ZodString;
61
+ }, z.core.$strip>>;
62
+ bindings: z.ZodArray<z.ZodObject<{
63
+ sourceId: z.ZodString;
64
+ token: z.ZodString;
65
+ mode: z.ZodEnum<{
66
+ object: "object";
67
+ value: "value";
68
+ spread: "spread";
69
+ repeaterItem: "repeaterItem";
70
+ condition: "condition";
71
+ }>;
72
+ }, z.core.$strip>>;
73
+ assets: z.ZodArray<z.ZodObject<{
74
+ id: z.ZodString;
75
+ }, z.core.$strip>>;
76
+ source: z.ZodObject<{
77
+ projectId: z.ZodString;
78
+ locale: z.ZodOptional<z.ZodString>;
79
+ }, z.core.$strip>;
80
+ }, z.core.$strip>;
81
+ export type FragmentPayload = z.infer<typeof fragmentPayloadSchema>;
82
+ /** The versioned fragment envelope — the single shape written to the OS clipboard. */
83
+ export declare const clipboardFragmentSchema: z.ZodObject<{
84
+ format: z.ZodLiteral<"elytra-canvas/fragment">;
85
+ version: z.ZodLiteral<1>;
86
+ payload: z.ZodObject<{
87
+ root: z.ZodType<import("@elytracms/core/project-graph").ComponentNode, unknown, z.core.$ZodTypeInternals<import("@elytracms/core/project-graph").ComponentNode, unknown>>;
88
+ components: z.ZodArray<z.ZodObject<{
89
+ name: z.ZodString;
90
+ version: z.ZodString;
91
+ }, z.core.$strip>>;
92
+ bindings: z.ZodArray<z.ZodObject<{
93
+ sourceId: z.ZodString;
94
+ token: z.ZodString;
95
+ mode: z.ZodEnum<{
96
+ object: "object";
97
+ value: "value";
98
+ spread: "spread";
99
+ repeaterItem: "repeaterItem";
100
+ condition: "condition";
101
+ }>;
102
+ }, z.core.$strip>>;
103
+ assets: z.ZodArray<z.ZodObject<{
104
+ id: z.ZodString;
105
+ }, z.core.$strip>>;
106
+ source: z.ZodObject<{
107
+ projectId: z.ZodString;
108
+ locale: z.ZodOptional<z.ZodString>;
109
+ }, z.core.$strip>;
110
+ }, z.core.$strip>;
111
+ }, z.core.$strip>;
112
+ export type ClipboardFragment = z.infer<typeof clipboardFragmentSchema>;
@@ -0,0 +1,79 @@
1
+ import { z } from 'zod';
2
+ import { bindingReferenceSchema, componentNodeSchema, idSchema } from '@elytracms/core/project-graph';
3
+ /**
4
+ * The clipboard fragment (EC-174, vision 3.7): a spec'd, versioned interchange
5
+ * envelope that makes copy/paste a real format instead of an app-internal
6
+ * buffer. One Zod-validated envelope carries everything a paste target needs to
7
+ * reconstruct a subtree:
8
+ *
9
+ * - the graph subtree itself (`payload.root`),
10
+ * - component manifest references (`name` + `version`, renderable as
11
+ * `name@version`) for every component the subtree uses,
12
+ * - the binding declarations the subtree's props/conditions point at,
13
+ * - asset references, and
14
+ * - source metadata (project id, optional locale).
15
+ *
16
+ * The envelope is deliberately permissive about *semantics*: a fragment whose
17
+ * components are unknown to the receiving registry, or whose bindings cannot be
18
+ * resolved, still parses — flagging mismatches is the consumer's job (EC-175
19
+ * diffing the enumerated references against its registry). Only structural
20
+ * problems (foreign format, unsupported version, schema violations) are parse
21
+ * errors, and those are structured results, never exceptions (see
22
+ * `serialize.ts`).
23
+ */
24
+ /** Format identifier — foreign clipboard payloads are detected, not guessed at. */
25
+ export const CLIPBOARD_FRAGMENT_FORMAT = 'elytra-canvas/fragment';
26
+ /** Spec version this package reads and writes. Newer payloads parse to a structured error. */
27
+ export const CLIPBOARD_FRAGMENT_VERSION = 1;
28
+ /**
29
+ * A component manifest reference: registry component id (`name`) plus the
30
+ * manifest version it was copied against. Rendered as `name@version`.
31
+ */
32
+ export const manifestRefSchema = z.object({
33
+ name: z.string().min(1),
34
+ version: z.string().min(1),
35
+ });
36
+ /** Render a manifest reference as its canonical `name@version` spec string. */
37
+ export function manifestRefSpec(ref) {
38
+ return `${ref.name}@${ref.version}`;
39
+ }
40
+ /** Parse a `name@version` spec string back into a manifest reference (or `undefined`). */
41
+ export function parseManifestRefSpec(spec) {
42
+ const at = spec.lastIndexOf('@');
43
+ if (at <= 0 || at === spec.length - 1)
44
+ return undefined;
45
+ return { name: spec.slice(0, at), version: spec.slice(at + 1) };
46
+ }
47
+ /** A reference to a project asset used by the subtree (e.g. images bound to props). */
48
+ export const assetRefSchema = z.object({
49
+ id: z.string().min(1),
50
+ });
51
+ /** Where the fragment was copied from — lets paste targets detect cross-project/locale pastes. */
52
+ export const fragmentSourceSchema = z.object({
53
+ projectId: idSchema,
54
+ locale: z.string().min(1).optional(),
55
+ });
56
+ /**
57
+ * The fragment payload: the subtree plus everything needed to reconcile it at
58
+ * the paste target. Reference lists are sorted and de-duplicated at build time
59
+ * so equal subtrees produce byte-identical fragments.
60
+ */
61
+ export const fragmentPayloadSchema = z.object({
62
+ /** The copied graph subtree (same node schema as `@elytracms/core/project-graph`). */
63
+ root: componentNodeSchema,
64
+ /** Manifest references for every component id used anywhere in the subtree (sorted by name). */
65
+ components: z.array(manifestRefSchema),
66
+ /** Unique binding declarations referenced by props/conditions (sorted). */
67
+ bindings: z.array(bindingReferenceSchema),
68
+ /** Unique asset references found in static prop values (sorted by id). */
69
+ assets: z.array(assetRefSchema),
70
+ /** Source project/locale metadata. */
71
+ source: fragmentSourceSchema,
72
+ });
73
+ /** The versioned fragment envelope — the single shape written to the OS clipboard. */
74
+ export const clipboardFragmentSchema = z.object({
75
+ format: z.literal(CLIPBOARD_FRAGMENT_FORMAT),
76
+ version: z.literal(CLIPBOARD_FRAGMENT_VERSION),
77
+ payload: fragmentPayloadSchema,
78
+ });
79
+ //# sourceMappingURL=fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragment.js","sourceRoot":"","sources":["../../src/clipboard/fragment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAErG;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,mFAAmF;AACnF,MAAM,CAAC,MAAM,yBAAyB,GAAG,wBAAwB,CAAA;AAEjE,8FAA8F;AAC9F,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAA;AAE3C;;;G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F,IAAI,EAAE,mBAAmB;IACzB,gGAAgG;IAChG,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;IACtC,2EAA2E;IAC3E,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC;IACzC,0EAA0E;IAC1E,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;IAC/B,sCAAsC;IACtC,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAA;AAGF,sFAAsF;AACtF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAAC;IAC5C,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC;IAC9C,OAAO,EAAE,qBAAqB;CAC/B,CAAC,CAAA"}
@@ -0,0 +1,26 @@
1
+ import type { ClipboardFragment } from './fragment';
2
+ import type { ParseFragmentResult } from './serialize';
3
+ /**
4
+ * HTML fallback representation. Many clipboard targets only accept `text/html`;
5
+ * this rendering serves both audiences at once:
6
+ *
7
+ * - **humans** — pasting outside the studio shows a readable summary (component
8
+ * names, static text content, source project), and
9
+ * - **the studio** — the canonical fragment JSON is embedded losslessly in a
10
+ * data attribute on the wrapper, so an HTML-only clipboard still restores the
11
+ * exact fragment ({@link parseFragmentFromHtml} round-trips byte-identically).
12
+ */
13
+ /** The wrapper attribute carrying the canonical fragment JSON (HTML-escaped). */
14
+ export declare const FRAGMENT_HTML_DATA_ATTRIBUTE = "data-elytra-clipboard-fragment";
15
+ /**
16
+ * Render a fragment as its HTML clipboard representation: a readable summary
17
+ * wrapped in an element whose data attribute embeds the canonical JSON.
18
+ */
19
+ export declare function fragmentToHtml(fragment: ClipboardFragment): string;
20
+ /**
21
+ * Restore a fragment from HTML clipboard content by extracting the embedded
22
+ * canonical JSON. Never throws; HTML without an embedded fragment is a
23
+ * structured `foreign-format` error, and the embedded JSON goes through the
24
+ * same {@link parseFragment} taxonomy as the canonical representation.
25
+ */
26
+ export declare function parseFragmentFromHtml(html: string): ParseFragmentResult;
@@ -0,0 +1,82 @@
1
+ import { parseFragment, serializeFragment } from './serialize';
2
+ /**
3
+ * HTML fallback representation. Many clipboard targets only accept `text/html`;
4
+ * this rendering serves both audiences at once:
5
+ *
6
+ * - **humans** — pasting outside the studio shows a readable summary (component
7
+ * names, static text content, source project), and
8
+ * - **the studio** — the canonical fragment JSON is embedded losslessly in a
9
+ * data attribute on the wrapper, so an HTML-only clipboard still restores the
10
+ * exact fragment ({@link parseFragmentFromHtml} round-trips byte-identically).
11
+ */
12
+ /** The wrapper attribute carrying the canonical fragment JSON (HTML-escaped). */
13
+ export const FRAGMENT_HTML_DATA_ATTRIBUTE = 'data-elytra-clipboard-fragment';
14
+ function escapeHtmlText(value) {
15
+ return value.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
16
+ }
17
+ function escapeHtmlAttribute(value) {
18
+ return escapeHtmlText(value).replaceAll('"', '&quot;');
19
+ }
20
+ function unescapeHtmlAttribute(value) {
21
+ return value
22
+ .replaceAll('&quot;', '"')
23
+ .replaceAll('&gt;', '>')
24
+ .replaceAll('&lt;', '<')
25
+ .replaceAll('&amp;', '&');
26
+ }
27
+ /** A short human-readable summary of one node: component id plus static string props. */
28
+ function nodeSummary(node) {
29
+ const texts = [];
30
+ for (const [name, value] of Object.entries(node.props ?? {})) {
31
+ if (value.kind === 'static' && typeof value.value === 'string') {
32
+ texts.push(`${name}: ${JSON.stringify(value.value)}`);
33
+ }
34
+ }
35
+ return texts.length > 0 ? `${node.componentId} — ${texts.join(', ')}` : node.componentId;
36
+ }
37
+ function renderNodeList(nodes) {
38
+ const items = nodes.map((node) => {
39
+ const childLists = Object.entries(node.slots ?? {})
40
+ .filter(([, children]) => children.length > 0)
41
+ .map(([, children]) => renderNodeList(children))
42
+ .join('');
43
+ return `<li>${escapeHtmlText(nodeSummary(node))}${childLists}</li>`;
44
+ });
45
+ return `<ul>${items.join('')}</ul>`;
46
+ }
47
+ /**
48
+ * Render a fragment as its HTML clipboard representation: a readable summary
49
+ * wrapped in an element whose data attribute embeds the canonical JSON.
50
+ */
51
+ export function fragmentToHtml(fragment) {
52
+ const json = serializeFragment(fragment);
53
+ const { source, components } = fragment.payload;
54
+ const origin = source.locale ? `${source.projectId} (${source.locale})` : source.projectId;
55
+ const header = `Elytra fragment — ${components.length} component` +
56
+ `${components.length === 1 ? '' : 's'} from project ${origin}`;
57
+ return (`<div ${FRAGMENT_HTML_DATA_ATTRIBUTE}="${escapeHtmlAttribute(json)}">` +
58
+ `<p>${escapeHtmlText(header)}</p>` +
59
+ renderNodeList([fragment.payload.root]) +
60
+ `</div>`);
61
+ }
62
+ const FRAGMENT_ATTRIBUTE_PATTERN = new RegExp(`${FRAGMENT_HTML_DATA_ATTRIBUTE}="([^"]*)"`);
63
+ /**
64
+ * Restore a fragment from HTML clipboard content by extracting the embedded
65
+ * canonical JSON. Never throws; HTML without an embedded fragment is a
66
+ * structured `foreign-format` error, and the embedded JSON goes through the
67
+ * same {@link parseFragment} taxonomy as the canonical representation.
68
+ */
69
+ export function parseFragmentFromHtml(html) {
70
+ const match = FRAGMENT_ATTRIBUTE_PATTERN.exec(html);
71
+ if (!match) {
72
+ return {
73
+ ok: false,
74
+ error: {
75
+ code: 'foreign-format',
76
+ message: 'HTML clipboard content carries no embedded Elytra fragment.',
77
+ },
78
+ };
79
+ }
80
+ return parseFragment(unescapeHtmlAttribute(match[1]));
81
+ }
82
+ //# sourceMappingURL=html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/clipboard/html.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAG9D;;;;;;;;;GASG;AAEH,iFAAiF;AACjF,MAAM,CAAC,MAAM,4BAA4B,GAAG,gCAAgC,CAAA;AAE5E,SAAS,cAAc,C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I,CAAC,CAAC;QACvC,QAAQ,CACT,CAAA;AACH,CAAC;AAED,MAAM,0BAA0B,GAAG,IAAI,MAAM,CAAC,GAAG,4BAA4B,YAAY,CAAC,CAAA;AAE1F;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,MAAM,KAAK,GAAG,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACnD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE;gBACL,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,6DAA6D;aACvE;SACF,CAAA;IACH,CAAC;IACD,OAAO,aAAa,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC,CAAA;AACxD,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @elytracms/clipboard — the spec'd, versioned clipboard fragment (EC-174,
3
+ * vision 3.7). Copy/paste as a real interchange format: a Zod-validated
4
+ * envelope carrying a graph subtree, manifest references, binding declarations,
5
+ * asset references, and source metadata, serialized to the OS clipboard as
6
+ * canonical JSON with a human-readable (and losslessly round-tripping) HTML
7
+ * fallback. Package-level only — EC-175 wires it into the studio.
8
+ */
9
+ export declare const PACKAGE = "@elytracms/core/clipboard";
10
+ export * from './fragment';
11
+ export * from './references';
12
+ export * from './serialize';
13
+ export * from './build';
14
+ export * from './html';
15
+ export * from './clipboard';