@voltro/cms 0.85.0 → 0.87.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.
- package/CHANGELOG.md +5987 -0
- package/README.md +138 -0
- package/THIRD-PARTY-NOTICES.md +864 -253
- package/dist/ContentForm.js +282 -0
- package/dist/RichDocumentEditor.js +550 -0
- package/dist/RichDocumentView.js +177 -0
- package/dist/RichTextSurface.js +135 -0
- package/dist/aiCandidates.js +199 -0
- package/dist/aiOperations.js +152 -0
- package/dist/applicationBuildSnapshotService.js +101 -0
- package/dist/assetRenditions.js +102 -0
- package/dist/assetRevision.js +46 -0
- package/dist/assetUseRights.js +72 -0
- package/dist/audiences.js +31 -0
- package/dist/availability.js +124 -0
- package/dist/blueprint.js +166 -0
- package/dist/build.d.ts +3063 -0
- package/dist/build.js +37 -0
- package/dist/buildApplicationAdmission.js +16 -0
- package/dist/buildApplicationCatalog.js +136 -0
- package/dist/buildApplicationCatalogTable.js +24 -0
- package/dist/buildApplicationRest.js +99 -0
- package/dist/buildApplicationUpload.js +111 -0
- package/dist/buildSnapshot.js +401 -0
- package/dist/buildSnapshotApplicationPin.js +32 -0
- package/dist/buildSnapshotRest.js +210 -0
- package/dist/buildSnapshotService.js +265 -0
- package/dist/buildSnapshotTables.js +25 -0
- package/dist/bulk.js +282 -0
- package/dist/cacheIdentity.js +152 -0
- package/dist/changes.js +307 -0
- package/dist/cmsContext.js +229 -0
- package/dist/collections.js +224 -0
- package/dist/consent.js +29 -0
- package/dist/contentLocations.js +53 -0
- package/dist/contentProjection.js +83 -0
- package/dist/contentRouteIdentity.js +13 -0
- package/dist/contentRouteMaterializer.js +97 -0
- package/dist/contentRouteTypes.js +39 -0
- package/dist/contentSeo.js +189 -0
- package/dist/contentTreePath.js +60 -0
- package/dist/contentType.js +208 -0
- package/dist/contentValues.js +18 -0
- package/dist/contentfulImport.js +162 -0
- package/dist/copies.js +89 -0
- package/dist/cutover.js +202 -0
- package/dist/deliveryChecks.js +138 -0
- package/dist/domainHost.js +7 -0
- package/dist/domains.js +139 -0
- package/dist/draftTexts.js +164 -0
- package/dist/duplicates.js +78 -0
- package/dist/edgePurge.js +69 -0
- package/dist/editHistory.js +113 -0
- package/dist/effectForm.js +11 -0
- package/dist/environmentAliases.js +138 -0
- package/dist/environments.js +147 -0
- package/dist/errors.js +107 -0
- package/dist/experiments.js +528 -0
- package/dist/exposure.js +28 -0
- package/dist/extensionManifest.js +81 -0
- package/dist/extensions.js +314 -0
- package/dist/fieldSchema.js +199 -0
- package/dist/formStrings.js +74 -0
- package/dist/frontendBindings.js +99 -0
- package/dist/frontendMedia.js +18 -0
- package/dist/glossary.js +73 -0
- package/dist/history.js +54 -0
- package/dist/htmlImport.js +297 -0
- package/dist/index.d.ts +771 -54
- package/dist/index.js +89 -6082
- package/dist/initializePublicRoutes.js +28 -0
- package/dist/liveContentRouteView.js +76 -0
- package/dist/media.js +29 -0
- package/dist/metrics.js +46 -0
- package/dist/migration.js +193 -0
- package/dist/migrationStages.js +13 -0
- package/dist/nativeOutputDeploymentService.js +205 -0
- package/dist/outputActivation.js +234 -0
- package/dist/outputActivationOrigin.js +51 -0
- package/dist/outputActivationStore.js +411 -0
- package/dist/outputActivationTables.js +11 -0
- package/dist/outputActivationTarget.js +81 -0
- package/dist/outputActivationTargetTable.js +25 -0
- package/dist/outputDeployment.js +174 -0
- package/dist/outputDeploymentRest.js +168 -0
- package/dist/outputDeploymentService.js +241 -0
- package/dist/outputRouteGraph.js +177 -0
- package/dist/outputSafetyArtifact.js +147 -0
- package/dist/outputTargetRest.js +62 -0
- package/dist/pathSegmentEncoding.js +4 -0
- package/dist/presenceAnchors.js +68 -0
- package/dist/preview.js +31 -0
- package/dist/privateCmsTransport.js +76 -0
- package/dist/privateNativeRouteReservation.js +10 -0
- package/dist/promotion.js +116 -0
- package/dist/publicBuild.js +90 -0
- package/dist/publicBuildRest.js +98 -0
- package/dist/publicBuildService.js +63 -0
- package/dist/publicOutputHttp.js +129 -0
- package/dist/publicOutputService.js +287 -0
- package/dist/publicPresentation.js +17 -0
- package/dist/publicRouteDispositionAdmission.js +38 -0
- package/dist/publicRouteHistoryStore.js +12 -0
- package/dist/publicRouteHistoryView.js +34 -0
- package/dist/publicRouteIntegrity.js +5 -0
- package/dist/publicRouteMutation.js +6 -0
- package/dist/publicRouteNamespace.js +134 -0
- package/dist/publicRoutePublication.js +36 -0
- package/dist/publicRouteRegistry.js +17 -0
- package/dist/publicRouteRegistryBinding.js +194 -0
- package/dist/publicRouteRegistryDefinition.js +76 -0
- package/dist/publicRouteSitePublication.js +40 -0
- package/dist/publicRouteTables.js +13 -0
- package/dist/publicRouteUrl.js +18 -0
- package/dist/publicationSeo.js +52 -0
- package/dist/publicationState.js +296 -0
- package/dist/quality.js +188 -0
- package/dist/reconfigurePublicRoutes.js +41 -0
- package/dist/recurrence.js +78 -0
- package/dist/redirects.js +130 -0
- package/dist/referenceGraph.js +224 -0
- package/dist/references.js +173 -0
- package/dist/release.js +241 -0
- package/dist/renderReadAuthority.js +43 -0
- package/dist/renderReadGrant.js +137 -0
- package/dist/rest.js +52 -0
- package/dist/review.js +160 -0
- package/dist/richDocument.js +521 -0
- package/dist/richInline.js +100 -0
- package/dist/routeDispositionGraph.js +44 -0
- package/dist/routeDispositionRest.js +51 -0
- package/dist/routeDispositionService.js +73 -0
- package/dist/routeDispositionStore.js +289 -0
- package/dist/routeDispositionTables.js +5 -0
- package/dist/routeDispositions.js +91 -0
- package/dist/routeHistoryStorage.js +320 -0
- package/dist/routeHistoryStore.js +12 -0
- package/dist/schedule.js +80 -0
- package/dist/search.js +148 -0
- package/dist/selectionIntent.js +164 -0
- package/dist/seo.js +31 -0
- package/dist/series.js +105 -0
- package/dist/share.js +112 -0
- package/dist/siteBindings.js +159 -0
- package/dist/siteBuildCandidate.js +104 -0
- package/dist/siteDelivery.js +115 -0
- package/dist/siteState.js +47 -0
- package/dist/snapshotAddressGraph.js +55 -0
- package/dist/snapshotAddressRead.js +73 -0
- package/dist/snapshotAppConsumer.js +71 -0
- package/dist/snapshotAppExecution.js +102 -0
- package/dist/snapshotApplication.js +75 -0
- package/dist/snapshotApprovedRouteDispositions.js +44 -0
- package/dist/snapshotAssetAssembly.js +70 -0
- package/dist/snapshotAssetAssemblyRest.js +50 -0
- package/dist/snapshotBindingRead.js +61 -0
- package/dist/snapshotCodeSeo.js +29 -0
- package/dist/snapshotComponent.js +34 -0
- package/dist/snapshotComponentSource.js +24 -0
- package/dist/snapshotConsumer.js +87 -0
- package/dist/snapshotContentIdentity.js +10 -0
- package/dist/snapshotDefinitions.js +264 -0
- package/dist/snapshotDocumentAssembly.js +193 -0
- package/dist/snapshotDocumentAssemblyRest.js +84 -0
- package/dist/snapshotDocumentProjection.js +202 -0
- package/dist/snapshotDocumentTransfer.js +35 -0
- package/dist/snapshotDocumentTransferRest.js +80 -0
- package/dist/snapshotDomains.js +56 -0
- package/dist/snapshotEnvironment.js +31 -0
- package/dist/snapshotFieldPlan.js +85 -0
- package/dist/snapshotFrontend.js +103 -0
- package/dist/snapshotLink.js +8 -0
- package/dist/snapshotMedia.js +111 -0
- package/dist/snapshotMediaCapture.js +246 -0
- package/dist/snapshotMediaFields.js +225 -0
- package/dist/snapshotMediaRead.js +185 -0
- package/dist/snapshotMediaReader.js +13 -0
- package/dist/snapshotObservation.js +16 -0
- package/dist/snapshotObservedRouteHistory.js +34 -0
- package/dist/snapshotOutputTransfer.js +78 -0
- package/dist/snapshotPageLoader.js +7 -0
- package/dist/snapshotPageSeo.js +59 -0
- package/dist/snapshotPathLocale.js +15 -0
- package/dist/snapshotPresentation.js +86 -0
- package/dist/snapshotPresentationPolicy.js +12 -0
- package/dist/snapshotProjection.js +119 -0
- package/dist/snapshotPublicAccess.js +161 -0
- package/dist/snapshotPublicRouteHistory.js +40 -0
- package/dist/snapshotReadAdmission.js +38 -0
- package/dist/snapshotRedirectOutput.js +151 -0
- package/dist/snapshotRedirectTargets.js +24 -0
- package/dist/snapshotRedirects.js +132 -0
- package/dist/snapshotReference.js +8 -0
- package/dist/snapshotReferenceAddress.js +10 -0
- package/dist/snapshotReferenceGraph.js +79 -0
- package/dist/snapshotReferenceRead.js +65 -0
- package/dist/snapshotRelease.js +99 -0
- package/dist/snapshotRender.js +361 -0
- package/dist/snapshotRenderDependencies.js +178 -0
- package/dist/snapshotRenditions.js +88 -0
- package/dist/snapshotRichDocument.js +62 -0
- package/dist/snapshotRoleTransfer.js +106 -0
- package/dist/snapshotRoleTransferRest.js +99 -0
- package/dist/snapshotRouteAdmission.js +71 -0
- package/dist/snapshotRouteDispatch.js +111 -0
- package/dist/snapshotRouteDispositionPlan.js +73 -0
- package/dist/snapshotRouteRead.js +43 -0
- package/dist/snapshotRoutes.js +79 -0
- package/dist/snapshotRouting.js +113 -0
- package/dist/snapshotSeo.js +179 -0
- package/dist/snapshotSeoControls.js +101 -0
- package/dist/snapshotSeoDocumentInventory.js +115 -0
- package/dist/snapshotSeoDocuments.js +129 -0
- package/dist/snapshotSeoMerge.js +85 -0
- package/dist/snapshotSeoMetadata.js +137 -0
- package/dist/snapshotSeoOutput.js +173 -0
- package/dist/snapshotSeoPathSets.js +105 -0
- package/dist/snapshotSeoRead.js +88 -0
- package/dist/snapshotSite.js +128 -0
- package/dist/snapshotSitemapFiles.js +36 -0
- package/dist/snapshotTreeDependencies.js +58 -0
- package/dist/snapshotTreeLoader.js +10 -0
- package/dist/snapshotTreeRead.js +158 -0
- package/dist/staticPathSet.js +177 -0
- package/dist/staticPathSetRest.js +129 -0
- package/dist/staticPathSetService.js +249 -0
- package/dist/staticPathSetStore.js +338 -0
- package/dist/stewardship.js +146 -0
- package/dist/taxonomy.js +36 -0
- package/dist/team.js +103 -0
- package/dist/templates.js +106 -0
- package/dist/trackChanges.js +197 -0
- package/dist/translation.js +64 -0
- package/dist/tree.js +87 -0
- package/dist/usage.js +50 -0
- package/dist/validation.js +192 -0
- package/dist/visualEditing.js +60 -0
- package/dist/web.d.ts +709 -7
- package/dist/web.js +50 -2
- package/dist/workflow.js +322 -0
- package/dist/write.js +419 -0
- package/dist/xliff.js +325 -0
- package/package.json +20 -6
- package/dist/presenceAnchors-4iHAVQB3.js +0 -4367
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import { blockMarkup as e, inlineMarkupOf as t, listNumberedAt as n, newBlockId as r, normalizeRichDocument as i, withBlockMarkup as a } from "./richDocument.js";
|
|
2
|
+
import { inlineText as o, mergeInline as s } from "./richInline.js";
|
|
3
|
+
import { blockHasChanges as c, pendingChanges as l, resolveChanges as u } from "./trackChanges.js";
|
|
4
|
+
import { contentFormStrings as d } from "./formStrings.js";
|
|
5
|
+
import { RichDocumentView as f } from "./RichDocumentView.js";
|
|
6
|
+
import { RichTextSurface as p } from "./RichTextSurface.js";
|
|
7
|
+
import { useId as m, useMemo as h, useState as g } from "react";
|
|
8
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
9
|
+
//#region src/RichDocumentEditor.tsx
|
|
10
|
+
var b = (e) => {
|
|
11
|
+
let t = i(e ?? ""), n = t.blocks;
|
|
12
|
+
return Array.isArray(n) ? t : {
|
|
13
|
+
type: "doc",
|
|
14
|
+
blocks: []
|
|
15
|
+
};
|
|
16
|
+
}, x = (e, t) => {
|
|
17
|
+
let n = r();
|
|
18
|
+
switch (e) {
|
|
19
|
+
case "paragraph": return {
|
|
20
|
+
id: n,
|
|
21
|
+
type: e,
|
|
22
|
+
content: []
|
|
23
|
+
};
|
|
24
|
+
case "heading": return {
|
|
25
|
+
id: n,
|
|
26
|
+
type: e,
|
|
27
|
+
level: t.profile?.headings[0] ?? 2,
|
|
28
|
+
content: []
|
|
29
|
+
};
|
|
30
|
+
case "list": return {
|
|
31
|
+
id: n,
|
|
32
|
+
type: e,
|
|
33
|
+
ordered: !1,
|
|
34
|
+
items: []
|
|
35
|
+
};
|
|
36
|
+
case "table": return {
|
|
37
|
+
id: n,
|
|
38
|
+
type: e,
|
|
39
|
+
header: !0,
|
|
40
|
+
rows: []
|
|
41
|
+
};
|
|
42
|
+
case "image": return {
|
|
43
|
+
id: n,
|
|
44
|
+
type: e,
|
|
45
|
+
asset: ""
|
|
46
|
+
};
|
|
47
|
+
case "file": return {
|
|
48
|
+
id: n,
|
|
49
|
+
type: e,
|
|
50
|
+
asset: "",
|
|
51
|
+
label: ""
|
|
52
|
+
};
|
|
53
|
+
case "component": return {
|
|
54
|
+
id: n,
|
|
55
|
+
type: e,
|
|
56
|
+
componentId: t.profile?.components[0]?.id ?? "",
|
|
57
|
+
props: {}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}, S = ({ id: e, options: t, renderPicker: n, onInsert: r, words: i }) => {
|
|
61
|
+
let a = t.profile?.contactPoints !== void 0 && n !== void 0 ? t.profile.contactPoints : void 0, o = t.profile?.contactLiterals === !0, [s, c] = g(a === void 0 ? "email" : "point"), [l, u] = g(""), [d, f] = g("");
|
|
62
|
+
if (a === void 0 && !o) return null;
|
|
63
|
+
let p = s === "point" ? { target: l } : {
|
|
64
|
+
channel: s,
|
|
65
|
+
value: l.trim()
|
|
66
|
+
};
|
|
67
|
+
return /* @__PURE__ */ y("div", {
|
|
68
|
+
"data-cms-rich-contact": !0,
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ v("label", {
|
|
71
|
+
htmlFor: `${e}-contact-kind`,
|
|
72
|
+
children: i.contactKind
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ y("select", {
|
|
75
|
+
id: `${e}-contact-kind`,
|
|
76
|
+
value: s,
|
|
77
|
+
onChange: (e) => {
|
|
78
|
+
c(e.target.value), u("");
|
|
79
|
+
},
|
|
80
|
+
children: [
|
|
81
|
+
a === void 0 ? null : /* @__PURE__ */ v("option", {
|
|
82
|
+
value: "point",
|
|
83
|
+
children: i.contactPoint
|
|
84
|
+
}),
|
|
85
|
+
o ? /* @__PURE__ */ v("option", {
|
|
86
|
+
value: "email",
|
|
87
|
+
children: i.contactEmail
|
|
88
|
+
}) : null,
|
|
89
|
+
o ? /* @__PURE__ */ v("option", {
|
|
90
|
+
value: "phone",
|
|
91
|
+
children: i.contactPhone
|
|
92
|
+
}) : null
|
|
93
|
+
]
|
|
94
|
+
}),
|
|
95
|
+
s === "point" && a !== void 0 ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("label", {
|
|
96
|
+
htmlFor: `${e}-contact-value`,
|
|
97
|
+
children: i.contactPoint
|
|
98
|
+
}), n?.({
|
|
99
|
+
id: `${e}-contact-value`,
|
|
100
|
+
type: a,
|
|
101
|
+
value: l,
|
|
102
|
+
onChange: u,
|
|
103
|
+
role: "contact"
|
|
104
|
+
})] }) : /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("label", {
|
|
105
|
+
htmlFor: `${e}-contact-value`,
|
|
106
|
+
children: i.contactValue
|
|
107
|
+
}), /* @__PURE__ */ v("input", {
|
|
108
|
+
id: `${e}-contact-value`,
|
|
109
|
+
type: s === "email" ? "email" : "tel",
|
|
110
|
+
value: l,
|
|
111
|
+
onChange: (e) => u(e.target.value)
|
|
112
|
+
})] }),
|
|
113
|
+
/* @__PURE__ */ v("label", {
|
|
114
|
+
htmlFor: `${e}-contact-text`,
|
|
115
|
+
children: i.contactText
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ v("input", {
|
|
118
|
+
id: `${e}-contact-text`,
|
|
119
|
+
value: d,
|
|
120
|
+
onChange: (e) => f(e.target.value)
|
|
121
|
+
}),
|
|
122
|
+
/* @__PURE__ */ v("button", {
|
|
123
|
+
type: "button",
|
|
124
|
+
disabled: l.trim() === "" || d.trim() === "",
|
|
125
|
+
onClick: () => {
|
|
126
|
+
r({
|
|
127
|
+
type: "contact",
|
|
128
|
+
text: d.trim(),
|
|
129
|
+
contact: p
|
|
130
|
+
}), u(""), f("");
|
|
131
|
+
},
|
|
132
|
+
children: i.insertContact
|
|
133
|
+
})
|
|
134
|
+
]
|
|
135
|
+
});
|
|
136
|
+
}, C = ({ id: e, type: t, renderPicker: n, onInsert: r, words: i, target: a }) => {
|
|
137
|
+
let [o, s] = g(""), [c, l] = g("");
|
|
138
|
+
return /* @__PURE__ */ y("div", {
|
|
139
|
+
"data-cms-rich-link": !0,
|
|
140
|
+
role: "group",
|
|
141
|
+
"aria-labelledby": `${e}-link-label`,
|
|
142
|
+
children: [
|
|
143
|
+
/* @__PURE__ */ v("span", {
|
|
144
|
+
id: `${e}-link-label`,
|
|
145
|
+
children: i.linkTo
|
|
146
|
+
}),
|
|
147
|
+
n({
|
|
148
|
+
id: `${e}-link-target`,
|
|
149
|
+
type: t,
|
|
150
|
+
value: o,
|
|
151
|
+
onChange: s,
|
|
152
|
+
target: a,
|
|
153
|
+
role: "link",
|
|
154
|
+
labelledBy: `${e}-link-label`
|
|
155
|
+
}),
|
|
156
|
+
o === "" ? null : /* @__PURE__ */ y(_, { children: [
|
|
157
|
+
/* @__PURE__ */ v("label", {
|
|
158
|
+
htmlFor: `${e}-link-text`,
|
|
159
|
+
children: i.linkText
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ v("input", {
|
|
162
|
+
id: `${e}-link-text`,
|
|
163
|
+
value: c,
|
|
164
|
+
onChange: (e) => l(e.target.value)
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ v("button", {
|
|
167
|
+
type: "button",
|
|
168
|
+
disabled: c.trim() === "",
|
|
169
|
+
onClick: () => {
|
|
170
|
+
r({
|
|
171
|
+
type: "link",
|
|
172
|
+
target: o,
|
|
173
|
+
text: c.trim()
|
|
174
|
+
}), s(""), l("");
|
|
175
|
+
},
|
|
176
|
+
children: i.insertLink
|
|
177
|
+
})
|
|
178
|
+
] })
|
|
179
|
+
]
|
|
180
|
+
});
|
|
181
|
+
}, w = (r) => {
|
|
182
|
+
let { id: i, name: w, field: T, value: E, onChange: D, renderPicker: O, renderBlockAside: k, renderComponentProps: A } = r, j = d(r.strings), M = T.richText ?? {}, N = M.profile, P = Object.keys(N?.styles?.tokens ?? {}), F = h(() => b(E), [E]), I = m(), [L, R] = g({}), [z, B] = g("paragraph"), V = Object.keys(j.blockNames).filter((e) => e !== "image" || M.images !== void 0 && O !== void 0).filter((e) => e !== "file" || M.files !== void 0 && O !== void 0).filter((e) => N === void 0 ? e !== "component" : N.blocks.includes(e)).filter((e) => e !== "component" || A !== void 0), H = (e) => D({
|
|
183
|
+
type: "doc",
|
|
184
|
+
blocks: e
|
|
185
|
+
}), U = (e, t) => H(F.blocks.map((n, r) => r === e ? t : n)), W = (e, t) => {
|
|
186
|
+
if (t < 0 || t >= F.blocks.length) return;
|
|
187
|
+
let n = [...F.blocks], [r] = n.splice(e, 1);
|
|
188
|
+
r !== void 0 && n.splice(t, 0, r), H(n);
|
|
189
|
+
}, G = (e, t, n) => {
|
|
190
|
+
R((e) => ({
|
|
191
|
+
...e,
|
|
192
|
+
[t.id]: n
|
|
193
|
+
})), U(e, a(t, n, P));
|
|
194
|
+
}, K = (e, n, r, i) => G(e, n, `${r}${r === "" || r.endsWith(" ") || r.endsWith("\n") ? "" : " "}${t([i])}`), q = F.blocks.map((t, i) => {
|
|
195
|
+
let a = `${j.blockNames[t.type]} ${i + 1}`, d = `${I}-${t.id}`, m = L[t.id] ?? e(t);
|
|
196
|
+
if (c(t)) {
|
|
197
|
+
let e = l({
|
|
198
|
+
type: "doc",
|
|
199
|
+
blocks: [t]
|
|
200
|
+
});
|
|
201
|
+
return /* @__PURE__ */ y("fieldset", {
|
|
202
|
+
"data-cms-rich-block": t.type,
|
|
203
|
+
"data-cms-block-id": t.id,
|
|
204
|
+
"data-cms-rich-suggested": !0,
|
|
205
|
+
children: [
|
|
206
|
+
/* @__PURE__ */ v("legend", { children: a }),
|
|
207
|
+
/* @__PURE__ */ v("p", { children: j.suggestedChanges }),
|
|
208
|
+
/* @__PURE__ */ v("div", {
|
|
209
|
+
"data-cms-rich-preview": !0,
|
|
210
|
+
children: /* @__PURE__ */ v(f, { document: {
|
|
211
|
+
type: "doc",
|
|
212
|
+
blocks: [t]
|
|
213
|
+
} })
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ v("ul", { children: e.map((e) => /* @__PURE__ */ y("li", { children: [
|
|
216
|
+
j.changeBy(e.by, e.inserted, e.deleted),
|
|
217
|
+
" ",
|
|
218
|
+
/* @__PURE__ */ v("button", {
|
|
219
|
+
type: "button",
|
|
220
|
+
"aria-label": j.acceptLabel(e.by),
|
|
221
|
+
onClick: () => D(u(F, (t) => t.id === e.id ? "accept" : "keep")),
|
|
222
|
+
children: j.accept
|
|
223
|
+
}),
|
|
224
|
+
" ",
|
|
225
|
+
/* @__PURE__ */ v("button", {
|
|
226
|
+
type: "button",
|
|
227
|
+
"aria-label": j.rejectLabel(e.by),
|
|
228
|
+
onClick: () => D(u(F, (t) => t.id === e.id ? "reject" : "keep")),
|
|
229
|
+
children: j.reject
|
|
230
|
+
})
|
|
231
|
+
] }, e.id)) }),
|
|
232
|
+
k?.(t.id, a) ?? null
|
|
233
|
+
]
|
|
234
|
+
}, t.id);
|
|
235
|
+
}
|
|
236
|
+
return /* @__PURE__ */ y("fieldset", {
|
|
237
|
+
"data-cms-rich-block": t.type,
|
|
238
|
+
"data-cms-block-id": t.id,
|
|
239
|
+
children: [
|
|
240
|
+
/* @__PURE__ */ v("legend", { children: a }),
|
|
241
|
+
t.type === "heading" ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("label", {
|
|
242
|
+
htmlFor: `${d}-level`,
|
|
243
|
+
children: j.level
|
|
244
|
+
}), /* @__PURE__ */ v("select", {
|
|
245
|
+
id: `${d}-level`,
|
|
246
|
+
value: t.level,
|
|
247
|
+
onChange: (e) => U(i, {
|
|
248
|
+
...t,
|
|
249
|
+
level: e.target.value === "3" ? 3 : 2
|
|
250
|
+
}),
|
|
251
|
+
children: (N?.headings ?? [2, 3]).map((e) => /* @__PURE__ */ v("option", {
|
|
252
|
+
value: e,
|
|
253
|
+
children: e
|
|
254
|
+
}, e))
|
|
255
|
+
})] }) : null,
|
|
256
|
+
N?.styles !== void 0 && (t.type === "paragraph" || t.type === "heading" || t.type === "list") ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("label", {
|
|
257
|
+
htmlFor: `${d}-style`,
|
|
258
|
+
children: j.style
|
|
259
|
+
}), /* @__PURE__ */ y("select", {
|
|
260
|
+
id: `${d}-style`,
|
|
261
|
+
value: t.style ?? "",
|
|
262
|
+
onChange: (e) => {
|
|
263
|
+
let { style: n, ...r } = t;
|
|
264
|
+
U(i, e.target.value === "" ? r : {
|
|
265
|
+
...r,
|
|
266
|
+
style: e.target.value
|
|
267
|
+
});
|
|
268
|
+
},
|
|
269
|
+
children: [/* @__PURE__ */ v("option", {
|
|
270
|
+
value: "",
|
|
271
|
+
children: j.noStyle
|
|
272
|
+
}), Object.entries(N.styles.tokens).map(([e, t]) => /* @__PURE__ */ v("option", {
|
|
273
|
+
value: e,
|
|
274
|
+
children: `${e} — ${t}`
|
|
275
|
+
}, e))]
|
|
276
|
+
})] }) : null,
|
|
277
|
+
t.type === "list" ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ y("label", { children: [
|
|
278
|
+
/* @__PURE__ */ v("input", {
|
|
279
|
+
type: "checkbox",
|
|
280
|
+
checked: t.ordered,
|
|
281
|
+
onChange: (e) => U(i, {
|
|
282
|
+
...t,
|
|
283
|
+
ordered: e.target.checked
|
|
284
|
+
})
|
|
285
|
+
}),
|
|
286
|
+
" ",
|
|
287
|
+
j.numbered
|
|
288
|
+
] }), Array.from({ length: Math.max(0, ...t.levels ?? []) }, (e, t) => t + 1).map((e) => /* @__PURE__ */ y("label", { children: [
|
|
289
|
+
/* @__PURE__ */ v("input", {
|
|
290
|
+
type: "checkbox",
|
|
291
|
+
checked: n(t, e),
|
|
292
|
+
onChange: (r) => U(i, {
|
|
293
|
+
...t,
|
|
294
|
+
sublists: Array.from({ length: Math.max(e, t.sublists?.length ?? 0) }, (i, a) => a === e - 1 ? r.target.checked ? "ordered" : "unordered" : n(t, a + 1) ? "ordered" : "unordered")
|
|
295
|
+
})
|
|
296
|
+
}),
|
|
297
|
+
" ",
|
|
298
|
+
j.numberedAt(e + 1)
|
|
299
|
+
] }, e))] }) : null,
|
|
300
|
+
t.type === "table" ? /* @__PURE__ */ y("label", { children: [
|
|
301
|
+
/* @__PURE__ */ v("input", {
|
|
302
|
+
type: "checkbox",
|
|
303
|
+
checked: t.header,
|
|
304
|
+
onChange: (e) => U(i, {
|
|
305
|
+
...t,
|
|
306
|
+
header: e.target.checked
|
|
307
|
+
})
|
|
308
|
+
}),
|
|
309
|
+
" ",
|
|
310
|
+
j.headerRow
|
|
311
|
+
] }) : null,
|
|
312
|
+
t.type === "component" ? /* @__PURE__ */ y(_, { children: [
|
|
313
|
+
/* @__PURE__ */ v("label", {
|
|
314
|
+
htmlFor: `${d}-component`,
|
|
315
|
+
children: j.component
|
|
316
|
+
}),
|
|
317
|
+
/* @__PURE__ */ v("select", {
|
|
318
|
+
id: `${d}-component`,
|
|
319
|
+
value: t.componentId,
|
|
320
|
+
onChange: (e) => U(i, {
|
|
321
|
+
id: t.id,
|
|
322
|
+
type: "component",
|
|
323
|
+
componentId: e.target.value,
|
|
324
|
+
props: {}
|
|
325
|
+
}),
|
|
326
|
+
children: (N?.components ?? []).map((e) => /* @__PURE__ */ v("option", {
|
|
327
|
+
value: e.id,
|
|
328
|
+
children: e.displayName
|
|
329
|
+
}, e.id))
|
|
330
|
+
}),
|
|
331
|
+
((e) => e === void 0 ? /* @__PURE__ */ v("p", { children: j.unknownComponent(t.componentId) }) : /* @__PURE__ */ v("div", {
|
|
332
|
+
"data-cms-instance": t.id,
|
|
333
|
+
"data-cms-component": t.componentId,
|
|
334
|
+
children: A?.(e, t.props, (e) => U(i, {
|
|
335
|
+
...t,
|
|
336
|
+
props: e
|
|
337
|
+
}))
|
|
338
|
+
}))(N?.components.find((e) => e.id === t.componentId))
|
|
339
|
+
] }) : t.type === "image" ? /* @__PURE__ */ y(_, { children: [
|
|
340
|
+
/* @__PURE__ */ v("label", {
|
|
341
|
+
htmlFor: `${d}-asset`,
|
|
342
|
+
children: j.image
|
|
343
|
+
}),
|
|
344
|
+
O?.({
|
|
345
|
+
id: `${d}-asset`,
|
|
346
|
+
type: M.images ?? "",
|
|
347
|
+
value: t.asset,
|
|
348
|
+
onChange: (e) => U(i, {
|
|
349
|
+
...t,
|
|
350
|
+
asset: e
|
|
351
|
+
}),
|
|
352
|
+
target: {
|
|
353
|
+
field: w,
|
|
354
|
+
blockId: t.id
|
|
355
|
+
},
|
|
356
|
+
role: "image"
|
|
357
|
+
}),
|
|
358
|
+
/* @__PURE__ */ v("label", {
|
|
359
|
+
htmlFor: `${d}-caption`,
|
|
360
|
+
children: j.caption
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ v("input", {
|
|
363
|
+
id: `${d}-caption`,
|
|
364
|
+
value: t.caption ?? "",
|
|
365
|
+
onChange: (e) => U(i, e.target.value === "" ? {
|
|
366
|
+
id: t.id,
|
|
367
|
+
type: "image",
|
|
368
|
+
asset: t.asset
|
|
369
|
+
} : {
|
|
370
|
+
...t,
|
|
371
|
+
caption: e.target.value
|
|
372
|
+
})
|
|
373
|
+
})
|
|
374
|
+
] }) : t.type === "file" ? /* @__PURE__ */ y(_, { children: [
|
|
375
|
+
/* @__PURE__ */ v("label", {
|
|
376
|
+
htmlFor: `${d}-asset`,
|
|
377
|
+
children: j.file
|
|
378
|
+
}),
|
|
379
|
+
O?.({
|
|
380
|
+
id: `${d}-asset`,
|
|
381
|
+
type: M.files ?? "",
|
|
382
|
+
value: t.asset,
|
|
383
|
+
onChange: (e) => U(i, {
|
|
384
|
+
...t,
|
|
385
|
+
asset: e
|
|
386
|
+
}),
|
|
387
|
+
target: {
|
|
388
|
+
field: w,
|
|
389
|
+
blockId: t.id
|
|
390
|
+
},
|
|
391
|
+
role: "file"
|
|
392
|
+
}),
|
|
393
|
+
/* @__PURE__ */ v("label", {
|
|
394
|
+
htmlFor: `${d}-label`,
|
|
395
|
+
children: j.fileLabel
|
|
396
|
+
}),
|
|
397
|
+
/* @__PURE__ */ v("input", {
|
|
398
|
+
id: `${d}-label`,
|
|
399
|
+
value: t.label,
|
|
400
|
+
onChange: (e) => U(i, {
|
|
401
|
+
...t,
|
|
402
|
+
label: e.target.value
|
|
403
|
+
})
|
|
404
|
+
})
|
|
405
|
+
] }) : r.surface === "visual" && (t.type === "paragraph" || t.type === "heading") ? /* @__PURE__ */ y(_, { children: [
|
|
406
|
+
/* @__PURE__ */ v("span", {
|
|
407
|
+
id: `${d}-label`,
|
|
408
|
+
"data-cms-rich-label": !0,
|
|
409
|
+
children: j.text
|
|
410
|
+
}),
|
|
411
|
+
/* @__PURE__ */ v(p, {
|
|
412
|
+
id: `${d}-text`,
|
|
413
|
+
labelledBy: `${d}-label`,
|
|
414
|
+
content: t.content,
|
|
415
|
+
onChange: (e) => U(i, {
|
|
416
|
+
...t,
|
|
417
|
+
content: e
|
|
418
|
+
}),
|
|
419
|
+
words: {
|
|
420
|
+
bold: j.bold,
|
|
421
|
+
italic: j.italic,
|
|
422
|
+
underline: j.underline
|
|
423
|
+
}
|
|
424
|
+
}),
|
|
425
|
+
M.links !== void 0 && O !== void 0 && t.type === "paragraph" ? /* @__PURE__ */ v(C, {
|
|
426
|
+
id: d,
|
|
427
|
+
type: M.links,
|
|
428
|
+
renderPicker: O,
|
|
429
|
+
words: j,
|
|
430
|
+
target: {
|
|
431
|
+
field: w,
|
|
432
|
+
blockId: t.id
|
|
433
|
+
},
|
|
434
|
+
onInsert: (e) => U(i, {
|
|
435
|
+
...t,
|
|
436
|
+
content: s([
|
|
437
|
+
...t.content,
|
|
438
|
+
...o(t.content).match(/(^|\s)$/) ? [] : [{
|
|
439
|
+
type: "text",
|
|
440
|
+
text: " "
|
|
441
|
+
}],
|
|
442
|
+
e
|
|
443
|
+
])
|
|
444
|
+
})
|
|
445
|
+
}) : null,
|
|
446
|
+
t.type === "paragraph" ? /* @__PURE__ */ v(S, {
|
|
447
|
+
id: d,
|
|
448
|
+
options: M,
|
|
449
|
+
renderPicker: O,
|
|
450
|
+
words: j,
|
|
451
|
+
onInsert: (e) => U(i, {
|
|
452
|
+
...t,
|
|
453
|
+
content: s([
|
|
454
|
+
...t.content,
|
|
455
|
+
...o(t.content).match(/(^|\s)$/) ? [] : [{
|
|
456
|
+
type: "text",
|
|
457
|
+
text: " "
|
|
458
|
+
}],
|
|
459
|
+
e
|
|
460
|
+
])
|
|
461
|
+
})
|
|
462
|
+
}) : null
|
|
463
|
+
] }) : /* @__PURE__ */ y(_, { children: [
|
|
464
|
+
/* @__PURE__ */ v("label", {
|
|
465
|
+
htmlFor: `${d}-text`,
|
|
466
|
+
children: t.type === "list" ? j.listItems : t.type === "table" ? j.tableRows : j.text
|
|
467
|
+
}),
|
|
468
|
+
/* @__PURE__ */ v("textarea", {
|
|
469
|
+
id: `${d}-text`,
|
|
470
|
+
value: m,
|
|
471
|
+
onChange: (e) => G(i, t, e.target.value)
|
|
472
|
+
}),
|
|
473
|
+
M.links !== void 0 && O !== void 0 && (t.type === "paragraph" || t.type === "list") ? /* @__PURE__ */ v(C, {
|
|
474
|
+
id: d,
|
|
475
|
+
type: M.links,
|
|
476
|
+
renderPicker: O,
|
|
477
|
+
words: j,
|
|
478
|
+
target: {
|
|
479
|
+
field: w,
|
|
480
|
+
blockId: t.id
|
|
481
|
+
},
|
|
482
|
+
onInsert: (e) => K(i, t, m, e)
|
|
483
|
+
}) : null,
|
|
484
|
+
t.type === "paragraph" || t.type === "list" ? /* @__PURE__ */ v(S, {
|
|
485
|
+
id: d,
|
|
486
|
+
options: M,
|
|
487
|
+
renderPicker: O,
|
|
488
|
+
words: j,
|
|
489
|
+
onInsert: (e) => K(i, t, m, e)
|
|
490
|
+
}) : null
|
|
491
|
+
] }),
|
|
492
|
+
/* @__PURE__ */ y("div", {
|
|
493
|
+
"data-cms-rich-actions": !0,
|
|
494
|
+
children: [
|
|
495
|
+
/* @__PURE__ */ v("button", {
|
|
496
|
+
type: "button",
|
|
497
|
+
"aria-label": j.moveUpLabel(a),
|
|
498
|
+
disabled: i === 0,
|
|
499
|
+
onClick: () => W(i, i - 1),
|
|
500
|
+
children: j.moveUp
|
|
501
|
+
}),
|
|
502
|
+
/* @__PURE__ */ v("button", {
|
|
503
|
+
type: "button",
|
|
504
|
+
"aria-label": j.moveDownLabel(a),
|
|
505
|
+
disabled: i === F.blocks.length - 1,
|
|
506
|
+
onClick: () => W(i, i + 1),
|
|
507
|
+
children: j.moveDown
|
|
508
|
+
}),
|
|
509
|
+
/* @__PURE__ */ v("button", {
|
|
510
|
+
type: "button",
|
|
511
|
+
"aria-label": j.removeLabel(a),
|
|
512
|
+
onClick: () => H(F.blocks.filter((e, t) => t !== i)),
|
|
513
|
+
children: j.remove
|
|
514
|
+
})
|
|
515
|
+
]
|
|
516
|
+
}),
|
|
517
|
+
k?.(t.id, a) ?? null
|
|
518
|
+
]
|
|
519
|
+
}, t.id);
|
|
520
|
+
});
|
|
521
|
+
return /* @__PURE__ */ y("div", {
|
|
522
|
+
id: i,
|
|
523
|
+
"data-cms-rich-document": !0,
|
|
524
|
+
children: [q, /* @__PURE__ */ y("div", {
|
|
525
|
+
"data-cms-rich-add": !0,
|
|
526
|
+
children: [
|
|
527
|
+
/* @__PURE__ */ v("label", {
|
|
528
|
+
htmlFor: `${i}-add`,
|
|
529
|
+
children: j.addBlock
|
|
530
|
+
}),
|
|
531
|
+
/* @__PURE__ */ v("select", {
|
|
532
|
+
id: `${i}-add`,
|
|
533
|
+
value: V.includes(z) ? z : V[0] ?? "paragraph",
|
|
534
|
+
onChange: (e) => B(e.target.value),
|
|
535
|
+
children: V.map((e) => /* @__PURE__ */ v("option", {
|
|
536
|
+
value: e,
|
|
537
|
+
children: j.blockNames[e]
|
|
538
|
+
}, e))
|
|
539
|
+
}),
|
|
540
|
+
/* @__PURE__ */ v("button", {
|
|
541
|
+
type: "button",
|
|
542
|
+
onClick: () => H([...F.blocks, x(V.includes(z) ? z : V[0] ?? "paragraph", M)]),
|
|
543
|
+
children: j.add
|
|
544
|
+
})
|
|
545
|
+
]
|
|
546
|
+
})]
|
|
547
|
+
});
|
|
548
|
+
};
|
|
549
|
+
//#endregion
|
|
550
|
+
export { w as RichDocumentEditor };
|