@voltro/cms 0.85.0 → 0.86.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 (80) hide show
  1. package/CHANGELOG.md +666 -0
  2. package/THIRD-PARTY-NOTICES.md +5 -33
  3. package/dist/ContentForm.js +282 -0
  4. package/dist/RichDocumentEditor.js +550 -0
  5. package/dist/RichDocumentView.js +132 -0
  6. package/dist/RichTextSurface.js +135 -0
  7. package/dist/aiCandidates.js +199 -0
  8. package/dist/aiOperations.js +152 -0
  9. package/dist/audiences.js +31 -0
  10. package/dist/availability.js +121 -0
  11. package/dist/blueprint.js +166 -0
  12. package/dist/bulk.js +281 -0
  13. package/dist/cacheIdentity.js +152 -0
  14. package/dist/changes.js +90 -0
  15. package/dist/cmsContext.js +229 -0
  16. package/dist/collections.js +224 -0
  17. package/dist/consent.js +29 -0
  18. package/dist/contentType.js +191 -0
  19. package/dist/contentfulImport.js +162 -0
  20. package/dist/copies.js +89 -0
  21. package/dist/cutover.js +202 -0
  22. package/dist/deliveryChecks.js +138 -0
  23. package/dist/domains.js +145 -0
  24. package/dist/draftTexts.js +164 -0
  25. package/dist/duplicates.js +78 -0
  26. package/dist/edgePurge.js +69 -0
  27. package/dist/editHistory.js +113 -0
  28. package/dist/effectForm.js +11 -0
  29. package/dist/environments.js +109 -0
  30. package/dist/errors.js +67 -0
  31. package/dist/experiments.js +528 -0
  32. package/dist/exposure.js +28 -0
  33. package/dist/extensionManifest.js +81 -0
  34. package/dist/extensions.js +314 -0
  35. package/dist/fieldSchema.js +199 -0
  36. package/dist/formStrings.js +74 -0
  37. package/dist/glossary.js +73 -0
  38. package/dist/history.js +54 -0
  39. package/dist/htmlImport.js +297 -0
  40. package/dist/index.d.ts +11 -7
  41. package/dist/index.js +73 -6082
  42. package/dist/media.js +29 -0
  43. package/dist/metrics.js +46 -0
  44. package/dist/migration.js +193 -0
  45. package/dist/migrationStages.js +13 -0
  46. package/dist/presenceAnchors.js +68 -0
  47. package/dist/preview.js +31 -0
  48. package/dist/promotion.js +107 -0
  49. package/dist/quality.js +188 -0
  50. package/dist/recurrence.js +78 -0
  51. package/dist/redirects.js +99 -0
  52. package/dist/referenceGraph.js +223 -0
  53. package/dist/references.js +173 -0
  54. package/dist/release.js +205 -0
  55. package/dist/rest.js +52 -0
  56. package/dist/review.js +160 -0
  57. package/dist/richDocument.js +491 -0
  58. package/dist/richInline.js +100 -0
  59. package/dist/schedule.js +80 -0
  60. package/dist/search.js +148 -0
  61. package/dist/selectionIntent.js +164 -0
  62. package/dist/seo.js +31 -0
  63. package/dist/series.js +105 -0
  64. package/dist/share.js +112 -0
  65. package/dist/stewardship.js +146 -0
  66. package/dist/taxonomy.js +36 -0
  67. package/dist/team.js +103 -0
  68. package/dist/templates.js +106 -0
  69. package/dist/trackChanges.js +197 -0
  70. package/dist/translation.js +64 -0
  71. package/dist/tree.js +87 -0
  72. package/dist/usage.js +50 -0
  73. package/dist/validation.js +192 -0
  74. package/dist/visualEditing.js +60 -0
  75. package/dist/web.js +33 -2
  76. package/dist/workflow.js +322 -0
  77. package/dist/write.js +394 -0
  78. package/dist/xliff.js +325 -0
  79. package/package.json +5 -5
  80. package/dist/presenceAnchors-4iHAVQB3.js +0 -4367
@@ -1,11 +1,11 @@
1
1
  # Third-Party Notices — @voltro/cms
2
2
 
