@arkitektbedriftene/fe-lib 0.4.19 → 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.
@@ -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 T, COMMAND_PRIORITY_CRITICAL as J, $isRangeSelection as L, $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
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 z, 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 zt, C as Ie, w as ze, x as _e } from "./Checkbox-a342242a.js";
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,7 +70,7 @@ 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
@@ -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, () => {
@@ -258,7 +258,7 @@ const vr = Lt("div", {
258
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
  });
@@ -277,7 +277,7 @@ const vr = Lt("div", {
277
277
  const { element: u, anchorNode: m } = g, E = u.getKey();
278
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
283
  ), S = k ? k.getListType() : u.getListType();
@@ -358,19 +358,19 @@ const vr = Lt("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
363
  ), E = v(
364
- () => t.dispatchCommand(B, "italic"),
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
372
  ), S = v(
373
- () => t.dispatchCommand(B, "superscript"),
373
+ () => t.dispatchCommand(A, "superscript"),
374
374
  [t]
375
375
  ), D = Tt(() => {
376
376
  const p = [];
@@ -384,7 +384,7 @@ const vr = Lt("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,7 +393,7 @@ const vr = Lt("div", {
393
393
  }
394
394
  ),
395
395
  /* @__PURE__ */ n(
396
- z,
396
+ _,
397
397
  {
398
398
  onClick: E,
399
399
  title: "Kursiv tekst",
@@ -402,7 +402,7 @@ const vr = Lt("div", {
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 = Lt("div", {
411
411
  }
412
412
  ),
413
413
  /* @__PURE__ */ n(
414
- z,
414
+ _,
415
415
  {
416
416
  onClick: k,
417
417
  title: "Kode",
@@ -420,7 +420,7 @@ const vr = Lt("div", {
420
420
  }
421
421
  ),
422
422
  /* @__PURE__ */ n(
423
- z,
423
+ _,
424
424
  {
425
425
  onClick: S,
426
426
  title: "Superscript",
@@ -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
@@ -534,11 +534,11 @@ function xr() {
534
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,18 +571,18 @@ 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, () => {
574
+ At(t, () => {
575
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
  }
@@ -602,9 +602,9 @@ function Q() {
602
602
  }
603
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,7 +616,7 @@ 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
621
  const l = Er(i, r);
622
622
  if (l != null) {
@@ -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,
@@ -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
- }, _r = {
780
+ }, zr = {
781
781
  fontSize: "1rem",
782
782
  lineHeight: "1.5",
783
783
  "h1, h2, h3, h4, h5, h6": {
@@ -945,7 +945,7 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
945
945
  defaultVariants: {
946
946
  size: "md"
947
947
  }
948
- }, kn = O(_r), bn = () => {
948
+ }, kn = O(zr), bn = () => {
949
949
  const [t] = y(), e = v(() => {
950
950
  t.dispatchCommand(fe, {
951
951
  rows: "3",
@@ -1046,7 +1046,7 @@ const vn = () => {
1046
1046
  }
1047
1047
  ) : null;
1048
1048
  };
1049
- function At(t) {
1049
+ function Bt(t) {
1050
1050
  let e = t;
1051
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;
1052
1052
  return e = String(e).trim(), e.match(r) || e.match(o) ? e : "https://";
@@ -1064,7 +1064,7 @@ const Cn = (t) => (R.baseURL = t, R), U = class extends vt {
1064
1064
  }
1065
1065
  createDOM(e) {
1066
1066
  const r = super.createDOM(e);
1067
- 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;
1068
1068
  }
1069
1069
  static importJSON(e) {
1070
1070
  return Ft(e.url);
@@ -1105,7 +1105,7 @@ const Dr = ({ onClose: t }) => {
1105
1105
  Zt(s) && s.getChildren().length === 0 && l.insertText(i);
1106
1106
  }
1107
1107
  }
1108
- }), e.dispatchCommand(Z, At(i));
1108
+ }), e.dispatchCommand(Z, Bt(i));
1109
1109
  },
1110
1110
  [e]
1111
1111
  );
@@ -1113,12 +1113,12 @@ const Dr = ({ onClose: t }) => {
1113
1113
  r(i.target.url.value), t();
1114
1114
  }, children: [
1115
1115
  /* @__PURE__ */ n(Re, { name: "url", label: "URL", type: "url", required: !0 }),
1116
- /* @__PURE__ */ f(zt, { children: [
1116
+ /* @__PURE__ */ f(_t, { children: [
1117
1117
  /* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
1118
1118
  /* @__PURE__ */ n($, { type: "submit", variant: "primary", children: "Lagre" })
1119
1119
  ] })
1120
1120
  ] });
1121
- }, Br = ({ onClose: t, getDocs: e }) => {
1121
+ }, Ar = ({ onClose: t, getDocs: e }) => {
1122
1122
  const [r] = y(), [o, i] = b([]), l = e(), a = v(
1123
1123
  (s) => {
1124
1124
  r.update(() => {
@@ -1127,7 +1127,7 @@ const Dr = ({ onClose: t }) => {
1127
1127
  const c = [];
1128
1128
  for (const [g, u] of s.entries()) {
1129
1129
  const m = Ft(u.value);
1130
- 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(" "));
1131
1131
  }
1132
1132
  d.insertNodes(c);
1133
1133
  }
@@ -1137,7 +1137,7 @@ const Dr = ({ onClose: t }) => {
1137
1137
  );
1138
1138
  return /* @__PURE__ */ f(Y, { children: [
1139
1139
  /* @__PURE__ */ n(Ie, { multi: !0, options: l, onChange: i }),
1140
- /* @__PURE__ */ f(zt, { children: [
1140
+ /* @__PURE__ */ f(_t, { children: [
1141
1141
  /* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
1142
1142
  /* @__PURE__ */ n(
1143
1143
  $,
@@ -1151,7 +1151,7 @@ const Dr = ({ onClose: t }) => {
1151
1151
  )
1152
1152
  ] })
1153
1153
  ] });
1154
- }, Ar = ({
1154
+ }, Br = ({
1155
1155
  open: t,
1156
1156
  onOpenChange: e,
1157
1157
  getDocs: r
@@ -1165,7 +1165,7 @@ const Dr = ({ onClose: t }) => {
1165
1165
  /* @__PURE__ */ n(ht, { active: o === "rutine", onClick: () => i("rutine"), children: "Rutine" })
1166
1166
  ] }),
1167
1167
  o === "url" && /* @__PURE__ */ n(Dr, { onClose: l }),
1168
- o === "rutine" && /* @__PURE__ */ n(Br, { onClose: l, getDocs: r })
1168
+ o === "rutine" && /* @__PURE__ */ n(Ar, { onClose: l, getDocs: r })
1169
1169
  ] });
1170
1170
  }, Mn = ({ getDocs: t }) => {
1171
1171
  const [e] = y(), [r, o] = b(!1), [i, l] = b(!1), a = v(() => {
@@ -1181,7 +1181,7 @@ const Dr = ({ onClose: t }) => {
1181
1181
  J
1182
1182
  ), [e, a]), /* @__PURE__ */ f(yt, { type: "single", value: r ? "link" : "", children: [
1183
1183
  /* @__PURE__ */ n(
1184
- z,
1184
+ _,
1185
1185
  {
1186
1186
  onClick: () => {
1187
1187
  r ? e.dispatchCommand(Z, null) : l(!0);
@@ -1192,7 +1192,7 @@ const Dr = ({ onClose: t }) => {
1192
1192
  }
1193
1193
  ),
1194
1194
  /* @__PURE__ */ n(
1195
- Ar,
1195
+ Br,
1196
1196
  {
1197
1197
  open: i,
1198
1198
  onOpenChange: l,
@@ -1215,10 +1215,10 @@ const Dr = ({ onClose: t }) => {
1215
1215
  elements: {
1216
1216
  reference: e.current
1217
1217
  },
1218
- middleware: [ze()]
1218
+ middleware: [_e()]
1219
1219
  }), { getFloatingProps: u } = Et([
1220
1220
  wt(g),
1221
- _e(g)
1221
+ ze(g)
1222
1222
  ]), m = v(() => {
1223
1223
  var S;
1224
1224
  const k = T();
@@ -1258,7 +1258,7 @@ const Dr = ({ onClose: t }) => {
1258
1258
  )
1259
1259
  ), [t, m, r]), !s)
1260
1260
  return null;
1261
- const x = At(i);
1261
+ const x = Bt(i);
1262
1262
  return /* @__PURE__ */ n(Rt, { children: /* @__PURE__ */ f(
1263
1263
  It,
1264
1264
  {
@@ -1291,7 +1291,7 @@ const Dr = ({ onClose: t }) => {
1291
1291
  children: i
1292
1292
  }
1293
1293
  ),
1294
- /* @__PURE__ */ n($, { color: "danger", icon: !0, size: "sm", onClick: E, children: /* @__PURE__ */ n(Ae, { size: 24 }) })
1294
+ /* @__PURE__ */ n($, { color: "danger", icon: !0, size: "sm", onClick: E, children: /* @__PURE__ */ n(Be, { size: 24 }) })
1295
1295
  ]
1296
1296
  }
1297
1297
  ) });
@@ -1314,7 +1314,7 @@ export {
1314
1314
  $t as isJSON,
1315
1315
  Ot as richTextContext,
1316
1316
  kn as richTextCss,
1317
- _r as richTextStyleObj,
1317
+ zr as richTextStyleObj,
1318
1318
  qe as setStateFromPlainText,
1319
1319
  gn as stateToHTML,
1320
1320
  tr as useHasFocusWithin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkitektbedriftene/fe-lib",
3
- "version": "0.4.19",
3
+ "version": "0.4.20",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {