@phtngyn/cms 0.2.0-beta.6 → 0.2.0-beta.8

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 (72) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +7 -4
  3. package/package.json +1 -1
  4. package/src/ApplicationTypes.d.ts +1 -1
  5. package/src/{Configuration-JQ1qyaU0.js → Configuration-CMweD9bn.js} +3 -3
  6. package/src/{Configuration-JQ1qyaU0.js.map → Configuration-CMweD9bn.js.map} +1 -1
  7. package/src/Configuration.d.ts +1 -1
  8. package/src/Content.js +4 -4
  9. package/src/Content.js.map +1 -1
  10. package/src/{DocumentEngine-j6Vi7nQo.js → DocumentEngine-tYtwbBjr.js} +7 -7
  11. package/src/DocumentEngine-tYtwbBjr.js.map +1 -0
  12. package/src/{HttpPaths-c9nLZ9H2.js → HttpPaths-Be3vshPJ.js} +2 -3
  13. package/src/HttpPaths-Be3vshPJ.js.map +1 -0
  14. package/src/{I18n-zbqpWxki.d.ts → I18n-wxswIRyY.d.ts} +3 -2
  15. package/src/I18n.d.ts +1 -1
  16. package/src/Module.js +2 -13
  17. package/src/Module.js.map +1 -1
  18. package/src/{S3MediaObjects-BRuPQbxl.js → S3MediaObjects-BXfjaZOu.js} +20 -6
  19. package/src/S3MediaObjects-BXfjaZOu.js.map +1 -0
  20. package/src/cli.js +3 -3
  21. package/src/{dev-lifecycle-CExksm2R.js → dev-lifecycle-3I_pozUl.js} +8 -8
  22. package/src/dev-lifecycle-3I_pozUl.js.map +1 -0
  23. package/src/{installation-BoG8E3nJ.js → installation-DxqSSVbH.js} +11 -22
  24. package/src/installation-DxqSSVbH.js.map +1 -0
  25. package/src/internal/authoring-catalog.js +1 -1
  26. package/src/internal/authoring-metadata.js +1 -1
  27. package/src/internal/configuration.js +1 -1
  28. package/src/internal/dev-lifecycle.js +1 -1
  29. package/src/internal/document-model.js +3 -3
  30. package/src/internal/document-model.js.map +1 -1
  31. package/src/internal/i18n.js +2 -2
  32. package/src/internal/i18n.js.map +1 -1
  33. package/src/internal/studio-app.js +3 -3
  34. package/src/internal/studio-app.js.map +1 -1
  35. package/src/{metadata-UzZmjwxM.js → metadata-DN9_K6Yl.js} +87 -7
  36. package/src/metadata-DN9_K6Yl.js.map +1 -0
  37. package/src/runtime/delivery/plugin.js +7 -2
  38. package/src/runtime/delivery/plugin.js.map +1 -1
  39. package/src/runtime/delivery/useDocument.js +1 -1
  40. package/src/runtime/delivery/useDocumentQuery.js +1 -1
  41. package/src/runtime/forms/useCmsForm.js +1 -1
  42. package/src/runtime/i18n/translator.js +10 -3
  43. package/src/runtime/i18n/translator.js.map +1 -1
  44. package/src/runtime/i18n/useCmsI18n.d.ts +1 -1
  45. package/src/runtime/installation.js +1 -1
  46. package/src/runtime/plugin.js +1 -1
  47. package/src/runtime/preview/controller.js +3 -2
  48. package/src/runtime/preview/controller.js.map +1 -1
  49. package/src/runtime/preview/crypto.js +16 -0
  50. package/src/runtime/preview/crypto.js.map +1 -0
  51. package/src/runtime/preview/plugin.client.js +1 -1
  52. package/src/runtime/preview/store.js +1 -1
  53. package/src/runtime/sitemap.js +1 -1
  54. package/src/runtime/studio-app.js +1 -1
  55. package/src/runtime/studio-app.js.map +1 -1
  56. package/src/runtime/studio-document.js +46 -0
  57. package/src/runtime/studio-document.js.map +1 -0
  58. package/src/runtime/studio-entry.js +5 -22
  59. package/src/runtime/studio-entry.js.map +1 -1
  60. package/src/runtime/studio-navigation.js +2 -2
  61. package/src/runtime/studio-navigation.js.map +1 -1
  62. package/src/{store-PKKB8xa2.js → store-X1e1o_MF.js} +2 -2
  63. package/src/{store-PKKB8xa2.js.map → store-X1e1o_MF.js.map} +1 -1
  64. package/studio/{CreateDocumentDialog-DqvusuGU.js → CreateDocumentDialog-C4_JBo1w.js} +90 -90
  65. package/studio/{SelectMenu-BgikeouH.js → SelectMenu-wXqxymUw.js} +8626 -8496
  66. package/studio/host.js +4244 -4151
  67. package/src/DocumentEngine-j6Vi7nQo.js.map +0 -1
  68. package/src/HttpPaths-c9nLZ9H2.js.map +0 -1
  69. package/src/S3MediaObjects-BRuPQbxl.js.map +0 -1
  70. package/src/dev-lifecycle-CExksm2R.js.map +0 -1
  71. package/src/installation-BoG8E3nJ.js.map +0 -1
  72. package/src/metadata-UzZmjwxM.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"metadata-UzZmjwxM.js","names":["EditorNodeIdSchema"],"sources":["../../../../document/src/internal/editor/identity.ts","../../../../document/src/internal/editor/metadata.ts"],"sourcesContent":["import type { EditorNodeId } from '@internal/protocol/Documents'\nimport { EditorNodeId as EditorNodeIdSchema } from '@internal/protocol/Documents'\nimport { Schema } from 'effect'\n\nconst isEditorNodeId = Schema.is(EditorNodeIdSchema)\n\nexport const IDENTIFIED_EDITOR_TYPES = new Set([\n 'blockquote',\n 'bulletList',\n 'cmsBlock',\n 'cmsOpaque',\n 'cmsSlot',\n 'codeBlock',\n 'heading',\n 'horizontalRule',\n 'image',\n 'listItem',\n 'orderedList',\n 'paragraph',\n])\n\nexport function createEditorNodeId(): EditorNodeId {\n const bytes = globalThis.crypto.getRandomValues(new Uint8Array(16))\n bytes[6] = ((bytes[6] ?? 0) & 0x0f) | 0x40\n bytes[8] = ((bytes[8] ?? 0) & 0x3f) | 0x80\n const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('')\n\n return EditorNodeIdSchema.make(\n `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`,\n )\n}\n\nexport function editorNodeId(value: Schema.Json | undefined): EditorNodeId | undefined {\n return isEditorNodeId(value) ? value : undefined\n}\n\nexport function isIdentifiedEditorType(type: string | undefined): boolean {\n return type !== undefined && IDENTIFIED_EDITOR_TYPES.has(type)\n}\n","import type { CmsMarkdownDocument, MarkdownNode } from '@internal/protocol/Documents'\nimport type { EditorNodeId } from '@internal/protocol/Documents'\nimport type { JSONContent } from '@tiptap/core'\nimport { Predicate, Schema } from 'effect'\nimport { editorNodeId, isIdentifiedEditorType } from './identity'\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\n\ninterface EditorMetadata {\n readonly implicitSlotId?: EditorNodeId\n readonly nodeId: EditorNodeId\n}\n\nexport function assertCanonicalEditorContent(content: JSONContent): void {\n const seen = new Set<EditorNodeId>()\n\n const visit = (node: JSONContent, path: ReadonlyArray<number>) => {\n if (isIdentifiedEditorNode(node)) {\n const id = editorNodeId(node.attrs?.cmsNodeId)\n\n if (id === undefined) {\n throw new Error(`Authorable ${node.type} at ${diagnosticPath(path)} has no valid node identity.`)\n }\n\n if (seen.has(id)) {\n throw new Error(`Authorable ${node.type} at ${diagnosticPath(path)} duplicates node identity \"${id}\".`)\n }\n\n seen.add(id)\n }\n\n node.content?.forEach((child, index) => visit(child, [...path, index]))\n }\n\n visit(content, [])\n}\n\nexport function identifiedAttributes(\n attributes: Schema.JsonObject,\n nodeIdValue: Schema.Json | undefined,\n implicitSlotIdValue?: Schema.Json,\n): Schema.JsonObject {\n const nodeId = editorNodeId(nodeIdValue)\n const implicitSlotId = implicitSlotIdValue === undefined ? undefined : editorNodeId(implicitSlotIdValue)\n\n if (nodeId === undefined) throw new Error('Cannot project an authorable node without a valid identity.')\n\n if (implicitSlotIdValue !== undefined && implicitSlotId === undefined)\n throw new Error('Cannot project an implicit slot without a valid identity.')\n\n const internal: Record<string, Schema.Json> = structuredClone(jsonObject(attributes.$))\n\n if (implicitSlotId === undefined) internal.editor = { nodeId }\n else internal.editor = { implicitSlotId, nodeId }\n const result: Record<string, Schema.Json> = structuredClone(attributes)\n result.$ = internal\n\n return result\n}\n\nexport function editorMetadata(attributes: Schema.JsonObject): EditorMetadata | undefined {\n const metadata = jsonObject(jsonObject(attributes.$).editor)\n const nodeId = editorNodeId(metadata.nodeId)\n const implicitSlotId = metadata.implicitSlotId === undefined ? undefined : editorNodeId(metadata.implicitSlotId)\n\n if (nodeId === undefined) return undefined\n\n if (metadata.implicitSlotId !== undefined && implicitSlotId === undefined) return undefined\n\n return implicitSlotId === undefined ? { nodeId } : { implicitSlotId, nodeId }\n}\n\nexport function withoutEditorMetadata(body: CmsMarkdownDocument): CmsMarkdownDocument {\n return {\n frontmatter: structuredClone(body.frontmatter),\n meta: structuredClone(body.meta),\n nodes: body.nodes.map(cleanNode),\n }\n}\n\nfunction cleanNode(node: MarkdownNode): MarkdownNode {\n if (Predicate.isString(node)) return node\n\n if (node[0] === null) {\n const cleanAttributes = cleanNodeAttributes(node[1])\n\n return [null, cleanAttributes, node[2]]\n }\n\n const [tag, attributes, ...children] = node\n\n return [tag, cleanNodeAttributes(attributes), ...children.map(cleanNode)]\n}\n\nfunction cleanNodeAttributes(attributes: Schema.JsonObject): Record<string, Schema.Json> {\n const cleanAttributes: Record<string, Schema.Json> = structuredClone(attributes)\n const internal = jsonObject(cleanAttributes.$)\n\n if (internal.editor !== undefined) {\n const { editor: _editor, ...remaining } = internal\n\n if (Object.keys(remaining).length) cleanAttributes.$ = remaining\n else delete cleanAttributes.$\n }\n\n return cleanAttributes\n}\n\nfunction isIdentifiedEditorNode(node: JSONContent): boolean {\n if (!isIdentifiedEditorType(node.type)) return false\n\n if (node.attrs?.cmsSynthetic === true || node.attrs?.cmsTransient === true) return false\n\n return node.type !== 'paragraph' || Boolean(node.content?.length)\n}\n\nfunction diagnosticPath(path: ReadonlyArray<number>): string {\n return path.length ? path.join('.') : 'document root'\n}\n\nfunction jsonObject(value: Schema.Json | undefined): Schema.JsonObject {\n return isJsonObject(value) ? value : {}\n}\n"],"mappings":";;;;AAIA,MAAM,iBAAiB,OAAO,GAAGA,YAAkB;AAEnD,MAAa,0CAA0B,IAAI,IAAI;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgB,qBAAmC;CACjD,MAAM,QAAQ,WAAW,OAAO,gCAAgB,IAAI,WAAW,EAAE,CAAC;CAClE,MAAM,MAAO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