@arkitektbedriftene/fe-lib 0.4.18 → 0.4.20

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,3 +1,172 @@
1
+ export declare const richTextStyleObj: {
2
+ fontSize: string;
3
+ lineHeight: string;
4
+ "h1, h2, h3, h4, h5, h6": {
5
+ fontWeight: string;
6
+ lineHeight: string;
7
+ margin: string;
8
+ "&:first-child": {
9
+ marginTop: string;
10
+ };
11
+ };
12
+ h1: {
13
+ fontSize: string;
14
+ };
15
+ h2: {
16
+ fontSize: string;
17
+ };
18
+ h3: {
19
+ fontSize: string;
20
+ };
21
+ h4: {
22
+ fontSize: string;
23
+ };
24
+ h5: {
25
+ fontSize: string;
26
+ };
27
+ h6: {
28
+ fontSize: string;
29
+ };
30
+ "p, ul, ol": {
31
+ margin: string;
32
+ "&:first-child": {
33
+ marginTop: string;
34
+ };
35
+ "&:last-child": {
36
+ marginBottom: string;
37
+ };
38
+ };
39
+ strong: {
40
+ fontWeight: string;
41
+ };
42
+ "ul, ol": {
43
+ paddingLeft: string;
44
+ listStylePosition: string;
45
+ listStyleImage: string;
46
+ };
47
+ ul: {
48
+ listStyleType: string;
49
+ };
50
+ ol: {
51
+ listStyleType: string;
52
+ };
53
+ th: {
54
+ fontWeight: string;
55
+ backgroundColor: string;
56
+ };
57
+ "th, td": {
58
+ padding: string;
59
+ border: string;
60
+ };
61
+ kbd: {
62
+ backgroundColor: string;
63
+ color: string;
64
+ padding: string;
65
+ borderRadius: string;
66
+ fontSize: string;
67
+ fontWeight: string;
68
+ };
69
+ "li[role=checkbox]": {
70
+ listStyle: string;
71
+ position: string;
72
+ paddingLeft: number;
73
+ "&::before": {
74
+ content: string;
75
+ width: number;
76
+ height: number;
77
+ top: number;
78
+ left: number;
79
+ cursor: string;
80
+ display: string;
81
+ backgroundSize: string;
82
+ position: string;
83
+ border: string;
84
+ borderRadius: number;
85
+ };
86
+ "&::after": {
87
+ content: string;
88
+ width: number;
89
+ height: number;
90
+ top: number;
91
+ left: number;
92
+ display: string;
93
+ position: string;
94
+ borderLeft: string;
95
+ borderBottom: string;
96
+ transform: string;
97
+ };
98
+ "&[aria-checked=true]": {
99
+ "&::before": {
100
+ backgroundColor: string;
101
+ borderColor: string;
102
+ };
103
+ };
104
+ "&:focus": {
105
+ outline: string;
106
+ "&::before": {
107
+ outline: string;
108
+ outlineOffset: number;
109
+ };
110
+ };
111
+ };
112
+ table: {
113
+ width: string;
114
+ borderCollapse: string;
115
+ border: string;
116
+ td: {
117
+ border: string;
118
+ verticalAlign: string;
119
+ padding: string;
120
+ };
121
+ };
122
+ a: {
123
+ color: string;
124
+ textDecoration: string;
125
+ "&.rutine-link": {
126
+ background: string;
127
+ color: string;
128
+ padding: string;
129
+ borderRadius: string;
130
+ };
131
+ };
132
+ variants: {
133
+ size: {
134
+ xs: {
135
+ fontSize: string;
136
+ "@print": {
137
+ fontSize: string;
138
+ };
139
+ };
140
+ sm: {
141
+ fontSize: string;
142
+ "@print": {
143
+ fontSize: string;
144
+ };
145
+ };
146
+ md: {
147
+ fontSize: string;
148
+ "@print": {
149
+ fontSize: string;
150
+ };
151
+ };
152
+ lg: {
153
+ fontSize: string;
154
+ "@print": {
155
+ fontSize: string;
156
+ };
157
+ };
158
+ xl: {
159
+ fontSize: string;
160
+ "@print": {
161
+ fontSize: string;
162
+ };
163
+ };
164
+ };
165
+ };
166
+ defaultVariants: {
167
+ size: string;
168
+ };
169
+ };
1
170
  export declare const richTextCss: import("@stitches/react/types/styled-component").CssComponent<never, {
2
171
  size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
3
172
  }, {
@@ -3,22 +3,22 @@ var Wt = (t, e, r) => e in t ? Ht(t, e, { enumerable: !0, configurable: !0, writ
3
3
  var lt = (t, e, r) => (Wt(t, typeof e != "symbol" ? e + "" : e, r), r);
4
4
  import { createHeadlessEditor as Ut } from "@lexical/headless";
5
5
  import { $generateHtmlFromNodes as jt } from "@lexical/html";
6
- import { $getRoot as j, ParagraphNode as Kt, $createParagraphNode as K, $createTextNode as A, $setSelection as kt, SELECTION_CHANGE_COMMAND as F, $getSelection as L, COMMAND_PRIORITY_CRITICAL as J, $isRangeSelection as T, $isRootOrShadowRoot as Yt, DEPRECATED_$isGridSelection as G, FORMAT_TEXT_COMMAND as B, COMMAND_PRIORITY_LOW as w, KEY_ARROW_DOWN_COMMAND as qt, KEY_ARROW_UP_COMMAND as Gt, KEY_ESCAPE_COMMAND as bt, KEY_SPACE_COMMAND as Xt, $getNearestNodeFromDOMNode as V, KEY_ARROW_LEFT_COMMAND as Qt, $isElementNode as Jt, COMMAND_PRIORITY_NORMAL as Vt, $isParagraphNode as Zt, COMMAND_PRIORITY_HIGH as te } from "lexical";
6
+ import { $getRoot as j, ParagraphNode as Kt, $createParagraphNode as K, $createTextNode as B, $setSelection as kt, SELECTION_CHANGE_COMMAND as F, $getSelection as T, COMMAND_PRIORITY_CRITICAL as J, $isRangeSelection as L, $isRootOrShadowRoot as Yt, DEPRECATED_$isGridSelection as G, FORMAT_TEXT_COMMAND as A, COMMAND_PRIORITY_LOW as w, KEY_ARROW_DOWN_COMMAND as qt, KEY_ARROW_UP_COMMAND as Gt, KEY_ESCAPE_COMMAND as bt, KEY_SPACE_COMMAND as Xt, $getNearestNodeFromDOMNode as V, KEY_ARROW_LEFT_COMMAND as Qt, $isElementNode as Jt, COMMAND_PRIORITY_NORMAL as Vt, $isParagraphNode as Zt, COMMAND_PRIORITY_HIGH as te } from "lexical";
7
7
  import { trimTextContentFromAnchor as ee, $setBlocksType as X, $isAtNodeEnd as st } from "@lexical/selection";
8
8
  import { AutoLinkNode as re, LinkNode as vt, $isLinkNode as W, TOGGLE_LINK_COMMAND as Z } from "@lexical/link";
9
- import { ListNode as Ct, ListItemNode as ne, $isListNode as tt, INSERT_UNORDERED_LIST_COMMAND as oe, INSERT_ORDERED_LIST_COMMAND as ie, INSERT_CHECK_LIST_COMMAND as Mt, insertList as ae, $isListItemNode as _ } from "@lexical/list";
9
+ import { ListNode as Ct, ListItemNode as ne, $isListNode as tt, INSERT_UNORDERED_LIST_COMMAND as oe, INSERT_ORDERED_LIST_COMMAND as ie, INSERT_CHECK_LIST_COMMAND as Mt, insertList as ae, $isListItemNode as z } from "@lexical/list";
10
10
  import { HeadingNode as le, QuoteNode as se, $isHeadingNode as ce, $createHeadingNode as de, $createQuoteNode as ue } from "@lexical/rich-text";
11
11
  import { TableNode as he, TableRowNode as pe, TableCellNode as ge, INSERT_TABLE_COMMAND as fe, $getTableCellNodeFromLexicalNode as me, $deleteTableColumn__EXPERIMENTAL as ke, $deleteTableRow__EXPERIMENTAL as be, $insertTableColumn__EXPERIMENTAL as ct, $insertTableRow__EXPERIMENTAL as dt } from "@lexical/table";
12
12
  import { jsx as n, jsxs as f, Fragment as Y } from "react/jsx-runtime";
13
- import { createContext as ve, useState as b, useRef as et, useCallback as v, useContext as Ce, useEffect as N, useMemo as Lt, useLayoutEffect as Me } from "react";
14
- import { c as O, s as Tt, D as rt, T as Nt, a as M, B as P, b as yt, d as z, u as nt, e as xt, f as Le, g as Te, o as Et, h as Ne, i as St, j as wt, F as Rt, O as It, k as ye, l as xe, S as Ee, m as $, n as I, p as ut, q as Se, N as we, r as ht, t as Re, v as zt, C as Ie, w as ze, x as _e } from "./Checkbox-a342242a.js";
13
+ import { createContext as ve, useState as b, useRef as et, useCallback as v, useContext as Ce, useEffect as N, useMemo as Tt, useLayoutEffect as Me } from "react";
14
+ import { c as O, s as Lt, D as rt, T as Nt, a as M, B as P, b as yt, d as _, u as nt, e as xt, f as Te, g as Le, o as St, h as Ne, i as Et, j as wt, F as Rt, O as It, k as ye, l as xe, S as Se, m as $, n as I, p as ut, q as Ee, N as we, r as ht, t as Re, v as _t, C as Ie, w as _e, x as ze } from "./Checkbox-a342242a.js";
15
15
  import "react-select";
16
16
  import { LexicalComposer as $e } from "@lexical/react/LexicalComposer.js";
17
17
  import { RichTextPlugin as Oe } from "@lexical/react/LexicalRichTextPlugin.js";
18
18
  import De from "@lexical/react/LexicalErrorBoundary.js";
19
19
  import { useLexicalComposerContext as y } from "@lexical/react/LexicalComposerContext.js";
20
- import { $getNearestNodeOfType as Be, $findMatchingParent as _t, mergeRegister as ot, isHTMLElement as pt } from "@lexical/utils";
21
- import { G as h, f as Ae } from "./index.esm-3266b7f8.js";
20
+ import { $getNearestNodeOfType as Ae, $findMatchingParent as zt, mergeRegister as ot, isHTMLElement as pt } from "@lexical/utils";
21
+ import { G as h, f as Be } from "./index.esm-3266b7f8.js";
22
22
  import { ListPlugin as Pe } from "@lexical/react/LexicalListPlugin.js";
23
23
  import { HistoryPlugin as Fe } from "@lexical/react/LexicalHistoryPlugin.js";
24
24
  import { TablePlugin as He } from "@lexical/react/LexicalTablePlugin.js";
@@ -58,7 +58,7 @@ const Ue = ({
58
58
  const r = j();
59
59
  r.clear();
60
60
  const o = K();
61
- o.append(A("")), r.append(o), kt(null);
61
+ o.append(B("")), r.append(o), kt(null);
62
62
  },
63
63
  {
64
64
  tag: e
@@ -70,13 +70,13 @@ const Ue = ({
70
70
  const o = j();
71
71
  o.clear();
72
72
  const i = K();
73
- i.append(A(t.trim())), o.append(i), kt(null);
73
+ i.append(B(t.trim())), o.append(i), kt(null);
74
74
  },
75
75
  {
76
76
  tag: r
77
77
  }
78
78
  ), e.blur();
79
- }, pn = (t, e, r) => {
79
+ }, gn = (t, e, r) => {
80
80
  let o = 0;
81
81
  const i = Ut({
82
82
  nodes: e,
@@ -87,7 +87,7 @@ const Ue = ({
87
87
  if (typeof t == "string" && !$t(t))
88
88
  i.update(() => {
89
89
  const a = j(), s = K();
90
- s.append(A(t.trim())), a.append(s);
90
+ s.append(B(t.trim())), a.append(s);
91
91
  });
92
92
  else {
93
93
  const a = i.parseEditorState(t, () => {
@@ -105,7 +105,7 @@ const Ue = ({
105
105
  return i.update(() => {
106
106
  l = jt(i);
107
107
  }), { html: l, trimCount: o };
108
- }, gn = [
108
+ }, fn = [
109
109
  le,
110
110
  se,
111
111
  Ct,
@@ -211,7 +211,7 @@ function kr(t) {
211
211
  function br(t) {
212
212
  return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5v5a5 5 0 0 0 10 0v-5" } }, { tag: "path", attr: { d: "M5 19h14" } }] })(t);
213
213
  }
214
- const vr = Tt("div", {
214
+ const vr = Lt("div", {
215
215
  width: "10rem",
216
216
  display: "flex"
217
217
  }), Dt = {
@@ -255,10 +255,10 @@ const vr = Tt("div", {
255
255
  }
256
256
  )
257
257
  ] }), Mr = (t) => {
258
- if (!T(t))
258
+ if (!L(t))
259
259
  return null;
260
260
  const e = t.anchor.getNode();
261
- let r = e.getKey() === "root" ? e : _t(e, (o) => {
261
+ let r = e.getKey() === "root" ? e : zt(e, (o) => {
262
262
  const i = o.getParent();
263
263
  return i !== null && Yt(i);
264
264
  });
@@ -266,22 +266,22 @@ const vr = Tt("div", {
266
266
  anchorNode: e,
267
267
  element: r
268
268
  };
269
- }, Lr = () => {
269
+ }, Tr = () => {
270
270
  const [t] = y(), [e, r] = b("paragraph");
271
271
  N(() => t.registerCommand(
272
272
  F,
273
273
  () => {
274
- const c = L(), g = Mr(c);
274
+ const c = T(), g = Mr(c);
275
275
  if (!g)
276
276
  return !1;
277
- const { element: u, anchorNode: m } = g, S = u.getKey();
278
- if (t.getElementByKey(S) !== null)
277
+ const { element: u, anchorNode: m } = g, E = u.getKey();
278
+ if (t.getElementByKey(E) !== null)
279
279
  if (tt(u)) {
280
- const k = Be(
280
+ const k = Ae(
281
281
  m,
282
282
  Ct
283
- ), E = k ? k.getListType() : u.getListType();
284
- r(E);
283
+ ), S = k ? k.getListType() : u.getListType();
284
+ r(S);
285
285
  } else {
286
286
  const k = ce(u) ? u.getTag() : u.getType();
287
287
  k in Dt && r(k);
@@ -292,8 +292,8 @@ const vr = Tt("div", {
292
292
  ), [t]);
293
293
  const o = (c) => {
294
294
  e !== c && t.update(() => {
295
- const g = L();
296
- (T(g) || G(g)) && (X(g, () => de(c)), r(c));
295
+ const g = T();
296
+ (L(g) || G(g)) && (X(g, () => de(c)), r(c));
297
297
  });
298
298
  };
299
299
  return /* @__PURE__ */ n(vr, { children: /* @__PURE__ */ f(
@@ -312,8 +312,8 @@ const vr = Tt("div", {
312
312
  children: [
313
313
  /* @__PURE__ */ n(M, { onClick: () => {
314
314
  e !== "paragraph" && t.update(() => {
315
- const c = L();
316
- (T(c) || G(c)) && (X(c, () => K()), r("paragraph"));
315
+ const c = T();
316
+ (L(c) || G(c)) && (X(c, () => K()), r("paragraph"));
317
317
  });
318
318
  }, children: /* @__PURE__ */ n(C, { blockType: "paragraph" }) }),
319
319
  /* @__PURE__ */ n(M, { onClick: () => o("h1"), children: /* @__PURE__ */ n(C, { blockType: "h1" }) }),
@@ -333,17 +333,17 @@ const vr = Tt("div", {
333
333
  }, children: /* @__PURE__ */ n(C, { blockType: "check" }) }),
334
334
  /* @__PURE__ */ n(M, { onClick: () => {
335
335
  e !== "quote" && t.update(() => {
336
- const c = L();
337
- (T(c) || G(c)) && (X(c, () => ue()), r("quote"));
336
+ const c = T();
337
+ (L(c) || G(c)) && (X(c, () => ue()), r("quote"));
338
338
  });
339
339
  }, children: /* @__PURE__ */ n(C, { blockType: "quote" }) })
340
340
  ]
341
341
  }
342
342
  ) });
343
- }, Tr = () => {
343
+ }, Lr = () => {
344
344
  const [t] = y(), [e, r] = b(!1), [o, i] = b(!1), [l, a] = b(!1), [s, d] = b(!1), [c, g] = b(!1), u = v(() => {
345
- const p = L();
346
- T(p) && (r(p.hasFormat("bold")), i(p.hasFormat("italic")), a(p.hasFormat("underline")), d(p.hasFormat("code")), g(p.hasFormat("superscript")));
345
+ const p = T();
346
+ L(p) && (r(p.hasFormat("bold")), i(p.hasFormat("italic")), a(p.hasFormat("underline")), d(p.hasFormat("code")), g(p.hasFormat("superscript")));
347
347
  }, []);
348
348
  N(() => ot(
349
349
  t.registerCommand(
@@ -358,21 +358,21 @@ const vr = Tt("div", {
358
358
  })
359
359
  ), [t, u]);
360
360
  const m = v(
361
- () => t.dispatchCommand(B, "bold"),
361
+ () => t.dispatchCommand(A, "bold"),
362
362
  [t]
363
- ), S = v(
364
- () => t.dispatchCommand(B, "italic"),
363
+ ), E = v(
364
+ () => t.dispatchCommand(A, "italic"),
365
365
  [t]
366
366
  ), x = v(
367
- () => t.dispatchCommand(B, "underline"),
367
+ () => t.dispatchCommand(A, "underline"),
368
368
  [t]
369
369
  ), k = v(
370
- () => t.dispatchCommand(B, "code"),
370
+ () => t.dispatchCommand(A, "code"),
371
371
  [t]
372
- ), E = v(
373
- () => t.dispatchCommand(B, "superscript"),
372
+ ), S = v(
373
+ () => t.dispatchCommand(A, "superscript"),
374
374
  [t]
375
- ), D = Lt(() => {
375
+ ), D = Tt(() => {
376
376
  const p = [];
377
377
  return e && p.push("bold"), o && p.push("italic"), l && p.push("underline"), s && p.push("code"), c && p.push("superscript"), p;
378
378
  }, [e, o, l, s, c]);
@@ -384,7 +384,7 @@ const vr = Tt("div", {
384
384
  value: D,
385
385
  children: [
386
386
  /* @__PURE__ */ n(
387
- z,
387
+ _,
388
388
  {
389
389
  onClick: m,
390
390
  title: "Fet tekst",
@@ -393,16 +393,16 @@ const vr = Tt("div", {
393
393
  }
394
394
  ),
395
395
  /* @__PURE__ */ n(
396
- z,
396
+ _,
397
397
  {
398
- onClick: S,
398
+ onClick: E,
399
399
  title: "Kursiv tekst",
400
400
  value: "italic",
401
401
  children: /* @__PURE__ */ n(cr, { size: "1.25rem" })
402
402
  }
403
403
  ),
404
404
  /* @__PURE__ */ n(
405
- z,
405
+ _,
406
406
  {
407
407
  onClick: x,
408
408
  title: "Understreket tekst",
@@ -411,7 +411,7 @@ const vr = Tt("div", {
411
411
  }
412
412
  ),
413
413
  /* @__PURE__ */ n(
414
- z,
414
+ _,
415
415
  {
416
416
  onClick: k,
417
417
  title: "Kode",
@@ -420,9 +420,9 @@ const vr = Tt("div", {
420
420
  }
421
421
  ),
422
422
  /* @__PURE__ */ n(
423
- z,
423
+ _,
424
424
  {
425
- onClick: E,
425
+ onClick: S,
426
426
  title: "Superscript",
427
427
  value: "superscript",
428
428
  children: /* @__PURE__ */ n(mr, { size: "1.25rem" })
@@ -440,13 +440,13 @@ const vr = Tt("div", {
440
440
  placement: "top",
441
441
  whileElementsMounted: xt,
442
442
  middleware: [
443
- Le({
443
+ Te({
444
444
  apply: ({ rects: g, elements: u }) => {
445
445
  u.floating.style.minWidth = `${g.reference.width}px`;
446
446
  }
447
447
  }),
448
- Te(),
449
- Et({
448
+ Le(),
449
+ St({
450
450
  mainAxis: 8
451
451
  }),
452
452
  Ne({
@@ -458,7 +458,7 @@ const vr = Tt("div", {
458
458
  elements: {
459
459
  reference: r.current
460
460
  }
461
- }), { getFloatingProps: c } = St([
461
+ }), { getFloatingProps: c } = Et([
462
462
  wt(a, {
463
463
  role: "dialog"
464
464
  })
@@ -482,9 +482,9 @@ const vr = Tt("div", {
482
482
  children: t,
483
483
  ...e
484
484
  }) => /* @__PURE__ */ f(ye, { "aria-label": "Formattering", ...e, children: [
485
- /* @__PURE__ */ n(Lr, {}),
486
- /* @__PURE__ */ n(xe, {}),
487
485
  /* @__PURE__ */ n(Tr, {}),
486
+ /* @__PURE__ */ n(xe, {}),
487
+ /* @__PURE__ */ n(Lr, {}),
488
488
  t
489
489
  ] });
490
490
  function xr() {
@@ -522,7 +522,7 @@ function xr() {
522
522
  const r = Q();
523
523
  return r != null && t.isEditable() ? (t.update(() => {
524
524
  const o = V(r);
525
- _(o) && (e.preventDefault(), o.toggleChecked());
525
+ z(o) && (e.preventDefault(), o.toggleChecked());
526
526
  }), !0) : !1;
527
527
  },
528
528
  w
@@ -530,15 +530,15 @@ function xr() {
530
530
  t.registerCommand(
531
531
  Qt,
532
532
  (e) => t.getEditorState().read(() => {
533
- const r = L();
534
- if (T(r) && r.isCollapsed()) {
533
+ const r = T();
534
+ if (L(r) && r.isCollapsed()) {
535
535
  const { anchor: o } = r, i = o.type === "element";
536
536
  if (i || o.offset === 0) {
537
- const l = o.getNode(), a = _t(
537
+ const l = o.getNode(), a = zt(
538
538
  l,
539
539
  (s) => Jt(s) && !s.isInline()
540
540
  );
541
- if (_(a)) {
541
+ if (z(a)) {
542
542
  const s = a.getParent();
543
543
  if (tt(s) && s.getListType() === "check" && (i || a.getFirstDescendant() === l)) {
544
544
  const d = t.getElementByKey(a.__key);
@@ -557,7 +557,7 @@ function xr() {
557
557
  })
558
558
  ), [t]), null;
559
559
  }
560
- function Bt(t, e) {
560
+ function At(t, e) {
561
561
  const r = t.target;
562
562
  if (r === null || !pt(r))
563
563
  return;
@@ -571,22 +571,22 @@ function Bt(t, e) {
571
571
  (r.dir === "rtl" ? l < a.right && l > a.right - 20 : l > a.left && l < a.left + 20) && e();
572
572
  }
573
573
  function gt(t) {
574
- Bt(t, () => {
575
- const e = t.target, r = Er(e);
574
+ At(t, () => {
575
+ const e = t.target, r = Sr(e);
576
576
  r != null && r.isEditable() && r.update(() => {
577
577
  if (t.target) {
578
578
  const o = V(e);
579
- _(o) && (e.focus(), o.toggleChecked());
579
+ z(o) && (e.focus(), o.toggleChecked());
580
580
  }
581
581
  });
582
582
  });
583
583
  }
584
584
  function ft(t) {
585
- Bt(t, () => {
585
+ At(t, () => {
586
586
  t.preventDefault();
587
587
  });
588
588
  }
589
- function Er(t) {
589
+ function Sr(t) {
590
590
  let e = t;
591
591
  for (; e; ) {
592
592
  if (e.__lexicalEditor)
@@ -600,11 +600,11 @@ function Q() {
600
600
  return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
601
601
  t.parentNode.__lexicalListType === "check" ? t : null;
602
602
  }
603
- function Sr(t, e) {
603
+ function Er(t, e) {
604
604
  let r = e ? t.getPreviousSibling() : t.getNextSibling(), o = t;
605
- for (; r == null && _(o); )
605
+ for (; r == null && z(o); )
606
606
  o = o.getParentOrThrow().getParent(), o != null && (r = e ? o.getPreviousSibling() : o.getNextSibling());
607
- for (; _(r); ) {
607
+ for (; z(r); ) {
608
608
  const i = e ? r.getLastChild() : r.getFirstChild();
609
609
  if (!tt(i))
610
610
  return r;
@@ -616,9 +616,9 @@ function mt(t, e, r) {
616
616
  const o = Q();
617
617
  return o != null && e.update(() => {
618
618
  const i = V(o);
619
- if (!_(i))
619
+ if (!z(i))
620
620
  return;
621
- const l = Sr(i, r);
621
+ const l = Er(i, r);
622
622
  if (l != null) {
623
623
  l.selectStart();
624
624
  const a = e.getElementByKey(l.__key);
@@ -655,7 +655,7 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
655
655
  console.error("Could not parse"), console.error(r);
656
656
  }
657
657
  }, []), null;
658
- }, Ir = Tt("div", {
658
+ }, Ir = Lt("div", {
659
659
  border: "1px solid $borderDarker",
660
660
  borderRadius: "$md",
661
661
  position: "relative",
@@ -692,7 +692,7 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
692
692
  }
693
693
  }
694
694
  ]
695
- }), zr = ({
695
+ }), _r = ({
696
696
  isLoading: t
697
697
  }) => /* @__PURE__ */ n(
698
698
  P,
@@ -704,9 +704,9 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
704
704
  right: "1rem",
705
705
  display: "flex"
706
706
  },
707
- children: /* @__PURE__ */ n(Ee, {})
707
+ children: /* @__PURE__ */ n(Se, {})
708
708
  }
709
- ), fn = ({
709
+ ), mn = ({
710
710
  isLoading: t,
711
711
  children: e,
712
712
  placeholderText: r,
@@ -720,14 +720,14 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
720
720
  defaultState: g,
721
721
  css: u
722
722
  }) => {
723
- const { hasFocus: m, attributes: S } = tr({ onBlur: c }), x = et(null), k = Lt(() => ({ hasFocus: m, editorRef: x }), [m]);
723
+ const { hasFocus: m, attributes: E } = tr({ onBlur: c }), x = et(null), k = Tt(() => ({ hasFocus: m, editorRef: x }), [m]);
724
724
  return /* @__PURE__ */ n(Ot.Provider, { value: k, children: /* @__PURE__ */ f(
725
725
  $e,
726
726
  {
727
727
  initialConfig: {
728
728
  namespace: "CommentEditor",
729
- onError: (E) => {
730
- console.error(E);
729
+ onError: (S) => {
730
+ console.error(S);
731
731
  },
732
732
  theme: Ze,
733
733
  nodes: o,
@@ -741,7 +741,7 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
741
741
  hasFocus: m,
742
742
  hideBorder: d,
743
743
  css: u,
744
- ...S,
744
+ ...E,
745
745
  children: [
746
746
  l,
747
747
  /* @__PURE__ */ n(
@@ -767,7 +767,7 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
767
767
  ),
768
768
  /* @__PURE__ */ n(wr, {}),
769
769
  i,
770
- /* @__PURE__ */ n(zr, { isLoading: t }),
770
+ /* @__PURE__ */ n(_r, { isLoading: t }),
771
771
  !l && /* @__PURE__ */ n(Nr, { children: a })
772
772
  ]
773
773
  }
@@ -777,7 +777,7 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
777
777
  ]
778
778
  }
779
779
  ) });
780
- }, mn = O({
780
+ }, zr = {
781
781
  fontSize: "1rem",
782
782
  lineHeight: "1.5",
783
783
  "h1, h2, h3, h4, h5, h6": {
@@ -891,12 +891,9 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
891
891
  table: {
892
892
  width: "100%",
893
893
  borderCollapse: "collapse",
894
- border: 0,
895
- tr: {
896
- border: 0
897
- },
894
+ border: "0",
898
895
  td: {
899
- border: "1px solid $gray800",
896
+ border: "1px solid black",
900
897
  verticalAlign: "top",
901
898
  padding: "$2"
902
899
  }
@@ -948,7 +945,7 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
948
945
  defaultVariants: {
949
946
  size: "md"
950
947
  }
951
- }), kn = () => {
948
+ }, kn = O(zr), bn = () => {
952
949
  const [t] = y(), e = v(() => {
953
950
  t.dispatchCommand(fe, {
954
951
  rows: "3",
@@ -969,10 +966,10 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
969
966
  }
970
967
  );
971
968
  };
972
- function _r(t) {
969
+ function $r(t) {
973
970
  return h({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "circle", attr: { cx: "256", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "416", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "96", cy: "256", r: "48" } }] })(t);
974
971
  }
975
- const bn = () => {
972
+ const vn = () => {
976
973
  const [t] = y(), [e, r] = b(null), { hasFocus: o } = it();
977
974
  N(() => {
978
975
  !o && e && r(null);
@@ -983,13 +980,13 @@ const bn = () => {
983
980
  elements: {
984
981
  reference: e
985
982
  },
986
- middleware: [Et({ mainAxis: -20, crossAxis: -2 })]
983
+ middleware: [St({ mainAxis: -20, crossAxis: -2 })]
987
984
  });
988
985
  N(() => t.registerCommand(
989
986
  F,
990
987
  () => {
991
- const s = L();
992
- if (T(s)) {
988
+ const s = T();
989
+ if (L(s)) {
993
990
  const d = s.anchor.getNode(), c = me(d);
994
991
  r(c ? t.getElementByKey(c.getKey()) : null);
995
992
  }
@@ -1033,7 +1030,7 @@ const bn = () => {
1033
1030
  ref: i.setFloating,
1034
1031
  style: l,
1035
1032
  css: { padding: "2px", width: "18px", height: "18px" },
1036
- children: /* @__PURE__ */ n(_r, {})
1033
+ children: /* @__PURE__ */ n($r, {})
1037
1034
  }
1038
1035
  ),
1039
1036
  children: [
@@ -1049,7 +1046,7 @@ const bn = () => {
1049
1046
  }
1050
1047
  ) : null;
1051
1048
  };
1052
- function At(t) {
1049
+ function Bt(t) {
1053
1050
  let e = t;
1054
1051
  const r = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi, o = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
1055
1052
  return e = String(e).trim(), e.match(r) || e.match(o) ? e : "https://";
@@ -1058,7 +1055,7 @@ function Pt(t) {
1058
1055
  const e = t.anchor, r = t.focus, o = t.anchor.getNode(), i = t.focus.getNode();
1059
1056
  return o === i ? o : t.isBackward() ? st(r) ? o : i : st(e) ? o : i;
1060
1057
  }
1061
- const vn = (t) => (R.baseURL = t, R), U = class extends vt {
1058
+ const Cn = (t) => (R.baseURL = t, R), U = class extends vt {
1062
1059
  static getType() {
1063
1060
  return "rutine_link";
1064
1061
  }
@@ -1067,7 +1064,7 @@ const vn = (t) => (R.baseURL = t, R), U = class extends vt {
1067
1064
  }
1068
1065
  createDOM(e) {
1069
1066
  const r = super.createDOM(e);
1070
- return r.setAttribute("href", this.getURL()), r.classList.add("rutine-link"), r;
1067
+ return r.setAttribute("href", this.getURL()), r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer"), r.classList.add("rutine-link"), r;
1071
1068
  }
1072
1069
  static importJSON(e) {
1073
1070
  return Ft(e.url);
@@ -1093,22 +1090,22 @@ lt(R, "baseURL", "");
1093
1090
  function Ft(t) {
1094
1091
  return new R(t);
1095
1092
  }
1096
- function $r(t) {
1093
+ function Or(t) {
1097
1094
  return t instanceof R;
1098
1095
  }
1099
- const Or = ({ onClose: t }) => {
1096
+ const Dr = ({ onClose: t }) => {
1100
1097
  const [e] = y(), r = v(
1101
1098
  (i) => {
1102
1099
  e.update(() => {
1103
- const l = L();
1104
- if (T(l) && l.isCollapsed()) {
1100
+ const l = T();
1101
+ if (L(l) && l.isCollapsed()) {
1105
1102
  const a = l.getNodes();
1106
1103
  if (a.length === 1) {
1107
1104
  const s = a[0];
1108
1105
  Zt(s) && s.getChildren().length === 0 && l.insertText(i);
1109
1106
  }
1110
1107
  }
1111
- }), e.dispatchCommand(Z, At(i));
1108
+ }), e.dispatchCommand(Z, Bt(i));
1112
1109
  },
1113
1110
  [e]
1114
1111
  );
@@ -1116,21 +1113,21 @@ const Or = ({ onClose: t }) => {
1116
1113
  r(i.target.url.value), t();
1117
1114
  }, children: [
1118
1115
  /* @__PURE__ */ n(Re, { name: "url", label: "URL", type: "url", required: !0 }),
1119
- /* @__PURE__ */ f(zt, { children: [
1116
+ /* @__PURE__ */ f(_t, { children: [
1120
1117
  /* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
1121
1118
  /* @__PURE__ */ n($, { type: "submit", variant: "primary", children: "Lagre" })
1122
1119
  ] })
1123
1120
  ] });
1124
- }, Dr = ({ onClose: t, getDocs: e }) => {
1121
+ }, Ar = ({ onClose: t, getDocs: e }) => {
1125
1122
  const [r] = y(), [o, i] = b([]), l = e(), a = v(
1126
1123
  (s) => {
1127
1124
  r.update(() => {
1128
- const d = L();
1129
- if (T(d)) {
1125
+ const d = T();
1126
+ if (L(d)) {
1130
1127
  const c = [];
1131
1128
  for (const [g, u] of s.entries()) {
1132
1129
  const m = Ft(u.value);
1133
- m.append(A(u.label)), c.push(m), g !== s.length - 1 && c.push(A(" "));
1130
+ m.append(B(u.label)), c.push(m), g !== s.length - 1 && c.push(B(" "));
1134
1131
  }
1135
1132
  d.insertNodes(c);
1136
1133
  }
@@ -1140,7 +1137,7 @@ const Or = ({ onClose: t }) => {
1140
1137
  );
1141
1138
  return /* @__PURE__ */ f(Y, { children: [
1142
1139
  /* @__PURE__ */ n(Ie, { multi: !0, options: l, onChange: i }),
1143
- /* @__PURE__ */ f(zt, { children: [
1140
+ /* @__PURE__ */ f(_t, { children: [
1144
1141
  /* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
1145
1142
  /* @__PURE__ */ n(
1146
1143
  $,
@@ -1162,18 +1159,18 @@ const Or = ({ onClose: t }) => {
1162
1159
  const [o, i] = b("url"), l = () => {
1163
1160
  e(!1);
1164
1161
  };
1165
- return /* @__PURE__ */ f(Se, { open: t, onOpenChange: e, css: { width: "600px" }, children: [
1162
+ return /* @__PURE__ */ f(Ee, { open: t, onOpenChange: e, css: { width: "600px" }, children: [
1166
1163
  /* @__PURE__ */ f(we, { css: { marginBottom: "$8" }, children: [
1167
1164
  /* @__PURE__ */ n(ht, { active: o === "url", onClick: () => i("url"), children: "URL" }),
1168
1165
  /* @__PURE__ */ n(ht, { active: o === "rutine", onClick: () => i("rutine"), children: "Rutine" })
1169
1166
  ] }),
1170
- o === "url" && /* @__PURE__ */ n(Or, { onClose: l }),
1171
- o === "rutine" && /* @__PURE__ */ n(Dr, { onClose: l, getDocs: r })
1167
+ o === "url" && /* @__PURE__ */ n(Dr, { onClose: l }),
1168
+ o === "rutine" && /* @__PURE__ */ n(Ar, { onClose: l, getDocs: r })
1172
1169
  ] });
1173
- }, Cn = ({ getDocs: t }) => {
1170
+ }, Mn = ({ getDocs: t }) => {
1174
1171
  const [e] = y(), [r, o] = b(!1), [i, l] = b(!1), a = v(() => {
1175
- const s = L();
1176
- if (T(s)) {
1172
+ const s = T();
1173
+ if (L(s)) {
1177
1174
  const d = Pt(s), c = d.getParent();
1178
1175
  o(W(c) || W(d));
1179
1176
  }
@@ -1184,7 +1181,7 @@ const Or = ({ onClose: t }) => {
1184
1181
  J
1185
1182
  ), [e, a]), /* @__PURE__ */ f(yt, { type: "single", value: r ? "link" : "", children: [
1186
1183
  /* @__PURE__ */ n(
1187
- z,
1184
+ _,
1188
1185
  {
1189
1186
  onClick: () => {
1190
1187
  r ? e.dispatchCommand(Z, null) : l(!0);
@@ -1203,7 +1200,7 @@ const Or = ({ onClose: t }) => {
1203
1200
  }
1204
1201
  )
1205
1202
  ] });
1206
- }, Mn = () => {
1203
+ }, Tn = () => {
1207
1204
  const [t] = y(), e = et(null), [r, o] = b(null), [i, l] = b(""), { hasFocus: a } = it();
1208
1205
  N(() => {
1209
1206
  r ? t.update(() => {
@@ -1218,24 +1215,24 @@ const Or = ({ onClose: t }) => {
1218
1215
  elements: {
1219
1216
  reference: e.current
1220
1217
  },
1221
- middleware: [ze()]
1222
- }), { getFloatingProps: u } = St([
1218
+ middleware: [_e()]
1219
+ }), { getFloatingProps: u } = Et([
1223
1220
  wt(g),
1224
- _e(g)
1221
+ ze(g)
1225
1222
  ]), m = v(() => {
1226
- var E;
1227
- const k = L();
1228
- if (T(k)) {
1223
+ var S;
1224
+ const k = T();
1225
+ if (L(k)) {
1229
1226
  const D = Pt(k), p = D.getParent();
1230
1227
  let H = null;
1231
1228
  if (W(p) ? H = p : W(D) && (H = D), H) {
1232
1229
  const q = window.getSelection(), at = t.getRootElement();
1233
- k !== null && q !== null && at !== null && at.contains(q.anchorNode) && t.isEditable() && (e.current = ((E = q.focusNode) == null ? void 0 : E.parentElement) ?? null);
1230
+ k !== null && q !== null && at !== null && at.contains(q.anchorNode) && t.isEditable() && (e.current = ((S = q.focusNode) == null ? void 0 : S.parentElement) ?? null);
1234
1231
  }
1235
1232
  o(H);
1236
1233
  }
1237
- }, [t]), S = v(() => {
1238
- r && $r(r) && t.update(() => {
1234
+ }, [t]), E = v(() => {
1235
+ r && Or(r) && t.update(() => {
1239
1236
  r.remove();
1240
1237
  }), t.dispatchCommand(Z, null);
1241
1238
  }, [t, r]);
@@ -1261,7 +1258,7 @@ const Or = ({ onClose: t }) => {
1261
1258
  )
1262
1259
  ), [t, m, r]), !s)
1263
1260
  return null;
1264
- const x = At(i);
1261
+ const x = Bt(i);
1265
1262
  return /* @__PURE__ */ n(Rt, { children: /* @__PURE__ */ f(
1266
1263
  It,
1267
1264
  {
@@ -1294,31 +1291,32 @@ const Or = ({ onClose: t }) => {
1294
1291
  children: i
1295
1292
  }
1296
1293
  ),
1297
- /* @__PURE__ */ n($, { color: "danger", icon: !0, size: "sm", onClick: S, children: /* @__PURE__ */ n(Ae, { size: 24 }) })
1294
+ /* @__PURE__ */ n($, { color: "danger", icon: !0, size: "sm", onClick: E, children: /* @__PURE__ */ n(Be, { size: 24 }) })
1298
1295
  ]
1299
1296
  }
1300
1297
  ) });
1301
1298
  };
1302
1299
  export {
1303
1300
  Ft as $createRutineLinkNode,
1304
- $r as $isRutineLinkNode,
1301
+ Or as $isRutineLinkNode,
1305
1302
  Nr as FloatingToolbar,
1306
- kn as InsertSelector,
1307
- Mn as LinkEditPlugin,
1308
- Cn as LinkToolbarButton,
1309
- fn as RichTextEditor,
1303
+ bn as InsertSelector,
1304
+ Tn as LinkEditPlugin,
1305
+ Mn as LinkToolbarButton,
1306
+ mn as RichTextEditor,
1310
1307
  yr as RichTextToolbar,
1311
1308
  R as RutineLinkNode,
1312
- vn as RutineLinkNodeInit,
1313
- bn as TableEditPlugin,
1309
+ Cn as RutineLinkNodeInit,
1310
+ vn as TableEditPlugin,
1314
1311
  Ye as clearEditorState,
1315
- gn as defaultNodes,
1312
+ fn as defaultNodes,
1316
1313
  Ke as isEditorState,
1317
1314
  $t as isJSON,
1318
1315
  Ot as richTextContext,
1319
- mn as richTextCss,
1316
+ kn as richTextCss,
1317
+ zr as richTextStyleObj,
1320
1318
  qe as setStateFromPlainText,
1321
- pn as stateToHTML,
1319
+ gn as stateToHTML,
1322
1320
  tr as useHasFocusWithin,
1323
1321
  it as useRichTextContext
1324
1322
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkitektbedriftene/fe-lib",
3
- "version": "0.4.18",
3
+ "version": "0.4.20",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {