@kardalum/plugin-sdk 0.18.0 → 0.19.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 +42 -0
- package/README.md +1 -1
- package/dist/assets/asset-picker.js +3 -3
- package/dist/built-in-serializers.js +1 -1
- package/dist/built-in-settings-schemas.js +4 -4
- package/dist/built-ins.js +10 -10
- package/dist/data-type-plugin.d.ts +2 -2
- package/dist/datatype-validation.d.ts +2 -2
- package/dist/datatype-validation.js +2 -2
- package/dist/define-plugin.d.ts +4 -4
- package/dist/define-plugin.js +5 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/manifest-schema.js +7 -1
- package/dist/media/media-picker.js +4 -4
- package/dist/plugin-context.js +3 -3
- package/dist/register-built-ins.js +6 -6
- package/dist/registry.js +1 -1
- package/dist/richtext/block-panel.js +2 -2
- package/dist/richtext/extensions.js +7 -7
- package/dist/richtext/insert-menu.js +3 -3
- package/dist/richtext/style-listbox.js +1 -1
- package/dist/richtext/text-style-class.js +1 -1
- package/dist/simple-storage-value-provider.js +3 -3
- package/dist/structured-storage-types.d.ts +1 -1
- package/dist/structured-storage-types.js +2 -2
- package/dist/ui-entry.js +3 -3
- package/dist/views/asset-view.js +3 -3
- package/dist/views/date-range-view.js +5 -5
- package/dist/views/html-code-editor.js +2 -2
- package/dist/views/html-view.js +7 -7
- package/dist/views/image-view.js +4 -4
- package/dist/views/rich-text-view.js +4 -3
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +14 -8
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +2 -2
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +14 -4
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +8 -8
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +11 -8
- package/node_modules/@kardalum/api-schemas/dist/index.js +6 -4
- package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.d.ts +46 -0
- package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.js +52 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +47 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +42 -8
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +9 -9
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +5 -5
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +1 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +24 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +39 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +207 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +147 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -8
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +2 -2
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +3 -3
- package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/theme-css.js +2 -2
- package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +3 -3
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +3 -3
- package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/themes/light.js +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +3 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +5 -5
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/types.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +2 -1
- package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +2 -2
- package/node_modules/@kardalum/plugin-package/dist/envelope.js +2 -2
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +3 -3
- package/node_modules/@kardalum/plugin-package/dist/extract.js +9 -9
- package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/hash.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +2 -2
- package/node_modules/@kardalum/plugin-package/dist/package-contract.js +5 -5
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +8 -3
- package/node_modules/@kardalum/ui/dist/components/badge.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.js +49 -4
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +5 -1
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +18 -5
- package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +4 -4
- package/node_modules/@kardalum/ui/dist/components/input.js +6 -1
- package/node_modules/@kardalum/ui/dist/components/property-field.js +3 -3
- package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/sheet.js +12 -7
- package/node_modules/@kardalum/ui/dist/components/skeleton.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +3 -3
- package/node_modules/@kardalum/ui/dist/components/toast.js +4 -3
- package/node_modules/@kardalum/ui/dist/components/tooltip.d.ts +27 -0
- package/node_modules/@kardalum/ui/dist/components/tooltip.js +82 -0
- package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +11 -0
- package/node_modules/@kardalum/ui/dist/components/truncated-text.js +94 -0
- package/node_modules/@kardalum/ui/dist/components/use-toast.js +2 -2
- package/node_modules/@kardalum/ui/dist/index.d.ts +3 -1
- package/node_modules/@kardalum/ui/dist/index.js +3 -1
- package/node_modules/@kardalum/ui/dist/lib/menu-host.d.ts +5 -0
- package/node_modules/@kardalum/ui/dist/lib/menu-host.js +17 -0
- package/node_modules/@kardalum/ui/package.json +8 -6
- package/package.json +7 -6
|
@@ -9,7 +9,7 @@ export const TextStyleClass = Mark.create({
|
|
|
9
9
|
return {
|
|
10
10
|
styleKey: {
|
|
11
11
|
default: null,
|
|
12
|
-
// The class carries the value
|
|
12
|
+
// The class carries the value, so there is nothing to read from a bare
|
|
13
13
|
// attribute, and nothing to render as one (see renderHTML below,
|
|
14
14
|
// which builds the class directly from mark.attrs.styleKey).
|
|
15
15
|
parseHTML: (element) => STYLE_KEY_PATTERN.exec(element.getAttribute("class") ?? "")?.[1] ?? null,
|
|
@@ -37,12 +37,12 @@ function refusalSentence(body) {
|
|
|
37
37
|
return `Could not save this field. ${ACTION_NOUNS[action]} is restricted at ${place} to: ${labels.length > 0 ? labels.join(", ") : "admins only"}.`;
|
|
38
38
|
}
|
|
39
39
|
// The only SDK code path that ever hits /api/plugins/:pluginId/storage/...
|
|
40
|
-
// (SimpleStorageAPI, Session 68)
|
|
40
|
+
// (SimpleStorageAPI, Session 68): a plugin's view code (and usePluginValue()
|
|
41
41
|
// itself) never touches the storage API directly, matching plugin-sdk.md's
|
|
42
42
|
// "SDK handles all host communication" rule. Fetches the current value on
|
|
43
43
|
// mount and feeds it into the SAME PluginValueContext usePluginValue()
|
|
44
44
|
// already reads, so a view wrapped in this provider is indistinguishable
|
|
45
|
-
// from one wrapped in a plain PluginValueProvider
|
|
45
|
+
// from one wrapped in a plain PluginValueProvider. Swap this in wherever a
|
|
46
46
|
// field's value should live in content_field_values instead of the local
|
|
47
47
|
// content blob (see document-type-form.tsx for the blob-backed default).
|
|
48
48
|
//
|
|
@@ -74,7 +74,7 @@ export function SimpleStorageValueProvider({ contentId, fieldId, pluginId, child
|
|
|
74
74
|
};
|
|
75
75
|
}, [fetchApi, path]);
|
|
76
76
|
function onChange(next) {
|
|
77
|
-
setValue(next); // optimistic
|
|
77
|
+
setValue(next); // optimistic: the view should feel instant
|
|
78
78
|
fetchApi(path, {
|
|
79
79
|
method: "PUT",
|
|
80
80
|
headers: { "Content-Type": "application/json" },
|
|
@@ -49,7 +49,7 @@ export interface PublishedContent {
|
|
|
49
49
|
export interface PluginApiRouteContext {
|
|
50
50
|
structuredStorage: ScopedStructuredStorage;
|
|
51
51
|
/** Null if the content id doesn't exist OR isn't published (a
|
|
52
|
-
* draft-only save never satisfies this)
|
|
52
|
+
* draft-only save never satisfies this). It deliberately conflates
|
|
53
53
|
* "missing" and "not yet purchasable," since callers treat both the
|
|
54
54
|
* same way. */
|
|
55
55
|
getPublishedContent(contentId: string): Promise<PublishedContent | null>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Local, SDK-owned duplicates of packages/db-adapter's structured-storage
|
|
2
2
|
// shapes and apps/server's StructuredStorageAPI/StructuredQueryBuilder/
|
|
3
|
-
// StructuredStorageTransaction classes
|
|
3
|
+
// StructuredStorageTransaction classes, never imported directly, since
|
|
4
4
|
// @kardalum/plugin-sdk is a published package that must not depend on
|
|
5
5
|
// unpublished adapter/server internals (same reasoning manifest.ts's
|
|
6
6
|
// DatabaseDialect duplication already uses). TypeScript's structural
|
|
7
7
|
// typing means the real apps/server classes satisfy these interfaces
|
|
8
|
-
// without any cast, as long as their member shapes match (they do
|
|
8
|
+
// without any cast, as long as their member shapes match (they do:
|
|
9
9
|
// this is exactly the public contract apps/docs/src/content/docs/v1/reference/storage.md
|
|
10
10
|
// already documents).
|
|
11
11
|
export {};
|
package/dist/ui-entry.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// The `@kardalum/plugin-sdk/ui` subpath: the shared UI primitives (all of
|
|
2
2
|
// @kardalum/ui, since R3) + the plugin-context
|
|
3
3
|
// hooks/providers, with none of the package index's richtext (TipTap)
|
|
4
|
-
// exports
|
|
4
|
+
// exports, with the same "no weight a consumer didn't ask for" boundary
|
|
5
5
|
// `./manifest` and `./datatypes` already draw, just for the UI-primitives
|
|
6
6
|
// half of the SDK surface.
|
|
7
7
|
//
|
|
8
|
-
// DO NOT import this from a federated plugin's own view code
|
|
8
|
+
// DO NOT import this from a federated plugin's own view code: a
|
|
9
9
|
// datatype/section/etc. plugin remote whose views run inside the admin
|
|
10
10
|
// host. S197 final-review fix F5 tried exactly that (google-maps'
|
|
11
11
|
// location-view.tsx) and it was a Critical regression, caught by the
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
// script, a test harness, tooling that renders SDK UI outside the Module
|
|
32
32
|
// Federation runtime entirely) where there is no host singleton to miss in
|
|
33
33
|
// the first place. If you're not sure which category you're in, you're
|
|
34
|
-
// almost certainly writing a plugin view
|
|
34
|
+
// almost certainly writing a plugin view, so use the bare package index.
|
|
35
35
|
export { PluginValueProvider, PluginSettingsProvider, PluginApiProvider, usePluginValue, usePluginSettings, usePluginSettingsValue, usePluginApi, } from "./plugin-context.js";
|
|
36
36
|
export { SimpleStorageValueProvider } from "./simple-storage-value-provider.js";
|
|
37
37
|
export { EntitlementGate, useEntitlement, } from "./entitlement-gate.js";
|
package/dist/views/asset-view.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId, useState } from "react";
|
|
3
3
|
import { assetPathIsImage } from "@kardalum/api-schemas";
|
|
4
|
-
import { Button, Input, PropertyField, usePropertyFieldControl } from "@kardalum/ui";
|
|
4
|
+
import { Button, Input, PropertyField, TruncatedText, usePropertyFieldControl } from "@kardalum/ui";
|
|
5
5
|
import { AssetPicker } from "../assets/asset-picker.js";
|
|
6
6
|
import { assetBaseName, normalizeStartFolder, useAssetThumbnail, useAssetTree } from "../assets/asset-tree.js";
|
|
7
7
|
import { usePluginSettings, usePluginSettingsValue, usePluginValue } from "../plugin-context.js";
|
|
@@ -31,7 +31,7 @@ export function AssetInputView() {
|
|
|
31
31
|
const missing = checked && !exists && !tree.truncated;
|
|
32
32
|
const isImage = path !== null && assetPathIsImage(path);
|
|
33
33
|
const thumbnail = useAssetThumbnail(path !== null && exists && isImage ? path : null);
|
|
34
|
-
return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex items-center gap-3 rounded-md border border-border-default bg-background-subtle p-3", children: [path !== null && !missing && isImage && (_jsx("span", { className: "block h-12 w-12 shrink-0 overflow-hidden rounded-md border border-border-subtle bg-background-elevated", children: thumbnail ? _jsx("img", { src: thumbnail, alt: "", className: "h-full w-full object-cover" }) : null })), _jsx("div", { className: "flex min-w-0 flex-1 flex-col", children: path === null ? (_jsx("span", { className: "text-sm text-text-tertiary", children: t("asset.noFile") })) : (_jsxs(_Fragment, { children: [_jsx(
|
|
34
|
+
return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex items-center gap-3 rounded-md border border-border-default bg-background-subtle p-3", children: [path !== null && !missing && isImage && (_jsx("span", { className: "block h-12 w-12 shrink-0 overflow-hidden rounded-md border border-border-subtle bg-background-elevated", children: thumbnail ? _jsx("img", { src: thumbnail, alt: "", className: "h-full w-full object-cover" }) : null })), _jsx("div", { className: "flex min-w-0 flex-1 flex-col", children: path === null ? (_jsx("span", { className: "text-sm text-text-tertiary", children: t("asset.noFile") })) : (_jsxs(_Fragment, { children: [_jsx(TruncatedText, { className: "truncate text-sm font-medium text-text-primary", children: missing ? t("asset.missing") : assetBaseName(path) }), _jsx(TruncatedText, { className: "truncate font-mono text-xs text-text-tertiary", children: path })] })) }), _jsxs("div", { ...field, role: "group", className: "flex shrink-0 items-center gap-2", children: [_jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setPicking(true), children: path === null ? t("asset.choose") : missing ? t("asset.chooseAnother") : t("asset.change") }), path !== null && (_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => onChange(null), children: t("asset.remove") }))] })] }), picking && (_jsx(AssetPicker, { accepts: readAccepts(settings), startFolder: readStartFolder(settings), currentPath: path, onPick: (picked) => {
|
|
35
35
|
setJustPicked(picked);
|
|
36
36
|
onChange(picked);
|
|
37
37
|
}, onClose: () => setPicking(false) }))] }));
|
|
@@ -51,5 +51,5 @@ export function AssetReadOnlyView() {
|
|
|
51
51
|
const t = usePluginTranslate();
|
|
52
52
|
if (typeof value !== "string" || value === "")
|
|
53
53
|
return _jsx("p", { className: "text-sm text-text-tertiary", children: t("asset.noFile") });
|
|
54
|
-
return (_jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx(
|
|
54
|
+
return (_jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx(TruncatedText, { className: "truncate text-sm font-medium text-text-primary", children: assetBaseName(value) }), _jsx(TruncatedText, { className: "truncate font-mono text-xs text-text-tertiary", children: value })] }));
|
|
55
55
|
}
|
|
@@ -3,7 +3,7 @@ import { useId } from "react";
|
|
|
3
3
|
import { Input, usePropertyFieldControl } from "@kardalum/ui";
|
|
4
4
|
import { usePluginValue } from "../plugin-context.js";
|
|
5
5
|
const EMPTY_RANGE = { start: null, end: null };
|
|
6
|
-
// Two independently-labeled <input type="date"> controls, not one
|
|
6
|
+
// Two independently-labeled <input type="date"> controls, not one, unlike
|
|
7
7
|
// every other built-in view, this value has two members a person needs to
|
|
8
8
|
// tell apart by NAME ("Start" vs "End"), so each gets its own visible
|
|
9
9
|
// <label>. That's why this doesn't follow the single-control idiom the
|
|
@@ -17,8 +17,8 @@ const EMPTY_RANGE = { start: null, end: null };
|
|
|
17
17
|
// child is left unchanged ... the control deep inside it calls
|
|
18
18
|
// usePropertyFieldControl() itself"), each half still shares the outer
|
|
19
19
|
// field's help/error text (aria-describedby) and invalid state
|
|
20
|
-
// (aria-invalid)
|
|
21
|
-
//
|
|
20
|
+
// (aria-invalid), so one field has one error message underneath both inputs.
|
|
21
|
+
// It just doesn't take the field's id/aria-labelledby.
|
|
22
22
|
export function DateRangeInputView() {
|
|
23
23
|
const { value, onChange } = usePluginValue();
|
|
24
24
|
const field = usePropertyFieldControl();
|
|
@@ -26,7 +26,7 @@ export function DateRangeInputView() {
|
|
|
26
26
|
const reactId = useId();
|
|
27
27
|
const startId = `${field.id ?? reactId}-start`;
|
|
28
28
|
const endId = `${field.id ?? reactId}-end`;
|
|
29
|
-
// Clearing a date input hands back ""
|
|
29
|
+
// Clearing a date input hands back "", normalized to null so downstream
|
|
30
30
|
// (the validate hook, isEmpty, serialization) only ever sees the two
|
|
31
31
|
// states asDateRange() understands: a real ISO string or null, never an
|
|
32
32
|
// empty string standing in for "no value".
|
|
@@ -44,7 +44,7 @@ export function DateRangeReadOnlyView() {
|
|
|
44
44
|
const range = value ?? EMPTY_RANGE;
|
|
45
45
|
// A half-filled or fully-empty range never reaches a saved, validated
|
|
46
46
|
// value (the hook above rejects both), but this view renders whatever
|
|
47
|
-
// it's handed
|
|
47
|
+
// it's handed (an in-progress preview, say) without crashing on it.
|
|
48
48
|
// An en dash, not an arrow: "→" is a fixed left-to-right glyph that
|
|
49
49
|
// still points right in an RTL locale, where the two dates read the
|
|
50
50
|
// other way round. A dash carries the same "from … to" sense in both.
|
|
@@ -8,7 +8,7 @@ import { bracketMatching, defaultHighlightStyle, indentOnInput, syntaxHighlighti
|
|
|
8
8
|
import { autocompletion, closeBrackets, closeBracketsKeymap, completionKeymap } from "@codemirror/autocomplete";
|
|
9
9
|
// Tags a dispatch made by the value-sync effect below so the update
|
|
10
10
|
// listener can tell "we just replaced the doc from a new `value` prop"
|
|
11
|
-
// apart from a real user edit and skip the onChange echo
|
|
11
|
+
// apart from a real user edit and skip the onChange echo, the same pattern
|
|
12
12
|
// (and same rationale) as admin-ui's code-editor.tsx.
|
|
13
13
|
const externalSync = Annotation.define();
|
|
14
14
|
export function HtmlCodeEditor({ value, onChange, readOnly = false, fieldId, ariaLabelledBy, ariaDescribedBy, ariaInvalid, }) {
|
|
@@ -68,7 +68,7 @@ export function HtmlCodeEditor({ value, onChange, readOnly = false, fieldId, ari
|
|
|
68
68
|
view.destroy();
|
|
69
69
|
viewRef.current = null;
|
|
70
70
|
};
|
|
71
|
-
// Mount-only by design
|
|
71
|
+
// Mount-only by design; see admin-ui's code-editor.tsx for the same
|
|
72
72
|
// convention and rationale.
|
|
73
73
|
}, []);
|
|
74
74
|
// Sync an externally-changed `value` into the view, guarded against
|
package/dist/views/html-view.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { lazy, Suspense } from "react";
|
|
3
3
|
import { PropertyField, Switch, usePropertyFieldControl } from "@kardalum/ui";
|
|
4
4
|
import { usePluginSettingsValue, usePluginValue } from "../plugin-context.js";
|
|
5
|
-
// The only React.lazy() boundary in this package's views so far
|
|
5
|
+
// The only React.lazy() boundary in this package's views so far, mirrors
|
|
6
6
|
// apps/admin-ui/src/editor/lazy-code-editor.tsx's split (html-code-editor.js
|
|
7
7
|
// pulls in the whole @codemirror/* graph, ~six packages' worth, which must
|
|
8
8
|
// stay out of whatever chunk loads this file / built-ins.tsx's static
|
|
@@ -11,15 +11,15 @@ import { usePluginSettingsValue, usePluginValue } from "../plugin-context.js";
|
|
|
11
11
|
// point for the com.kardalum.html editor.
|
|
12
12
|
const HtmlCodeEditorLazy = lazy(() => import("./html-code-editor.js").then((module) => ({ default: module.HtmlCodeEditor })));
|
|
13
13
|
// Same role="status" + aria-hidden placeholder pattern as
|
|
14
|
-
// lazy-code-editor.tsx's CodeEditorFallback
|
|
14
|
+
// lazy-code-editor.tsx's CodeEditorFallback: no react-i18next here (this
|
|
15
15
|
// package's views deliberately hardcode English strings today, see
|
|
16
16
|
// built-ins.tsx's TextReadOnlyView/ImageInputView precedent).
|
|
17
17
|
function HtmlEditorFallback() {
|
|
18
18
|
return (_jsx("div", { role: "status", "aria-label": "Loading code editor\u2026", children: _jsx("div", { "aria-hidden": "true", className: "h-44 w-full animate-pulse rounded-md border border-border-default bg-background-subtle" }) }));
|
|
19
19
|
}
|
|
20
20
|
// The Trusted setting has no bearing on how this field is EDITED (both
|
|
21
|
-
// modes get the same CodeMirror surface)
|
|
22
|
-
// (render-context.ts's html branch, S197 Task 8)
|
|
21
|
+
// modes get the same CodeMirror surface), only on how it's RENDERED
|
|
22
|
+
// (render-context.ts's html branch, S197 Task 8), so neither the input
|
|
23
23
|
// nor the readOnly view reads settings at all, matching the datatype's
|
|
24
24
|
// posture that `trusted` is purely a render-pipeline decision.
|
|
25
25
|
function HtmlEditor({ editable }) {
|
|
@@ -42,11 +42,11 @@ export function HtmlInputView() {
|
|
|
42
42
|
export function HtmlReadOnlyView() {
|
|
43
43
|
return _jsx(HtmlEditor, { editable: false });
|
|
44
44
|
}
|
|
45
|
-
// Rendered by the Data Types editor only (data-type-editor.tsx)
|
|
45
|
+
// Rendered by the Data Types editor only (data-type-editor.tsx): a
|
|
46
46
|
// settings-EDITING view, same usePluginSettingsValue() convention as
|
|
47
47
|
// TextSettingsView/ImageSettingsView in built-ins.tsx. The help copy is
|
|
48
|
-
// spec-binding verbatim text (S197 spec §7 / task brief), not a paraphrase
|
|
49
|
-
//
|
|
48
|
+
// spec-binding verbatim text (S197 spec §7 / task brief), not a paraphrase,
|
|
49
|
+
// so do not reword it.
|
|
50
50
|
export function HtmlSettingsView() {
|
|
51
51
|
const { value: settings, onChange } = usePluginSettingsValue();
|
|
52
52
|
return (_jsx("div", { className: "flex flex-col gap-4", children: _jsx(PropertyField, { label: "Trusted", htmlFor: "html-settings-trusted", helpText: "Trusted HTML renders exactly as written: including scripts. Only enable for fields edited by people you'd let deploy code.", children: _jsx(Switch, { id: "html-settings-trusted", checked: settings.trusted === true, onCheckedChange: (checked) => onChange({ ...settings, trusted: checked === true }) }) }) }));
|
package/dist/views/image-view.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useRef, useState } from "react";
|
|
3
3
|
import { CROP_EDITOR_ID, CropSettingsSchema, renditionName, renditionShape, THUMBNAIL_EDITOR_ID, ThumbnailSettingsSchema, } from "@kardalum/api-schemas";
|
|
4
|
-
import { Button, cn, Input, PropertyField, usePropertyFieldControl } from "@kardalum/ui";
|
|
4
|
+
import { Button, cn, Input, PropertyField, TruncatedText, usePropertyFieldControl } from "@kardalum/ui";
|
|
5
5
|
import { MediaPicker } from "../media/media-picker.js";
|
|
6
6
|
import { uploadFailureMessage } from "../media/upload-error.js";
|
|
7
7
|
import { MANAGE_API, usePluginApi, usePluginSettings, usePluginSettingsValue, usePluginValue, } from "../plugin-context.js";
|
|
8
8
|
import { readAllPages } from "../read-all-pages.js";
|
|
9
9
|
// downloadUrl is the stable app path for a public item (S186c §1/§3) but
|
|
10
|
-
// carries a freshly minted, short-lived `?token=` for a private one
|
|
10
|
+
// carries a freshly minted, short-lived `?token=` for a private one,
|
|
11
11
|
// never persisted; refetch GET /api/manage/v1/media/:id whenever the field's value
|
|
12
12
|
// (media id) changes rather than caching one, so a private item's
|
|
13
13
|
// preview always has a live token.
|
|
@@ -127,7 +127,7 @@ function requestedRendition(settings) {
|
|
|
127
127
|
// known at all.
|
|
128
128
|
function PictureFacts({ preview }) {
|
|
129
129
|
const cut = preview.cut;
|
|
130
|
-
return (_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx(
|
|
130
|
+
return (_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx(TruncatedText, { className: "block truncate font-mono text-xs text-text-primary", dir: "auto", children: cut.state === "found" ? cut.filename : preview.filename }), cut.state === "found" && (_jsx(TruncatedText, { className: "block truncate text-xs text-text-tertiary", dir: "auto", children: `${cut.name} of ${preview.filename}` })), cut.state === "absent" && (_jsx("span", { className: "mt-1 inline-block rounded-sm bg-warning-100 px-1 text-xs text-warning-800", children: "full image" }))] }));
|
|
131
131
|
}
|
|
132
132
|
export function ImageInputView() {
|
|
133
133
|
const { value, onChange } = usePluginValue();
|
|
@@ -309,7 +309,7 @@ function useRenditionChoices() {
|
|
|
309
309
|
}, [fetchApi]);
|
|
310
310
|
return { groups, loading, error, complete };
|
|
311
311
|
}
|
|
312
|
-
// Rendered by the Data Types editor only
|
|
312
|
+
// Rendered by the Data Types editor only, a settings-EDITING view (see
|
|
313
313
|
// TextSettingsView in built-ins.tsx for the same pattern/rationale).
|
|
314
314
|
// acceptedTypes is edited as a comma-separated string (no multi-select
|
|
315
315
|
// widget precedent in this codebase) and parsed to string[] on change.
|
|
@@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from "react";
|
|
|
3
3
|
import { EditorContent, useEditor } from "@tiptap/react";
|
|
4
4
|
import { NodeSelection } from "@tiptap/pm/state";
|
|
5
5
|
import { Code2, Image as ImageIcon, Link as LinkIcon, List as ListIcon, Quote as QuoteIcon } from "lucide-react";
|
|
6
|
-
import { cn, usePropertyFieldControl } from "@kardalum/ui";
|
|
6
|
+
import { cn, IconTooltip, usePropertyFieldControl } from "@kardalum/ui";
|
|
7
7
|
import { MANAGE_API, usePluginApi, usePluginValue } from "../plugin-context.js";
|
|
8
8
|
import { buildRichtextExtensions } from "../richtext/extensions.js";
|
|
9
9
|
import { MediaPicker } from "../media/media-picker.js";
|
|
@@ -127,8 +127,9 @@ function useToolbarRovingTabIndex(focusableKeys) {
|
|
|
127
127
|
}
|
|
128
128
|
return { activeKey, setActiveKey, registerRef, handleKeyDown };
|
|
129
129
|
}
|
|
130
|
-
function ToolbarButton({ itemKey, label, ariaLabel,
|
|
131
|
-
|
|
130
|
+
function ToolbarButton({ itemKey, label, ariaLabel, active, disabled, expanded, hasPopup, isRovingActive, registerRef, onFocus, onClick, }) {
|
|
131
|
+
const button = (_jsx("button", { ref: registerRef, type: "button", "data-testid": `rt-toolbar-${itemKey}`, "aria-label": ariaLabel, "aria-pressed": active, "aria-haspopup": hasPopup, "aria-expanded": hasPopup ? expanded : undefined, disabled: disabled, tabIndex: disabled ? -1 : isRovingActive ? 0 : -1, onFocus: onFocus, onClick: onClick, className: cn("inline-flex h-8 items-center gap-1 rounded-md px-2 text-xs font-medium text-text-secondary hover:bg-background-hover disabled:pointer-events-none disabled:opacity-50", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", active && "bg-primary-100 text-primary-800"), children: label }));
|
|
132
|
+
return ariaLabel ? _jsx(IconTooltip, { children: button }) : button;
|
|
132
133
|
}
|
|
133
134
|
function ToolbarSeparator() {
|
|
134
135
|
return _jsx("span", { "aria-hidden": "true", className: "mx-1 inline-block h-4 w-px bg-border-default" });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
// The one error body shape every route uses
|
|
2
|
+
// The one error body shape every route uses: auth, content, media. Route
|
|
3
3
|
// handlers vary the status code, never the shape.
|
|
4
4
|
export const ApiErrorSchema = z.object({
|
|
5
5
|
message: z.string(),
|
|
@@ -4,7 +4,7 @@ import { AssetPathSchema, AssetRoutePathSchema, AssetVersionMetaSchema, AssetVer
|
|
|
4
4
|
import { VersionListQuerySchema } from "./content-api.schema.js";
|
|
5
5
|
// S192 asset tree browser: caps mirror the content-tree pagination
|
|
6
6
|
// philosophy (never load an unbounded subtree) even though the tree
|
|
7
|
-
// walk itself isn't cursor-paginated
|
|
7
|
+
// walk itself isn't cursor-paginated, but depth/entry caps bound the work.
|
|
8
8
|
export const ASSET_TREE_MAX_DEPTH = 8;
|
|
9
9
|
export const ASSET_TREE_MAX_ENTRIES = 2000;
|
|
10
10
|
export const AssetTreeEntrySchema = z.object({
|
|
@@ -19,7 +19,7 @@ const AuthUserSchema = z.object({
|
|
|
19
19
|
* at worst shows a control the server then refuses. */
|
|
20
20
|
actions: z.array(z.string()),
|
|
21
21
|
});
|
|
22
|
-
// The refresh token itself never appears in a request/response body
|
|
22
|
+
// The refresh token itself never appears in a request/response body: it
|
|
23
23
|
// travels only as an httpOnly cookie (see routes/auth.ts), so the JS client
|
|
24
24
|
// can never read it, and a page reload doesn't lose it.
|
|
25
25
|
export const LoginResponseSchema = z.object({
|
|
@@ -236,6 +236,7 @@ export declare const LatestVersionResponseSchema: z.ZodObject<{
|
|
|
236
236
|
createdBy: z.ZodString;
|
|
237
237
|
}, z.core.$strip>;
|
|
238
238
|
defaultCulture: z.ZodOptional<z.ZodString>;
|
|
239
|
+
saveKeepsName: z.ZodOptional<z.ZodLiteral<true>>;
|
|
239
240
|
fellBack: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
240
241
|
}, z.core.$strip>;
|
|
241
242
|
export type LatestVersionResponse = z.infer<typeof LatestVersionResponseSchema>;
|
|
@@ -4,7 +4,7 @@ import { RESERVED_ROOT_SLUGS, isReservedRootSlug } from "./reserved-slugs.js";
|
|
|
4
4
|
import { ContentNodeSchema, NodeCultureSchema } from "./content.schema.js";
|
|
5
5
|
import { ContentVersionSchema } from "./content-version.schema.js";
|
|
6
6
|
import { NodeAccessFlagsSchema } from "./node-access.schema.js";
|
|
7
|
-
// createdBy is deliberately absent from mutation request bodies
|
|
7
|
+
// createdBy is deliberately absent from mutation request bodies: it comes
|
|
8
8
|
// from the authenticated JWT (sub claim), never from the caller.
|
|
9
9
|
// The culture is a BCP 47 language tag, the same shape Accept-Language is
|
|
10
10
|
// matched against.
|
|
@@ -61,7 +61,7 @@ export const ContentItemResponseSchema = z.object({
|
|
|
61
61
|
// What the signed-in person may do on this node (S276).
|
|
62
62
|
access: NodeAccessFlagsSchema,
|
|
63
63
|
});
|
|
64
|
-
// S156 admin by-path lookup
|
|
64
|
+
// S156 admin by-path lookup: the admin origin's honest-headless view
|
|
65
65
|
// resolves a pasted URL against the content tree. Drafts ARE visible here
|
|
66
66
|
// (this is the back office); the public no-leak rule lives on the server
|
|
67
67
|
// origin's bridge, not on this authenticated route.
|
|
@@ -146,18 +146,24 @@ export const LatestVersionResponseSchema = z.object({
|
|
|
146
146
|
// the latest read and on the one-version read alike; it is optional so a
|
|
147
147
|
// client reading an older server, or a test double, need not carry it.
|
|
148
148
|
defaultCulture: CultureSchema.optional(),
|
|
149
|
+
// S366c: true when a save that names no `_name` keeps the page's name and
|
|
150
|
+
// does not move it (S366 D3), in every culture. A client patching the
|
|
151
|
+
// newest save (the CLI's --field) then leaves the name out unless it was
|
|
152
|
+
// given; a server older than S366 says nothing, and there a default
|
|
153
|
+
// culture's save without the name would drop it.
|
|
154
|
+
saveKeepsName: z.literal(true).optional(),
|
|
149
155
|
// With ?locale=: the varying field ids this language has no value for,
|
|
150
156
|
// whether or not the default language has one. Unlike the public read,
|
|
151
157
|
// where fellBack lists only the fields actually filled from the default.
|
|
152
158
|
// Absent without locale.
|
|
153
159
|
fellBack: z.array(z.string()).optional(),
|
|
154
160
|
});
|
|
155
|
-
// Version history list: metadata only
|
|
161
|
+
// Version history list: metadata only: `data` can be arbitrarily large
|
|
156
162
|
// and the history view only needs the row facts; the full snapshot is one
|
|
157
163
|
// GET /api/manage/v1/content/:id/versions/:version away.
|
|
158
164
|
export const ContentVersionMetaSchema = ContentVersionSchema.omit({ data: true });
|
|
159
165
|
// Newest-first pages. Version numbers are contiguous (1..latest, rows are
|
|
160
|
-
// never deleted
|
|
166
|
+
// never deleted: immutability), so the cursor is simply the last version
|
|
161
167
|
// number of the previous page.
|
|
162
168
|
export const VersionListQuerySchema = z.object({
|
|
163
169
|
cursor: z.coerce.number().int().positive().optional(),
|
|
@@ -204,7 +210,7 @@ export const PublishAllResponseSchema = z.object({ results: z.array(PublishAllRe
|
|
|
204
210
|
// short-TTL, single-content-id preview token (see
|
|
205
211
|
// apps/server/src/auth/preview-tokens.ts). Any existing content id may be
|
|
206
212
|
// minted for, published or not; `expiresAt` is an ISO datetime string.
|
|
207
|
-
// Session 117: added `previewUrl
|
|
213
|
+
// Session 117: added `previewUrl`: the full preview URL (including token),
|
|
208
214
|
// or null if KARDALUM_PREVIEW_BASE_URL is not configured.
|
|
209
215
|
export const PreviewTokenResponseSchema = z.object({
|
|
210
216
|
token: z.string(),
|
|
@@ -293,7 +299,7 @@ export const ContentChildrenResponseSchema = z.object({
|
|
|
293
299
|
// null = no more pages.
|
|
294
300
|
nextCursor: z.string().uuid().nullable(),
|
|
295
301
|
});
|
|
296
|
-
// Whole-array reorder (mirrors the document-type fields/tabs pattern)
|
|
302
|
+
// Whole-array reorder (mirrors the document-type fields/tabs pattern):
|
|
297
303
|
// orderedIds must exactly match the current children of the parent (or
|
|
298
304
|
// root nodes, for /api/manage/v1/content/roots/reorder); the adapter rejects
|
|
299
305
|
// otherwise. Only practical for a fully-loaded sibling list, so the admin
|
|
@@ -305,14 +311,14 @@ export const ReorderNodesResponseSchema = z.object({
|
|
|
305
311
|
success: z.literal(true),
|
|
306
312
|
});
|
|
307
313
|
// The one deliberate exception to ApiErrorSchema's "every route, same
|
|
308
|
-
// shape" rule (api-error.schema.ts)
|
|
314
|
+
// shape" rule (api-error.schema.ts): field validation failures are
|
|
309
315
|
// per-field by nature, and the admin editor needs that structure to
|
|
310
316
|
// eventually highlight the right field/tab, not just show a string.
|
|
311
317
|
//
|
|
312
318
|
// Two reporting routes (S198): a webmaster-configured rule and a built-in
|
|
313
319
|
// datatype's hook both report `key` (a translation key the admin already
|
|
314
320
|
// renders); a third-party datatype's hook reports `message` (its own
|
|
315
|
-
// string
|
|
321
|
+
// string: plugin-message i18n is a later concern). Exactly one of the two
|
|
316
322
|
// is always present, and `path` names a sub-key inside a composite value
|
|
317
323
|
// (a date range's "end") so the form can mark the precise sub-input rather
|
|
318
324
|
// than the whole field.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
// S154 content trash. The DELETE is two-step like the structured-data
|
|
3
3
|
// uninstall gate: unconfirmed → 409 naming the blast radius (the count
|
|
4
|
-
// the confirm dialog renders), confirmed → trash. Trash is SOFT
|
|
5
|
-
// reversible via the restore route
|
|
4
|
+
// the confirm dialog renders), confirmed → trash. Trash is SOFT:
|
|
5
|
+
// reversible via the restore route, so this is a plain confirmation,
|
|
6
6
|
// not the snapshot-gate treatment.
|
|
7
7
|
//
|
|
8
8
|
// Fastify substitutes `null` for a genuinely absent body before handing it
|
|
9
|
-
// to the validator
|
|
9
|
+
// to the validator: a DELETE sent with no payload at all lands here as
|
|
10
10
|
// `null`, not `undefined`. `.nullish()` (not `.optional()`) is required so
|
|
11
11
|
// an absent body validates; `request.body?.confirm` in the route handler
|
|
12
12
|
// already tolerates both null and undefined.
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { TrashCursorSchema } from "./trash-cursor.schema.js";
|
|
3
3
|
import { NodeAccessFlagsSchema } from "./node-access.schema.js";
|
|
4
4
|
// S161: the trash browse surface. Separate from content-trash-api.schema.ts
|
|
5
|
-
// (S154's trash/restore confirmation bodies)
|
|
5
|
+
// (S154's trash/restore confirmation bodies); this file is the list route
|
|
6
6
|
// and the restore-blocked 409, added a session later.
|
|
7
7
|
export const ContentTrashListQuerySchema = z.object({
|
|
8
8
|
cursor: TrashCursorSchema.optional(),
|
|
@@ -213,12 +213,12 @@ export declare const CORE_ACTIONS: readonly [{
|
|
|
213
213
|
readonly action: "settings.read";
|
|
214
214
|
readonly adminGatedToday: false;
|
|
215
215
|
readonly label: "View settings";
|
|
216
|
-
readonly route: "GET /api/manage/v1/settings/render, GET /api/manage/v1/settings/cultures, GET /api/manage/v1/settings/sites, GET /api/manage/v1/settings/nav, GET /api/manage/v1/settings/audit-retention, GET /api/manage/v1/home/news, GET /api/manage/v1/settings/notification-retention";
|
|
216
|
+
readonly route: "GET /api/manage/v1/settings/render, GET /api/manage/v1/settings/cultures, GET /api/manage/v1/settings/sites, GET /api/manage/v1/settings/nav, GET /api/manage/v1/settings/audit-retention, GET /api/manage/v1/home/news, GET /api/manage/v1/settings/notification-retention, GET /api/manage/v1/settings/server";
|
|
217
217
|
}, {
|
|
218
218
|
readonly action: "settings.update";
|
|
219
219
|
readonly adminGatedToday: true;
|
|
220
220
|
readonly label: "Change settings";
|
|
221
|
-
readonly route: "PUT /api/manage/v1/settings/render, PUT /api/manage/v1/settings/cultures, PUT /api/manage/v1/settings/nav, PUT /api/manage/v1/settings/notification-retention";
|
|
221
|
+
readonly route: "PUT /api/manage/v1/settings/render, PUT /api/manage/v1/settings/cultures, PUT /api/manage/v1/settings/nav, PUT /api/manage/v1/settings/notification-retention, PUT /api/manage/v1/settings/server";
|
|
222
222
|
}, {
|
|
223
223
|
readonly action: "sites.manage";
|
|
224
224
|
readonly adminGatedToday: true;
|
|
@@ -75,8 +75,8 @@ export const CORE_ACTIONS = [
|
|
|
75
75
|
{ action: "render.preview", adminGatedToday: true, label: "Render a block preview", route: "POST /api/manage/v1/render/block" },
|
|
76
76
|
// S300a: the app bar's order read in the shell (GET /api/settings/nav) is open to every signed-in user on purpose (S281) and asks no action;
|
|
77
77
|
// its management read (GET /api/manage/v1/settings/nav, S309) asks settings.read, and its write is settings.update.
|
|
78
|
-
{ action: "settings.read", adminGatedToday: false, label: "View settings", route: "GET /api/manage/v1/settings/render, GET /api/manage/v1/settings/cultures, GET /api/manage/v1/settings/sites, GET /api/manage/v1/settings/nav, GET /api/manage/v1/settings/audit-retention, GET /api/manage/v1/home/news, GET /api/manage/v1/settings/notification-retention" },
|
|
79
|
-
{ action: "settings.update", adminGatedToday: true, label: "Change settings", route: "PUT /api/manage/v1/settings/render, PUT /api/manage/v1/settings/cultures, PUT /api/manage/v1/settings/nav, PUT /api/manage/v1/settings/notification-retention" },
|
|
78
|
+
{ action: "settings.read", adminGatedToday: false, label: "View settings", route: "GET /api/manage/v1/settings/render, GET /api/manage/v1/settings/cultures, GET /api/manage/v1/settings/sites, GET /api/manage/v1/settings/nav, GET /api/manage/v1/settings/audit-retention, GET /api/manage/v1/home/news, GET /api/manage/v1/settings/notification-retention, GET /api/manage/v1/settings/server" },
|
|
79
|
+
{ action: "settings.update", adminGatedToday: true, label: "Change settings", route: "PUT /api/manage/v1/settings/render, PUT /api/manage/v1/settings/cultures, PUT /api/manage/v1/settings/nav, PUT /api/manage/v1/settings/notification-retention, PUT /api/manage/v1/settings/server" },
|
|
80
80
|
// S277d: a site's domains and the choice of default site. New with the
|
|
81
81
|
// Site tab, so there was no earlier gate to read; admin-gated because it
|
|
82
82
|
// decides which content every address of the install shows.
|
|
@@ -9,7 +9,7 @@ export const CreateDataTypeRequestSchema = z
|
|
|
9
9
|
settings: z.record(z.string(), z.unknown()).default({}),
|
|
10
10
|
})
|
|
11
11
|
.strict();
|
|
12
|
-
// editorId is deliberately absent
|
|
12
|
+
// editorId is deliberately absent, being immutable after creation (see
|
|
13
13
|
// DataTypeConfigSchema). At least the route merges partial updates onto
|
|
14
14
|
// the loaded config, so both fields are optional here.
|
|
15
15
|
export const UpdateDataTypeRequestSchema = z
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
// A Data Type is a named, admin-created CONFIGURATION of a registry
|
|
3
3
|
// editor (Umbraco's split: the editor is the input-control code shipped
|
|
4
4
|
// by core/plugins; the Data Type is "Richtext: limited toolbar").
|
|
5
|
-
// Document type fields reference a Data Type's id
|
|
5
|
+
// Document type fields reference a Data Type's id: configure once,
|
|
6
6
|
// reuse across document types. Settings are validated against the
|
|
7
7
|
// editor's settingsSchema when the plugin settings pipeline lands
|
|
8
8
|
// (Month 6); until then they are a free-form record.
|
|
@@ -11,7 +11,7 @@ export const DataTypeConfigSchema = z
|
|
|
11
11
|
id: z.string().uuid(),
|
|
12
12
|
name: z.string().min(1),
|
|
13
13
|
// Registry editor id, e.g. 'com.kardalum.richtext'. Immutable after
|
|
14
|
-
// creation
|
|
14
|
+
// creation: swapping the editor under fields that already store
|
|
15
15
|
// values in the old editor's shape is a data footgun.
|
|
16
16
|
editorId: z.string().min(1),
|
|
17
17
|
settings: z.record(z.string(), z.unknown()).default({}),
|
|
@@ -21,7 +21,7 @@ export const DataTypeConfigSchema = z
|
|
|
21
21
|
// arrives as HTML.
|
|
22
22
|
export const RICHTEXT_EDITOR_ID = "com.kardalum.richtext";
|
|
23
23
|
// Every built-in editor seeds one default config in migration
|
|
24
|
-
// 0006_data_types, with these FIXED ids
|
|
24
|
+
// 0006_data_types, with these FIXED ids, the single source of truth
|
|
25
25
|
// shared by the migrations, tests, and any code that needs "the plain
|
|
26
26
|
// Text data type" without a lookup. Version-4/variant-8 shaped so
|
|
27
27
|
// z.string().uuid() accepts them.
|
|
@@ -205,6 +205,93 @@ export declare const DocumentTypeListQuerySchema: z.ZodObject<{
|
|
|
205
205
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
206
206
|
}, z.core.$strip>;
|
|
207
207
|
export type DocumentTypeListQuery = z.infer<typeof DocumentTypeListQuerySchema>;
|
|
208
|
+
export declare const DocumentTypeListItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
209
|
+
id: z.ZodString;
|
|
210
|
+
name: z.ZodString;
|
|
211
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
212
|
+
kind: z.ZodLiteral<"page">;
|
|
213
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
214
|
+
id: z.ZodString;
|
|
215
|
+
name: z.ZodString;
|
|
216
|
+
datatypeId: z.ZodString;
|
|
217
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
218
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
219
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
220
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
222
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
223
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
224
|
+
}, z.core.$strict>>;
|
|
225
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
226
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
227
|
+
}, z.core.$strict>>;
|
|
228
|
+
treeRules: z.ZodObject<{
|
|
229
|
+
allowedAtRoot: z.ZodBoolean;
|
|
230
|
+
allowedParentTypes: z.ZodArray<z.ZodString>;
|
|
231
|
+
allowedChildTypes: z.ZodArray<z.ZodString>;
|
|
232
|
+
}, z.core.$strip>;
|
|
233
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
234
|
+
id: z.ZodString;
|
|
235
|
+
name: z.ZodString;
|
|
236
|
+
}, z.core.$strict>>>;
|
|
237
|
+
defaultTemplateId: z.ZodOptional<z.ZodString>;
|
|
238
|
+
translationMandatory: z.ZodOptional<z.ZodBoolean>;
|
|
239
|
+
collection: z.ZodOptional<z.ZodBoolean>;
|
|
240
|
+
ownedBy: z.ZodNullable<z.ZodString>;
|
|
241
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
242
|
+
id: z.ZodString;
|
|
243
|
+
name: z.ZodString;
|
|
244
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
245
|
+
kind: z.ZodLiteral<"element">;
|
|
246
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
247
|
+
id: z.ZodString;
|
|
248
|
+
name: z.ZodString;
|
|
249
|
+
datatypeId: z.ZodString;
|
|
250
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
251
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
252
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
253
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
254
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
255
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
256
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
257
|
+
}, z.core.$strict>>;
|
|
258
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
259
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
260
|
+
}, z.core.$strict>>;
|
|
261
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
262
|
+
id: z.ZodString;
|
|
263
|
+
name: z.ZodString;
|
|
264
|
+
}, z.core.$strict>>>;
|
|
265
|
+
ownedBy: z.ZodNullable<z.ZodString>;
|
|
266
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
267
|
+
id: z.ZodString;
|
|
268
|
+
name: z.ZodString;
|
|
269
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
270
|
+
kind: z.ZodLiteral<"media">;
|
|
271
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
272
|
+
id: z.ZodString;
|
|
273
|
+
name: z.ZodString;
|
|
274
|
+
datatypeId: z.ZodString;
|
|
275
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
276
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
277
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
278
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
279
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
280
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
281
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
282
|
+
}, z.core.$strict>>;
|
|
283
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
284
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
285
|
+
}, z.core.$strict>>;
|
|
286
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
287
|
+
id: z.ZodString;
|
|
288
|
+
name: z.ZodString;
|
|
289
|
+
}, z.core.$strict>>>;
|
|
290
|
+
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
291
|
+
catchAll: z.ZodOptional<z.ZodBoolean>;
|
|
292
|
+
ownedBy: z.ZodNullable<z.ZodString>;
|
|
293
|
+
}, z.core.$strict>], "kind">;
|
|
294
|
+
export type DocumentTypeListItem = z.infer<typeof DocumentTypeListItemSchema>;
|
|
208
295
|
export declare const DocumentTypeListResponseSchema: z.ZodObject<{
|
|
209
296
|
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
210
297
|
id: z.ZodString;
|
|
@@ -238,6 +325,7 @@ export declare const DocumentTypeListResponseSchema: z.ZodObject<{
|
|
|
238
325
|
defaultTemplateId: z.ZodOptional<z.ZodString>;
|
|
239
326
|
translationMandatory: z.ZodOptional<z.ZodBoolean>;
|
|
240
327
|
collection: z.ZodOptional<z.ZodBoolean>;
|
|
328
|
+
ownedBy: z.ZodNullable<z.ZodString>;
|
|
241
329
|
}, z.core.$strict>, z.ZodObject<{
|
|
242
330
|
id: z.ZodString;
|
|
243
331
|
name: z.ZodString;
|
|
@@ -262,6 +350,7 @@ export declare const DocumentTypeListResponseSchema: z.ZodObject<{
|
|
|
262
350
|
id: z.ZodString;
|
|
263
351
|
name: z.ZodString;
|
|
264
352
|
}, z.core.$strict>>>;
|
|
353
|
+
ownedBy: z.ZodNullable<z.ZodString>;
|
|
265
354
|
}, z.core.$strict>, z.ZodObject<{
|
|
266
355
|
id: z.ZodString;
|
|
267
356
|
name: z.ZodString;
|
|
@@ -288,6 +377,7 @@ export declare const DocumentTypeListResponseSchema: z.ZodObject<{
|
|
|
288
377
|
}, z.core.$strict>>>;
|
|
289
378
|
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
290
379
|
catchAll: z.ZodOptional<z.ZodBoolean>;
|
|
380
|
+
ownedBy: z.ZodNullable<z.ZodString>;
|
|
291
381
|
}, z.core.$strict>], "kind">>;
|
|
292
382
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
293
383
|
}, z.core.$strip>;
|