3
- This package depends on the open-source software listed below. Each is the
3
+ This package uses the open-source software listed below. Each is the
4
4
  property of its respective copyright holders and is used under the terms of
5
5
  its license. This file is provided for attribution; it grants no rights in
6
6
  @voltro/cms itself, which is proprietary (see LICENSE).
7
7
 
8
- Generated from the resolved runtime dependency closure (42 packages).
8
+ Generated from the resolved runtime dependency closure (41 packages).
9
9
 
10
10
  ---
11
11
 
@@ -3636,34 +3636,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3636
3636
  SOFTWARE.
3637
3637
  ```
3638
3638
 
3639
- ## layerr@3.0.0
3640
-
3641
- License: MIT
3642
-
3643
- ```
3644
- MIT License
3645
-
3646
- Copyright (c) 2020 Perry Mitchell
3647
-
3648
- Permission is hereby granted, free of charge, to any person obtaining a copy
3649
- of this software and associated documentation files (the "Software"), to deal
3650
- in the Software without restriction, including without limitation the rights
3651
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3652
- copies of the Software, and to permit persons to whom the Software is
3653
- furnished to do so, subject to the following conditions:
3654
-
3655
- The above copyright notice and this permission notice shall be included in all
3656
- copies or substantial portions of the Software.
3657
-
3658
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3659
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3660
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3661
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3662
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3663
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3664
- SOFTWARE.
3665
- ```
3666
-
3667
3639
  ## lib0@0.2.117
3668
3640
 
3669
3641
  License: MIT
@@ -4013,14 +3985,14 @@ Apache License
4013
3985
  limitations under the License.
4014
3986
  ```
4015
3987
 
4016
- ## ulidx@2.4.1
3988
+ ## ulid@3.0.2
4017
3989
 
4018
3990
  License: MIT
4019
3991
 
