@measured/puck 0.21.0-canary.eb8ea5ce → 0.21.0-canary.ed10e2a4
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/{chunk-YZQENDBP.mjs → chunk-JA7SEUEH.mjs} +499 -70
- package/dist/{chunk-MSIUWPEI.mjs → chunk-UABEUL66.mjs} +2681 -913
- package/dist/index.css +22 -278
- package/dist/index.d.mts +7 -104
- package/dist/index.d.ts +7 -104
- package/dist/index.js +2494 -5508
- package/dist/index.mjs +9 -19
- package/dist/no-external.css +22 -278
- package/dist/no-external.d.mts +2 -17
- package/dist/no-external.d.ts +2 -17
- package/dist/no-external.js +2494 -5508
- package/dist/no-external.mjs +9 -19
- package/dist/rsc.d.mts +2 -17
- package/dist/rsc.d.ts +2 -17
- package/dist/rsc.js +21 -407
- package/dist/rsc.mjs +9 -15
- package/dist/{walk-tree-Ja9bNCM9.d.mts → walk-tree-CgWnYC1X.d.mts} +3 -202
- package/dist/{walk-tree-Ja9bNCM9.d.ts → walk-tree-CgWnYC1X.d.ts} +3 -202
- package/package.json +1 -23
- package/dist/Editor-DR57V55X.mjs +0 -194
- package/dist/Editor-F2LSS6SE.css +0 -403
- package/dist/Render-6Q5WP25Y.mjs +0 -51
- package/dist/Render-QEMDIDQC.css +0 -101
- package/dist/chunk-A7EMVTSK.mjs +0 -413
- package/dist/chunk-CF5XA6LF.mjs +0 -103
- package/dist/chunk-GQ457KMA.mjs +0 -199
- package/dist/chunk-OPXWLTPM.mjs +0 -3140
- package/dist/rsc.css +0 -101
package/dist/Editor-DR57V55X.mjs
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EditorInner,
|
|
3
|
-
LoadedRichTextMenu,
|
|
4
|
-
useAppStore,
|
|
5
|
-
useAppStoreApi
|
|
6
|
-
} from "./chunk-OPXWLTPM.mjs";
|
|
7
|
-
import "./chunk-YZQENDBP.mjs";
|
|
8
|
-
import {
|
|
9
|
-
PuckRichText
|
|
10
|
-
} from "./chunk-CF5XA6LF.mjs";
|
|
11
|
-
import {
|
|
12
|
-
__spreadProps,
|
|
13
|
-
__spreadValues,
|
|
14
|
-
init_react_import
|
|
15
|
-
} from "./chunk-GQ457KMA.mjs";
|
|
16
|
-
|
|
17
|
-
// components/RichTextEditor/components/Editor.tsx
|
|
18
|
-
init_react_import();
|
|
19
|
-
import { memo, useMemo } from "react";
|
|
20
|
-
|
|
21
|
-
// components/RichTextEditor/lib/use-synced-editor.ts
|
|
22
|
-
init_react_import();
|
|
23
|
-
import { useEditor } from "@tiptap/react";
|
|
24
|
-
import { useEffect, useRef } from "react";
|
|
25
|
-
import { useDebounce } from "use-debounce";
|
|
26
|
-
function useSyncedEditor({
|
|
27
|
-
content,
|
|
28
|
-
onChange,
|
|
29
|
-
extensions,
|
|
30
|
-
editable = true,
|
|
31
|
-
onFocusChange,
|
|
32
|
-
name
|
|
33
|
-
}) {
|
|
34
|
-
const [debouncedState, setDebouncedState] = useDebounce(null, 50, {
|
|
35
|
-
leading: true,
|
|
36
|
-
maxWait: 200
|
|
37
|
-
});
|
|
38
|
-
const syncingRef = useRef(false);
|
|
39
|
-
const lastSyncedRef = useRef("");
|
|
40
|
-
const editTimer = useRef(null);
|
|
41
|
-
const isPending = !!editTimer.current;
|
|
42
|
-
const isFocused = useAppStore((s) => s.state.ui.field.focus === name);
|
|
43
|
-
const resetTimer = (clearOn) => {
|
|
44
|
-
if (editTimer.current) {
|
|
45
|
-
clearTimeout(editTimer.current);
|
|
46
|
-
}
|
|
47
|
-
editTimer.current = setTimeout(() => {
|
|
48
|
-
if (lastSyncedRef.current === clearOn) {
|
|
49
|
-
editTimer.current = null;
|
|
50
|
-
}
|
|
51
|
-
}, 200);
|
|
52
|
-
};
|
|
53
|
-
const appStoreApi = useAppStoreApi();
|
|
54
|
-
const editor = useEditor({
|
|
55
|
-
extensions,
|
|
56
|
-
content,
|
|
57
|
-
editable,
|
|
58
|
-
immediatelyRender: false,
|
|
59
|
-
parseOptions: { preserveWhitespace: "full" },
|
|
60
|
-
onUpdate: ({ editor: editor2 }) => {
|
|
61
|
-
if (syncingRef.current || !isFocused) {
|
|
62
|
-
appStoreApi.getState().setUi({ field: { focus: name } });
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const html = editor2.getHTML();
|
|
66
|
-
const { from, to } = editor2.state.selection;
|
|
67
|
-
setDebouncedState({ from, to, html });
|
|
68
|
-
resetTimer(html);
|
|
69
|
-
lastSyncedRef.current = html;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
if (!editor) return;
|
|
74
|
-
const handleFocus = () => {
|
|
75
|
-
onFocusChange == null ? void 0 : onFocusChange(editor);
|
|
76
|
-
};
|
|
77
|
-
editor.on("focus", handleFocus);
|
|
78
|
-
return () => {
|
|
79
|
-
editor.off("focus", handleFocus);
|
|
80
|
-
};
|
|
81
|
-
}, [editor, onFocusChange]);
|
|
82
|
-
useEffect(() => {
|
|
83
|
-
if (debouncedState) {
|
|
84
|
-
const { ui } = appStoreApi.getState().state;
|
|
85
|
-
onChange(debouncedState.html, {
|
|
86
|
-
field: __spreadProps(__spreadValues({}, ui.field), {
|
|
87
|
-
metadata: { from: debouncedState.from, to: debouncedState.to }
|
|
88
|
-
})
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}, [editor, debouncedState, onChange, appStoreApi, name]);
|
|
92
|
-
useEffect(() => {
|
|
93
|
-
editor == null ? void 0 : editor.setEditable(editable);
|
|
94
|
-
}, [editor, editable]);
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
var _a;
|
|
97
|
-
if (!editor) return;
|
|
98
|
-
if (isPending) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
const current = editor.getHTML();
|
|
102
|
-
if (current === content) return;
|
|
103
|
-
syncingRef.current = true;
|
|
104
|
-
editor.commands.setContent(content, { emitUpdate: false });
|
|
105
|
-
const { ui } = appStoreApi.getState().state;
|
|
106
|
-
if (typeof ((_a = ui.field.metadata) == null ? void 0 : _a.from) !== "undefined") {
|
|
107
|
-
editor.commands.setTextSelection({
|
|
108
|
-
from: ui.field.metadata.from,
|
|
109
|
-
to: ui.field.metadata.to
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
syncingRef.current = false;
|
|
113
|
-
}, [content, editor, appStoreApi]);
|
|
114
|
-
return editor;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// components/RichTextEditor/components/Editor.tsx
|
|
118
|
-
import { EditorContent } from "@tiptap/react";
|
|
119
|
-
import { jsx } from "react/jsx-runtime";
|
|
120
|
-
var Editor = memo((props) => {
|
|
121
|
-
const {
|
|
122
|
-
onChange,
|
|
123
|
-
content,
|
|
124
|
-
readOnly = false,
|
|
125
|
-
field,
|
|
126
|
-
inline = false,
|
|
127
|
-
onFocus,
|
|
128
|
-
id,
|
|
129
|
-
name
|
|
130
|
-
} = props;
|
|
131
|
-
const { tiptap = {}, options } = field;
|
|
132
|
-
const { extensions = [] } = tiptap;
|
|
133
|
-
const loadedExtensions = useMemo(
|
|
134
|
-
() => [PuckRichText.configure(options), ...extensions],
|
|
135
|
-
[field, extensions]
|
|
136
|
-
);
|
|
137
|
-
const appStoreApi = useAppStoreApi();
|
|
138
|
-
const focusName = `${name}${inline ? "::inline" : ""}`;
|
|
139
|
-
const editor = useSyncedEditor({
|
|
140
|
-
content,
|
|
141
|
-
onChange,
|
|
142
|
-
extensions: loadedExtensions,
|
|
143
|
-
editable: !readOnly,
|
|
144
|
-
name: focusName,
|
|
145
|
-
onFocusChange: (editor2) => {
|
|
146
|
-
if (editor2) {
|
|
147
|
-
const s = appStoreApi.getState();
|
|
148
|
-
appStoreApi.setState({
|
|
149
|
-
currentRichText: {
|
|
150
|
-
field,
|
|
151
|
-
editor: editor2,
|
|
152
|
-
id,
|
|
153
|
-
inline
|
|
154
|
-
},
|
|
155
|
-
state: __spreadProps(__spreadValues({}, s.state), {
|
|
156
|
-
ui: __spreadProps(__spreadValues({}, s.state.ui), {
|
|
157
|
-
field: __spreadProps(__spreadValues({}, s.state.ui.field), {
|
|
158
|
-
focus: focusName
|
|
159
|
-
})
|
|
160
|
-
})
|
|
161
|
-
})
|
|
162
|
-
});
|
|
163
|
-
onFocus == null ? void 0 : onFocus(editor2);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
const menuEditor = useAppStore((s) => {
|
|
168
|
-
var _a, _b;
|
|
169
|
-
if (!inline && ((_a = s.currentRichText) == null ? void 0 : _a.id) === id && ((_b = s.currentRichText) == null ? void 0 : _b.inlineComponentId)) {
|
|
170
|
-
return s.currentRichText.editor;
|
|
171
|
-
}
|
|
172
|
-
return editor;
|
|
173
|
-
});
|
|
174
|
-
if (!editor) return null;
|
|
175
|
-
return /* @__PURE__ */ jsx(
|
|
176
|
-
EditorInner,
|
|
177
|
-
__spreadProps(__spreadValues({}, props), {
|
|
178
|
-
editor,
|
|
179
|
-
menu: /* @__PURE__ */ jsx(
|
|
180
|
-
LoadedRichTextMenu,
|
|
181
|
-
{
|
|
182
|
-
field,
|
|
183
|
-
editor: menuEditor,
|
|
184
|
-
readOnly
|
|
185
|
-
}
|
|
186
|
-
),
|
|
187
|
-
children: /* @__PURE__ */ jsx(EditorContent, { editor, className: "rich-text" })
|
|
188
|
-
})
|
|
189
|
-
);
|
|
190
|
-
});
|
|
191
|
-
Editor.displayName = "Editor";
|
|
192
|
-
export {
|
|
193
|
-
Editor
|
|
194
|
-
};
|
package/dist/Editor-F2LSS6SE.css
DELETED
|
@@ -1,403 +0,0 @@
|
|
|
1
|
-
/* css-module:/home/runner/work/puck/puck/packages/core/components/RichTextMenu/styles.module.css/#css-module-data */
|
|
2
|
-
._RichTextMenu_k97eh_1 {
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-direction: row;
|
|
5
|
-
flex-wrap: nowrap;
|
|
6
|
-
}
|
|
7
|
-
._RichTextMenu--form_k97eh_7 {
|
|
8
|
-
border-top-left-radius: 4px;
|
|
9
|
-
border-top-right-radius: 4px;
|
|
10
|
-
padding: 6px 6px;
|
|
11
|
-
background-color: var(--puck-color-grey-12);
|
|
12
|
-
position: relative;
|
|
13
|
-
scrollbar-width: none;
|
|
14
|
-
overflow-x: auto;
|
|
15
|
-
}
|
|
16
|
-
._RichTextMenu-group_k97eh_17 {
|
|
17
|
-
display: flex;
|
|
18
|
-
align-items: space-between;
|
|
19
|
-
flex-direction: row;
|
|
20
|
-
flex-wrap: nowrap;
|
|
21
|
-
padding-inline: 6px;
|
|
22
|
-
gap: 2px;
|
|
23
|
-
position: relative;
|
|
24
|
-
}
|
|
25
|
-
._RichTextMenu-group_k97eh_17:first-of-type {
|
|
26
|
-
padding-left: 0;
|
|
27
|
-
}
|
|
28
|
-
._RichTextMenu-group_k97eh_17:last-of-type {
|
|
29
|
-
padding-right: 0;
|
|
30
|
-
}
|
|
31
|
-
._RichTextMenu--inline_k97eh_35 ._RichTextMenu-group_k97eh_17 {
|
|
32
|
-
color: var(--puck-color-grey-08);
|
|
33
|
-
gap: 0px;
|
|
34
|
-
flex-wrap: nowrap;
|
|
35
|
-
}
|
|
36
|
-
._RichTextMenu-group_k97eh_17 + ._RichTextMenu-group_k97eh_17 {
|
|
37
|
-
border-left: 1px solid var(--puck-color-grey-10);
|
|
38
|
-
}
|
|
39
|
-
._RichTextMenu--inline_k97eh_35 ._RichTextMenu-group_k97eh_17 + ._RichTextMenu-group_k97eh_17 {
|
|
40
|
-
border-left: 0.5px solid var(--puck-color-grey-05);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/* css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css/#css-module-data */
|
|
44
|
-
._IconButton_ffob9_1 {
|
|
45
|
-
align-items: center;
|
|
46
|
-
background: transparent;
|
|
47
|
-
border: none;
|
|
48
|
-
border-radius: 4px;
|
|
49
|
-
color: currentColor;
|
|
50
|
-
display: flex;
|
|
51
|
-
font-family: var(--puck-font-family);
|
|
52
|
-
justify-content: center;
|
|
53
|
-
padding: 4px;
|
|
54
|
-
transition: background-color 50ms ease-in, color 50ms ease-in;
|
|
55
|
-
}
|
|
56
|
-
._IconButton--active_ffob9_14 {
|
|
57
|
-
color: var(--puck-color-azure-04);
|
|
58
|
-
}
|
|
59
|
-
._IconButton_ffob9_1:focus-visible {
|
|
60
|
-
outline: 2px solid var(--puck-color-azure-05);
|
|
61
|
-
outline-offset: -2px;
|
|
62
|
-
}
|
|
63
|
-
@media (hover: hover) and (pointer: fine) {
|
|
64
|
-
._IconButton_ffob9_1:hover:not(._IconButton--disabled_ffob9_24) {
|
|
65
|
-
background: var(--puck-color-grey-10);
|
|
66
|
-
color: var(--puck-color-azure-04);
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
transition: none;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
._IconButton_ffob9_1:active {
|
|
72
|
-
background: var(--puck-color-azure-11);
|
|
73
|
-
transition: none;
|
|
74
|
-
}
|
|
75
|
-
._IconButton-title_ffob9_37 {
|
|
76
|
-
clip: rect(0 0 0 0);
|
|
77
|
-
clip-path: inset(100%);
|
|
78
|
-
height: 1px;
|
|
79
|
-
overflow: hidden;
|
|
80
|
-
position: absolute;
|
|
81
|
-
white-space: nowrap;
|
|
82
|
-
width: 1px;
|
|
83
|
-
}
|
|
84
|
-
._IconButton--disabled_ffob9_24 {
|
|
85
|
-
color: var(--puck-color-grey-07);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/* css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css/#css-module-data */
|
|
89
|
-
@keyframes _loader-animation_nacdm_1 {
|
|
90
|
-
0% {
|
|
91
|
-
transform: rotate(0deg) scale(1);
|
|
92
|
-
}
|
|
93
|
-
50% {
|
|
94
|
-
transform: rotate(180deg) scale(0.8);
|
|
95
|
-
}
|
|
96
|
-
100% {
|
|
97
|
-
transform: rotate(360deg) scale(1);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
._Loader_nacdm_13 {
|
|
101
|
-
background: transparent;
|
|
102
|
-
border-radius: 100%;
|
|
103
|
-
border: 2px solid currentColor;
|
|
104
|
-
border-bottom-color: transparent;
|
|
105
|
-
display: inline-block;
|
|
106
|
-
animation: _loader-animation_nacdm_1 1s 0s infinite linear;
|
|
107
|
-
animation-fill-mode: both;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/* css-module:/home/runner/work/puck/puck/packages/core/components/ActionBar/styles.module.css/#css-module-data */
|
|
111
|
-
._ActionBar_1nmyk_1 {
|
|
112
|
-
align-items: center;
|
|
113
|
-
cursor: default;
|
|
114
|
-
display: flex;
|
|
115
|
-
width: auto;
|
|
116
|
-
padding: 4px;
|
|
117
|
-
padding-inline-start: 0;
|
|
118
|
-
padding-inline-end: 0;
|
|
119
|
-
border-top-left-radius: 8px;
|
|
120
|
-
border-top-right-radius: 8px;
|
|
121
|
-
border-radius: 8px;
|
|
122
|
-
background: var(--puck-color-grey-01);
|
|
123
|
-
color: var(--puck-color-white);
|
|
124
|
-
font-family: var(--puck-font-family);
|
|
125
|
-
min-height: 26px;
|
|
126
|
-
}
|
|
127
|
-
._ActionBar-label_1nmyk_18 {
|
|
128
|
-
color: var(--puck-color-grey-08);
|
|
129
|
-
font-size: var(--puck-font-size-xxxs);
|
|
130
|
-
font-weight: 500;
|
|
131
|
-
padding-inline-start: 8px;
|
|
132
|
-
padding-inline-end: 8px;
|
|
133
|
-
margin-inline-start: 4px;
|
|
134
|
-
margin-inline-end: 4px;
|
|
135
|
-
text-overflow: ellipsis;
|
|
136
|
-
white-space: nowrap;
|
|
137
|
-
}
|
|
138
|
-
._ActionBarAction_1nmyk_30 + ._ActionBar-label_1nmyk_18 {
|
|
139
|
-
padding-inline-start: 0;
|
|
140
|
-
}
|
|
141
|
-
._ActionBar-label_1nmyk_18 + ._ActionBarAction_1nmyk_30 {
|
|
142
|
-
margin-inline-start: -4px;
|
|
143
|
-
}
|
|
144
|
-
._ActionBar-group_1nmyk_38 {
|
|
145
|
-
align-items: center;
|
|
146
|
-
border-inline-start: 0.5px solid var(--puck-color-grey-05);
|
|
147
|
-
display: flex;
|
|
148
|
-
height: 100%;
|
|
149
|
-
padding-inline-start: 4px;
|
|
150
|
-
padding-inline-end: 4px;
|
|
151
|
-
}
|
|
152
|
-
._ActionBar-group_1nmyk_38:first-of-type {
|
|
153
|
-
border-inline-start: 0;
|
|
154
|
-
}
|
|
155
|
-
._ActionBar-group_1nmyk_38:empty {
|
|
156
|
-
display: none;
|
|
157
|
-
}
|
|
158
|
-
._ActionBarAction_1nmyk_30 {
|
|
159
|
-
background: transparent;
|
|
160
|
-
border: none;
|
|
161
|
-
color: var(--puck-color-grey-08);
|
|
162
|
-
cursor: pointer;
|
|
163
|
-
padding: 6px;
|
|
164
|
-
margin-inline-start: 4px;
|
|
165
|
-
margin-inline-end: 4px;
|
|
166
|
-
border-radius: 4px;
|
|
167
|
-
overflow: hidden;
|
|
168
|
-
display: flex;
|
|
169
|
-
align-items: center;
|
|
170
|
-
justify-content: center;
|
|
171
|
-
transition: color 50ms ease-in;
|
|
172
|
-
}
|
|
173
|
-
._ActionBarAction--disabled_1nmyk_71 {
|
|
174
|
-
cursor: auto;
|
|
175
|
-
color: var(--puck-color-grey-06);
|
|
176
|
-
}
|
|
177
|
-
._ActionBarAction_1nmyk_30 svg {
|
|
178
|
-
max-width: none !important;
|
|
179
|
-
}
|
|
180
|
-
._ActionBarAction_1nmyk_30:focus-visible {
|
|
181
|
-
outline: 2px solid var(--puck-color-azure-05);
|
|
182
|
-
outline-offset: -2px;
|
|
183
|
-
}
|
|
184
|
-
@media (hover: hover) and (pointer: fine) {
|
|
185
|
-
._ActionBarAction_1nmyk_30:hover:not(._ActionBarAction--disabled_1nmyk_71) {
|
|
186
|
-
color: var(--puck-color-azure-06);
|
|
187
|
-
transition: none;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
._ActionBarAction_1nmyk_30:active:not(._ActionBarAction--disabled_1nmyk_71),
|
|
191
|
-
._ActionBarAction--active_1nmyk_93 {
|
|
192
|
-
color: var(--puck-color-azure-07);
|
|
193
|
-
transition: none;
|
|
194
|
-
}
|
|
195
|
-
._ActionBar-group_1nmyk_38 * {
|
|
196
|
-
margin: 0;
|
|
197
|
-
}
|
|
198
|
-
._ActionBar-separator_1nmyk_102 {
|
|
199
|
-
background: var(--puck-color-grey-05);
|
|
200
|
-
margin-inline: 4px;
|
|
201
|
-
width: 0.5px;
|
|
202
|
-
height: 100%;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/* css-module:/home/runner/work/puck/puck/packages/core/components/RichTextMenu/components/Control/styles.module.css/#css-module-data */
|
|
206
|
-
._Control_1aveu_1 .lucide {
|
|
207
|
-
height: 18px;
|
|
208
|
-
width: 18px;
|
|
209
|
-
}
|
|
210
|
-
._Control--inline_1aveu_6 .lucide {
|
|
211
|
-
height: 16px;
|
|
212
|
-
width: 16px;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/* css-module:/home/runner/work/puck/puck/packages/core/components/Select/styles.module.css/#css-module-data */
|
|
216
|
-
._Select_xjbef_1 {
|
|
217
|
-
position: relative;
|
|
218
|
-
z-index: 1;
|
|
219
|
-
}
|
|
220
|
-
._Select-button_xjbef_6 {
|
|
221
|
-
align-items: center;
|
|
222
|
-
background: transparent;
|
|
223
|
-
border: none;
|
|
224
|
-
border-radius: 4px;
|
|
225
|
-
display: flex;
|
|
226
|
-
justify-content: center;
|
|
227
|
-
gap: 0px;
|
|
228
|
-
height: 100%;
|
|
229
|
-
padding: 4px;
|
|
230
|
-
padding-right: 2px;
|
|
231
|
-
}
|
|
232
|
-
._Select--hasOptions_xjbef_19 ._Select-button_xjbef_6 {
|
|
233
|
-
color: currentColor;
|
|
234
|
-
}
|
|
235
|
-
._Select--hasOptions_xjbef_19:not(._Select--disabled_xjbef_23) ._Select-button_xjbef_6 {
|
|
236
|
-
cursor: pointer;
|
|
237
|
-
}
|
|
238
|
-
._Select-buttonIcon_xjbef_27 {
|
|
239
|
-
align-items: center;
|
|
240
|
-
display: flex;
|
|
241
|
-
justify-content: center;
|
|
242
|
-
}
|
|
243
|
-
._Select--standalone_xjbef_33 ._Select-buttonIcon_xjbef_27 .lucide {
|
|
244
|
-
height: 18px;
|
|
245
|
-
width: 18px;
|
|
246
|
-
}
|
|
247
|
-
._Select--actionBar_xjbef_38 ._Select-buttonIcon_xjbef_27 .lucide {
|
|
248
|
-
height: 16px;
|
|
249
|
-
width: 16px;
|
|
250
|
-
}
|
|
251
|
-
._Select--hasOptions_xjbef_19:not(._Select--disabled_xjbef_23) ._Select-button_xjbef_6:hover,
|
|
252
|
-
._Select--hasValue_xjbef_44 ._Select-button_xjbef_6 {
|
|
253
|
-
background: var(--puck-color-grey-10);
|
|
254
|
-
color: var(--puck-color-azure-04);
|
|
255
|
-
}
|
|
256
|
-
._Select--disabled_xjbef_23 ._Select-button_xjbef_6 {
|
|
257
|
-
color: var(--puck-color-grey-07);
|
|
258
|
-
}
|
|
259
|
-
._Select--actionBar_xjbef_38 {
|
|
260
|
-
&._Select--hasOptions_xjbef_19 ._Select-button_xjbef_6:hover,
|
|
261
|
-
&._Select--hasValue_xjbef_44 ._Select-button_xjbef_6 {
|
|
262
|
-
background: none;
|
|
263
|
-
color: var(--puck-color-azure-07);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
._Select-items_xjbef_61 {
|
|
267
|
-
background: white;
|
|
268
|
-
border: 1px solid var(--puck-color-grey-09);
|
|
269
|
-
border-radius: 8px;
|
|
270
|
-
margin: 10px 8px;
|
|
271
|
-
margin-left: 0;
|
|
272
|
-
padding: 4px;
|
|
273
|
-
z-index: 2;
|
|
274
|
-
list-style: none;
|
|
275
|
-
}
|
|
276
|
-
._SelectItem_xjbef_72 {
|
|
277
|
-
background: transparent;
|
|
278
|
-
border-radius: 4px;
|
|
279
|
-
border: none;
|
|
280
|
-
color: var(--puck-color-grey-04);
|
|
281
|
-
cursor: pointer;
|
|
282
|
-
display: flex;
|
|
283
|
-
gap: 8px;
|
|
284
|
-
align-items: center;
|
|
285
|
-
font-size: var(--puck-font-size-xxs);
|
|
286
|
-
margin: 0;
|
|
287
|
-
padding: 8px 12px;
|
|
288
|
-
width: 100%;
|
|
289
|
-
}
|
|
290
|
-
._SelectItem--isSelected_xjbef_87 {
|
|
291
|
-
background: var(--puck-color-azure-11);
|
|
292
|
-
color: var(--puck-color-azure-04);
|
|
293
|
-
font-weight: 500;
|
|
294
|
-
}
|
|
295
|
-
._SelectItem--isSelected_xjbef_87 ._SelectItem-icon_xjbef_93 {
|
|
296
|
-
color: var(--puck-color-azure-04);
|
|
297
|
-
}
|
|
298
|
-
._SelectItem_xjbef_72:hover {
|
|
299
|
-
background: var(--puck-color-azure-11);
|
|
300
|
-
color: var(--puck-color-azure-04);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/* css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css/#css-module-data */
|
|
304
|
-
._RichTextEditor_1elol_1 .ProseMirror {
|
|
305
|
-
white-space: pre-wrap;
|
|
306
|
-
word-wrap: break-word;
|
|
307
|
-
cursor: text;
|
|
308
|
-
outline: none;
|
|
309
|
-
position: relative;
|
|
310
|
-
}
|
|
311
|
-
._RichTextEditor_1elol_1 .rich-text * {
|
|
312
|
-
white-space: pre-wrap;
|
|
313
|
-
user-select: auto;
|
|
314
|
-
-webkit-user-select: auto;
|
|
315
|
-
}
|
|
316
|
-
._RichTextEditor_1elol_1 .rich-text blockquote {
|
|
317
|
-
margin: 1em 0;
|
|
318
|
-
padding: 0 1em;
|
|
319
|
-
border-left: 4px solid var(--puck-color-grey-09);
|
|
320
|
-
}
|
|
321
|
-
._RichTextEditor_1elol_1 .rich-text code {
|
|
322
|
-
background-color: var(--puck-color-grey-11);
|
|
323
|
-
padding: 4px 8px;
|
|
324
|
-
border-radius: 4px;
|
|
325
|
-
}
|
|
326
|
-
._RichTextEditor_1elol_1 .rich-text p:empty::before {
|
|
327
|
-
content: "\a0";
|
|
328
|
-
}
|
|
329
|
-
._RichTextEditor_1elol_1 .rich-text pre code {
|
|
330
|
-
display: block;
|
|
331
|
-
padding: 8px 12px;
|
|
332
|
-
}
|
|
333
|
-
._RichTextEditor_1elol_1 .rich-text > *:first-child,
|
|
334
|
-
._RichTextEditor_1elol_1 .ProseMirror > *:first-child,
|
|
335
|
-
._RichTextEditor_1elol_1 .rich-text * p:first-of-type {
|
|
336
|
-
margin-top: 0;
|
|
337
|
-
}
|
|
338
|
-
._RichTextEditor_1elol_1 .rich-text > *:last-child,
|
|
339
|
-
._RichTextEditor_1elol_1 .ProseMirror > *:last-child,
|
|
340
|
-
._RichTextEditor_1elol_1 .rich-text * p:last-of-type {
|
|
341
|
-
margin-bottom: 0;
|
|
342
|
-
}
|
|
343
|
-
._RichTextEditor--editor_1elol_50 {
|
|
344
|
-
background: var(--puck-color-white);
|
|
345
|
-
border-width: 1px;
|
|
346
|
-
border-style: solid;
|
|
347
|
-
border-color: var(--puck-color-grey-09);
|
|
348
|
-
border-radius: 4px;
|
|
349
|
-
box-sizing: border-box;
|
|
350
|
-
display: flex;
|
|
351
|
-
flex-direction: column;
|
|
352
|
-
font-family: inherit;
|
|
353
|
-
font-size: var(--puck-font-size-xxs);
|
|
354
|
-
resize: vertical;
|
|
355
|
-
transition: border-color 50ms ease-in;
|
|
356
|
-
width: 100%;
|
|
357
|
-
max-width: 100%;
|
|
358
|
-
min-height: 128px;
|
|
359
|
-
}
|
|
360
|
-
._RichTextEditor--editor_1elol_50 .rich-text {
|
|
361
|
-
flex-grow: 1;
|
|
362
|
-
}
|
|
363
|
-
._RichTextEditor--editor_1elol_50 .rich-text:not(:has(.ProseMirror)),
|
|
364
|
-
._RichTextEditor--editor_1elol_50 .rich-text .ProseMirror {
|
|
365
|
-
height: 100%;
|
|
366
|
-
padding: 12px 15px;
|
|
367
|
-
}
|
|
368
|
-
._RichTextEditor--editor_1elol_50 .rich-text ul,
|
|
369
|
-
._RichTextEditor--editor_1elol_50 .rich-text ol {
|
|
370
|
-
padding-left: 24px;
|
|
371
|
-
}
|
|
372
|
-
._RichTextEditor--editor_1elol_50 .rich-text li {
|
|
373
|
-
line-height: 1.5;
|
|
374
|
-
}
|
|
375
|
-
._RichTextEditor--editor_1elol_50 .rich-text p {
|
|
376
|
-
margin-block: 12px;
|
|
377
|
-
}
|
|
378
|
-
._RichTextEditor--editor_1elol_50 .rich-text ul {
|
|
379
|
-
list-style: disc;
|
|
380
|
-
}
|
|
381
|
-
._RichTextEditor--editor_1elol_50 .rich-text ol {
|
|
382
|
-
list-style: decimal;
|
|
383
|
-
}
|
|
384
|
-
._RichTextEditor--editor_1elol_50:focus-within {
|
|
385
|
-
border-color: var(--puck-color-grey-05);
|
|
386
|
-
outline: 2px solid var(--puck-color-azure-05);
|
|
387
|
-
transition: none;
|
|
388
|
-
}
|
|
389
|
-
._RichTextEditor--editor_1elol_50._RichTextEditor--disabled_1elol_106 {
|
|
390
|
-
background: var(--puck-color-grey-11);
|
|
391
|
-
}
|
|
392
|
-
._RichTextEditor_1elol_1:not(:focus-within):not(._RichTextEditor--isActive_1elol_110) .ProseMirror ::selection {
|
|
393
|
-
background-color: transparent;
|
|
394
|
-
}
|
|
395
|
-
._RichTextEditor-menu_1elol_116 {
|
|
396
|
-
border-bottom: 1px solid var(--puck-color-grey-10);
|
|
397
|
-
position: sticky;
|
|
398
|
-
top: 0;
|
|
399
|
-
z-index: 1;
|
|
400
|
-
}
|
|
401
|
-
._RichTextEditor--disabled_1elol_106 ._RichTextEditor-menu_1elol_116 {
|
|
402
|
-
border-bottom: 1px solid var(--puck-color-grey-09);
|
|
403
|
-
}
|
package/dist/Render-6Q5WP25Y.mjs
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PuckRichText
|
|
3
|
-
} from "./chunk-CF5XA6LF.mjs";
|
|
4
|
-
import {
|
|
5
|
-
get_class_name_factory_default,
|
|
6
|
-
init_react_import,
|
|
7
|
-
styles_module_default
|
|
8
|
-
} from "./chunk-GQ457KMA.mjs";
|
|
9
|
-
|
|
10
|
-
// components/RichTextEditor/components/Render.tsx
|
|
11
|
-
init_react_import();
|
|
12
|
-
import { generateHTML, generateJSON } from "@tiptap/html";
|
|
13
|
-
import { useMemo } from "react";
|
|
14
|
-
import { jsx } from "react/jsx-runtime";
|
|
15
|
-
var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
|
|
16
|
-
function RichTextRender({
|
|
17
|
-
content,
|
|
18
|
-
field
|
|
19
|
-
}) {
|
|
20
|
-
const { tiptap = {}, options } = field;
|
|
21
|
-
const { extensions = [] } = tiptap;
|
|
22
|
-
const loadedExtensions = useMemo(
|
|
23
|
-
() => [PuckRichText.configure(options), ...extensions],
|
|
24
|
-
[field, extensions]
|
|
25
|
-
);
|
|
26
|
-
const normalized = useMemo(() => {
|
|
27
|
-
if (typeof content === "object" && (content == null ? void 0 : content.type) === "doc") {
|
|
28
|
-
return content;
|
|
29
|
-
}
|
|
30
|
-
if (typeof content === "string") {
|
|
31
|
-
const isHtml = /<\/?[a-z][\s\S]*>/i.test(content);
|
|
32
|
-
if (isHtml) {
|
|
33
|
-
return generateJSON(content, loadedExtensions);
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
type: "doc",
|
|
37
|
-
content: [
|
|
38
|
-
{ type: "paragraph", content: [{ type: "text", text: content }] }
|
|
39
|
-
]
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
return { type: "doc", content: [] };
|
|
43
|
-
}, [content, loadedExtensions]);
|
|
44
|
-
const html = useMemo(() => {
|
|
45
|
-
return generateHTML(normalized, loadedExtensions);
|
|
46
|
-
}, [normalized, loadedExtensions]);
|
|
47
|
-
return /* @__PURE__ */ jsx("div", { className: getClassName(), children: /* @__PURE__ */ jsx("div", { className: "rich-text", dangerouslySetInnerHTML: { __html: html } }) });
|
|
48
|
-
}
|
|
49
|
-
export {
|
|
50
|
-
RichTextRender
|
|
51
|
-
};
|