@cosmicdrift/kumiko-renderer 0.393.0 → 0.395.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/dist/app/content-preview.js +1 -9
- package/dist/app/entity-list-screen.js +4 -2
- package/dist/app/kumiko-screen.js +4 -36
- package/dist/app/projection-list-body.js +1 -1
- package/dist/app/qn.d.ts +1 -6
- package/dist/app/qn.js +1 -12
- package/dist/app/screen-visibility-gate.d.ts +19 -0
- package/dist/app/screen-visibility-gate.js +60 -0
- package/dist/app/secrets-edit-body.js +5 -4
- package/dist/app/use-embedded-screen.d.ts +2 -0
- package/dist/app/use-embedded-screen.js +1 -1
- package/dist/app/use-gated-toolbar-actions.d.ts +7 -0
- package/dist/app/use-gated-toolbar-actions.js +51 -0
- package/dist/app/use-projection-list-actions.d.ts +1 -0
- package/dist/app/use-projection-list-actions.js +11 -2
- package/dist/app/visible-when.d.ts +5 -1
- package/dist/app/visible-when.js +11 -0
- package/dist/components/form-screen-layout.d.ts +2 -1
- package/dist/components/form-screen-layout.js +2 -2
- package/dist/components/render-edit-banners.js +1 -1
- package/dist/components/render-edit-layout-flags.d.ts +2 -1
- package/dist/components/render-edit-layout-flags.js +3 -2
- package/dist/components/render-edit-logic.d.ts +2 -1
- package/dist/components/render-edit-logic.js +14 -0
- package/dist/data-table-view-types.d.ts +4 -2
- package/dist/hooks/list-column-layout.d.ts +3 -1
- package/dist/hooks/list-column-layout.js +20 -7
- package/dist/hooks/use-list-view-state.d.ts +1 -1
- package/dist/hooks/use-list-view-state.js +3 -2
- package/dist/i18n-defaults.js +2 -0
- package/dist/web/app/client-plugin.d.ts +1 -1
- package/dist/web/app/dashboard-body.js +1 -1
- package/dist/web/app/dashboard-screen-tiles.d.ts +2 -1
- package/dist/web/app/dashboard-screen-tiles.js +9 -7
- package/dist/web/app/dashboard-shared.d.ts +2 -0
- package/dist/web/app/use-dashboard-screen-state.js +6 -1
- package/dist/web/index.d.ts +1 -1
- package/dist/web/index.js +1 -1
- package/dist/web/layout/shell-breadcrumb.d.ts +4 -1
- package/dist/web/layout/shell-breadcrumb.js +18 -3
- package/dist/web/layout/shell-header.js +4 -2
- package/dist/web/lib/upload-file-ref.d.ts +4 -1
- package/dist/web/lib/upload-file-ref.js +15 -3
- package/dist/web/primitives/action-menu.js +2 -2
- package/dist/web/primitives/calendar-popover.js +1 -1
- package/dist/web/primitives/combobox.js +1 -1
- package/dist/web/primitives/data-table/table-data-cell.js +27 -1
- package/dist/web/primitives/data-table/table-header-row.js +1 -1
- package/dist/web/primitives/data-table/table-view.js +2 -2
- package/dist/web/primitives/data-table/use-column-sizing.d.ts +4 -2
- package/dist/web/primitives/data-table/use-column-sizing.js +34 -11
- package/dist/web/primitives/data-table/view-menu.js +1 -1
- package/dist/web/primitives/data-table-cell.js +1 -1
- package/dist/web/primitives/dialog.js +1 -1
- package/dist/web/primitives/dropdown-menu.d.ts +1 -1
- package/dist/web/primitives/dropdown-menu.js +2 -2
- package/dist/web/primitives/file-upload.js +5 -2
- package/dist/web/primitives/files-dropzone.js +8 -2
- package/dist/web/primitives/lightbox.js +1 -1
- package/dist/web/primitives/modal-shell.js +1 -1
- package/dist/web/primitives/modal.js +1 -1
- package/dist/web/primitives/narrow-pinned-footer.js +1 -1
- package/dist/web/primitives/toast.js +2 -2
- package/dist/web/sse/live-events.js +0 -7
- package/dist/web/widgets/floating-panel-geometry.d.ts +32 -0
- package/dist/web/widgets/floating-panel-geometry.js +71 -0
- package/dist/web/widgets/floating-panel.d.ts +2 -6
- package/dist/web/widgets/floating-panel.js +11 -55
- package/dist/web/widgets/infinity-list.js +27 -14
- package/dist/web/widgets/plan-card.d.ts +2 -0
- package/dist/web/widgets/plan-card.js +5 -1
- package/package.json +6 -19
- package/src/changes.json +54 -0
- package/dist/web/app/rich-content-editor.d.ts +0 -3
- package/dist/web/app/rich-content-editor.js +0 -15
- package/dist/web/app/tiptap-editor.d.ts +0 -3
- package/dist/web/app/tiptap-editor.js +0 -120
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// @runtime client
|
|
3
|
-
//
|
|
4
|
-
// tiptap-backed implementation behind RichContentEditor's lazy() boundary —
|
|
5
|
-
// never import this file directly, tiptap must only load when a "rich"
|
|
6
|
-
// collection is actually rendered. StarterKit covers bold/italic/lists/
|
|
7
|
-
// headings, and its bundled Link extension autolinks on type/paste — no
|
|
8
|
-
// link button, so no URL-prompt UI to build or test.
|
|
9
|
-
import { EditorContent, useEditor, useEditorState } from "@tiptap/react";
|
|
10
|
-
import StarterKit from "@tiptap/starter-kit";
|
|
11
|
-
import { Bold as BoldIcon, Heading1, Heading2, Italic as ItalicIcon, List, ListOrdered, } from "lucide-react";
|
|
12
|
-
import { useEffect } from "react";
|
|
13
|
-
import { TextareaContentEditor, usePrimitives, useTranslation, VariableChips, } from "../../index.js";
|
|
14
|
-
import { cn } from "../lib/cn.js";
|
|
15
|
-
function Toolbar({ actions, disabled, }) {
|
|
16
|
-
const { Button } = usePrimitives();
|
|
17
|
-
return (_jsx("div", { className: "flex flex-wrap gap-1 border-b border-input p-1", children: actions.map((action) => (_jsx(Button, { type: "button", variant: action.isActive ? "primary" : "secondary", size: "icon", disabled: disabled, onClick: action.onClick, ariaLabel: action.label, children: _jsx(action.icon, { size: 16 }) }, action.label))) }));
|
|
18
|
-
}
|
|
19
|
-
export default function TiptapEditor({ id, value, onChange, variables, readOnly, }) {
|
|
20
|
-
const t = useTranslation();
|
|
21
|
-
// ponytail: rich = StarterKit's schema (bold/italic/lists/headings/links).
|
|
22
|
-
// Anything the schema doesn't model — <table>, <div>/<span>, style attrs,
|
|
23
|
-
// <img>, classes — is dropped on first parse (setContent below, and the
|
|
24
|
-
// initial `content: value` here). Upgrade if that ceiling is hit: add the
|
|
25
|
-
// matching tiptap extensions, or a raw-HTML mode for markup StarterKit
|
|
26
|
-
// can't represent.
|
|
27
|
-
const editor = useEditor({
|
|
28
|
-
extensions: [StarterKit],
|
|
29
|
-
content: value,
|
|
30
|
-
editable: !readOnly,
|
|
31
|
-
// Suspense (RichContentEditor's lazy boundary) speculatively mounts
|
|
32
|
-
// this component before committing it; immediate render would create
|
|
33
|
-
// an editor instance during that throwaway pass.
|
|
34
|
-
immediatelyRender: false,
|
|
35
|
-
// Caller-supplied id — the Field wrapping the editor (TextBlockEditor)
|
|
36
|
-
// associates its label via this id, see ContentEditorProps.id in
|
|
37
|
-
// content-editors.tsx.
|
|
38
|
-
editorProps: { attributes: { id } },
|
|
39
|
-
onUpdate: ({ editor: e }) => onChange(e.getHTML()),
|
|
40
|
-
});
|
|
41
|
-
// `useEditor` alone leaves `editor.isActive(...)` reads in the render body
|
|
42
|
-
// frozen on the last prop-driven render — @tiptap/react v3 defaults
|
|
43
|
-
// `shouldRerenderOnTransaction` to false, so a selection-only change (e.g.
|
|
44
|
-
// moving the cursor into bold text without typing) never triggers a
|
|
45
|
-
// re-render on its own. `useEditorState` subscribes to transactions itself
|
|
46
|
-
// and only re-renders when the selected slice of state actually changes.
|
|
47
|
-
const activeState = useEditorState({
|
|
48
|
-
editor,
|
|
49
|
-
selector: ({ editor: e }) => e === null
|
|
50
|
-
? null
|
|
51
|
-
: {
|
|
52
|
-
bold: e.isActive("bold"),
|
|
53
|
-
italic: e.isActive("italic"),
|
|
54
|
-
heading1: e.isActive("heading", { level: 1 }),
|
|
55
|
-
heading2: e.isActive("heading", { level: 2 }),
|
|
56
|
-
bulletList: e.isActive("bulletList"),
|
|
57
|
-
orderedList: e.isActive("orderedList"),
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
// TextBlockEditor loads the entry's content asynchronously (by-slug query
|
|
61
|
-
// resolves after mount), so `value` arrives after useEditor already read
|
|
62
|
-
// its initial (empty) content once. Sync it in — guarded against
|
|
63
|
-
// clobbering in-flight typing by comparing against the editor's own HTML.
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
if (editor && value !== editor.getHTML()) {
|
|
66
|
-
editor.commands.setContent(value, { emitUpdate: false });
|
|
67
|
-
}
|
|
68
|
-
}, [value, editor]);
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
editor?.setEditable(!readOnly);
|
|
71
|
-
}, [readOnly, editor]);
|
|
72
|
-
if (!editor)
|
|
73
|
-
return (_jsx(TextareaContentEditor, { id: id, value: value, onChange: onChange, variables: variables, readOnly: readOnly }));
|
|
74
|
-
const actions = [
|
|
75
|
-
{
|
|
76
|
-
label: t("kumiko.contentEditor.bold"),
|
|
77
|
-
icon: BoldIcon,
|
|
78
|
-
isActive: activeState?.bold ?? false,
|
|
79
|
-
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
label: t("kumiko.contentEditor.italic"),
|
|
83
|
-
icon: ItalicIcon,
|
|
84
|
-
isActive: activeState?.italic ?? false,
|
|
85
|
-
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
label: t("kumiko.contentEditor.heading1"),
|
|
89
|
-
icon: Heading1,
|
|
90
|
-
isActive: activeState?.heading1 ?? false,
|
|
91
|
-
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
label: t("kumiko.contentEditor.heading2"),
|
|
95
|
-
icon: Heading2,
|
|
96
|
-
isActive: activeState?.heading2 ?? false,
|
|
97
|
-
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
label: t("kumiko.contentEditor.bulletList"),
|
|
101
|
-
icon: List,
|
|
102
|
-
isActive: activeState?.bulletList ?? false,
|
|
103
|
-
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
label: t("kumiko.contentEditor.orderedList"),
|
|
107
|
-
icon: ListOrdered,
|
|
108
|
-
isActive: activeState?.orderedList ?? false,
|
|
109
|
-
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
110
|
-
},
|
|
111
|
-
];
|
|
112
|
-
const insertVariable = (name) => {
|
|
113
|
-
editor
|
|
114
|
-
.chain()
|
|
115
|
-
.focus()
|
|
116
|
-
.insertContent({ type: "text", text: `{{${name}}}` })
|
|
117
|
-
.run();
|
|
118
|
-
};
|
|
119
|
-
return (_jsxs("div", { className: "rounded-md border border-input bg-transparent", children: [_jsx(Toolbar, { actions: actions, disabled: readOnly }), _jsx(EditorContent, { editor: editor, className: cn("min-h-40 px-3 py-2 text-base outline-none md:text-sm", "[&_.ProseMirror]:min-h-40 [&_.ProseMirror]:outline-none", "[&_ul]:list-disc [&_ol]:list-decimal [&_ul]:pl-6 [&_ol]:pl-6", "[&_h1]:text-xl [&_h1]:font-bold [&_h2]:text-lg [&_h2]:font-bold", "[&_a]:underline [&_a]:text-primary", "[&_strong]:font-bold [&_em]:italic") }), variables.length > 0 && (_jsx("div", { className: "border-t border-input p-1", children: _jsx(VariableChips, { variables: variables, onInsert: insertVariable, disabled: readOnly }) }))] }));
|
|
120
|
-
}
|