@opengis/form 0.1.19 → 0.1.21

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.
@@ -0,0 +1,153 @@
1
+ import { N as M, n as R, m as v, R as x, c as $ } from "./index-pYkcVgEL.js";
2
+ var z = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, _ = M.create({
3
+ name: "image",
4
+ addOptions() {
5
+ return {
6
+ inline: !1,
7
+ allowBase64: !1,
8
+ HTMLAttributes: {},
9
+ resize: !1
10
+ };
11
+ },
12
+ inline() {
13
+ return this.options.inline;
14
+ },
15
+ group() {
16
+ return this.options.inline ? "inline" : "block";
17
+ },
18
+ draggable: !0,
19
+ addAttributes() {
20
+ return {
21
+ src: {
22
+ default: null
23
+ },
24
+ alt: {
25
+ default: null
26
+ },
27
+ title: {
28
+ default: null
29
+ },
30
+ width: {
31
+ default: null
32
+ },
33
+ height: {
34
+ default: null
35
+ }
36
+ };
37
+ },
38
+ parseHTML() {
39
+ return [
40
+ {
41
+ tag: this.options.allowBase64 ? "img[src]" : 'img[src]:not([src^="data:"])'
42
+ }
43
+ ];
44
+ },
45
+ renderHTML({ HTMLAttributes: e }) {
46
+ return ["img", v(this.options.HTMLAttributes, e)];
47
+ },
48
+ parseMarkdown: (e, i) => i.createNode("image", {
49
+ src: e.href,
50
+ title: e.title,
51
+ alt: e.text
52
+ }),
53
+ renderMarkdown: (e) => {
54
+ var i, l, o, c, d, h;
55
+ const u = (l = (i = e.attrs) == null ? void 0 : i.src) != null ? l : "", f = (c = (o = e.attrs) == null ? void 0 : o.alt) != null ? c : "", t = (h = (d = e.attrs) == null ? void 0 : d.title) != null ? h : "";
56
+ return t ? `![${f}](${u} "${t}")` : `![${f}](${u})`;
57
+ },
58
+ addNodeView() {
59
+ if (!this.options.resize || !this.options.resize.enabled || typeof document > "u")
60
+ return null;
61
+ const { directions: e, minWidth: i, minHeight: l, alwaysPreserveAspectRatio: o } = this.options.resize, c = /* @__PURE__ */ new Set(["src", "width", "height"]);
62
+ return ({ node: d, getPos: h, HTMLAttributes: u, editor: f }) => {
63
+ const t = document.createElement("img");
64
+ t.draggable = !1;
65
+ const m = v(this.options.HTMLAttributes, u);
66
+ Object.entries(m).forEach(([r, n]) => {
67
+ if (n != null)
68
+ switch (r) {
69
+ case "src":
70
+ case "width":
71
+ case "height":
72
+ break;
73
+ default:
74
+ t.setAttribute(r, n);
75
+ break;
76
+ }
77
+ }), m.src !== null && (t.src = m.src);
78
+ let b = { ...u };
79
+ const g = (r) => {
80
+ if (typeof r == "string" && r !== "") {
81
+ t.getAttribute("src") !== r && (t.src = r);
82
+ return;
83
+ }
84
+ t.hasAttribute("src") && t.removeAttribute("src"), t.src !== "" && (t.src = "");
85
+ };
86
+ g(u.src);
87
+ const y = (r) => {
88
+ if (r.type !== d.type)
89
+ return !1;
90
+ const n = f.extensionManager.attributes.filter(
91
+ (s) => s.type === r.type.name
92
+ ), a = $(r, n);
93
+ return Object.keys(b).forEach((s) => {
94
+ !c.has(s) && !(s in a) && t.removeAttribute(s);
95
+ }), Object.entries(a).forEach(([s, w]) => {
96
+ c.has(s) || (w != null ? t.setAttribute(s, w) : t.removeAttribute(s));
97
+ }), g(a.src), b = a, !0;
98
+ }, A = new x({
99
+ element: t,
100
+ editor: f,
101
+ node: d,
102
+ getPos: h,
103
+ onResize: (r, n) => {
104
+ t.style.width = `${r}px`, t.style.height = `${n}px`;
105
+ },
106
+ onCommit: (r, n) => {
107
+ const a = h();
108
+ a !== void 0 && this.editor.chain().setNodeSelection(a).updateAttributes(this.name, {
109
+ width: r,
110
+ height: n
111
+ }).run();
112
+ },
113
+ onUpdate: y,
114
+ options: {
115
+ directions: e,
116
+ min: {
117
+ width: i,
118
+ height: l
119
+ },
120
+ preserveAspectRatio: o === !0
121
+ }
122
+ }), p = A.dom;
123
+ return p.style.visibility = "hidden", p.style.pointerEvents = "none", t.onload = () => {
124
+ p.style.visibility = "", p.style.pointerEvents = "";
125
+ }, A;
126
+ };
127
+ },
128
+ addCommands() {
129
+ return {
130
+ setImage: (e) => ({ commands: i }) => i.insertContent({
131
+ type: this.name,
132
+ attrs: e
133
+ })
134
+ };
135
+ },
136
+ addInputRules() {
137
+ return [
138
+ R({
139
+ find: z,
140
+ type: this.type,
141
+ getAttributes: (e) => {
142
+ const [, , i, l, o] = e;
143
+ return { src: l, alt: i, title: o };
144
+ }
145
+ })
146
+ ];
147
+ }
148
+ }), H = _;
149
+ export {
150
+ _ as Image,
151
+ H as default,
152
+ z as inputRegex
153
+ };
@@ -0,0 +1,237 @@
1
+ import { E as s, M as y, g as l, m as d } from "./index-pYkcVgEL.js";
2
+ var p = 20, a = (t, e = 0) => {
3
+ const r = [];
4
+ return !t.children.length || e > p || Array.from(t.children).forEach((n) => {
5
+ n.tagName === "SPAN" ? r.push(n) : n.children.length && r.push(...a(n, e + 1));
6
+ }), r;
7
+ }, f = (t) => {
8
+ if (!t.children.length)
9
+ return;
10
+ const e = a(t);
11
+ e && e.forEach((r) => {
12
+ var n, o;
13
+ const i = r.getAttribute("style"), u = (o = (n = r.parentElement) == null ? void 0 : n.closest("span")) == null ? void 0 : o.getAttribute("style");
14
+ r.setAttribute("style", `${u};${i}`);
15
+ });
16
+ }, c = y.create({
17
+ name: "textStyle",
18
+ priority: 101,
19
+ addOptions() {
20
+ return {
21
+ HTMLAttributes: {},
22
+ mergeNestedSpanStyles: !0
23
+ };
24
+ },
25
+ parseHTML() {
26
+ return [
27
+ {
28
+ tag: "span",
29
+ consuming: !1,
30
+ getAttrs: (t) => t.hasAttribute("style") ? (this.options.mergeNestedSpanStyles && f(t), {}) : !1
31
+ }
32
+ ];
33
+ },
34
+ renderHTML({ HTMLAttributes: t }) {
35
+ return ["span", d(this.options.HTMLAttributes, t), 0];
36
+ },
37
+ addCommands() {
38
+ return {
39
+ toggleTextStyle: (t) => ({ commands: e }) => e.toggleMark(this.name, t),
40
+ removeEmptyTextStyle: () => ({ tr: t }) => {
41
+ const { selection: e } = t;
42
+ return t.doc.nodesBetween(e.from, e.to, (r, n) => {
43
+ if (r.isTextblock)
44
+ return !0;
45
+ r.marks.filter((o) => o.type === this.type).some((o) => Object.values(o.attrs).some((i) => !!i)) || t.removeMark(n, n + r.nodeSize, this.type);
46
+ }), !0;
47
+ }
48
+ };
49
+ }
50
+ }), h = s.create({
51
+ name: "backgroundColor",
52
+ addOptions() {
53
+ return {
54
+ types: ["textStyle"]
55
+ };
56
+ },
57
+ addGlobalAttributes() {
58
+ return [
59
+ {
60
+ types: this.options.types,
61
+ attributes: {
62
+ backgroundColor: {
63
+ default: null,
64
+ parseHTML: (t) => {
65
+ var e;
66
+ const r = (e = l(t, "background-color")) != null ? e : t.style.backgroundColor;
67
+ return r?.replace(/['"]+/g, "");
68
+ },
69
+ renderHTML: (t) => t.backgroundColor ? {
70
+ style: `background-color: ${t.backgroundColor}`
71
+ } : {}
72
+ }
73
+ }
74
+ }
75
+ ];
76
+ },
77
+ addCommands() {
78
+ return {
79
+ setBackgroundColor: (t) => ({ chain: e }) => e().setMark("textStyle", { backgroundColor: t }).run(),
80
+ unsetBackgroundColor: () => ({ chain: t }) => t().setMark("textStyle", { backgroundColor: null }).removeEmptyTextStyle().run()
81
+ };
82
+ }
83
+ }), S = s.create({
84
+ name: "color",
85
+ addOptions() {
86
+ return {
87
+ types: ["textStyle"]
88
+ };
89
+ },
90
+ addGlobalAttributes() {
91
+ return [
92
+ {
93
+ types: this.options.types,
94
+ attributes: {
95
+ color: {
96
+ default: null,
97
+ parseHTML: (t) => {
98
+ var e;
99
+ const r = (e = l(t, "color")) != null ? e : t.style.color;
100
+ return r?.replace(/['"]+/g, "");
101
+ },
102
+ renderHTML: (t) => t.color ? {
103
+ style: `color: ${t.color}`
104
+ } : {}
105
+ }
106
+ }
107
+ }
108
+ ];
109
+ },
110
+ addCommands() {
111
+ return {
112
+ setColor: (t) => ({ chain: e }) => e().setMark("textStyle", { color: t }).run(),
113
+ unsetColor: () => ({ chain: t }) => t().setMark("textStyle", { color: null }).removeEmptyTextStyle().run()
114
+ };
115
+ }
116
+ }), g = s.create({
117
+ name: "fontFamily",
118
+ addOptions() {
119
+ return {
120
+ types: ["textStyle"]
121
+ };
122
+ },
123
+ addGlobalAttributes() {
124
+ return [
125
+ {
126
+ types: this.options.types,
127
+ attributes: {
128
+ fontFamily: {
129
+ default: null,
130
+ // Prefer the raw inline `style` attribute so unquoted or
131
+ // single-quoted multi-word names are preserved instead of being
132
+ // canonicalized by `element.style.fontFamily`, which forces double
133
+ // quotes that then get HTML-encoded to `"` on serialization.
134
+ parseHTML: (t) => {
135
+ var e;
136
+ return (e = l(t, "font-family")) != null ? e : t.style.fontFamily;
137
+ },
138
+ renderHTML: (t) => t.fontFamily ? {
139
+ style: `font-family: ${t.fontFamily}`
140
+ } : {}
141
+ }
142
+ }
143
+ }
144
+ ];
145
+ },
146
+ addCommands() {
147
+ return {
148
+ setFontFamily: (t) => ({ chain: e }) => e().setMark("textStyle", { fontFamily: t }).run(),
149
+ unsetFontFamily: () => ({ chain: t }) => t().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run()
150
+ };
151
+ }
152
+ }), m = s.create({
153
+ name: "fontSize",
154
+ addOptions() {
155
+ return {
156
+ types: ["textStyle"]
157
+ };
158
+ },
159
+ addGlobalAttributes() {
160
+ return [
161
+ {
162
+ types: this.options.types,
163
+ attributes: {
164
+ fontSize: {
165
+ default: null,
166
+ // Prefer the raw inline `style` attribute so the original format
167
+ // is preserved instead of the canonicalized value returned by
168
+ // `element.style.fontSize`.
169
+ parseHTML: (t) => {
170
+ var e;
171
+ return (e = l(t, "font-size")) != null ? e : t.style.fontSize;
172
+ },
173
+ renderHTML: (t) => t.fontSize ? {
174
+ style: `font-size: ${t.fontSize}`
175
+ } : {}
176
+ }
177
+ }
178
+ }
179
+ ];
180
+ },
181
+ addCommands() {
182
+ return {
183
+ setFontSize: (t) => ({ chain: e }) => e().setMark("textStyle", { fontSize: t }).run(),
184
+ unsetFontSize: () => ({ chain: t }) => t().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
185
+ };
186
+ }
187
+ }), x = s.create({
188
+ name: "lineHeight",
189
+ addOptions() {
190
+ return {
191
+ types: ["textStyle"]
192
+ };
193
+ },
194
+ addGlobalAttributes() {
195
+ return [
196
+ {
197
+ types: this.options.types,
198
+ attributes: {
199
+ lineHeight: {
200
+ default: null,
201
+ // Prefer the raw inline `style` attribute so the original format
202
+ // is preserved instead of the canonicalized value returned by
203
+ // `element.style.lineHeight`.
204
+ parseHTML: (t) => {
205
+ var e;
206
+ return (e = l(t, "line-height")) != null ? e : t.style.lineHeight;
207
+ },
208
+ renderHTML: (t) => t.lineHeight ? {
209
+ style: `line-height: ${t.lineHeight}`
210
+ } : {}
211
+ }
212
+ }
213
+ }
214
+ ];
215
+ },
216
+ addCommands() {
217
+ return {
218
+ setLineHeight: (t) => ({ chain: e }) => e().setMark("textStyle", { lineHeight: t }).run(),
219
+ unsetLineHeight: () => ({ chain: t }) => t().setMark("textStyle", { lineHeight: null }).removeEmptyTextStyle().run()
220
+ };
221
+ }
222
+ }), v = s.create({
223
+ name: "textStyleKit",
224
+ addExtensions() {
225
+ const t = [];
226
+ return this.options.backgroundColor !== !1 && t.push(h.configure(this.options.backgroundColor)), this.options.color !== !1 && t.push(S.configure(this.options.color)), this.options.fontFamily !== !1 && t.push(g.configure(this.options.fontFamily)), this.options.fontSize !== !1 && t.push(m.configure(this.options.fontSize)), this.options.lineHeight !== !1 && t.push(x.configure(this.options.lineHeight)), this.options.textStyle !== !1 && t.push(c.configure(this.options.textStyle)), t;
227
+ }
228
+ });
229
+ export {
230
+ h as BackgroundColor,
231
+ S as Color,
232
+ g as FontFamily,
233
+ m as FontSize,
234
+ x as LineHeight,
235
+ c as TextStyle,
236
+ v as TextStyleKit
237
+ };
@@ -1156,7 +1156,7 @@ const is = { class: "relative w-full bg-white rounded-lg" }, us = { class: "abso
1156
1156
  return (o.options ?? []).find((i) => i?.id?.toString() === String(l)) ?? null;
1157
1157
  try {
1158
1158
  const a = new URLSearchParams();
1159
- a.set("json", "1"), a.set("val", String(l)), o.parentValue !== void 0 && o.parentValue !== null && o.parentValue !== "" && a.set("parent", String(o.parentValue)), o.start === 1 && a.set("start", "1");
1159
+ a.set("val", String(l)), o.parentValue !== void 0 && o.parentValue !== null && o.parentValue !== "" && a.set("parent", String(o.parentValue)), o.start === 1 && a.set("start", "1");
1160
1160
  const r = await (await fetch(`${ba(o)}?${a.toString()}`)).json();
1161
1161
  return ha(r)[0] ?? null;
1162
1162
  } catch {
@@ -5388,7 +5388,7 @@ const $d = /* @__PURE__ */ me({
5388
5388
  }),
5389
5389
  emits: ["update:modelValue"],
5390
5390
  setup(e) {
5391
- const t = jo(() => import("./vs-richtext-CZk9qSac.js")), n = e, l = ze(e, "modelValue"), o = y(() => !!n.disabled), a = y(() => n.placeholder ?? ""), i = y(() => ({
5391
+ const t = jo(() => import("./vs-richtext-_ShEE562.js")), n = e, l = ze(e, "modelValue"), o = y(() => !!n.disabled), a = y(() => n.placeholder ?? ""), i = y(() => ({
5392
5392
  height: n.richtextProps.height || "300px",
5393
5393
  format: n.format,
5394
5394
  ...n.richtextProps
@@ -0,0 +1,50 @@
1
+ import { N as d, m as u } from "./index-pYkcVgEL.js";
2
+ var n = " ", i = " ", h = d.create({
3
+ name: "paragraph",
4
+ priority: 1e3,
5
+ addOptions() {
6
+ return {
7
+ HTMLAttributes: {}
8
+ };
9
+ },
10
+ group: "block",
11
+ content: "inline*",
12
+ parseHTML() {
13
+ return [{ tag: "p" }];
14
+ },
15
+ renderHTML({ HTMLAttributes: t }) {
16
+ return ["p", u(this.options.HTMLAttributes, t), 0];
17
+ },
18
+ parseMarkdown: (t, a) => {
19
+ const r = t.tokens || [];
20
+ if (r.length === 1 && r[0].type === "image")
21
+ return a.parseChildren([r[0]]);
22
+ const e = a.parseInline(r);
23
+ return r.length === 1 && r[0].type === "text" && (r[0].raw === n || r[0].text === n || r[0].raw === i || r[0].text === i) && e.length === 1 && e[0].type === "text" && (e[0].text === n || e[0].text === i) ? a.createNode("paragraph", void 0, []) : a.createNode("paragraph", void 0, e);
24
+ },
25
+ renderMarkdown: (t, a, r) => {
26
+ var e, o;
27
+ if (!t)
28
+ return "";
29
+ const p = Array.isArray(t.content) ? t.content : [];
30
+ if (p.length === 0) {
31
+ const s = Array.isArray((e = r?.previousNode) == null ? void 0 : e.content) ? r.previousNode.content : [];
32
+ return ((o = r?.previousNode) == null ? void 0 : o.type) === "paragraph" && s.length === 0 ? n : "";
33
+ }
34
+ return a.renderChildren(p);
35
+ },
36
+ addCommands() {
37
+ return {
38
+ setParagraph: () => ({ commands: t }) => t.setNode(this.name)
39
+ };
40
+ },
41
+ addKeyboardShortcuts() {
42
+ return {
43
+ "Mod-Alt-0": () => this.editor.commands.setParagraph()
44
+ };
45
+ }
46
+ }), c = h;
47
+ export {
48
+ h as Paragraph,
49
+ c as default
50
+ };
@@ -0,0 +1,89 @@
1
+ import { M as o, a as s, b as l, m as u, g as d } from "./index-pYkcVgEL.js";
2
+ var h = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, g = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, c = o.create({
3
+ name: "highlight",
4
+ addOptions() {
5
+ return {
6
+ multicolor: !1,
7
+ HTMLAttributes: {}
8
+ };
9
+ },
10
+ addAttributes() {
11
+ return this.options.multicolor ? {
12
+ color: {
13
+ default: null,
14
+ // Prefer `data-color` (set by our own `renderHTML`) for lossless
15
+ // round-trips. Otherwise parse the raw inline `style` attribute so
16
+ // the original color format (e.g. `#rrggbb`) is preserved instead of
17
+ // the canonicalized `rgb(...)` value from `element.style.backgroundColor`.
18
+ parseHTML: (r) => r.getAttribute("data-color") || d(r, "background-color") || r.style.backgroundColor,
19
+ renderHTML: (r) => r.color ? {
20
+ "data-color": r.color,
21
+ style: `background-color: ${r.color}; color: inherit`
22
+ } : {}
23
+ }
24
+ } : {};
25
+ },
26
+ parseHTML() {
27
+ return [
28
+ {
29
+ tag: "mark"
30
+ }
31
+ ];
32
+ },
33
+ renderHTML({ HTMLAttributes: r }) {
34
+ return ["mark", u(this.options.HTMLAttributes, r), 0];
35
+ },
36
+ renderMarkdown: (r, t) => `==${t.renderChildren(r)}==`,
37
+ parseMarkdown: (r, t) => t.applyMark("highlight", t.parseInline(r.tokens || [])),
38
+ markdownTokenizer: {
39
+ name: "highlight",
40
+ level: "inline",
41
+ start: (r) => r.indexOf("=="),
42
+ tokenize(r, t, a) {
43
+ const e = /^(==)([^=]+)(==)/.exec(r);
44
+ if (e) {
45
+ const n = e[2].trim(), i = a.inlineTokens(n);
46
+ return {
47
+ type: "highlight",
48
+ raw: e[0],
49
+ text: n,
50
+ tokens: i
51
+ };
52
+ }
53
+ }
54
+ },
55
+ addCommands() {
56
+ return {
57
+ setHighlight: (r) => ({ commands: t }) => t.setMark(this.name, r),
58
+ toggleHighlight: (r) => ({ commands: t }) => t.toggleMark(this.name, r),
59
+ unsetHighlight: () => ({ commands: r }) => r.unsetMark(this.name)
60
+ };
61
+ },
62
+ addKeyboardShortcuts() {
63
+ return {
64
+ "Mod-Shift-h": () => this.editor.commands.toggleHighlight()
65
+ };
66
+ },
67
+ addInputRules() {
68
+ return [
69
+ l({
70
+ find: h,
71
+ type: this.type
72
+ })
73
+ ];
74
+ },
75
+ addPasteRules() {
76
+ return [
77
+ s({
78
+ find: g,
79
+ type: this.type
80
+ })
81
+ ];
82
+ }
83
+ }), m = c;
84
+ export {
85
+ c as Highlight,
86
+ m as default,
87
+ h as inputRegex,
88
+ g as pasteRegex
89
+ };
@@ -0,0 +1,47 @@
1
+ import { E as n } from "./index-pYkcVgEL.js";
2
+ var s = n.create({
3
+ name: "textAlign",
4
+ addOptions() {
5
+ return {
6
+ types: [],
7
+ alignments: ["left", "center", "right", "justify"],
8
+ defaultAlignment: null
9
+ };
10
+ },
11
+ addGlobalAttributes() {
12
+ return [
13
+ {
14
+ types: this.options.types,
15
+ attributes: {
16
+ textAlign: {
17
+ default: this.options.defaultAlignment,
18
+ parseHTML: (t) => {
19
+ const e = t.style.textAlign;
20
+ return this.options.alignments.includes(e) ? e : this.options.defaultAlignment;
21
+ },
22
+ renderHTML: (t) => t.textAlign ? { style: `text-align: ${t.textAlign}` } : {}
23
+ }
24
+ }
25
+ }
26
+ ];
27
+ },
28
+ addCommands() {
29
+ return {
30
+ setTextAlign: (t) => ({ commands: e }) => this.options.alignments.includes(t) ? this.options.types.map((i) => e.updateAttributes(i, { textAlign: t })).some((i) => i) : !1,
31
+ unsetTextAlign: () => ({ commands: t }) => this.options.types.map((e) => t.resetAttributes(e, "textAlign")).some((e) => e),
32
+ toggleTextAlign: (t) => ({ editor: e, commands: i }) => this.options.alignments.includes(t) ? e.isActive({ textAlign: t }) ? i.unsetTextAlign() : i.setTextAlign(t) : !1
33
+ };
34
+ },
35
+ addKeyboardShortcuts() {
36
+ return {
37
+ "Mod-Shift-l": () => this.editor.commands.setTextAlign("left"),
38
+ "Mod-Shift-e": () => this.editor.commands.setTextAlign("center"),
39
+ "Mod-Shift-r": () => this.editor.commands.setTextAlign("right"),
40
+ "Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
41
+ };
42
+ }
43
+ }), l = s;
44
+ export {
45
+ s as TextAlign,
46
+ l as default
47
+ };