4020
3992
  ```
4021
- MIT License
3993
+ The MIT License (MIT)
4022
3994
 
4023
- Copyright (c) 2021 Perry Mitchell
3995
+ Copyright (c) 2017 Alizain Feerasta
4024
3996
 
4025
3997
  Permission is hereby granted, free of charge, to any person obtaining a copy
4026
3998
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,282 @@
1
+ import { newInstanceId as e } from "./validation.js";
2
+ import { contentFormStrings as t } from "./formStrings.js";
3
+ import { RichDocumentEditor as n } from "./RichDocumentEditor.js";
4
+ import { createElement as r, useId as i, useRef as a, useState as o } from "react";
5
+ //#region src/ContentForm.tsx
6
+ var s = ({ id: e, name: t, field: n, value: i, onChange: a }) => r("input", {
7
+ type: "text",
8
+ id: e,
9
+ name: t,
10
+ ...n.maxLength === void 0 ? {} : { maxLength: n.maxLength },
11
+ value: i == null ? "" : String(i),
12
+ onChange: (e) => a(e.target.value)
13
+ }), c = ({ id: e, name: t, field: n, value: i, onChange: a }) => r("textarea", {
14
+ id: e,
15
+ name: t,
16
+ ...n.maxLength === void 0 ? {} : { maxLength: n.maxLength },
17
+ value: i == null ? "" : String(i),
18
+ onChange: (e) => a(e.target.value)
19
+ }), l = ({ id: e, name: t, field: n, value: i, onChange: a }) => r("input", {
20
+ type: "number",
21
+ ...n.fraction === !0 ? { step: "any" } : {},
22
+ id: e,
23
+ name: t,
24
+ value: i == null ? "" : String(i),
25
+ onChange: (e) => a(e.target.value === "" ? null : Number(e.target.value))
26
+ }), u = ({ id: e, name: t, value: n, onChange: i }) => r("input", {
27
+ type: "checkbox",
28
+ id: e,
29
+ name: t,
30
+ checked: n === !0,
31
+ onChange: (e) => i(e.target.checked)
32
+ }), d = (e) => ({ id: t, name: n, value: i, onChange: a }) => r("input", {
33
+ type: e,
34
+ id: t,
35
+ name: n,
36
+ value: i == null ? "" : String(i),
37
+ onChange: (e) => a(e.target.value)
38
+ }), f = ({ id: e, name: t, field: n, value: i, onChange: a }) => r("select", {
39
+ id: e,
40
+ name: t,
41
+ value: i == null ? "" : String(i),
42
+ onChange: (e) => a(e.target.value)
43
+ }, [r("option", {
44
+ key: "",
45
+ value: ""
46
+ }, ""), ...(n.literals ?? []).map((e) => r("option", {
47
+ key: e,
48
+ value: e
49
+ }, n.literalLabels?.[e] ?? e))]), p = (e) => ({ id: t, name: n, value: i, onChange: a }) => r("textarea", {
50
+ id: t,
51
+ name: n,
52
+ "data-cms-widget": e,
53
+ value: i == null ? "" : typeof i == "string" ? i : JSON.stringify(i),
54
+ onChange: (e) => a(e.target.value)
55
+ }), m = (e) => {
56
+ let { id: n, label: i, element: o, value: s, onChange: c, widgets: l, strings: u } = e, d = t(u), f = Array.isArray(s) ? s : [], p = a(f);
57
+ p.current = f;
58
+ let m = v(o.editorHint, l), h = (e, t) => {
59
+ if (t < 0 || t >= f.length) return;
60
+ let n = [...f], [r] = n.splice(e, 1);
61
+ n.splice(t, 0, r), c(n);
62
+ }, g = o.kind === "number" ? 0 : o.kind !== "boolean" && "", _ = f.map((e, t) => {
63
+ let a = d.item(i, t + 1), s = `${n}-${t}`;
64
+ return r("fieldset", {
65
+ key: t,
66
+ "data-cms-array-entry": t
67
+ }, r("legend", null, r("label", { htmlFor: s }, a)), r(m, {
68
+ id: s,
69
+ name: `${n}[${t}]`,
70
+ field: o,
71
+ value: e,
72
+ onChange: (e) => c(p.current.map((n, r) => r === t ? e : n))
73
+ }), r("div", { "data-cms-array-actions": !0 }, r("button", {
74
+ type: "button",
75
+ "aria-label": d.moveUpLabel(a),
76
+ disabled: t === 0,
77
+ onClick: () => h(t, t - 1)
78
+ }, d.moveUp), r("button", {
79
+ type: "button",
80
+ "aria-label": d.moveDownLabel(a),
81
+ disabled: t === f.length - 1,
82
+ onClick: () => h(t, t + 1)
83
+ }, d.moveDown), r("button", {
84
+ type: "button",
85
+ "aria-label": d.removeLabel(a),
86
+ onClick: () => c(f.filter((e, n) => n !== t))
87
+ }, d.remove)));
88
+ });
89
+ return r("div", {
90
+ id: n,
91
+ "data-cms-array": !0
92
+ }, _, r("button", {
93
+ type: "button",
94
+ "data-cms-array-add": !0,
95
+ onClick: () => c([...p.current, g])
96
+ }, d.addItem));
97
+ }, h = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "object" && !!e && typeof e.componentId == "string") : [], g = (n) => {
98
+ let { id: i, definitions: s, value: c, onChange: l, widgets: u, renderPicker: d, fieldLabel: f, strings: p } = n, m = t(p), g = h(c), _ = a(g);
99
+ _.current = g;
100
+ let [v, b] = o(s[0]?.id ?? ""), [x, S] = o(""), C = new Map(s.map((e) => [e.id, e])), w = (e) => l(e), T = (e, t) => w(_.current.map((n, r) => r === e ? {
101
+ ...n,
102
+ props: t
103
+ } : n)), E = (e, t) => {
104
+ if (t < 0 || t >= g.length) return;
105
+ let n = [...g], [r] = n.splice(e, 1);
106
+ r !== void 0 && n.splice(t, 0, r), w(n);
107
+ }, D = g.map((e, t) => {
108
+ let i = C.get(e.componentId), a = `${i?.displayName ?? e.componentId} ${t + 1}`;
109
+ return r("fieldset", {
110
+ key: e.instanceId ?? `new-${t}`,
111
+ "data-cms-component": e.componentId,
112
+ ...e.instanceId === void 0 ? {} : { "data-cms-instance": e.instanceId }
113
+ }, r("legend", null, a), i === void 0 ? r("p", null, m.unknownComponent(e.componentId)) : r(y, {
114
+ contentType: { fields: i.props },
115
+ value: e.props,
116
+ onChange: (e) => T(t, e),
117
+ ...((e) => e === void 0 ? {} : { widgetTarget: (t) => ({
118
+ field: n.field,
119
+ instanceId: e,
120
+ prop: t
121
+ }) })(e.instanceId),
122
+ ...u ? { widgets: u } : {},
123
+ ...d ? { renderPicker: d } : {},
124
+ ...f ? { fieldLabel: (e) => f(`${i.id}.${e}`) } : {},
125
+ ...p ? { strings: p } : {}
126
+ }), r("div", { "data-cms-component-actions": !0 }, r("button", {
127
+ type: "button",
128
+ "aria-label": m.moveUpLabel(a),
129
+ disabled: t === 0,
130
+ onClick: () => E(t, t - 1)
131
+ }, m.moveUp), r("button", {
132
+ type: "button",
133
+ "aria-label": m.moveDownLabel(a),
134
+ disabled: t === g.length - 1,
135
+ onClick: () => E(t, t + 1)
136
+ }, m.moveDown), r("button", {
137
+ type: "button",
138
+ "aria-label": m.removeLabel(a),
139
+ onClick: () => w(g.filter((e, n) => n !== t))
140
+ }, m.remove)));
141
+ }), O = `${i}-add`, k = x.trim().toLowerCase(), A = s.filter((e) => k === "" || [
142
+ e.displayName,
143
+ e.description ?? "",
144
+ ...e.jobs ?? []
145
+ ].some((e) => e.toLowerCase().includes(k))), j = /* @__PURE__ */ new Map();
146
+ for (let e of A) {
147
+ let t = e.jobs?.[0] ?? "";
148
+ j.set(t, [...j.get(t) ?? [], e]);
149
+ }
150
+ let M = (e) => [r("option", {
151
+ key: e.id,
152
+ value: e.id,
153
+ title: e.description
154
+ }, e.displayName), ...Object.keys(e.variants ?? {}).map((t) => r("option", {
155
+ key: `${e.id}::${t}`,
156
+ value: `${e.id}::${t}`,
157
+ title: e.description
158
+ }, `${e.displayName} — ${t}`))], N = [...j].sort(([e], [t]) => e === "" ? 1 : t === "" ? -1 : e.localeCompare(t)), [P = ""] = v.split("::"), F = A.some((e) => e.id === P) ? v : A[0]?.id ?? "", [I = "", L] = F.split("::"), R = `${i}-find`;
159
+ return r("div", {
160
+ id: i,
161
+ "data-cms-components": !0
162
+ }, D, r("div", { "data-cms-component-add": !0 }, r("label", { htmlFor: R }, m.findComponent), r("input", {
163
+ id: R,
164
+ type: "search",
165
+ value: x,
166
+ onChange: (e) => S(e.target.value)
167
+ }), r("label", { htmlFor: O }, m.addComponent), A.length === 0 ? r("p", { role: "status" }, m.noComponentFound) : r("select", {
168
+ id: O,
169
+ value: F,
170
+ onChange: (e) => b(e.target.value)
171
+ }, j.size === 1 && N[0]?.[0] === "" ? A.flatMap(M) : N.map(([e, t]) => r("optgroup", {
172
+ key: e || "~other",
173
+ label: e || m.otherComponents
174
+ }, t.flatMap(M)))), I !== "" && C.get(I)?.description !== void 0 ? r("p", { "data-cms-component-description": !0 }, C.get(I)?.description) : null, r("button", {
175
+ type: "button",
176
+ disabled: !C.has(I),
177
+ onClick: () => w([...g, {
178
+ instanceId: e(),
179
+ componentId: I,
180
+ props: { ...L === void 0 ? {} : C.get(I)?.variants?.[L] ?? {} }
181
+ }])
182
+ }, m.add)));
183
+ }, _ = {
184
+ text: s,
185
+ textarea: c,
186
+ number: l,
187
+ boolean: u,
188
+ date: d("date"),
189
+ datetime: d("datetime-local"),
190
+ select: f,
191
+ richText: n,
192
+ media: p("media"),
193
+ reference: p("reference"),
194
+ array: p("array"),
195
+ struct: p("struct"),
196
+ components: p("components")
197
+ }, v = (e, t) => t?.[e] ?? _[e], y = (e) => {
198
+ let { contentType: t, value: o, onChange: s, widgets: c, fieldWidgets: l, renderPicker: u, renderFieldAside: d, renderBlockAside: f, fieldLabel: p, strings: h, richTextSurface: _, widgetTarget: b } = e, x = i(), S = a(o);
199
+ S.current = o;
200
+ let C = (e, t) => s({
201
+ ...S.current,
202
+ [e]: t
203
+ }), w = Object.entries(t.fields).map(([e, t]) => {
204
+ let i = `${x}-${e}`, a = d?.(e) ?? null, s = p?.(e) ?? e, S = l?.[e];
205
+ return S === void 0 && t.editorHint === "array" && c?.array === void 0 && t.element !== void 0 && t.element.kind !== "struct" && t.element.kind !== "array" ? r("div", {
206
+ key: e,
207
+ "data-cms-field": e,
208
+ role: "group",
209
+ "aria-labelledby": `${i}-label`
210
+ }, r("span", {
211
+ id: `${i}-label`,
212
+ "data-cms-field-label": !0
213
+ }, s), r(m, {
214
+ id: i,
215
+ label: s,
216
+ element: t.element,
217
+ value: o[e],
218
+ onChange: (t) => C(e, t),
219
+ widgets: c,
220
+ strings: h
221
+ }), a) : S === void 0 && t.editorHint === "components" && c?.components === void 0 ? r("div", {
222
+ key: e,
223
+ "data-cms-field": e,
224
+ role: "group",
225
+ "aria-labelledby": `${i}-label`
226
+ }, r("span", {
227
+ id: `${i}-label`,
228
+ "data-cms-field-label": !0
229
+ }, s), r(g, {
230
+ id: i,
231
+ field: e,
232
+ definitions: t.components ?? [],
233
+ value: o[e],
234
+ onChange: (t) => C(e, t),
235
+ widgets: c,
236
+ renderPicker: u,
237
+ fieldLabel: p,
238
+ strings: h
239
+ }), a) : S === void 0 && t.editorHint === "richText" && c?.richText === void 0 ? r("div", {
240
+ key: e,
241
+ "data-cms-field": e,
242
+ role: "group",
243
+ "aria-labelledby": `${i}-label`
244
+ }, r("span", {
245
+ id: `${i}-label`,
246
+ "data-cms-field-label": !0
247
+ }, s), r(n, {
248
+ id: i,
249
+ name: e,
250
+ field: t,
251
+ value: o[e],
252
+ onChange: (t) => C(e, t),
253
+ ...u ? { renderPicker: u } : {},
254
+ ...f ? { renderBlockAside: (t, n) => f(e, t, n) } : {},
255
+ ...h ? { strings: h } : {},
256
+ ..._ ? { surface: _ } : {},
257
+ renderComponentProps: (e, t, n) => r(y, {
258
+ contentType: { fields: e.props },
259
+ value: { ...t },
260
+ onChange: n,
261
+ ...c ? { widgets: c } : {},
262
+ ...u ? { renderPicker: u } : {},
263
+ ...p ? { fieldLabel: (t) => p(`${e.id}.${t}`) } : {},
264
+ ...h ? { strings: h } : {}
265
+ })
266
+ }), a) : r("div", {
267
+ key: e,
268
+ "data-cms-field": e,
269
+ ...t.publishRequired === !0 ? { "data-cms-required-to-publish": !0 } : {}
270
+ }, r("label", { htmlFor: i }, s), r(S ?? v(t.editorHint, c), {
271
+ id: i,
272
+ name: e,
273
+ field: t,
274
+ value: o[e],
275
+ onChange: (t) => C(e, t),
276
+ target: b?.(e) ?? { field: e }
277
+ }), a);
278
+ });
279
+ return r("div", { "data-cms-form": !0 }, ...w);
280
+ };
281
+ //#endregion
282
+ export { y as ContentForm, v as widgetFor };