@opengis/form 0.1.32 → 0.1.33

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.
@@ -1,187 +0,0 @@
1
- import { E as o, g as l, M as a, m as y } from "./index-z-RdtcIQ.js";
2
- const d = 20, u = (t, e = 0) => {
3
- const r = [];
4
- return !t.children.length || e > d || Array.from(t.children).forEach((n) => {
5
- n.tagName === "SPAN" ? r.push(n) : n.children.length && r.push(...u(n, e + 1));
6
- }), r;
7
- }, p = (t) => {
8
- if (!t.children.length) return;
9
- const e = u(t);
10
- e && e.forEach((r) => {
11
- var n;
12
- const s = r.getAttribute("style"), i = (n = r.parentElement) === null || n === void 0 || (n = n.closest("span")) === null || n === void 0 ? void 0 : n.getAttribute("style");
13
- r.setAttribute("style", `${i};${s}`);
14
- });
15
- }, c = a.create({
16
- name: "textStyle",
17
- priority: 101,
18
- addOptions() {
19
- return {
20
- HTMLAttributes: {},
21
- mergeNestedSpanStyles: !0
22
- };
23
- },
24
- parseHTML() {
25
- return [{
26
- tag: "span",
27
- consuming: !1,
28
- getAttrs: (t) => t.hasAttribute("style") ? (this.options.mergeNestedSpanStyles && p(t), {}) : !1
29
- }];
30
- },
31
- renderHTML({ HTMLAttributes: t }) {
32
- return [
33
- "span",
34
- y(this.options.HTMLAttributes, t),
35
- 0
36
- ];
37
- },
38
- addCommands() {
39
- return {
40
- toggleTextStyle: (t) => ({ commands: e }) => e.toggleMark(this.name, t),
41
- removeEmptyTextStyle: () => ({ tr: t }) => {
42
- const { selection: e } = t;
43
- return t.doc.nodesBetween(e.from, e.to, (r, n) => {
44
- if (!r.isInline) return !0;
45
- r.marks.filter((s) => s.type === this.type).some((s) => Object.values(s.attrs).some((i) => !!i)) || t.removeMark(n, n + r.nodeSize, this.type);
46
- }), !0;
47
- }
48
- };
49
- }
50
- }), f = o.create({
51
- name: "backgroundColor",
52
- addOptions() {
53
- return { types: ["textStyle"] };
54
- },
55
- addGlobalAttributes() {
56
- return [{
57
- types: this.options.types,
58
- attributes: { backgroundColor: {
59
- default: null,
60
- parseHTML: (t) => {
61
- var e;
62
- const r = (e = l(t, "background-color")) !== null && e !== void 0 ? e : t.style.backgroundColor;
63
- return r?.replace(/['"]+/g, "");
64
- },
65
- renderHTML: (t) => t.backgroundColor ? { style: `background-color: ${t.backgroundColor}` } : {}
66
- } }
67
- }];
68
- },
69
- addCommands() {
70
- return {
71
- setBackgroundColor: (t) => ({ chain: e }) => e().setMark("textStyle", { backgroundColor: t }).run(),
72
- unsetBackgroundColor: () => ({ chain: t }) => t().setMark("textStyle", { backgroundColor: null }).removeEmptyTextStyle().run()
73
- };
74
- }
75
- }), S = o.create({
76
- name: "color",
77
- addOptions() {
78
- return { types: ["textStyle"] };
79
- },
80
- addGlobalAttributes() {
81
- return [{
82
- types: this.options.types,
83
- attributes: { color: {
84
- default: null,
85
- parseHTML: (t) => {
86
- var e;
87
- const r = (e = l(t, "color")) !== null && e !== void 0 ? e : t.style.color;
88
- return r?.replace(/['"]+/g, "");
89
- },
90
- renderHTML: (t) => t.color ? { style: `color: ${t.color}` } : {}
91
- } }
92
- }];
93
- },
94
- addCommands() {
95
- return {
96
- setColor: (t) => ({ chain: e }) => e().setMark("textStyle", { color: t }).run(),
97
- unsetColor: () => ({ chain: t }) => t().setMark("textStyle", { color: null }).removeEmptyTextStyle().run()
98
- };
99
- }
100
- }), g = o.create({
101
- name: "fontFamily",
102
- addOptions() {
103
- return { types: ["textStyle"] };
104
- },
105
- addGlobalAttributes() {
106
- return [{
107
- types: this.options.types,
108
- attributes: { fontFamily: {
109
- default: null,
110
- parseHTML: (t) => {
111
- var e;
112
- return (e = l(t, "font-family")) !== null && e !== void 0 ? e : t.style.fontFamily;
113
- },
114
- renderHTML: (t) => t.fontFamily ? { style: `font-family: ${t.fontFamily}` } : {}
115
- } }
116
- }];
117
- },
118
- addCommands() {
119
- return {
120
- setFontFamily: (t) => ({ chain: e }) => e().setMark("textStyle", { fontFamily: t }).run(),
121
- unsetFontFamily: () => ({ chain: t }) => t().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run()
122
- };
123
- }
124
- }), h = o.create({
125
- name: "fontSize",
126
- addOptions() {
127
- return { types: ["textStyle"] };
128
- },
129
- addGlobalAttributes() {
130
- return [{
131
- types: this.options.types,
132
- attributes: { fontSize: {
133
- default: null,
134
- parseHTML: (t) => {
135
- var e;
136
- return (e = l(t, "font-size")) !== null && e !== void 0 ? e : t.style.fontSize;
137
- },
138
- renderHTML: (t) => t.fontSize ? { style: `font-size: ${t.fontSize}` } : {}
139
- } }
140
- }];
141
- },
142
- addCommands() {
143
- return {
144
- setFontSize: (t) => ({ chain: e }) => e().setMark("textStyle", { fontSize: t }).run(),
145
- unsetFontSize: () => ({ chain: t }) => t().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
146
- };
147
- }
148
- }), m = o.create({
149
- name: "lineHeight",
150
- addOptions() {
151
- return { types: ["textStyle"] };
152
- },
153
- addGlobalAttributes() {
154
- return [{
155
- types: this.options.types,
156
- attributes: { lineHeight: {
157
- default: null,
158
- parseHTML: (t) => {
159
- var e;
160
- return (e = l(t, "line-height")) !== null && e !== void 0 ? e : t.style.lineHeight;
161
- },
162
- renderHTML: (t) => t.lineHeight ? { style: `line-height: ${t.lineHeight}` } : {}
163
- } }
164
- }];
165
- },
166
- addCommands() {
167
- return {
168
- setLineHeight: (t) => ({ chain: e }) => e().setMark("textStyle", { lineHeight: t }).run(),
169
- unsetLineHeight: () => ({ chain: t }) => t().setMark("textStyle", { lineHeight: null }).removeEmptyTextStyle().run()
170
- };
171
- }
172
- }), M = o.create({
173
- name: "textStyleKit",
174
- addExtensions() {
175
- const t = [];
176
- return this.options.backgroundColor !== !1 && t.push(f.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(h.configure(this.options.fontSize)), this.options.lineHeight !== !1 && t.push(m.configure(this.options.lineHeight)), this.options.textStyle !== !1 && t.push(c.configure(this.options.textStyle)), t;
177
- }
178
- });
179
- export {
180
- f as BackgroundColor,
181
- S as Color,
182
- g as FontFamily,
183
- h as FontSize,
184
- m as LineHeight,
185
- c as TextStyle,
186
- M as TextStyleKit
187
- };