@phtngyn/cms 0.1.0-beta.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 (120) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +90 -0
  3. package/dist/studio/assets/ActivityEntryRow-D--fRvWI.js +1 -0
  4. package/dist/studio/assets/ActivityView-D-XBBUHb.js +1 -0
  5. package/dist/studio/assets/CreateDocumentDialog-CH8UH1QM.js +1 -0
  6. package/dist/studio/assets/DocumentsView-CxRpmAxt.js +34 -0
  7. package/dist/studio/assets/DropdownMenu-BSb1l7fr.js +1 -0
  8. package/dist/studio/assets/Input-DVao38h7.js +3 -0
  9. package/dist/studio/assets/MediaView-BHrPIjxB.js +1 -0
  10. package/dist/studio/assets/Modal-VNrXGa5C.js +1 -0
  11. package/dist/studio/assets/OverviewView-DfP6-mLZ.js +1 -0
  12. package/dist/studio/assets/Select-BJZIs9sY.js +1 -0
  13. package/dist/studio/assets/SettingsView-CerHe-ua.js +1 -0
  14. package/dist/studio/assets/Skeleton-CWJNi3nS.js +1 -0
  15. package/dist/studio/assets/StudioPageHeader-DP9HDAF2.js +1 -0
  16. package/dist/studio/assets/UsersView-cP3REkH2.js +1 -0
  17. package/dist/studio/assets/collaboration-BLnCzfvV.js +4 -0
  18. package/dist/studio/assets/context-dY4fNbn3.js +1 -0
  19. package/dist/studio/assets/editor-CE07wW83.js +137 -0
  20. package/dist/studio/assets/gateway-BAyQgCse.js +10 -0
  21. package/dist/studio/assets/index-CjoaPLhZ.js +28 -0
  22. package/dist/studio/assets/index-s2rPqCmP.css +2 -0
  23. package/dist/studio/assets/render-BkxbK2St.js +83 -0
  24. package/dist/studio/assets/rolldown-runtime-DK3Fl9T5.js +1 -0
  25. package/dist/studio/assets/useMediaLibrary-D7qR7aBf.js +1 -0
  26. package/dist/studio/index.html +76 -0
  27. package/package.json +75 -0
  28. package/src/Authoring.d.ts +46 -0
  29. package/src/Authoring.js +1 -0
  30. package/src/AuthoringSchema-BQ5kbhVB.js +926 -0
  31. package/src/AuthoringSchema-BQ5kbhVB.js.map +1 -0
  32. package/src/Configuration-BGYFD2N1.js +150 -0
  33. package/src/Configuration-BGYFD2N1.js.map +1 -0
  34. package/src/Configuration.d.ts +44 -0
  35. package/src/Configuration.js +9 -0
  36. package/src/Configuration.js.map +1 -0
  37. package/src/DocumentEngine-Da0kWotL.js +851 -0
  38. package/src/DocumentEngine-Da0kWotL.js.map +1 -0
  39. package/src/DocumentModel.d.ts +30 -0
  40. package/src/DocumentModel.js +15 -0
  41. package/src/DocumentModel.js.map +1 -0
  42. package/src/HttpPaths-86qLGB90.js +15 -0
  43. package/src/HttpPaths-86qLGB90.js.map +1 -0
  44. package/src/Module.d.ts +12 -0
  45. package/src/Module.js +167 -0
  46. package/src/Module.js.map +1 -0
  47. package/src/StudioHttp-BTLLooh0.js +916 -0
  48. package/src/StudioHttp-BTLLooh0.js.map +1 -0
  49. package/src/connection-ZGtL54qY.js +94 -0
  50. package/src/connection-ZGtL54qY.js.map +1 -0
  51. package/src/installation-BNKaVjni.js +9128 -0
  52. package/src/installation-BNKaVjni.js.map +1 -0
  53. package/src/internal/authoring-compiler.js +120 -0
  54. package/src/internal/authoring-compiler.js.map +1 -0
  55. package/src/internal/authoring-metadata.js +163 -0
  56. package/src/internal/authoring-metadata.js.map +1 -0
  57. package/src/internal/cms-config.js +46 -0
  58. package/src/internal/cms-config.js.map +1 -0
  59. package/src/internal/component-metadata.js +37 -0
  60. package/src/internal/component-metadata.js.map +1 -0
  61. package/src/internal/configuration.js +93 -0
  62. package/src/internal/configuration.js.map +1 -0
  63. package/src/internal/document-model.js +236 -0
  64. package/src/internal/document-model.js.map +1 -0
  65. package/src/internal/field-metadata.js +6 -0
  66. package/src/internal/field-metadata.js.map +1 -0
  67. package/src/metadata-Czvi3E4K.js +190 -0
  68. package/src/metadata-Czvi3E4K.js.map +1 -0
  69. package/src/models-Citx8jBi.js +306 -0
  70. package/src/models-Citx8jBi.js.map +1 -0
  71. package/src/models-DS5ClMsH.js +153 -0
  72. package/src/models-DS5ClMsH.js.map +1 -0
  73. package/src/runtime/api.js +9 -0
  74. package/src/runtime/api.js.map +1 -0
  75. package/src/runtime/collaboration.js +40 -0
  76. package/src/runtime/collaboration.js.map +1 -0
  77. package/src/runtime/delivery/DocumentField.js +23 -0
  78. package/src/runtime/delivery/DocumentField.js.map +1 -0
  79. package/src/runtime/delivery/DocumentRenderer.js +51 -0
  80. package/src/runtime/delivery/DocumentRenderer.js.map +1 -0
  81. package/src/runtime/delivery/DocumentScope.js +41 -0
  82. package/src/runtime/delivery/DocumentScope.js.map +1 -0
  83. package/src/runtime/delivery/document-page.js +23 -0
  84. package/src/runtime/delivery/document-page.js.map +1 -0
  85. package/src/runtime/delivery/document.js +25 -0
  86. package/src/runtime/delivery/document.js.map +1 -0
  87. package/src/runtime/delivery/preview.d.ts +11 -0
  88. package/src/runtime/delivery/preview.js +6 -0
  89. package/src/runtime/delivery/preview.js.map +1 -0
  90. package/src/runtime/delivery/types.d.ts +80 -0
  91. package/src/runtime/delivery/types.js +1 -0
  92. package/src/runtime/delivery/useDocument.d.ts +6 -0
  93. package/src/runtime/delivery/useDocument.js +20 -0
  94. package/src/runtime/delivery/useDocument.js.map +1 -0
  95. package/src/runtime/delivery/useDocumentQuery.d.ts +7 -0
  96. package/src/runtime/delivery/useDocumentQuery.js +26 -0
  97. package/src/runtime/delivery/useDocumentQuery.js.map +1 -0
  98. package/src/runtime/installation.js +3 -0
  99. package/src/runtime/plugin.js +32 -0
  100. package/src/runtime/plugin.js.map +1 -0
  101. package/src/runtime/preview/CmsStudioPreviewMarker.js +15 -0
  102. package/src/runtime/preview/CmsStudioPreviewMarker.js.map +1 -0
  103. package/src/runtime/preview/comark-document.js +38 -0
  104. package/src/runtime/preview/comark-document.js.map +1 -0
  105. package/src/runtime/preview/connection.js +3 -0
  106. package/src/runtime/preview/controller.js +247 -0
  107. package/src/runtime/preview/controller.js.map +1 -0
  108. package/src/runtime/preview/plugin.client.js +70 -0
  109. package/src/runtime/preview/plugin.client.js.map +1 -0
  110. package/src/runtime/preview/preview.css +9 -0
  111. package/src/runtime/preview/protocol.d.ts +10 -0
  112. package/src/runtime/preview/protocol.js +11 -0
  113. package/src/runtime/preview/protocol.js.map +1 -0
  114. package/src/runtime/preview/store.js +4 -0
  115. package/src/runtime/preview/targets.js +102 -0
  116. package/src/runtime/preview/targets.js.map +1 -0
  117. package/src/runtime/studio-app.js +13 -0
  118. package/src/runtime/studio-app.js.map +1 -0
  119. package/src/store-Nl4uxEXx.js +221 -0
  120. package/src/store-Nl4uxEXx.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthoringSchema-BQ5kbhVB.js","names":["isJsonObject","jsonObject","CmsMarkdownDocumentSchema","isElementNode","isJsonObject","jsonObject","comarkToEditor","isJsonObject","textContent"],"sources":["../../../../document/src/internal/comark/bindings.ts","../../../../document/src/internal/comark/source-mapping.ts","../../../../document/src/internal/comark/grammar.ts","../../../../document/src/internal/editor/attributes.ts","../../../../document/src/internal/editor/image.ts","../../../../document/src/internal/editor/marks.ts","../../../../document/src/internal/comark/to-editor.ts","../../../../document/src/internal/editor/errors.ts","../../../../document/src/AuthoringSchema.ts"],"sourcesContent":["import type { ComponentDefinition } from '@internal/protocol/Configuration'\nimport type { CmsMarkdownDocument, MarkdownNode } from '@internal/protocol/Documents'\nimport type { NodeRenderData } from 'comark'\nimport { CmsMarkdownDocument as CmsMarkdownDocumentSchema } from '@internal/protocol/Documents'\nimport { resolveAttributes } from 'comark/utils'\nimport { Option, Predicate, Schema } from 'effect'\nimport { mutableJson, mutableJsonObject, toMutableComarkAttributes } from './document-adapter'\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\nconst decodeJson = Schema.decodeUnknownOption(Schema.Json)\n\nexport type CmsComarkAttributeValue = Schema.Json | undefined\nexport type CmsComarkAttributes = ReadonlyMap<string, CmsComarkAttributeValue>\n\ninterface CmsEditorComponentProjection {\n readonly bindings: Schema.JsonObject\n readonly props: Schema.JsonObject\n readonly renderData: NodeRenderData\n}\n\n/** Normalizes bindings exactly as Comark's framework renderers do before passing props to a component. */\nexport function resolveCmsComarkAttributes(\n attributes: Schema.JsonObject,\n renderData: NodeRenderData,\n): CmsComarkAttributes {\n const resolved = new Map<string, CmsComarkAttributeValue>()\n for (const [name, value] of Object.entries(\n resolveAttributes(toMutableComarkAttributes(attributes), renderData, { parseJson: true }),\n )) {\n if (Predicate.isUndefined(value)) {\n resolved.set(name, undefined)\n continue\n }\n const decoded = decodeJson(value)\n if (Option.isNone(decoded)) throw new Error(`Comark resolved non-JSON attribute \"${name}\".`)\n resolved.set(name, decoded.value)\n }\n return resolved\n}\n\n/** Projects bindings to editable values while retaining enough metadata to reconstruct their authored form. */\nexport function projectCmsEditorComponentAttributes(\n attributes: Schema.JsonObject,\n renderData: NodeRenderData,\n): CmsEditorComponentProjection {\n const resolved = resolveCmsComarkAttributes(attributes, renderData)\n const props: Record<string, Schema.Json> = {}\n for (const [name, value] of resolved) {\n if (!Predicate.isUndefined(value)) props[name] = mutableJson(value)\n }\n\n const bindings: Record<string, Schema.Json> = {}\n for (const [authoredName, authoredValue] of Object.entries(attributes)) {\n if (!authoredName.startsWith(':') || authoredName.length === 1) continue\n const name = authoredName.slice(1)\n if (!resolved.has(name)) continue\n const literal = jsonLiteral(authoredValue)\n if (!Predicate.isString(authoredValue) || literal !== authoredValue) {\n bindings[name] = { kind: 'literal' }\n continue\n }\n const resolvedValue = resolved.get(name)\n bindings[name] = Object.assign(\n { expression: authoredValue, kind: 'expression' },\n Predicate.isUndefined(resolvedValue) ? undefined : { resolved: mutableJson(resolvedValue) },\n )\n }\n\n return { bindings, props, renderData: withCmsComarkProps(renderData, resolved) }\n}\n\n/** Reconstructs authored bindings, keeping expressions until a user replaces their resolved value. */\nexport function encodeCmsEditorComponentAttributes(\n props: Schema.JsonObject,\n bindings: Schema.JsonObject,\n): Schema.JsonObject {\n const attributes = mutableJsonObject(props)\n for (const [name, encodedBinding] of Object.entries(bindings)) {\n const binding = jsonObject(encodedBinding)\n const kind = binding.kind\n if (kind !== 'literal' && kind !== 'expression') continue\n const current = props[name]\n if (Predicate.isUndefined(current)) {\n const expression = binding.expression\n if (kind === 'expression' && Predicate.isString(expression)) attributes[`:${name}`] = expression\n continue\n }\n\n delete attributes[name]\n const expression = binding.expression\n const resolved = binding.resolved\n attributes[`:${name}`] =\n kind === 'expression' &&\n Predicate.isString(expression) &&\n Object.hasOwn(binding, 'resolved') &&\n sameJson(current, resolved)\n ? expression\n : mutableJson(current)\n }\n return attributes\n}\n\nexport function withCmsComarkProps(renderData: NodeRenderData, attributes: CmsComarkAttributes): NodeRenderData {\n return attributes.size > 0 ? { ...renderData, props: Object.fromEntries(attributes) } : renderData\n}\n\n/** Restores typed component bindings that Comark's block-YAML roundtrip can emit as plain attributes. */\nexport function normalizeCmsComponentBindings(\n document: CmsMarkdownDocument,\n components: ReadonlyMap<string, ComponentDefinition> | undefined,\n): CmsMarkdownDocument {\n if (!components) return document\n return CmsMarkdownDocumentSchema.make({\n frontmatter: document.frontmatter,\n meta: document.meta,\n nodes: document.nodes.map((node) => normalizeComponentNode(node, components)),\n })\n}\n\nexport function matchesCmsComponentPropType(\n value: CmsComarkAttributeValue,\n type: ComponentDefinition['props'][number]['type'],\n): boolean {\n switch (type) {\n case 'array':\n return Array.isArray(value)\n case 'boolean':\n return Predicate.isBoolean(value)\n case 'number':\n return Predicate.isNumber(value)\n case 'object':\n return isJsonObject(value)\n case 'string':\n return Predicate.isString(value)\n }\n}\n\nfunction normalizeComponentNode(\n node: MarkdownNode,\n components: ReadonlyMap<string, ComponentDefinition>,\n): MarkdownNode {\n if (Predicate.isString(node) || node[0] === null) return node\n const [tag, originalAttributes, ...originalChildren] = node\n const attributes = mutableJsonObject(originalAttributes)\n const definition = components.get(tag.toLocaleLowerCase())\n if (definition) {\n for (const prop of definition.props) {\n if (prop.type === 'string' || `:${prop.name}` in attributes || !(prop.name in attributes)) continue\n const value = attributes[prop.name]\n if (Predicate.isUndefined(value)) continue\n const resolved = jsonLiteral(value)\n if (!matchesCmsComponentPropType(resolved, prop.type)) continue\n delete attributes[prop.name]\n attributes[`:${prop.name}`] = value\n }\n }\n return [tag, attributes, ...originalChildren.map((child) => normalizeComponentNode(child, components))]\n}\n\nfunction jsonLiteral(value: Schema.Json | undefined): CmsComarkAttributeValue {\n if (!Predicate.isString(value)) return value\n try {\n const decoded = decodeJson(JSON.parse(value))\n return Option.isSome(decoded) ? decoded.value : value\n } catch {\n return value\n }\n}\n\nfunction jsonObject(value: Schema.Json | undefined): Schema.JsonObject {\n return isJsonObject(value) ? value : {}\n}\n\nfunction sameJson(left: Schema.Json, right: Schema.Json | undefined): boolean {\n return !Predicate.isUndefined(right) && JSON.stringify(left) === JSON.stringify(right)\n}\n","import type { DocumentSourceMapping, DocumentSourcePoint, DocumentSourceRange } from '@internal/protocol/Documents'\nimport type { ComarkParsePostState, ComarkParsePreState, ComarkPlugin, ElementNode, Node } from 'comark'\nimport { Predicate, Schema } from 'effect'\n\nexport const SOURCE_MAPPINGS_META_KEY = '__cmsSourceMappings'\n\ninterface SourceMapParseState {\n __cmsOriginalMarkdown?: string\n parsedLines?: number\n}\n\ninterface ComarkToken extends Schema.Schema.Type<typeof ComarkToken> {}\n\ninterface BlockDescriptor {\n readonly children: BlockDescriptor[]\n range: DocumentSourceRange\n readonly tag: string\n}\n\nconst BLOCK_TAGS = new Map([\n ['blockquote_open', 'blockquote'],\n ['bullet_list_open', 'ul'],\n ['list_item_open', 'li'],\n ['ordered_list_open', 'ol'],\n ['paragraph_open', 'p'],\n ['table_open', 'table'],\n ['tbody_open', 'tbody'],\n ['td_open', 'td'],\n ['th_open', 'th'],\n ['thead_open', 'thead'],\n ['tr_open', 'tr'],\n])\n\nconst ComarkToken = Schema.Struct({\n attrs: Schema.optionalKey(Schema.NullOr(Schema.Array(Schema.Tuple([Schema.String, Schema.String])))),\n hidden: Schema.optionalKey(Schema.Boolean),\n level: Schema.optionalKey(Schema.Finite),\n map: Schema.optionalKey(Schema.NullOr(Schema.Tuple([Schema.Finite, Schema.Finite]))),\n nesting: Schema.optionalKey(Schema.Finite),\n tag: Schema.optionalKey(Schema.String),\n type: Schema.optionalKey(Schema.String),\n})\n\nconst WRAPPER_TAGS = new Set(['blockquote', 'ol', 'pre', 'table', 'ul'])\n\n/** Captures the durable source before frontmatter or other pre-parse stages mutate it. */\nexport function sourceCapturePlugin(): ComarkPlugin {\n return {\n name: 'cms-source-capture',\n pre(state: ComarkParsePreState & SourceMapParseState) {\n state.__cmsOriginalMarkdown = state.markdown\n },\n }\n}\n\n/** Translate Comark block token line maps into exact JavaScript source offsets. */\nexport function sourceMappingPlugin(): ComarkPlugin {\n return {\n name: 'cms-source-mapping',\n post(state: ComarkParsePostState & SourceMapParseState) {\n const source = state.__cmsOriginalMarkdown ?? state.markdown\n const descriptors = createBlockDescriptors(\n state.tokens.flatMap((token) => {\n const decoded = Schema.decodeUnknownOption(ComarkToken)(token)\n return decoded._tag === 'Some' ? [decoded.value] : []\n }),\n source,\n state.markdown,\n state.parsedLines ?? 0,\n )\n const mappings: DocumentSourceMapping[] = []\n mapNodes(state.tree.nodes, descriptors, [], mappings)\n state.tree.meta[SOURCE_MAPPINGS_META_KEY] = mappings\n },\n }\n}\n\nfunction createBlockDescriptors(\n tokens: ReadonlyArray<ComarkToken>,\n source: string,\n parsedMarkdown: string,\n parsedLines: number,\n): BlockDescriptor[] {\n const roots: BlockDescriptor[] = []\n const stack: Array<{ descriptor: BlockDescriptor; level: number }> = []\n const sourceLineStarts = indexLineStarts(source)\n const parsedLineStarts = indexLineStarts(parsedMarkdown)\n const parsedOffset = source.lastIndexOf(parsedMarkdown)\n const slotMaps = createSlotTokenMaps(tokens, parsedMarkdown)\n\n for (let tokenIndex = 0; tokenIndex < tokens.length; tokenIndex++) {\n const token = tokens[tokenIndex]\n if (!token) continue\n const tag = blockTag(token)\n const tokenMap = token.map ?? slotMaps.get(tokenIndex)\n if (!tag || !tokenMap) continue\n\n const level = token.level ?? 0\n while (true) {\n const current = stack.at(-1)\n if (!current || current.level < level) break\n stack.pop()\n }\n\n const descriptor: BlockDescriptor = {\n children: [],\n range: rangeFromParsedLines(\n source,\n sourceLineStarts,\n parsedMarkdown,\n parsedLineStarts,\n parsedOffset,\n tokenMap[0],\n tokenMap[1] + (token.type === 'mdc_block_open' ? 1 : 0),\n parsedLines,\n ),\n tag,\n }\n const parent = stack.at(-1)?.descriptor\n ;(parent?.children ?? roots).push(descriptor)\n if (token.nesting === 1) stack.push({ descriptor, level })\n }\n\n return roots.map(collapseComarkWrapper).map(groupProjectedSlotContent)\n}\n\nfunction blockTag(token: ComarkToken): string | undefined {\n if (token.hidden || !token.type) return undefined\n if (token.type === 'heading_open') return token.tag\n if (token.type === 'mdc_block_open' || (token.type === 'mdc_block_shorthand' && token.nesting !== -1))\n return token.tag || 'component'\n if (token.type === 'mdc_block_slot' && token.nesting === 1) return 'template'\n if (['fence', 'fenced_code_block', 'code_block'].includes(token.type)) return 'pre'\n if (token.type === 'math_block') return 'math'\n if (token.type === 'html_block') return '*'\n if (token.type === 'hr') return 'hr'\n return BLOCK_TAGS.get(token.type)\n}\n\nfunction createSlotTokenMaps(\n tokens: ReadonlyArray<ComarkToken>,\n parsedMarkdown: string,\n): Map<number, [number, number]> {\n const maps = new Map<number, [number, number]>()\n const markers = slotMarkers(parsedMarkdown)\n const stack: Array<{ index: number; marker: number }> = []\n let nextMarker = 0\n\n for (let index = 0; index < tokens.length; index++) {\n const token = tokens[index]\n if (!token || token.type !== 'mdc_block_slot') continue\n\n if (token.nesting === 1) {\n const name = token.attrs?.[0]?.[0]?.replace(/^#/u, '')\n let markerIndex = nextMarker\n while (markerIndex < markers.length && markers[markerIndex]?.name !== name) markerIndex++\n const marker = markers[markerIndex]\n if (marker) {\n stack.push({ index, marker: marker.line })\n nextMarker = markerIndex + 1\n }\n continue\n }\n\n if (token.nesting !== -1) continue\n const open = stack.pop()\n if (!open) continue\n let endLine = open.marker + 1\n for (let childIndex = open.index + 1; childIndex < index; childIndex++) {\n const child = tokens[childIndex]\n const map = child?.map ?? maps.get(childIndex)\n if (child && map) {\n endLine = Math.max(endLine, map[1] + (child.type === 'mdc_block_open' ? 1 : 0))\n }\n }\n maps.set(open.index, [open.marker, endLine])\n }\n return maps\n}\n\nfunction slotMarkers(source: string): Array<{ line: number; name: string }> {\n return source.split(/\\r?\\n/u).flatMap((line, index) => {\n const name = line.match(/^\\s*#([^\\s{]+)/u)?.[1]\n return name ? [{ line: index, name }] : []\n })\n}\n\nfunction collapseComarkWrapper(descriptor: BlockDescriptor): BlockDescriptor {\n const children = descriptor.children.map(collapseComarkWrapper)\n if (WRAPPER_TAGS.has(descriptor.tag) && children.length === 1 && children[0]?.tag === descriptor.tag) {\n return { ...descriptor, children: children[0].children }\n }\n return { ...descriptor, children }\n}\n\n/** Comark projects siblings after a named slot into that active slot. */\nfunction groupProjectedSlotContent(descriptor: BlockDescriptor): BlockDescriptor {\n const grouped: BlockDescriptor[] = []\n let activeSlot: BlockDescriptor | undefined\n\n for (const rawChild of descriptor.children) {\n const child = groupProjectedSlotContent(rawChild)\n if (child.tag === 'template') {\n activeSlot = child\n grouped.push(child)\n continue\n }\n if (!activeSlot) {\n grouped.push(child)\n continue\n }\n activeSlot.children.push(child)\n if (child.range.end.offset > activeSlot.range.end.offset) {\n activeSlot.range = { start: activeSlot.range.start, end: child.range.end }\n }\n }\n return { ...descriptor, children: grouped }\n}\n\nfunction mapNodes(\n nodes: ReadonlyArray<Node>,\n descriptors: ReadonlyArray<BlockDescriptor>,\n parentPath: ReadonlyArray<number>,\n mappings: DocumentSourceMapping[],\n): void {\n let descriptorIndex = 0\n\n for (let nodeIndex = 0; nodeIndex < nodes.length; nodeIndex++) {\n const node = nodes[nodeIndex]\n if (!node || !isElementNode(node)) continue\n\n let matchIndex = descriptorIndex\n while (\n matchIndex < descriptors.length &&\n descriptors[matchIndex]?.tag !== '*' &&\n descriptors[matchIndex]?.tag !== node[0]\n ) {\n matchIndex++\n }\n const descriptor = descriptors[matchIndex]\n if (!descriptor) continue\n\n descriptorIndex = matchIndex + 1\n const nodePath = [...parentPath, nodeIndex]\n mappings.push({ nodePath, range: descriptor.range })\n const [, , ...children] = node\n mapNodes(children, descriptor.children, nodePath, mappings)\n }\n}\n\nfunction isElementNode(node: Node): node is ElementNode {\n return Array.isArray(node) && Predicate.isString(node[0])\n}\n\nfunction indexLineStarts(source: string): number[] {\n const starts = [0]\n for (let offset = 0; offset < source.length; offset++) {\n if (source.charCodeAt(offset) === 10) starts.push(offset + 1)\n }\n return starts\n}\n\nfunction rangeFromParsedLines(\n source: string,\n sourceLineStarts: ReadonlyArray<number>,\n parsedMarkdown: string,\n parsedLineStarts: ReadonlyArray<number>,\n parsedOffset: number,\n startLine: number,\n endLine: number,\n fallbackLineOffset: number,\n): DocumentSourceRange {\n const startOffset =\n parsedOffset >= 0\n ? parsedOffset + (parsedLineStarts[startLine] ?? parsedMarkdown.length)\n : (sourceLineStarts[startLine + fallbackLineOffset] ?? source.length)\n const endOffset =\n parsedOffset >= 0\n ? parsedOffset + (parsedLineStarts[endLine] ?? parsedMarkdown.length)\n : (sourceLineStarts[endLine + fallbackLineOffset] ?? source.length)\n return {\n start: pointAt(source, sourceLineStarts, startOffset),\n end: pointAt(source, sourceLineStarts, Math.max(startOffset, endOffset)),\n }\n}\n\nfunction pointAt(source: string, lineStarts: ReadonlyArray<number>, rawOffset: number): DocumentSourcePoint {\n const offset = Math.min(Math.max(rawOffset, 0), source.length)\n let low = 0\n let high = lineStarts.length - 1\n while (low < high) {\n const middle = Math.ceil((low + high) / 2)\n if ((lineStarts[middle] ?? source.length) <= offset) low = middle\n else high = middle - 1\n }\n return {\n offset,\n line: low + 1,\n column: offset - (lineStarts[low] ?? 0) + 1,\n }\n}\n","import type { ComarkParseFn } from 'comark'\nimport { createMarkdownParser } from 'comark/parse'\nimport alert from 'comark/plugins/alert'\nimport attributes from 'comark/plugins/attributes'\nimport components from 'comark/plugins/components'\nimport frontmatter from 'comark/plugins/frontmatter'\nimport headings from 'comark/plugins/headings'\nimport security from 'comark/plugins/security'\nimport taskList from 'comark/plugins/task-list'\nimport toc from 'comark/plugins/toc'\nimport { sourceCapturePlugin, sourceMappingPlugin } from './source-mapping'\n\n/**\n * Changes when parsing, normalization, or projection semantics change. Stored\n * with compiled documents so migrations can identify stale derived content.\n */\nexport const DOCUMENT_ENGINE_FINGERPRINT =\n 'comark@0.6.2/frontmatter+alert+task-list+components+attributes+security+headings+toc+source-mapping/v1'\n\n/** One explicit grammar for authoring, preview, delivery, and analysis projections. */\nexport function createDocumentParser(): ComarkParseFn {\n return createMarkdownParser({\n autoClose: false,\n registerDefaultPlugins: false,\n plugins: [\n sourceCapturePlugin(),\n frontmatter(),\n alert(),\n taskList(),\n components(),\n attributes(),\n // Security mutates the tree before metadata and source paths are derived.\n security(),\n headings(),\n toc({ depth: 5, searchDepth: 6 }),\n sourceMappingPlugin(),\n ],\n })\n}\n","import { Predicate, Schema } from 'effect'\n\nexport function compactJsonAttributes(\n attributes: Readonly<Record<string, Schema.Json | undefined>>,\n): Schema.JsonObject {\n return Object.fromEntries(\n Object.entries(attributes).filter((entry): entry is [string, Schema.Json] => entry[1] !== undefined),\n )\n}\n\nexport function nonEmptyStringAttribute(value: Schema.Json | undefined): string | undefined {\n return Predicate.isString(value) && value ? value : undefined\n}\n\nexport function finiteNumberAttribute(value: Schema.Json | undefined, fallback: number): number {\n const number = Predicate.isNumber(value) ? value : Number(value)\n return Number.isFinite(number) ? number : fallback\n}\n","import { Predicate, Schema } from 'effect'\nimport { compactJsonAttributes } from './attributes'\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\n\nconst EDITOR_IMAGE_LAYOUTS = ['natural', 'content', 'full'] as const\nexport type EditorImageLayout = (typeof EDITOR_IMAGE_LAYOUTS)[number]\n\nconst EditorImageLayout = Schema.Literals(EDITOR_IMAGE_LAYOUTS)\nconst isEditorImageLayout = Schema.is(EditorImageLayout)\n\nexport const EDITOR_IMAGE_LAYOUT_ATTRIBUTE = 'data-cms-layout'\nconst IMAGE_DECORATIVE_ATTRIBUTE = 'data-cms-decorative'\nconst IMAGE_SEMANTIC_ATTRIBUTES = new Set([\n 'alt',\n IMAGE_DECORATIVE_ATTRIBUTE,\n EDITOR_IMAGE_LAYOUT_ATTRIBUTE,\n 'src',\n 'title',\n])\n\nexport function decodeEditorImageAttributes(attributes: Schema.JsonObject): Schema.JsonObject {\n const cmsProps = Object.fromEntries(\n Object.entries(attributes).filter(([name]) => !IMAGE_SEMANTIC_ATTRIBUTES.has(name)),\n )\n return compactJsonAttributes({\n alt:\n attributes[IMAGE_DECORATIVE_ATTRIBUTE] !== undefined\n ? ''\n : Predicate.isString(attributes.alt)\n ? attributes.alt\n : null,\n cmsProps: Object.keys(cmsProps).length ? cmsProps : null,\n layout: normalizeEditorImageLayout(attributes[EDITOR_IMAGE_LAYOUT_ATTRIBUTE]),\n src: stringValue(attributes.src) || null,\n title: stringValue(attributes.title) || null,\n })\n}\n\nexport function encodeEditorImageAttributes(value: Schema.JsonObject | undefined): Schema.JsonObject {\n const attributes = jsonObject(value)\n const alt = attributes.alt\n const layout = normalizeEditorImageLayout(attributes.layout)\n return compactJsonAttributes(\n Object.assign({}, jsonObject(attributes.cmsProps), {\n alt: Predicate.isString(alt) ? alt : undefined,\n [IMAGE_DECORATIVE_ATTRIBUTE]: alt === '' ? 'true' : undefined,\n [EDITOR_IMAGE_LAYOUT_ATTRIBUTE]: layout === 'natural' ? undefined : layout,\n src: stringValue(attributes.src) || undefined,\n title: stringValue(attributes.title) || undefined,\n }),\n )\n}\n\nexport function normalizeEditorImageLayout(value: Schema.Json | undefined): EditorImageLayout {\n return isEditorImageLayout(value) ? value : 'natural'\n}\n\nfunction jsonObject(value: Schema.Json | undefined): Schema.JsonObject {\n return isJsonObject(value) ? value : {}\n}\n\nfunction stringValue(value: Schema.Json | undefined): string {\n return Predicate.isString(value) || Predicate.isNumber(value) ? String(value) : ''\n}\n","const EDITOR_MARKS = [\n ['bold', 'strong'],\n ['code', 'code'],\n ['italic', 'em'],\n ['link', 'a'],\n ['strike', 'del'],\n ['underline', 'u'],\n] as const\n\nexport const EDITOR_MARK_TYPES = EDITOR_MARKS.map(([type]) => type)\n\nconst editorToComark = new Map<string, string>(EDITOR_MARKS)\nconst comarkToEditor = new Map<string, string>(EDITOR_MARKS.map(([type, tag]) => [tag, type]))\n\nexport function comarkTagForEditorMark(type: string): string | undefined {\n return editorToComark.get(type)\n}\n\nexport function editorMarkForComarkTag(tag: string): string | undefined {\n return comarkToEditor.get(tag)\n}\n\nexport function isEditorMark(type: string): boolean {\n return editorToComark.has(type)\n}\n\nexport function isComarkMark(tag: string): boolean {\n return comarkToEditor.has(tag)\n}\n","import type { MarkdownNode } from '@internal/protocol/Documents'\nimport type { EditorNodeId } from '@internal/protocol/Documents'\nimport type { JSONContent } from '@tiptap/core'\nimport type { NodeRenderData } from 'comark'\nimport { Predicate, Schema } from 'effect'\nimport { projectCmsEditorComponentAttributes, resolveCmsComarkAttributes, withCmsComarkProps } from './bindings'\nimport { editorNodeId, createEditorNodeId } from '../editor/identity'\nimport { decodeEditorImageAttributes } from '../editor/image'\nimport { editorMetadata } from '../editor/metadata'\nimport { compactJsonAttributes, finiteNumberAttribute, nonEmptyStringAttribute } from '../editor/attributes'\nimport { editorMarkForComarkTag, isComarkMark } from '../editor/marks'\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\n\ntype ElementMarkdownNode = Extract<MarkdownNode, readonly [string, Schema.JsonObject, ...MarkdownNode[]]>\n\ninterface DecodeContext {\n readonly usedIds: Set<EditorNodeId>\n}\n\nconst OPAQUE_BLOCK_TAGS = new Set(['math', 'table', 'tbody', 'td', 'th', 'thead', 'tr'])\n\nexport function comarkToEditor(\n nodes: ReadonlyArray<MarkdownNode>,\n renderData: NodeRenderData = { data: {}, frontmatter: {}, meta: {}, props: {} },\n): JSONContent[] {\n return decodeBlocks(\n nodes,\n {\n usedIds: new Set(),\n },\n renderData,\n )\n}\n\nfunction decodeBlocks(\n nodes: ReadonlyArray<MarkdownNode>,\n context: DecodeContext,\n renderData: NodeRenderData,\n wrapInlineContent = false,\n): JSONContent[] {\n const content: JSONContent[] = []\n let inlineNodes: MarkdownNode[] = []\n\n const flushInlineNodes = () => {\n const inline = decodeInlines(inlineNodes, context, renderData)\n if (inline.length) {\n content.push({\n type: 'paragraph',\n attrs: wrapInlineContent ? { cmsSynthetic: true } : { cmsNodeId: claimIdentity(context) },\n content: inline,\n })\n }\n inlineNodes = []\n }\n\n for (const node of nodes) {\n if (Predicate.isString(node) || isInlineElement(node)) {\n inlineNodes.push(node)\n continue\n }\n flushInlineNodes()\n content.push(decodeBlock(node, context, renderData))\n }\n flushInlineNodes()\n return content\n}\n\nfunction decodeBlock(\n node: Exclude<MarkdownNode, string>,\n context: DecodeContext,\n renderData: NodeRenderData,\n): JSONContent {\n if (node[0] === null) {\n return opaqueBlock(node, 'Comment', claimIdentity(context, node[1]))\n }\n\n const [tag, rawAttributes, ...children] = node\n const attrs = cleanAttrs(rawAttributes)\n const childRenderData = withCmsComarkProps(renderData, resolveCmsComarkAttributes(rawAttributes, renderData))\n const metadata = editorMetadata(rawAttributes)\n const cmsNodeId = claimIdentity(context, rawAttributes)\n const commonAttrs = compactJsonAttributes({\n cmsNodeId,\n cmsProps: attrs,\n })\n\n if (/^h[1-6]$/u.test(tag)) {\n return {\n type: 'heading',\n attrs: mergeJsonAttributes(commonAttrs, { level: Number(tag.slice(1)) }),\n content: decodeInlines(children, context, childRenderData),\n }\n }\n\n switch (tag) {\n case 'p':\n return { type: 'paragraph', attrs: commonAttrs, content: decodeInlines(children, context, childRenderData) }\n case 'blockquote':\n return {\n type: 'blockquote',\n attrs: commonAttrs,\n content: decodeBlocks(children, context, childRenderData),\n }\n case 'ul':\n return {\n type: 'bulletList',\n attrs: commonAttrs,\n content: decodeListItems(children, context, childRenderData),\n }\n case 'ol':\n return {\n type: 'orderedList',\n attrs: mergeJsonAttributes(commonAttrs, { start: finiteNumberAttribute(attrs.start, 1) }),\n content: decodeListItems(children, context, childRenderData),\n }\n case 'li':\n return {\n type: 'listItem',\n attrs: commonAttrs,\n content: decodeBlocks(children, context, childRenderData),\n }\n case 'pre': {\n const code = children.find(isElementNode)\n const language =\n nonEmptyStringAttribute(attrs.language) ?? nonEmptyStringAttribute(code?.[1].class)?.replace(/^language-/u, '')\n return {\n type: 'codeBlock',\n attrs: mergeJsonAttributes(commonAttrs, { language }),\n content: textContent(code ? elementChildren(code) : children),\n }\n }\n case 'hr':\n return { type: 'horizontalRule', attrs: commonAttrs }\n default:\n if (OPAQUE_BLOCK_TAGS.has(tag)) return opaqueBlock(node, tag, cmsNodeId)\n const projection = projectCmsEditorComponentAttributes(rawAttributes, renderData)\n return {\n type: 'cmsBlock',\n attrs: compactJsonAttributes({\n bindings: projection.bindings,\n cmsNodeId,\n props: projection.props,\n tag,\n }),\n content: decodeComponentSlots(children, context, projection.renderData, metadata?.implicitSlotId),\n }\n }\n}\n\nfunction decodeComponentSlots(\n children: ReadonlyArray<MarkdownNode>,\n context: DecodeContext,\n renderData: NodeRenderData,\n implicitSlotId?: EditorNodeId,\n): JSONContent[] {\n const templates = children.filter(isSlotTemplate)\n const regular = children.filter((node) => !isSlotTemplate(node))\n const slots = templates.map((node) => decodeSlot(node, context, renderData))\n if (!regular.length) return slots\n\n const defaultContent = slotContent(decodeBlocks(regular, context, renderData, true))\n const explicitDefault = slots.find((slot) => slot.attrs?.name === 'default')\n if (explicitDefault) {\n explicitDefault.content = [...(explicitDefault.content ?? []), ...defaultContent]\n return slots\n }\n\n return [\n {\n type: 'cmsSlot',\n attrs: {\n cmsNodeId: claimIdentityValue(context, implicitSlotId),\n implicit: true,\n name: 'default',\n props: {},\n },\n content: defaultContent,\n },\n ...slots,\n ]\n}\n\nfunction decodeSlot(node: ElementMarkdownNode, context: DecodeContext, renderData: NodeRenderData): JSONContent {\n const attrs = cleanAttrs(node[1])\n const childRenderData = withCmsComarkProps(renderData, resolveCmsComarkAttributes(node[1], renderData))\n const name = slotName(attrs)\n const { name: _name, ...slotProps } = attrs\n return {\n type: 'cmsSlot',\n attrs: {\n cmsNodeId: claimIdentity(context, node[1]),\n implicit: false,\n name,\n props: slotProps,\n },\n content: slotContent(decodeBlocks(elementChildren(node), context, childRenderData, true)),\n }\n}\n\nfunction decodeListItems(\n nodes: ReadonlyArray<MarkdownNode>,\n context: DecodeContext,\n renderData: NodeRenderData,\n): JSONContent[] {\n return nodes\n .filter(isElementNode)\n .filter((node) => node[0] === 'li')\n .map((node) => decodeBlock(node, context, renderData))\n}\n\nfunction decodeInlines(\n nodes: ReadonlyArray<MarkdownNode>,\n context: DecodeContext,\n renderData: NodeRenderData,\n inheritedMarks: NonNullable<JSONContent['marks']> = [],\n): JSONContent[] {\n const result: JSONContent[] = []\n for (const node of nodes) {\n if (Predicate.isString(node)) {\n if (node) {\n result.push(withMarks({ type: 'text', text: node }, inheritedMarks))\n }\n continue\n }\n if (node[0] === null) {\n result.push(\n withMarks(\n {\n type: 'cmsInlineOpaque',\n attrs: { label: 'Comment', node: stripInternalMetadata(node) },\n },\n inheritedMarks,\n ),\n )\n continue\n }\n\n const markType = editorMarkForComarkTag(node[0])\n if (markType) {\n const attrs = cleanAttrs(node[1])\n const childRenderData = withCmsComarkProps(renderData, resolveCmsComarkAttributes(node[1], renderData))\n const markAttrs =\n markType === 'link'\n ? mergeJsonAttributes(attrs, { cmsProps: attrs })\n : Object.keys(attrs).length\n ? { cmsProps: attrs }\n : undefined\n const mark = markAttrs === undefined ? { type: markType } : { attrs: markAttrs, type: markType }\n result.push(...decodeInlines(elementChildren(node), context, childRenderData, [...inheritedMarks, mark]))\n continue\n }\n\n if (node[0] === 'br') {\n result.push(withMarks({ type: 'hardBreak' }, inheritedMarks))\n continue\n }\n if (node[0] === 'img') {\n result.push(\n withMarks(\n {\n type: 'image',\n attrs: mergeJsonAttributes(decodeEditorImageAttributes(cleanAttrs(node[1])), {\n cmsNodeId: claimIdentity(context, node[1]),\n }),\n },\n inheritedMarks,\n ),\n )\n continue\n }\n\n result.push(\n withMarks(\n {\n type: 'cmsInlineOpaque',\n attrs: {\n label: node[0],\n node: stripInternalMetadata(node),\n },\n },\n inheritedMarks,\n ),\n )\n }\n return result\n}\n\nfunction claimIdentity(context: DecodeContext, attributes?: Schema.JsonObject): EditorNodeId {\n return claimIdentityValue(context, attributes ? editorMetadata(attributes)?.nodeId : undefined)\n}\n\nfunction claimIdentityValue(context: DecodeContext, candidate?: Schema.Json): EditorNodeId {\n const existing = editorNodeId(candidate)\n if (existing !== undefined && !context.usedIds.has(existing)) {\n context.usedIds.add(existing)\n return existing\n }\n for (let attempt = 0; attempt < 100; attempt++) {\n const created = createEditorNodeId()\n if (!context.usedIds.has(created)) {\n context.usedIds.add(created)\n return created\n }\n }\n throw new Error('The editor identity factory did not produce a unique identity.')\n}\n\nfunction opaqueBlock(node: Exclude<MarkdownNode, string>, label: string, cmsNodeId: EditorNodeId): JSONContent {\n return {\n type: 'cmsOpaque',\n attrs: {\n cmsNodeId,\n label,\n node: stripInternalMetadata(node),\n },\n }\n}\n\nfunction stripInternalMetadata(node: Exclude<MarkdownNode, string>): Exclude<MarkdownNode, string> {\n if (node[0] === null) return [null, cleanAttrs(node[1]), node[2]]\n const [tag, attributes, ...children] = node\n const clean = cleanAttrs(attributes)\n return [tag, clean, ...children.map((child) => (Predicate.isString(child) ? child : stripInternalMetadata(child)))]\n}\n\nfunction slotContent(content: JSONContent[]): JSONContent[] {\n return content.length ? content : [{ type: 'paragraph', attrs: { cmsSynthetic: true } }]\n}\n\nfunction slotName(attrs: Schema.JsonObject): string {\n return nonEmptyStringAttribute(attrs.name) ?? 'default'\n}\n\nfunction cleanAttrs(attrs: Schema.JsonObject): Schema.JsonObject {\n const { $: _internal, 'data-cms-node': _marker, ...clean } = attrs\n return structuredClone(clean)\n}\n\nfunction textContent(nodes: ReadonlyArray<MarkdownNode>): JSONContent[] | undefined {\n const text = nodes\n .map((node) =>\n Predicate.isString(node)\n ? node\n : node[0] === null\n ? node[2]\n : (textContent(elementChildren(node))\n ?.map((child) => child.text ?? '')\n .join('') ?? ''),\n )\n .join('')\n return text ? [{ type: 'text', text }] : undefined\n}\n\nfunction isInlineElement(node: Exclude<MarkdownNode, string>): boolean {\n return (\n node[0] !== null &&\n (isComarkMark(node[0]) || node[0] === 'br' || node[0] === 'img' || jsonObject(node[1].$).block === 0)\n )\n}\n\nfunction isSlotTemplate(node: MarkdownNode): node is ElementMarkdownNode {\n return isElementNode(node) && node[0] === 'template'\n}\n\nfunction isElementNode(node: MarkdownNode | undefined): node is ElementMarkdownNode {\n return Array.isArray(node) && Predicate.isString(node[0])\n}\n\nfunction elementChildren(node: ElementMarkdownNode): MarkdownNode[] {\n const [, , ...children] = node\n return children\n}\n\nfunction jsonObject(value: Schema.Json | undefined): Schema.JsonObject {\n return isJsonObject(value) ? value : {}\n}\n\nfunction mergeJsonAttributes(\n attributes: Schema.JsonObject,\n additions: Readonly<Record<string, Schema.Json | undefined>>,\n): Schema.JsonObject {\n return compactJsonAttributes(Object.assign({}, attributes, additions))\n}\n\nfunction withMarks(content: JSONContent, marks: NonNullable<JSONContent['marks']>): JSONContent {\n return marks.length ? Object.assign({}, content, { marks }) : content\n}\n","import { Schema } from 'effect'\n\nexport class EditorDocumentInvalid extends Schema.TaggedError<EditorDocumentInvalid>()('EditorDocument.Invalid', {\n message: Schema.NonEmptyString,\n cause: Schema.Defect(),\n}) {}\n\nexport class EditorRenderFailed extends Schema.TaggedError<EditorRenderFailed>()('EditorDocument.RenderFailed', {\n cause: Schema.Defect(),\n}) {}\n","import type { BlockAuthoring, BlockProp, BlockSlot } from '@internal/protocol/Authoring'\nimport type { Editor, JSONContent } from '@tiptap/core'\nimport type { ComponentDefinition } from '@internal/protocol/Configuration'\nimport { Extension } from '@tiptap/core'\nimport { Plugin } from '@tiptap/pm/state'\nimport { ySyncPluginKey } from '@tiptap/y-tiptap'\nimport { CmsMarkdownDocument } from '@internal/protocol/Documents'\nimport { Effect, Predicate, Schema } from 'effect'\nimport { comarkToEditor } from './internal/comark/to-editor'\nimport { createCmsComarkRenderData } from './internal/comark/document-adapter'\nimport { createDocumentParser } from './internal/comark/grammar'\nimport { EditorDocumentInvalid } from './internal/editor/errors'\nimport { createEditorNodeId } from './internal/editor/identity'\n\n/** Compiles insertion content with the same grammar used for publication. */\nexport const parseAuthoringContent = Effect.fn('AuthoringSchema.parseContent')(function* (markdown: string) {\n const body = yield* Effect.tryPromise({\n try: () => createDocumentParser()(markdown),\n catch: (cause) => new EditorDocumentInvalid({ cause, message: 'Invalid initial Markdown content.' }),\n })\n const decoded = yield* Schema.decodeUnknownEffect(CmsMarkdownDocument)(body)\n return decoded.nodes\n})\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\n\n/** Validates authored blocks during single-document compilation as well as catalog publication. */\nexport function validateAuthoringDocument(\n body: CmsMarkdownDocument,\n components: ReadonlyMap<string, ComponentDefinition> | undefined,\n): ReadonlyArray<string> {\n if (!components || ![...components.values()].some((component) => component.authoring)) return []\n function visit(node: JSONContent): ReadonlyArray<string> {\n const component = node.type === 'cmsBlock' ? components?.get(String(node.attrs?.tag).toLowerCase()) : undefined\n return [\n ...(component?.authoring\n ? createAuthoringSchema(component.name, component.authoring).validate(node, 'publish')\n : []),\n ...(node.content ?? []).flatMap(visit),\n ]\n }\n return comarkToEditor(body.nodes, createCmsComarkRenderData(body)).flatMap(visit)\n}\n\n/** Resolved block behavior shared by insertion, controls, and publication validation. */\nexport interface AuthoringSchema {\n readonly definition: BlockAuthoring\n readonly createContent: () => JSONContent\n readonly createSlot: (name: string) => JSONContent\n readonly setProperty: (current: Schema.JsonObject, name: string, value: Schema.Json | undefined) => Schema.JsonObject\n readonly validate: (node: JSONContent, purpose: 'working' | 'publish') => ReadonlyArray<string>\n}\n\nexport function createAuthoringSchema(name: string, definition: BlockAuthoring): AuthoringSchema {\n const fields = new Map(definition.props.map((field) => [field.name, field]))\n const slots = new Map(definition.slots.map((slot) => [slot.name, slot]))\n if (fields.size !== definition.props.length || slots.size !== definition.slots.length) {\n throw new Error(`${definition.label}: authoring names must be unique.`)\n }\n const initialProps = {\n ...Object.fromEntries(\n definition.props.flatMap((field) => (field.defaultValue === undefined ? [] : [[field.name, field.defaultValue]])),\n ),\n ...definition.initialProps,\n }\n for (const field of definition.props) {\n if (field.defaultValue === undefined) continue\n const issue = propertyIssue(field, field.defaultValue, 'working')\n if (issue) throw new Error(`Invalid default for ${definition.label}: ${issue}`)\n }\n\n function createSlot(slotName: string): JSONContent {\n const slot = slots.get(slotName)\n if (!slot) throw new Error(`${definition.label}: unknown content region ${slotName}.`)\n const content = slot.initial ? comarkToEditor(slot.initial) : []\n return {\n type: 'cmsSlot',\n attrs: { cmsNodeId: createEditorNodeId(), name: slotName, implicit: slotName === 'default', props: {} },\n content: content.length ? content : [{ type: 'paragraph', attrs: { cmsNodeId: createEditorNodeId() } }],\n }\n }\n\n function createContent(): JSONContent {\n return {\n type: 'cmsBlock',\n attrs: { cmsNodeId: createEditorNodeId(), tag: name, props: structuredClone(initialProps) },\n content: definition.slots\n .filter((slot) => slot.required || slot.initial !== undefined)\n .map((slot) => createSlot(slot.name)),\n }\n }\n\n function validate(node: JSONContent, purpose: 'working' | 'publish'): ReadonlyArray<string> {\n const issues: string[] = []\n const attributes = node.attrs?.props\n const values = isJsonObject(attributes) ? attributes : {}\n for (const key of Object.keys(values))\n if (!fields.has(key)) issues.push(`${definition.label}: ${key} is not editable.`)\n for (const field of definition.props) {\n const value = values[field.name] ?? (values[field.name] === null ? null : field.defaultValue)\n const issue = propertyIssue(field, value, purpose)\n if (issue) issues.push(issue)\n }\n const used = new Set<string>()\n for (const region of node.content ?? []) {\n const key = String(region.attrs?.name ?? 'default')\n const slot = slots.get(key)\n if (!slot || region.type !== 'cmsSlot') {\n issues.push(`${definition.label}: unsupported content region ${key}.`)\n continue\n }\n if (used.has(key)) issues.push(`${slot.label} can only appear once.`)\n used.add(key)\n if (!validRegion(slot, region.content ?? []))\n issues.push(`${slot.label} contains unsupported formatting or blocks.`)\n }\n for (const slot of definition.slots)\n if (slot.required && !used.has(slot.name)) issues.push(`${slot.label} is required.`)\n return issues\n }\n\n const schema: AuthoringSchema = {\n definition,\n createContent,\n createSlot,\n validate,\n setProperty(current: Schema.JsonObject, key: string, value: Schema.Json | undefined) {\n const field = fields.get(key)\n if (!field) throw new Error(`${definition.label}: ${key} is not editable.`)\n const issue = propertyIssue(field, value, 'working')\n if (issue) throw new Error(issue)\n const next = Object.fromEntries(Object.entries(current))\n if (value === undefined) delete next[key]\n else next[key] = value\n return next\n },\n }\n const issues = validate(createContent(), 'publish')\n if (issues.length) throw new Error(`Invalid initial content for ${definition.label}: ${issues.join(' ')}`)\n return schema\n}\n\n/** Context for Studio's formatting and insertion controls, resolved from the document selection. */\nexport function selectedAuthoringSlot(\n editor: Editor,\n components: ReadonlyArray<ComponentDefinition>,\n): BlockSlot | undefined {\n const position = editor.state.selection.$from\n for (let depth = position.depth; depth > 0; depth--) {\n const region = position.node(depth)\n if (region.type.name !== 'cmsSlot') continue\n const block = position.node(depth - 1)\n return components\n .find((component) => component.name === block.attrs.tag)\n ?.authoring?.slots.find((slot) => slot.name === region.attrs.name)\n }\n return undefined\n}\n\n/** Applies authoring rules to local edits. Remote CRDT updates always converge; publication validates them. */\nexport function createAuthoringExtension(components: ReadonlyArray<ComponentDefinition>): Extension {\n const schemas = new Map(\n components.flatMap((component) =>\n component.authoring\n ? [[component.name, createAuthoringSchema(component.name, component.authoring)] as const]\n : [],\n ),\n )\n function issues(content: JSONContent): string[] {\n return [\n ...(content.type === 'cmsBlock'\n ? (schemas.get(String(content.attrs?.tag))?.validate(content, 'working') ?? [])\n : []),\n ...(content.content ?? []).flatMap(issues),\n ]\n }\n return Extension.create({\n name: 'cmsAuthoringPolicy',\n addProseMirrorPlugins() {\n return [\n new Plugin({\n filterTransaction(transaction, state) {\n if (!transaction.docChanged || transaction.getMeta(ySyncPluginKey)?.isChangeOrigin) return true\n const previous = issues(state.doc.toJSON())\n return issues(transaction.doc.toJSON()).every((issue) => {\n const index = previous.indexOf(issue)\n if (index < 0) return false\n previous.splice(index, 1)\n return true\n })\n },\n }),\n ]\n },\n })\n}\n\nfunction propertyIssue(\n field: BlockProp,\n value: Schema.Json | undefined,\n purpose: 'working' | 'publish',\n): string | undefined {\n if (value === undefined) return field.required && purpose === 'publish' ? `${field.label} is required.` : undefined\n if (value === null && field.nullable) return undefined\n const valid =\n field.type === 'string'\n ? Predicate.isString(value)\n : field.type === 'number'\n ? Predicate.isNumber(value) && Number.isFinite(value)\n : Predicate.isBoolean(value)\n if (!valid) return `${field.label} must be ${field.type}.`\n if (field.options.length && !field.options.some((option) => option.value === value))\n return `${field.label} must use one of its available choices.`\n return undefined\n}\n\nfunction validRegion(slot: BlockSlot, content: ReadonlyArray<JSONContent>): boolean {\n const types = new Set(['paragraph', 'text', 'hardBreak'])\n const marks = new Set<string>()\n if (slot.input === 'text' && content.length > 1) return false\n if (slot.input === 'rich-text')\n for (const feature of slot.features) {\n if (feature === 'bullet-list') {\n types.add('bulletList')\n types.add('listItem')\n } else marks.add(feature)\n }\n const valid = (node: JSONContent): boolean =>\n types.has(node.type ?? '') &&\n (node.marks ?? []).every((mark) => marks.has(mark.type)) &&\n (node.content ?? []).every(valid)\n return content.every(valid)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,MAAMA,iBAAe,OAAO,GAAG,OAAO,UAAU;AAChD,MAAM,aAAa,OAAO,oBAAoB,OAAO,IAAI;;AAYzD,SAAgB,2BACd,YACA,YACqB;CACrB,MAAM,2BAAW,IAAI,IAAqC;CAC1D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QACjC,kBAAkB,0BAA0B,UAAU,GAAG,YAAY,EAAE,WAAW,KAAK,CAAC,CAC1F,GAAG;EACD,IAAI,UAAU,YAAY,KAAK,GAAG;GAChC,SAAS,IAAI,MAAM,MAAS;GAC5B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AI,UAAU;CACtB,OAAO,MAAM,IAAI,OAAO;CAE5B,MAAM,SAAS,SACb,MAAM,IAAI,KAAK,QAAQ,EAAE,MACxB,KAAK,SAAS,CAAC,EAAC,CAAE,OAAO,SAAS,MAAM,IAAI,KAAK,IAAI,CAAC,MACtD,KAAK,WAAW,CAAC,EAAC,CAAE,MAAM,KAAK;CAClC,OAAO,QAAQ,MAAM,KAAK;AAC5B"}
@@ -0,0 +1,150 @@
1
+ import { F as Locale, I as SourceDirectory, N as AddressPattern, P as CollectionName, S as MarkdownNode } from "./models-Citx8jBi.js";
2
+ import { Schema } from "effect";
3
+
4
+ //#region ../protocol/src/Authoring.ts
5
+ /** Serializable component authoring data resolved by the framework compiler. */
6
+ const BlockProp = Schema.Struct({
7
+ name: Schema.NonEmptyString,
8
+ label: Schema.NonEmptyString,
9
+ help: Schema.optionalKey(Schema.String),
10
+ type: Schema.Literals([
11
+ "string",
12
+ "number",
13
+ "boolean"
14
+ ]),
15
+ input: Schema.Literals([
16
+ "text",
17
+ "textarea",
18
+ "select",
19
+ "number",
20
+ "toggle"
21
+ ]),
22
+ required: Schema.Boolean,
23
+ nullable: Schema.Boolean,
24
+ defaultValue: Schema.optionalKey(Schema.Json),
25
+ options: Schema.Array(Schema.Struct({
26
+ value: Schema.String,
27
+ label: Schema.String
28
+ }))
29
+ });
30
+ const BlockSlot = Schema.Struct({
31
+ name: Schema.NonEmptyString,
32
+ label: Schema.NonEmptyString,
33
+ help: Schema.optionalKey(Schema.String),
34
+ required: Schema.Boolean,
35
+ input: Schema.Literals(["text", "rich-text"]),
36
+ features: Schema.Array(Schema.Literals([
37
+ "bold",
38
+ "italic",
39
+ "link",
40
+ "bullet-list",
41
+ "code"
42
+ ])),
43
+ initial: Schema.optionalKey(Schema.Array(MarkdownNode))
44
+ });
45
+ const BlockAuthoring = Schema.Struct({
46
+ version: Schema.Literal(1),
47
+ label: Schema.NonEmptyString,
48
+ description: Schema.optionalKey(Schema.String),
49
+ group: Schema.optionalKey(Schema.String),
50
+ icon: Schema.optionalKey(Schema.String),
51
+ props: Schema.Array(BlockProp),
52
+ slots: Schema.Array(BlockSlot),
53
+ initialProps: Schema.JsonObject
54
+ });
55
+
56
+ //#endregion
57
+ //#region ../protocol/src/Configuration.ts
58
+ /** Validated installation configuration shared by authoring, compilation, Studio, and Nuxt. */
59
+ const fieldPresentation = {
60
+ path: Schema.NonEmptyString,
61
+ label: Schema.NonEmptyString,
62
+ description: Schema.optionalKey(Schema.String),
63
+ defaultValue: Schema.optionalKey(Schema.Json),
64
+ required: Schema.Boolean
65
+ };
66
+ const BooleanAuthoringField = Schema.Struct({
67
+ type: Schema.tag("boolean"),
68
+ ...fieldPresentation,
69
+ input: Schema.Literal("toggle")
70
+ });
71
+ const DateAuthoringField = Schema.Struct({
72
+ type: Schema.tag("date"),
73
+ ...fieldPresentation,
74
+ input: Schema.Literal("date")
75
+ });
76
+ const NumberAuthoringField = Schema.Struct({
77
+ type: Schema.tag("number"),
78
+ ...fieldPresentation,
79
+ input: Schema.Literals(["number", "select"]),
80
+ options: Schema.Array(Schema.Finite)
81
+ });
82
+ const StringAuthoringField = Schema.Struct({
83
+ type: Schema.tag("string"),
84
+ ...fieldPresentation,
85
+ input: Schema.Literals([
86
+ "select",
87
+ "text",
88
+ "textarea"
89
+ ]),
90
+ options: Schema.Array(Schema.String)
91
+ });
92
+ const StringArrayAuthoringField = Schema.Struct({
93
+ type: Schema.tag("string[]"),
94
+ ...fieldPresentation,
95
+ input: Schema.Literal("multiselect"),
96
+ options: Schema.Array(Schema.String)
97
+ });
98
+ const DocumentField = Schema.Union([
99
+ BooleanAuthoringField,
100
+ DateAuthoringField,
101
+ NumberAuthoringField,
102
+ StringArrayAuthoringField,
103
+ StringAuthoringField
104
+ ]);
105
+ const CollectionDefinition = Schema.Struct({
106
+ collection: CollectionName,
107
+ label: Schema.NonEmptyString,
108
+ description: Schema.String,
109
+ directory: SourceDirectory,
110
+ addressPattern: AddressPattern,
111
+ hierarchy: Schema.Boolean,
112
+ canCreate: Schema.Boolean,
113
+ authoringFields: Schema.Array(DocumentField)
114
+ }).annotate({ identifier: "CollectionDefinition" });
115
+ const LocaleConfiguration = Schema.Struct({
116
+ locales: Schema.Array(Locale),
117
+ defaultLocale: Locale,
118
+ fallbackLocale: Schema.NullOr(Locale),
119
+ prefixDefaultLocale: Schema.Boolean
120
+ }).annotate({ identifier: "LocaleConfiguration" });
121
+ const DocumentConfiguration = Schema.Struct({
122
+ types: Schema.Array(CollectionDefinition),
123
+ locales: Schema.optionalKey(LocaleConfiguration)
124
+ }).annotate({ identifier: "DocumentConfiguration" });
125
+ const ComponentPropDefinition = Schema.Struct({
126
+ name: Schema.NonEmptyString,
127
+ required: Schema.Boolean,
128
+ type: Schema.Literals([
129
+ "array",
130
+ "boolean",
131
+ "number",
132
+ "object",
133
+ "string"
134
+ ])
135
+ });
136
+ const ComponentSlotDefinition = Schema.Struct({ name: Schema.NonEmptyString });
137
+ const ComponentDefinition = Schema.Struct({
138
+ authoring: Schema.optionalKey(BlockAuthoring),
139
+ name: Schema.NonEmptyString,
140
+ props: Schema.Array(ComponentPropDefinition),
141
+ slots: Schema.Array(ComponentSlotDefinition)
142
+ }).annotate({ identifier: "ComponentDefinition" });
143
+ const MediaConfiguration = Schema.Struct({
144
+ enabled: Schema.Boolean,
145
+ maxUploadBytes: Schema.Int.check(Schema.isGreaterThan(0))
146
+ });
147
+
148
+ //#endregion
149
+ export { BlockAuthoring as i, DocumentConfiguration as n, MediaConfiguration as r, ComponentDefinition as t };
150
+ //# sourceMappingURL=Configuration-BGYFD2N1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Configuration-BGYFD2N1.js","names":[],"sources":["../../../../protocol/src/Authoring.ts","../../../../protocol/src/Configuration.ts"],"sourcesContent":["/** Serializable component authoring data resolved by the framework compiler. */\nimport { Schema } from 'effect'\nimport { MarkdownNode } from './internal/documents/models'\n\nexport const BlockProp = Schema.Struct({\n name: Schema.NonEmptyString,\n label: Schema.NonEmptyString,\n help: Schema.optionalKey(Schema.String),\n type: Schema.Literals(['string', 'number', 'boolean']),\n input: Schema.Literals(['text', 'textarea', 'select', 'number', 'toggle']),\n required: Schema.Boolean,\n nullable: Schema.Boolean,\n defaultValue: Schema.optionalKey(Schema.Json),\n options: Schema.Array(Schema.Struct({ value: Schema.String, label: Schema.String })),\n})\nexport interface BlockProp extends Schema.Schema.Type<typeof BlockProp> {}\n\nexport const BlockSlot = Schema.Struct({\n name: Schema.NonEmptyString,\n label: Schema.NonEmptyString,\n help: Schema.optionalKey(Schema.String),\n required: Schema.Boolean,\n input: Schema.Literals(['text', 'rich-text']),\n features: Schema.Array(Schema.Literals(['bold', 'italic', 'link', 'bullet-list', 'code'])),\n initial: Schema.optionalKey(Schema.Array(MarkdownNode)),\n})\nexport interface BlockSlot extends Schema.Schema.Type<typeof BlockSlot> {}\n\nexport const BlockAuthoring = Schema.Struct({\n version: Schema.Literal(1),\n label: Schema.NonEmptyString,\n description: Schema.optionalKey(Schema.String),\n group: Schema.optionalKey(Schema.String),\n icon: Schema.optionalKey(Schema.String),\n props: Schema.Array(BlockProp),\n slots: Schema.Array(BlockSlot),\n initialProps: Schema.JsonObject,\n})\nexport interface BlockAuthoring extends Schema.Schema.Type<typeof BlockAuthoring> {}\n","/** Validated installation configuration shared by authoring, compilation, Studio, and Nuxt. */\nimport { Schema } from 'effect'\nimport { BlockAuthoring } from './Authoring'\nimport { AddressPattern, CollectionName, Locale, SourceDirectory } from './internal/configuration/scalars'\n\nexport { AddressPattern, CollectionName, Locale, SourceDirectory } from './internal/configuration/scalars'\n\nconst fieldPresentation = {\n path: Schema.NonEmptyString,\n label: Schema.NonEmptyString,\n description: Schema.optionalKey(Schema.String),\n defaultValue: Schema.optionalKey(Schema.Json),\n required: Schema.Boolean,\n}\n\nconst BooleanAuthoringField = Schema.Struct({\n type: Schema.tag('boolean'),\n ...fieldPresentation,\n input: Schema.Literal('toggle'),\n})\n\nconst DateAuthoringField = Schema.Struct({\n type: Schema.tag('date'),\n ...fieldPresentation,\n input: Schema.Literal('date'),\n})\n\nconst NumberAuthoringField = Schema.Struct({\n type: Schema.tag('number'),\n ...fieldPresentation,\n input: Schema.Literals(['number', 'select']),\n options: Schema.Array(Schema.Finite),\n})\n\nconst StringAuthoringField = Schema.Struct({\n type: Schema.tag('string'),\n ...fieldPresentation,\n input: Schema.Literals(['select', 'text', 'textarea']),\n options: Schema.Array(Schema.String),\n})\n\nconst StringArrayAuthoringField = Schema.Struct({\n type: Schema.tag('string[]'),\n ...fieldPresentation,\n input: Schema.Literal('multiselect'),\n options: Schema.Array(Schema.String),\n})\n\nexport const DocumentField = Schema.Union([\n BooleanAuthoringField,\n DateAuthoringField,\n NumberAuthoringField,\n StringArrayAuthoringField,\n StringAuthoringField,\n])\nexport type DocumentField = typeof DocumentField.Type\n\nexport const CollectionDefinition = Schema.Struct({\n collection: CollectionName,\n label: Schema.NonEmptyString,\n description: Schema.String,\n directory: SourceDirectory,\n addressPattern: AddressPattern,\n hierarchy: Schema.Boolean,\n canCreate: Schema.Boolean,\n authoringFields: Schema.Array(DocumentField),\n}).annotate({ identifier: 'CollectionDefinition' })\nexport interface CollectionDefinition extends Schema.Schema.Type<typeof CollectionDefinition> {}\n\nexport const LocaleConfiguration = Schema.Struct({\n locales: Schema.Array(Locale),\n defaultLocale: Locale,\n fallbackLocale: Schema.NullOr(Locale),\n prefixDefaultLocale: Schema.Boolean,\n}).annotate({ identifier: 'LocaleConfiguration' })\nexport interface LocaleConfiguration extends Schema.Schema.Type<typeof LocaleConfiguration> {}\n\nexport const DocumentConfiguration = Schema.Struct({\n types: Schema.Array(CollectionDefinition),\n locales: Schema.optionalKey(LocaleConfiguration),\n}).annotate({ identifier: 'DocumentConfiguration' })\nexport interface DocumentConfiguration extends Schema.Schema.Type<typeof DocumentConfiguration> {}\n\nexport const ComponentPropDefinition = Schema.Struct({\n name: Schema.NonEmptyString,\n required: Schema.Boolean,\n type: Schema.Literals(['array', 'boolean', 'number', 'object', 'string']),\n})\nexport interface ComponentPropDefinition extends Schema.Schema.Type<typeof ComponentPropDefinition> {}\n\nconst ComponentSlotDefinition = Schema.Struct({\n name: Schema.NonEmptyString,\n})\n\nexport const ComponentDefinition = Schema.Struct({\n authoring: Schema.optionalKey(BlockAuthoring),\n name: Schema.NonEmptyString,\n props: Schema.Array(ComponentPropDefinition),\n slots: Schema.Array(ComponentSlotDefinition),\n}).annotate({ identifier: 'ComponentDefinition' })\nexport interface ComponentDefinition extends Schema.Schema.Type<typeof ComponentDefinition> {}\n\nexport const MediaConfiguration = Schema.Struct({\n enabled: Schema.Boolean,\n maxUploadBytes: Schema.Int.check(Schema.isGreaterThan(0)),\n})\nexport interface MediaConfiguration extends Schema.Schema.Type<typeof MediaConfiguration> {}\n"],"mappings":";;;;;AAIA,MAAa,YAAY,OAAO,OAAO;CACrC,MAAM,OAAO;CACb,OAAO,OAAO;CACd,MAAM,OAAO,YAAY,OAAO,MAAM;CACtC,MAAM,OAAO,SAAS;EAAC;EAAU;EAAU;CAAS,CAAC;CACrD,OAAO,OAAO,SAAS;EAAC;EAAQ;EAAY;EAAU;EAAU;CAAQ,CAAC;CACzE,UAAU,OAAO;CACjB,UAAU,OAAO;CACjB,cAAc,OAAO,YAAY,OAAO,IAAI;CAC5C,SAAS,OAAO,MAAM,OAAO,OAAO;EAAE,OAAO,OAAO;EAAQ,OAAO,OAAO;CAAO,CAAC,CAAC;AACrF,CAAC;AAGD,MAAa,YAAY,OAAO,OAAO;CACrC,MAAM,OAAO;CACb,OAAO,OAAO;CACd,MAAM,OAAO,YAAY,OAAO,MAAM;CACtC,UAAU,OAAO;CACjB,OAAO,OAAO,SAAS,CAAC,QAAQ,WAAW,CAAC;CAC5C,UAAU,OAAO,MAAM,OAAO,SAAS;EAAC;EAAQ;EAAU;EAAQ;EAAe;CAAM,CAAC,CAAC;CACzF,SAAS,OAAO,YAAY,OAAO,MAAM,YAAY,CAAC;AACxD,CAAC;AAGD,MAAa,iBAAiB,OAA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MAAa,uBAAuB,OAAO,OAAO;CAChD,YAAY;CACZ,OAAO,OAAO;CACd,aAAa,OAAO;CACpB,WAAW;CACX,gBAAgB;CAChB,WAAW,OAAO;CAClB,WAAW,OAAO;CAClB,iBAAiB,OAAO,MAAM,aAAa;AAC7C,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,uBAAuB,CAAC;AAGlD,MAAa,sBAAsB,OAAO,OAAO;CAC/C,SAAS,OAAO,MAAM,MAAM;CAC5B,eAAe;CACf,gBAAgB,OAAO,OAAO,MAAM;CACpC,qBAAqB,OAAO;AAC9B,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,sBAAsB,CAAC;AAGjD,MAAa,wBAAwB,OAAO,OAAO;CACjD,OAAO,OAAO,MAAM,oBAAoB;CACxC,SAAS,OAAO,YAAY,mBAAmB;AACjD,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,wBAAwB,CAAC;AAGnD,MAAa,0BAA0B,OAAO,OAAO;CACnD,MAAM,OAAO;CACb,UAAU,OAAO;CACjB,MAAM,OAAO,SAAS;EAAC;EAAS;EAAW;EAAU;EAAU;CAAQ,CAAC;AAC1E,CAAC;AAGD,MAAM,0BAA0B,OAAO,OAAO,EAC5C,MAAM,OAAO,eACf,CAAC;AAED,MAAa,sBAAsB,OAAO,OAAO;CAC/C,WAAW,OAAO,YAAY,cAAc;CAC5C,MAAM,OAAO;CACb,OAAO,OAAO,MAAM,uBAAuB;CAC3C,OAAO,OAAO,MAAM,uBAAuB;AAC7C,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,sBAAsB,CAAC;AAGjD,MAAa,qBAAqB,OAAO,OAAO;CAC9C,SAAS,OAAO;CAChB,gBAAgB,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { CmsDocumentModelOptions } from "./DocumentModel.js";
2
+ //#region src/Configuration.d.ts
3
+ export interface CmsInitialDocument {
4
+ readonly markdown: string;
5
+ readonly published: boolean;
6
+ readonly sourcePath: string;
7
+ }
8
+ export type CmsInitialDocumentProvider = () => PromiseLike<ReadonlyArray<CmsInitialDocument>> | ReadonlyArray<CmsInitialDocument>;
9
+ export interface CmsCleanupOptions {
10
+ readonly initialDelayMillis?: number;
11
+ readonly intervalMillis?: number;
12
+ }
13
+ export interface CmsMediaStorageCredentials {
14
+ readonly accessKeyId: string;
15
+ readonly secretAccessKey: string;
16
+ readonly sessionToken?: string;
17
+ }
18
+ export interface CmsMediaStorageOptions {
19
+ readonly bucket: string;
20
+ readonly credentials?: CmsMediaStorageCredentials;
21
+ readonly endpoint?: string;
22
+ readonly forcePathStyle?: boolean;
23
+ readonly provisionBucket?: boolean;
24
+ readonly region: string;
25
+ }
26
+ export interface CmsMediaOptions {
27
+ readonly maxUploadBytes?: number;
28
+ readonly publicBaseUrl: string;
29
+ readonly storage: CmsMediaStorageOptions;
30
+ }
31
+ export interface CmsConfiguration {
32
+ readonly baseUrl: string;
33
+ readonly cleanup?: false | CmsCleanupOptions;
34
+ readonly databaseUrl: string;
35
+ readonly documents: CmsDocumentModelOptions;
36
+ readonly initialSources?: CmsInitialDocumentProvider;
37
+ readonly initializationToken: string;
38
+ readonly media?: false | CmsMediaOptions;
39
+ readonly secret: string;
40
+ }
41
+ /** Preserves full inference while checking the authored CMS configuration. */
42
+ export declare function defineCmsConfig<const Configuration extends CmsConfiguration>(configuration: Configuration): Configuration;
43
+ //#endregion
44
+ //# sourceMappingURL=Configuration.d.ts.map
@@ -0,0 +1,9 @@
1
+ //#region src/Configuration.ts
2
+ /** Preserves full inference while checking the authored CMS configuration. */
3
+ function defineCmsConfig(configuration) {
4
+ return configuration;
5
+ }
6
+
7
+ //#endregion
8
+ export { defineCmsConfig };
9
+ //# sourceMappingURL=Configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Configuration.js","names":[],"sources":["../../../src/Configuration.ts"],"sourcesContent":["import type { CmsDocumentModelOptions } from './DocumentModel'\n\nexport interface CmsInitialDocument {\n readonly markdown: string\n readonly published: boolean\n readonly sourcePath: string\n}\n\nexport type CmsInitialDocumentProvider = () =>\n | PromiseLike<ReadonlyArray<CmsInitialDocument>>\n | ReadonlyArray<CmsInitialDocument>\n\nexport interface CmsCleanupOptions {\n readonly initialDelayMillis?: number\n readonly intervalMillis?: number\n}\n\nexport interface CmsMediaStorageCredentials {\n readonly accessKeyId: string\n readonly secretAccessKey: string\n readonly sessionToken?: string\n}\n\nexport interface CmsMediaStorageOptions {\n readonly bucket: string\n readonly credentials?: CmsMediaStorageCredentials\n readonly endpoint?: string\n readonly forcePathStyle?: boolean\n readonly provisionBucket?: boolean\n readonly region: string\n}\n\nexport interface CmsMediaOptions {\n readonly maxUploadBytes?: number\n readonly publicBaseUrl: string\n readonly storage: CmsMediaStorageOptions\n}\n\nexport interface CmsConfiguration {\n readonly baseUrl: string\n readonly cleanup?: false | CmsCleanupOptions\n readonly databaseUrl: string\n readonly documents: CmsDocumentModelOptions\n readonly initialSources?: CmsInitialDocumentProvider\n readonly initializationToken: string\n readonly media?: false | CmsMediaOptions\n readonly secret: string\n}\n\n/** Preserves full inference while checking the authored CMS configuration. */\nexport function defineCmsConfig<const Configuration extends CmsConfiguration>(\n configuration: Configuration,\n): Configuration {\n return configuration\n}\n"],"mappings":";;AAkDA,SAAgB,gBACd,eACe;CACf,OAAO;AACT"}