@arkitektbedriftene/fe-lib 0.4.1 → 0.4.2

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,12 +3,13 @@ import { type CSS } from "../ui/ui";
3
3
  import { type InitialConfigType } from "@lexical/react/LexicalComposer.js";
4
4
  import type { EditorState, SerializedEditorState } from "lexical";
5
5
  export type RichTextEditorState = EditorState | string | SerializedEditorState;
6
- export declare const RichTextEditor: ({ isLoading, children, placeholderText, nodes, plugins, toolbarContent, content, hideBorder, onBlur, defaultState, css, }: {
6
+ export declare const RichTextEditor: ({ isLoading, children, placeholderText, nodes, plugins, toolbar, toolbarContent, content, hideBorder, onBlur, defaultState, css, }: {
7
7
  isLoading: boolean;
8
8
  children: ReactNode;
9
9
  placeholderText?: string | undefined;
10
10
  nodes: InitialConfigType["nodes"];
11
11
  plugins?: ReactNode;
12
+ toolbar?: ReactNode;
12
13
  toolbarContent?: ReactNode;
13
14
  content: ReactElement;
14
15
  hideBorder?: boolean | undefined;
@@ -1,6 +1,126 @@
1
- /// <reference types="react" />
1
+ import { type ComponentProps } from "react";
2
+ import { Toolbar } from "../../ui/ui";
2
3
  type ToolbarProps = {
3
4
  children: React.ReactNode;
4
5
  };
5
- export declare const RichTextToolbar: ({ children }: ToolbarProps) => JSX.Element | null;
6
+ export declare const FloatingToolbar: ({ children }: ToolbarProps) => JSX.Element | null;
7
+ export declare const RichTextToolbar: ({ children, ...props }: {
8
+ children?: React.ReactNode;
9
+ } & Omit<import("@radix-ui/react-toolbar").ToolbarProps & import("react").RefAttributes<HTMLDivElement>, "css"> & import("@stitches/react/types/styled-component").TransformProps<{}, {
10
+ lg: "(min-width: 1200px)";
11
+ print: "print";
12
+ }> & {
13
+ css?: import("@stitches/react/types/css-util").CSS<{
14
+ lg: "(min-width: 1200px)";
15
+ print: "print";
16
+ }, {
17
+ colors: {
18
+ gray50: string;
19
+ gray100: string;
20
+ gray200: string;
21
+ gray300: string;
22
+ gray400: string;
23
+ gray500: string;
24
+ gray600: string;
25
+ gray700: string;
26
+ gray800: string;
27
+ gray900: string;
28
+ blue50: string;
29
+ blue100: string;
30
+ blue200: string;
31
+ blue300: string;
32
+ blue400: string;
33
+ blue500: string;
34
+ blue600: string;
35
+ blue700: string;
36
+ blue800: string;
37
+ blue900: string;
38
+ yellow50: string;
39
+ yellow100: string;
40
+ yellow200: string;
41
+ yellow300: string;
42
+ yellow400: string;
43
+ yellow500: string;
44
+ yellow600: string;
45
+ yellow700: string;
46
+ yellow800: string;
47
+ yellow900: string;
48
+ orange500: string;
49
+ red50: string;
50
+ red100: string;
51
+ red200: string;
52
+ red300: string;
53
+ red400: string;
54
+ red500: string;
55
+ red600: string;
56
+ red700: string;
57
+ red800: string;
58
+ red900: string;
59
+ green50: string;
60
+ green100: string;
61
+ green200: string;
62
+ green300: string;
63
+ green400: string;
64
+ green500: string;
65
+ green600: string;
66
+ green700: string;
67
+ green800: string;
68
+ green900: string;
69
+ primaryTextOnLightBg: string;
70
+ primaryBg: string;
71
+ primaryBgHover: string;
72
+ primaryTextOnWhite: string;
73
+ bodyGray: string;
74
+ hoverDarker: string;
75
+ borderDarker: string;
76
+ selectedDarker: string;
77
+ selectedOnBodyGray: string;
78
+ darkGrayBg: string;
79
+ border: string;
80
+ text: string;
81
+ secondaryText: string;
82
+ focusRing: string;
83
+ };
84
+ fontSizes: {
85
+ xs: string;
86
+ sm: string;
87
+ md: string;
88
+ lg: string;
89
+ xl: string;
90
+ "2xl": string;
91
+ "3xl": string;
92
+ };
93
+ fontWeights: {
94
+ normal: string;
95
+ medium: string;
96
+ bold: string;
97
+ };
98
+ space: {
99
+ 1: string;
100
+ 2: string;
101
+ 3: string;
102
+ 4: string;
103
+ 6: string;
104
+ 8: string;
105
+ };
106
+ shadows: {
107
+ xs: string;
108
+ sm: string;
109
+ md: string;
110
+ lg: string;
111
+ overlayCard: string;
112
+ };
113
+ radii: {
114
+ xs: string;
115
+ sm: string;
116
+ md: string;
117
+ mdmd: string;
118
+ full: string;
119
+ };
120
+ zIndices: {
121
+ toast: number;
122
+ overlayCard: number;
123
+ };
124
+ }, import("@stitches/react/types/config").DefaultThemeMap, {}> | undefined;
125
+ }) => JSX.Element;
6
126
  export {};
@@ -3,3 +3,4 @@ export * from './config';
3
3
  export * from './Editor';
4
4
  export * from './editorContext';
5
5
  export * from './styles';
6
+ export * from './Toolbar/Toolbar';
@@ -1,21 +1,21 @@
1
1
  import { createHeadlessEditor as dt } from "@lexical/headless";
2
2
  import { $generateHtmlFromNodes as ct } from "@lexical/html";
3
- import { $getRoot as O, ParagraphNode as ht, $createParagraphNode as $, $createTextNode as P, $setSelection as G, SELECTION_CHANGE_COMMAND as Q, $getSelection as L, COMMAND_PRIORITY_CRITICAL as V, $isRangeSelection as y, $isRootOrShadowRoot as ut, DEPRECATED_$isGridSelection as H, FORMAT_TEXT_COMMAND as E, COMMAND_PRIORITY_LOW as T, KEY_ARROW_DOWN_COMMAND as pt, KEY_ARROW_UP_COMMAND as gt, KEY_ESCAPE_COMMAND as ft, KEY_SPACE_COMMAND as mt, $getNearestNodeFromDOMNode as W, KEY_ARROW_LEFT_COMMAND as kt, $isElementNode as Mt } from "lexical";
4
- import { trimTextContentFromAnchor as vt, $setBlocksType as D } from "@lexical/selection";
3
+ import { $getRoot as _, ParagraphNode as ht, $createParagraphNode as R, $createTextNode as W, $setSelection as G, SELECTION_CHANGE_COMMAND as Q, $getSelection as L, COMMAND_PRIORITY_CRITICAL as V, $isRangeSelection as y, $isRootOrShadowRoot as ut, DEPRECATED_$isGridSelection as D, FORMAT_TEXT_COMMAND as z, COMMAND_PRIORITY_LOW as T, KEY_ARROW_DOWN_COMMAND as pt, KEY_ARROW_UP_COMMAND as gt, KEY_ESCAPE_COMMAND as ft, KEY_SPACE_COMMAND as mt, $getNearestNodeFromDOMNode as A, KEY_ARROW_LEFT_COMMAND as kt, $isElementNode as Mt } from "lexical";
4
+ import { trimTextContentFromAnchor as vt, $setBlocksType as F } from "@lexical/selection";
5
5
  import { AutoLinkNode as Ct, LinkNode as bt } from "@lexical/link";
6
- import { ListNode as X, ListItemNode as Tt, $isListNode as A, INSERT_UNORDERED_LIST_COMMAND as Lt, INSERT_ORDERED_LIST_COMMAND as yt, INSERT_CHECK_LIST_COMMAND as J, insertList as xt, $isListItemNode as x } from "@lexical/list";
6
+ import { ListNode as X, ListItemNode as Tt, $isListNode as j, INSERT_UNORDERED_LIST_COMMAND as Lt, INSERT_ORDERED_LIST_COMMAND as yt, INSERT_CHECK_LIST_COMMAND as J, insertList as xt, $isListItemNode as x } from "@lexical/list";
7
7
  import { HeadingNode as Nt, QuoteNode as St, $isHeadingNode as Et, $createHeadingNode as wt, $createQuoteNode as zt } from "@lexical/rich-text";
8
8
  import { TableNode as It, TableRowNode as Ot, TableCellNode as $t } from "@lexical/table";
9
- import { jsx as o, jsxs as C, Fragment as j } from "react/jsx-runtime";
10
- import { createContext as _t, useState as v, useRef as Z, useCallback as M, useContext as Rt, useEffect as _, useMemo as tt, useLayoutEffect as Bt } from "react";
11
- import { c as N, s as et, D as Ht, T as Dt, a as m, B as I, b as Ft, d as w, u as Pt, e as Wt, f as At, g as jt, o as Kt, h as Ut, i as Yt, j as qt, F as Gt, O as Qt, k as Vt, l as Xt, S as Jt } from "./DropdownMenu-6b0364a0.js";
9
+ import { jsx as o, jsxs as b, Fragment as O } from "react/jsx-runtime";
10
+ import { createContext as _t, useState as v, useRef as Z, useCallback as M, useContext as Rt, useEffect as B, useMemo as tt, useLayoutEffect as Bt } from "react";
11
+ import { c as N, s as et, D as Ht, T as Dt, a as m, B as $, b as Ft, d as I, u as Pt, e as Wt, f as At, g as jt, o as Kt, h as Ut, i as Yt, j as qt, F as Gt, O as Qt, k as Vt, l as Xt, S as Jt } from "./DropdownMenu-6b0364a0.js";
12
12
  import "react-select";
13
13
  import { LexicalComposer as Zt } from "@lexical/react/LexicalComposer.js";
14
14
  import { RichTextPlugin as te } from "@lexical/react/LexicalRichTextPlugin.js";
15
15
  import ee from "@lexical/react/LexicalErrorBoundary.js";
16
- import { useLexicalComposerContext as R } from "@lexical/react/LexicalComposerContext.js";
16
+ import { useLexicalComposerContext as H } from "@lexical/react/LexicalComposerContext.js";
17
17
  import { $getNearestNodeOfType as re, $findMatchingParent as rt, mergeRegister as ot, isHTMLElement as K } from "@lexical/utils";
18
- import { G as h } from "./index.esm-d078f232.js";
18
+ import { G as c } from "./index.esm-d078f232.js";
19
19
  import { ListPlugin as oe } from "@lexical/react/LexicalListPlugin.js";
20
20
  import { HistoryPlugin as ne } from "@lexical/react/LexicalHistoryPlugin.js";
21
21
  import { TablePlugin as ae } from "@lexical/react/LexicalTablePlugin.js";
@@ -25,70 +25,70 @@ import "@radix-ui/react-toolbar";
25
25
  import "@radix-ui/react-dropdown-menu";
26
26
  const le = ({
27
27
  text: t,
28
- maxChars: r,
29
- maxLines: e
28
+ maxChars: e,
29
+ maxLines: r
30
30
  }) => {
31
31
  if (t.length === 0)
32
32
  return 0;
33
- const n = typeof e == "number", a = typeof r == "number";
33
+ const n = typeof r == "number", a = typeof e == "number";
34
34
  if (!n && !a)
35
35
  return t.length;
36
36
  let l = 0, i = 0;
37
- for (; i < t.length && (!n || l < e) && (!a || i < r); )
37
+ for (; i < t.length && (!n || l < r) && (!a || i < e); )
38
38
  t[i] === `
39
39
  ` && l++, i++;
40
40
  return t.slice(0, i).length;
41
41
  }, se = ({
42
42
  editor: t,
43
- maxChars: r,
44
- maxLines: e
43
+ maxChars: e,
44
+ maxLines: r
45
45
  }) => {
46
- const n = O(), a = n.getTextContent(), l = le({ text: a, maxChars: r, maxLines: e }), i = a.length - l, p = n.select().anchor;
46
+ const n = _(), a = n.getTextContent(), l = le({ text: a, maxChars: e, maxLines: r }), i = a.length - l, p = n.select().anchor;
47
47
  vt(t, p, i);
48
48
  const s = n.getLastChild();
49
49
  return s instanceof ht && s.getChildrenSize() === 0 && s.remove(), i;
50
- }, nt = (t) => t[0] === "{", de = (t) => t !== null && typeof t == "object" && "isEmpty" in t, ce = (t, r) => {
50
+ }, nt = (t) => t[0] === "{", de = (t) => t !== null && typeof t == "object" && "isEmpty" in t, ce = (t, e) => {
51
51
  t.update(
52
52
  () => {
53
- const e = O();
54
- e.clear();
55
- const n = $();
56
- n.append(P("")), e.append(n), G(null);
53
+ const r = _();
54
+ r.clear();
55
+ const n = R();
56
+ n.append(W("")), r.append(n), G(null);
57
57
  },
58
58
  {
59
- tag: r
59
+ tag: e
60
60
  }
61
61
  );
62
- }, he = (t, r, e) => {
63
- r.update(
62
+ }, he = (t, e, r) => {
63
+ e.update(
64
64
  () => {
65
- const n = O();
65
+ const n = _();
66
66
  n.clear();
67
- const a = $();
68
- a.append(P(t.trim())), n.append(a), G(null);
67
+ const a = R();
68
+ a.append(W(t.trim())), n.append(a), G(null);
69
69
  },
70
70
  {
71
- tag: e
71
+ tag: r
72
72
  }
73
- ), r.blur();
74
- }, Cr = (t, r, e) => {
73
+ ), e.blur();
74
+ }, br = (t, e, r) => {
75
75
  let n = 0;
76
76
  const a = dt({
77
- nodes: r,
77
+ nodes: e,
78
78
  editable: !1
79
79
  });
80
80
  if (t)
81
81
  try {
82
82
  if (typeof t == "string" && !nt(t))
83
83
  a.update(() => {
84
- const i = O(), d = $();
85
- d.append(P(t.trim())), i.append(d);
84
+ const i = _(), d = R();
85
+ d.append(W(t.trim())), i.append(d);
86
86
  });
87
87
  else {
88
88
  const i = a.parseEditorState(t, () => {
89
89
  n = se({
90
90
  editor: a,
91
- maxLines: e == null ? void 0 : e.maxLines
91
+ maxLines: r == null ? void 0 : r.maxLines
92
92
  });
93
93
  });
94
94
  i.isEmpty() || a.setEditorState(i);
@@ -100,7 +100,7 @@ const le = ({
100
100
  return a.update(() => {
101
101
  l = ct(a);
102
102
  }), { html: l, trimCount: n };
103
- }, br = [
103
+ }, Tr = [
104
104
  Nt,
105
105
  St,
106
106
  X,
@@ -137,15 +137,15 @@ const le = ({
137
137
  }
138
138
  }
139
139
  }, at = _t({ hasFocus: !1, editorRef: { current: null } }), Me = ({ onBlur: t }) => {
140
- const [r, e] = v(!1), n = Z(null), a = M(() => {
141
- e(!0), n.current && window.clearTimeout(n.current);
140
+ const [e, r] = v(!1), n = Z(null), a = M(() => {
141
+ r(!0), n.current && window.clearTimeout(n.current);
142
142
  }, []), l = M(() => {
143
143
  n.current = window.setTimeout(() => {
144
- e(!1), t == null || t();
144
+ r(!1), t == null || t();
145
145
  }, 0);
146
146
  }, [t]);
147
147
  return {
148
- hasFocus: r,
148
+ hasFocus: e,
149
149
  attributes: {
150
150
  onFocus: a,
151
151
  onBlur: l
@@ -153,52 +153,52 @@ const le = ({
153
153
  };
154
154
  }, ve = () => Rt(at);
155
155
  function Ce(t) {
156
- 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 5h6a3.5 3.5 0 0 1 0 7h-6z" } }, { tag: "path", attr: { d: "M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7" } }] })(t);
156
+ return c({ 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 5h6a3.5 3.5 0 0 1 0 7h-6z" } }, { tag: "path", attr: { d: "M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7" } }] })(t);
157
157
  }
158
158
  function be(t) {
159
- 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 8l-4 4l4 4" } }, { tag: "path", attr: { d: "M17 8l4 4l-4 4" } }, { tag: "path", attr: { d: "M14 4l-4 16" } }] })(t);
159
+ return c({ 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 8l-4 4l4 4" } }, { tag: "path", attr: { d: "M17 8l4 4l-4 4" } }, { tag: "path", attr: { d: "M14 4l-4 16" } }] })(t);
160
160
  }
161
161
  function Te(t) {
162
- 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: "M19 18v-8l-2 2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
162
+ return c({ 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: "M19 18v-8l-2 2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
163
163
  }
164
164
  function Le(t) {
165
- 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: "M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
165
+ return c({ 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: "M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
166
166
  }
167
167
  function ye(t) {
168
- 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: "M19 14a2 2 0 1 0 -2 -2" } }, { tag: "path", attr: { d: "M17 16a2 2 0 1 0 2 -2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
168
+ return c({ 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: "M19 14a2 2 0 1 0 -2 -2" } }, { tag: "path", attr: { d: "M17 16a2 2 0 1 0 2 -2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
169
169
  }
170
170
  function xe(t) {
171
- 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: "M20 18v-8l-4 6h5" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
171
+ return c({ 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: "M20 18v-8l-4 6h5" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
172
172
  }
173
173
  function Ne(t) {
174
- 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: "M17 18h2a2 2 0 1 0 0 -4h-2v-4h4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
174
+ return c({ 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: "M17 18h2a2 2 0 1 0 0 -4h-2v-4h4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
175
175
  }
176
176
  function Se(t) {
177
- 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: "M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z" } }, { tag: "path", attr: { d: "M21 12a2 2 0 1 0 -4 0v4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
177
+ return c({ 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: "M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z" } }, { tag: "path", attr: { d: "M21 12a2 2 0 1 0 -4 0v4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
178
178
  }
179
179
  function Ee(t) {
180
- 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: "M11 5l6 0" } }, { tag: "path", attr: { d: "M7 19l6 0" } }, { tag: "path", attr: { d: "M14 5l-4 14" } }] })(t);
180
+ return c({ 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: "M11 5l6 0" } }, { tag: "path", attr: { d: "M7 19l6 0" } }, { tag: "path", attr: { d: "M14 5l-4 14" } }] })(t);
181
181
  }
182
182
  function we(t) {
183
- 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: "M17.5 15.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0" } }, { tag: "path", attr: { d: "M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5" } }, { tag: "path", attr: { d: "M3 13h7" } }, { tag: "path", attr: { d: "M21 12v7" } }] })(t);
183
+ return c({ 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: "M17.5 15.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0" } }, { tag: "path", attr: { d: "M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5" } }, { tag: "path", attr: { d: "M3 13h7" } }, { tag: "path", attr: { d: "M21 12v7" } }] })(t);
184
184
  }
185
185
  function ze(t) {
186
- 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: "M3.5 5.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 11.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 17.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M11 6l9 0" } }, { tag: "path", attr: { d: "M11 12l9 0" } }, { tag: "path", attr: { d: "M11 18l9 0" } }] })(t);
186
+ return c({ 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: "M3.5 5.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 11.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 17.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M11 6l9 0" } }, { tag: "path", attr: { d: "M11 12l9 0" } }, { tag: "path", attr: { d: "M11 18l9 0" } }] })(t);
187
187
  }
188
188
  function Ie(t) {
189
- 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: "M11 6h9" } }, { tag: "path", attr: { d: "M11 12h9" } }, { tag: "path", attr: { d: "M12 18h8" } }, { tag: "path", attr: { d: "M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4" } }, { tag: "path", attr: { d: "M6 10v-6l-2 2" } }] })(t);
189
+ return c({ 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: "M11 6h9" } }, { tag: "path", attr: { d: "M11 12h9" } }, { tag: "path", attr: { d: "M12 18h8" } }, { tag: "path", attr: { d: "M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4" } }, { tag: "path", attr: { d: "M6 10v-6l-2 2" } }] })(t);
190
190
  }
191
191
  function Oe(t) {
192
- 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: "M9 6l11 0" } }, { tag: "path", attr: { d: "M9 12l11 0" } }, { tag: "path", attr: { d: "M9 18l11 0" } }, { tag: "path", attr: { d: "M5 6l0 .01" } }, { tag: "path", attr: { d: "M5 12l0 .01" } }, { tag: "path", attr: { d: "M5 18l0 .01" } }] })(t);
192
+ return c({ 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: "M9 6l11 0" } }, { tag: "path", attr: { d: "M9 12l11 0" } }, { tag: "path", attr: { d: "M9 18l11 0" } }, { tag: "path", attr: { d: "M5 6l0 .01" } }, { tag: "path", attr: { d: "M5 12l0 .01" } }, { tag: "path", attr: { d: "M5 18l0 .01" } }] })(t);
193
193
  }
194
194
  function $e(t) {
195
- 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: "M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }, { tag: "path", attr: { d: "M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }] })(t);
195
+ return c({ 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: "M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }, { tag: "path", attr: { d: "M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }] })(t);
196
196
  }
197
197
  function _e(t) {
198
- 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: "M5 7l8 10m-8 0l8 -10" } }, { tag: "path", attr: { d: "M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" } }] })(t);
198
+ return c({ 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: "M5 7l8 10m-8 0l8 -10" } }, { tag: "path", attr: { d: "M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" } }] })(t);
199
199
  }
200
200
  function Re(t) {
201
- 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);
201
+ return c({ 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);
202
202
  }
203
203
  const Be = et("div", {
204
204
  width: "10rem",
@@ -229,10 +229,10 @@ const Be = et("div", {
229
229
  quote: /* @__PURE__ */ o($e, { size: "1.25rem" })
230
230
  }, f = ({
231
231
  blockType: t
232
- }) => /* @__PURE__ */ C(j, { children: [
233
- /* @__PURE__ */ o(I, { css: { display: "flex", flex: "0 0 auto" }, children: He[t] }),
232
+ }) => /* @__PURE__ */ b(O, { children: [
233
+ /* @__PURE__ */ o($, { css: { display: "flex", flex: "0 0 auto" }, children: He[t] }),
234
234
  /* @__PURE__ */ o(
235
- I,
235
+ $,
236
236
  {
237
237
  css: {
238
238
  flex: "1 1 auto",
@@ -246,46 +246,46 @@ const Be = et("div", {
246
246
  ] }), De = (t) => {
247
247
  if (!y(t))
248
248
  return null;
249
- const r = t.anchor.getNode();
250
- let e = r.getKey() === "root" ? r : rt(r, (n) => {
249
+ const e = t.anchor.getNode();
250
+ let r = e.getKey() === "root" ? e : rt(e, (n) => {
251
251
  const a = n.getParent();
252
252
  return a !== null && ut(a);
253
253
  });
254
- return e === null && (e = r.getTopLevelElementOrThrow()), {
255
- anchorNode: r,
256
- element: e
254
+ return r === null && (r = e.getTopLevelElementOrThrow()), {
255
+ anchorNode: e,
256
+ element: r
257
257
  };
258
258
  }, Fe = () => {
259
- const [t] = R(), [r, e] = v("paragraph");
260
- _(() => t.registerCommand(
259
+ const [t] = H(), [e, r] = v("paragraph");
260
+ B(() => t.registerCommand(
261
261
  Q,
262
262
  () => {
263
263
  const s = L(), g = De(s);
264
264
  if (!g)
265
265
  return !1;
266
- const { element: c, anchorNode: S } = g, b = c.getKey();
267
- if (t.getElementByKey(b) !== null)
268
- if (A(c)) {
266
+ const { element: u, anchorNode: C } = g, S = u.getKey();
267
+ if (t.getElementByKey(S) !== null)
268
+ if (j(u)) {
269
269
  const k = re(
270
- S,
270
+ C,
271
271
  X
272
- ), B = k ? k.getListType() : c.getListType();
273
- e(B);
272
+ ), w = k ? k.getListType() : u.getListType();
273
+ r(w);
274
274
  } else {
275
- const k = Et(c) ? c.getTag() : c.getType();
276
- k in it && e(k);
275
+ const k = Et(u) ? u.getTag() : u.getType();
276
+ k in it && r(k);
277
277
  }
278
278
  return !1;
279
279
  },
280
280
  V
281
281
  ), [t]);
282
282
  const n = (s) => {
283
- r !== s && t.update(() => {
283
+ e !== s && t.update(() => {
284
284
  const g = L();
285
- (y(g) || H(g)) && (D(g, () => wt(s)), e(s));
285
+ (y(g) || D(g)) && (F(g, () => wt(s)), r(s));
286
286
  });
287
287
  };
288
- return /* @__PURE__ */ o(Be, { children: /* @__PURE__ */ C(
288
+ return /* @__PURE__ */ o(Be, { children: /* @__PURE__ */ b(
289
289
  Ht,
290
290
  {
291
291
  trigger: /* @__PURE__ */ o(
@@ -293,16 +293,16 @@ const Be = et("div", {
293
293
  {
294
294
  dropdown: !0,
295
295
  css: { display: "flex", width: "100%", overflow: "hidden" },
296
- children: /* @__PURE__ */ o(f, { blockType: r })
296
+ children: /* @__PURE__ */ o(f, { blockType: e })
297
297
  }
298
298
  ),
299
299
  side: "bottom",
300
300
  align: "start",
301
301
  children: [
302
302
  /* @__PURE__ */ o(m, { onClick: () => {
303
- r !== "paragraph" && t.update(() => {
303
+ e !== "paragraph" && t.update(() => {
304
304
  const s = L();
305
- (y(s) || H(s)) && (D(s, () => $()), e("paragraph"));
305
+ (y(s) || D(s)) && (F(s, () => R()), r("paragraph"));
306
306
  });
307
307
  }, children: /* @__PURE__ */ o(f, { blockType: "paragraph" }) }),
308
308
  /* @__PURE__ */ o(m, { onClick: () => n("h1"), children: /* @__PURE__ */ o(f, { blockType: "h1" }) }),
@@ -312,60 +312,60 @@ const Be = et("div", {
312
312
  /* @__PURE__ */ o(m, { onClick: () => n("h5"), children: /* @__PURE__ */ o(f, { blockType: "h5" }) }),
313
313
  /* @__PURE__ */ o(m, { onClick: () => n("h6"), children: /* @__PURE__ */ o(f, { blockType: "h6" }) }),
314
314
  /* @__PURE__ */ o(m, { onClick: () => {
315
- r !== "bullet" && (t.dispatchCommand(Lt, void 0), e("bullet"));
315
+ e !== "bullet" && (t.dispatchCommand(Lt, void 0), r("bullet"));
316
316
  }, children: /* @__PURE__ */ o(f, { blockType: "bullet" }) }),
317
317
  /* @__PURE__ */ o(m, { onClick: () => {
318
- r !== "number" && (t.dispatchCommand(yt, void 0), e("number"));
318
+ e !== "number" && (t.dispatchCommand(yt, void 0), r("number"));
319
319
  }, children: /* @__PURE__ */ o(f, { blockType: "number" }) }),
320
320
  /* @__PURE__ */ o(m, { onClick: () => {
321
- r !== "check" && (t.dispatchCommand(J, void 0), e("check"));
321
+ e !== "check" && (t.dispatchCommand(J, void 0), r("check"));
322
322
  }, children: /* @__PURE__ */ o(f, { blockType: "check" }) }),
323
323
  /* @__PURE__ */ o(m, { onClick: () => {
324
- r !== "quote" && t.update(() => {
324
+ e !== "quote" && t.update(() => {
325
325
  const s = L();
326
- (y(s) || H(s)) && (D(s, () => zt()), e("quote"));
326
+ (y(s) || D(s)) && (F(s, () => zt()), r("quote"));
327
327
  });
328
328
  }, children: /* @__PURE__ */ o(f, { blockType: "quote" }) })
329
329
  ]
330
330
  }
331
331
  ) });
332
332
  }, Pe = () => {
333
- const [t] = R(), [r, e] = v(!1), [n, a] = v(!1), [l, i] = v(!1), [d, p] = v(!1), [s, g] = v(!1), c = M(() => {
334
- const u = L();
335
- y(u) && (e(u.hasFormat("bold")), a(u.hasFormat("italic")), i(u.hasFormat("underline")), p(u.hasFormat("code")), g(u.hasFormat("superscript")));
333
+ const [t] = H(), [e, r] = v(!1), [n, a] = v(!1), [l, i] = v(!1), [d, p] = v(!1), [s, g] = v(!1), u = M(() => {
334
+ const h = L();
335
+ y(h) && (r(h.hasFormat("bold")), a(h.hasFormat("italic")), i(h.hasFormat("underline")), p(h.hasFormat("code")), g(h.hasFormat("superscript")));
336
336
  }, []);
337
- _(() => ot(
337
+ B(() => ot(
338
338
  t.registerCommand(
339
339
  Q,
340
- () => (c(), !1),
340
+ () => (u(), !1),
341
341
  V
342
342
  ),
343
- t.registerUpdateListener(({ editorState: u }) => {
344
- u.read(() => {
345
- c();
343
+ t.registerUpdateListener(({ editorState: h }) => {
344
+ h.read(() => {
345
+ u();
346
346
  });
347
347
  })
348
- ), [t, c]);
349
- const S = M(
350
- () => t.dispatchCommand(E, "bold"),
348
+ ), [t, u]);
349
+ const C = M(
350
+ () => t.dispatchCommand(z, "bold"),
351
351
  [t]
352
- ), b = M(
353
- () => t.dispatchCommand(E, "italic"),
352
+ ), S = M(
353
+ () => t.dispatchCommand(z, "italic"),
354
354
  [t]
355
- ), z = M(
356
- () => t.dispatchCommand(E, "underline"),
355
+ ), E = M(
356
+ () => t.dispatchCommand(z, "underline"),
357
357
  [t]
358
358
  ), k = M(
359
- () => t.dispatchCommand(E, "code"),
359
+ () => t.dispatchCommand(z, "code"),
360
360
  [t]
361
- ), B = M(
362
- () => t.dispatchCommand(E, "superscript"),
361
+ ), w = M(
362
+ () => t.dispatchCommand(z, "superscript"),
363
363
  [t]
364
364
  ), st = tt(() => {
365
- const u = [];
366
- return r && u.push("bold"), n && u.push("italic"), l && u.push("underline"), d && u.push("code"), s && u.push("superscript"), u;
367
- }, [r, n, l, d, s]);
368
- return /* @__PURE__ */ C(
365
+ const h = [];
366
+ return e && h.push("bold"), n && h.push("italic"), l && h.push("underline"), d && h.push("code"), s && h.push("superscript"), h;
367
+ }, [e, n, l, d, s]);
368
+ return /* @__PURE__ */ b(
369
369
  Ft,
370
370
  {
371
371
  type: "multiple",
@@ -373,34 +373,34 @@ const Be = et("div", {
373
373
  value: st,
374
374
  children: [
375
375
  /* @__PURE__ */ o(
376
- w,
376
+ I,
377
377
  {
378
- onClick: S,
378
+ onClick: C,
379
379
  title: "Fet tekst",
380
380
  value: "bold",
381
381
  children: /* @__PURE__ */ o(Ce, { size: "1.25rem" })
382
382
  }
383
383
  ),
384
384
  /* @__PURE__ */ o(
385
- w,
385
+ I,
386
386
  {
387
- onClick: b,
387
+ onClick: S,
388
388
  title: "Kursiv tekst",
389
389
  value: "italic",
390
390
  children: /* @__PURE__ */ o(Ee, { size: "1.25rem" })
391
391
  }
392
392
  ),
393
393
  /* @__PURE__ */ o(
394
- w,
394
+ I,
395
395
  {
396
- onClick: z,
396
+ onClick: E,
397
397
  title: "Understreket tekst",
398
398
  value: "underline",
399
399
  children: /* @__PURE__ */ o(Re, { size: "1.25rem" })
400
400
  }
401
401
  ),
402
402
  /* @__PURE__ */ o(
403
- w,
403
+ I,
404
404
  {
405
405
  onClick: k,
406
406
  title: "Kode",
@@ -409,9 +409,9 @@ const Be = et("div", {
409
409
  }
410
410
  ),
411
411
  /* @__PURE__ */ o(
412
- w,
412
+ I,
413
413
  {
414
- onClick: B,
414
+ onClick: w,
415
415
  title: "Superscript",
416
416
  value: "superscript",
417
417
  children: /* @__PURE__ */ o(_e, { size: "1.25rem" })
@@ -421,7 +421,7 @@ const Be = et("div", {
421
421
  }
422
422
  );
423
423
  }, We = ({ children: t }) => {
424
- const { hasFocus: r, editorRef: e } = ve(), n = r, [a, l] = v(n);
424
+ const { hasFocus: e, editorRef: r } = ve(), n = e, [a, l] = v(n);
425
425
  Bt(() => {
426
426
  l(n);
427
427
  }, [n]);
@@ -430,8 +430,8 @@ const Be = et("div", {
430
430
  whileElementsMounted: Wt,
431
431
  middleware: [
432
432
  At({
433
- apply: ({ rects: g, elements: c }) => {
434
- c.floating.style.minWidth = `${g.reference.width}px`;
433
+ apply: ({ rects: g, elements: u }) => {
434
+ u.floating.style.minWidth = `${g.reference.width}px`;
435
435
  }
436
436
  }),
437
437
  jt(),
@@ -445,7 +445,7 @@ const Be = et("div", {
445
445
  open: a,
446
446
  onOpenChange: l,
447
447
  elements: {
448
- reference: e.current
448
+ reference: r.current
449
449
  }
450
450
  }), { getFloatingProps: s } = Yt([
451
451
  qt(i, {
@@ -464,18 +464,21 @@ const Be = et("div", {
464
464
  overflow: "hidden",
465
465
  boxShadow: "$md"
466
466
  },
467
- children: /* @__PURE__ */ C(Vt, { "aria-label": "Formattering", children: [
468
- /* @__PURE__ */ o(Fe, {}),
469
- /* @__PURE__ */ o(Xt, {}),
470
- /* @__PURE__ */ o(Pe, {}),
471
- t
472
- ] })
467
+ children: /* @__PURE__ */ o(Ae, { children: t })
473
468
  }
474
469
  ) }) : null;
475
- };
476
- function Ae() {
477
- const [t] = R();
478
- return _(() => ot(
470
+ }, Ae = ({
471
+ children: t,
472
+ ...e
473
+ }) => /* @__PURE__ */ b(Vt, { "aria-label": "Formattering", ...e, children: [
474
+ /* @__PURE__ */ o(Fe, {}),
475
+ /* @__PURE__ */ o(Xt, {}),
476
+ /* @__PURE__ */ o(Pe, {}),
477
+ t
478
+ ] });
479
+ function je() {
480
+ const [t] = H();
481
+ return B(() => ot(
479
482
  t.registerCommand(
480
483
  J,
481
484
  () => (xt(t, "check"), !0),
@@ -483,18 +486,18 @@ function Ae() {
483
486
  ),
484
487
  t.registerCommand(
485
488
  pt,
486
- (r) => q(r, t, !1),
489
+ (e) => q(e, t, !1),
487
490
  T
488
491
  ),
489
492
  t.registerCommand(
490
493
  gt,
491
- (r) => q(r, t, !0),
494
+ (e) => q(e, t, !0),
492
495
  T
493
496
  ),
494
497
  t.registerCommand(
495
498
  ft,
496
- (r) => {
497
- if (F() != null) {
499
+ (e) => {
500
+ if (P() != null) {
498
501
  const n = t.getRootElement();
499
502
  return n != null && n.focus(), !0;
500
503
  }
@@ -504,21 +507,21 @@ function Ae() {
504
507
  ),
505
508
  t.registerCommand(
506
509
  mt,
507
- (r) => {
508
- const e = F();
509
- return e != null && t.isEditable() ? (t.update(() => {
510
- const n = W(e);
511
- x(n) && (r.preventDefault(), n.toggleChecked());
510
+ (e) => {
511
+ const r = P();
512
+ return r != null && t.isEditable() ? (t.update(() => {
513
+ const n = A(r);
514
+ x(n) && (e.preventDefault(), n.toggleChecked());
512
515
  }), !0) : !1;
513
516
  },
514
517
  T
515
518
  ),
516
519
  t.registerCommand(
517
520
  kt,
518
- (r) => t.getEditorState().read(() => {
519
- const e = L();
520
- if (y(e) && e.isCollapsed()) {
521
- const { anchor: n } = e, a = n.type === "element";
521
+ (e) => t.getEditorState().read(() => {
522
+ const r = L();
523
+ if (y(r) && r.isCollapsed()) {
524
+ const { anchor: n } = r, a = n.type === "element";
522
525
  if (a || n.offset === 0) {
523
526
  const l = n.getNode(), i = rt(
524
527
  l,
@@ -526,10 +529,10 @@ function Ae() {
526
529
  );
527
530
  if (x(i)) {
528
531
  const d = i.getParent();
529
- if (A(d) && d.getListType() === "check" && (a || i.getFirstDescendant() === l)) {
532
+ if (j(d) && d.getListType() === "check" && (a || i.getFirstDescendant() === l)) {
530
533
  const p = t.getElementByKey(i.__key);
531
534
  if (p != null && document.activeElement !== p)
532
- return p.focus(), r.preventDefault(), !0;
535
+ return p.focus(), e.preventDefault(), !0;
533
536
  }
534
537
  }
535
538
  }
@@ -538,31 +541,31 @@ function Ae() {
538
541
  }),
539
542
  T
540
543
  ),
541
- t.registerRootListener((r, e) => {
542
- r !== null && (r.addEventListener("click", U), r.addEventListener("pointerdown", Y)), e !== null && (e.removeEventListener("click", U), e.removeEventListener("pointerdown", Y));
544
+ t.registerRootListener((e, r) => {
545
+ e !== null && (e.addEventListener("click", U), e.addEventListener("pointerdown", Y)), r !== null && (r.removeEventListener("click", U), r.removeEventListener("pointerdown", Y));
543
546
  })
544
547
  ), [t]), null;
545
548
  }
546
- function lt(t, r) {
547
- const e = t.target;
548
- if (e === null || !K(e))
549
+ function lt(t, e) {
550
+ const r = t.target;
551
+ if (r === null || !K(r))
549
552
  return;
550
- const n = e.firstChild;
553
+ const n = r.firstChild;
551
554
  if (n != null && K(n) && (n.tagName === "UL" || n.tagName === "OL"))
552
555
  return;
553
- const a = e.parentNode;
556
+ const a = r.parentNode;
554
557
  if (!a || a.__lexicalListType !== "check")
555
558
  return;
556
- const l = t.pageX, i = e.getBoundingClientRect();
557
- (e.dir === "rtl" ? l < i.right && l > i.right - 20 : l > i.left && l < i.left + 20) && r();
559
+ const l = t.pageX, i = r.getBoundingClientRect();
560
+ (r.dir === "rtl" ? l < i.right && l > i.right - 20 : l > i.left && l < i.left + 20) && e();
558
561
  }
559
562
  function U(t) {
560
563
  lt(t, () => {
561
- const r = t.target, e = je(r);
562
- e != null && e.isEditable() && e.update(() => {
564
+ const e = t.target, r = Ke(e);
565
+ r != null && r.isEditable() && r.update(() => {
563
566
  if (t.target) {
564
- const n = W(r);
565
- x(n) && (r.focus(), n.toggleChecked());
567
+ const n = A(e);
568
+ x(n) && (e.focus(), n.toggleChecked());
566
569
  }
567
570
  });
568
571
  });
@@ -572,76 +575,76 @@ function Y(t) {
572
575
  t.preventDefault();
573
576
  });
574
577
  }
575
- function je(t) {
576
- let r = t;
577
- for (; r; ) {
578
- if (r.__lexicalEditor)
579
- return r.__lexicalEditor;
580
- r = r.parentNode;
578
+ function Ke(t) {
579
+ let e = t;
580
+ for (; e; ) {
581
+ if (e.__lexicalEditor)
582
+ return e.__lexicalEditor;
583
+ e = e.parentNode;
581
584
  }
582
585
  return null;
583
586
  }
584
- function F() {
587
+ function P() {
585
588
  const t = document.activeElement;
586
589
  return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
587
590
  t.parentNode.__lexicalListType === "check" ? t : null;
588
591
  }
589
- function Ke(t, r) {
590
- let e = r ? t.getPreviousSibling() : t.getNextSibling(), n = t;
591
- for (; e == null && x(n); )
592
- n = n.getParentOrThrow().getParent(), n != null && (e = r ? n.getPreviousSibling() : n.getNextSibling());
593
- for (; x(e); ) {
594
- const a = r ? e.getLastChild() : e.getFirstChild();
595
- if (!A(a))
596
- return e;
597
- e = r ? a.getLastChild() : a.getFirstChild();
592
+ function Ue(t, e) {
593
+ let r = e ? t.getPreviousSibling() : t.getNextSibling(), n = t;
594
+ for (; r == null && x(n); )
595
+ n = n.getParentOrThrow().getParent(), n != null && (r = e ? n.getPreviousSibling() : n.getNextSibling());
596
+ for (; x(r); ) {
597
+ const a = e ? r.getLastChild() : r.getFirstChild();
598
+ if (!j(a))
599
+ return r;
600
+ r = e ? a.getLastChild() : a.getFirstChild();
598
601
  }
599
602
  return null;
600
603
  }
601
- function q(t, r, e) {
602
- const n = F();
603
- return n != null && r.update(() => {
604
- const a = W(n);
604
+ function q(t, e, r) {
605
+ const n = P();
606
+ return n != null && e.update(() => {
607
+ const a = A(n);
605
608
  if (!x(a))
606
609
  return;
607
- const l = Ke(a, e);
610
+ const l = Ue(a, r);
608
611
  if (l != null) {
609
612
  l.selectStart();
610
- const i = r.getElementByKey(l.__key);
613
+ const i = e.getElementByKey(l.__key);
611
614
  i != null && (t.preventDefault(), setTimeout(() => {
612
615
  i.focus();
613
616
  }, 0));
614
617
  }
615
618
  }), !1;
616
619
  }
617
- const Ue = () => /* @__PURE__ */ C(j, { children: [
620
+ const Ye = () => /* @__PURE__ */ b(O, { children: [
618
621
  /* @__PURE__ */ o(oe, {}),
619
622
  /* @__PURE__ */ o(ae, {}),
620
623
  /* @__PURE__ */ o(ne, {}),
621
- /* @__PURE__ */ o(Ae, {}),
624
+ /* @__PURE__ */ o(je, {}),
622
625
  /* @__PURE__ */ o(ie, {})
623
- ] }), Ye = ({
626
+ ] }), qe = ({
624
627
  state: t
625
628
  }) => {
626
- const [r] = R();
627
- return _(() => {
629
+ const [e] = H();
630
+ return B(() => {
628
631
  if (t)
629
632
  try {
630
633
  if (de(t)) {
631
- t.isEmpty() ? ce(r) : r.setEditorState(t);
634
+ t.isEmpty() ? ce(e) : e.setEditorState(t);
632
635
  return;
633
636
  }
634
637
  if (typeof t == "string" && !nt(t)) {
635
- he(t, r);
638
+ he(t, e);
636
639
  return;
637
640
  }
638
- const e = r.parseEditorState(t);
639
- e.isEmpty() || r.setEditorState(e);
640
- } catch (e) {
641
- console.error("Could not parse"), console.error(e);
641
+ const r = e.parseEditorState(t);
642
+ r.isEmpty() || e.setEditorState(r);
643
+ } catch (r) {
644
+ console.error("Could not parse"), console.error(r);
642
645
  }
643
646
  }, []), null;
644
- }, qe = et("div", {
647
+ }, Ge = et("div", {
645
648
  border: "1px solid $borderDarker",
646
649
  borderRadius: "$md",
647
650
  position: "relative",
@@ -678,10 +681,10 @@ const Ue = () => /* @__PURE__ */ C(j, { children: [
678
681
  }
679
682
  }
680
683
  ]
681
- }), Ge = ({
684
+ }), Qe = ({
682
685
  isLoading: t
683
686
  }) => /* @__PURE__ */ o(
684
- I,
687
+ $,
685
688
  {
686
689
  css: {
687
690
  visibility: t ? "visible" : "hidden",
@@ -692,48 +695,50 @@ const Ue = () => /* @__PURE__ */ C(j, { children: [
692
695
  },
693
696
  children: /* @__PURE__ */ o(Jt, {})
694
697
  }
695
- ), Tr = ({
698
+ ), Lr = ({
696
699
  isLoading: t,
697
- children: r,
698
- placeholderText: e,
700
+ children: e,
701
+ placeholderText: r,
699
702
  nodes: n,
700
703
  plugins: a,
701
- toolbarContent: l,
702
- content: i,
703
- hideBorder: d,
704
- onBlur: p,
705
- defaultState: s,
706
- css: g
704
+ toolbar: l,
705
+ toolbarContent: i,
706
+ content: d,
707
+ hideBorder: p,
708
+ onBlur: s,
709
+ defaultState: g,
710
+ css: u
707
711
  }) => {
708
- const { hasFocus: c, attributes: S } = Me({ onBlur: p }), b = Z(null), z = tt(() => ({ hasFocus: c, editorRef: b }), [c]);
709
- return /* @__PURE__ */ o(at.Provider, { value: z, children: /* @__PURE__ */ C(
712
+ const { hasFocus: C, attributes: S } = Me({ onBlur: s }), E = Z(null), k = tt(() => ({ hasFocus: C, editorRef: E }), [C]);
713
+ return /* @__PURE__ */ o(at.Provider, { value: k, children: /* @__PURE__ */ b(
710
714
  Zt,
711
715
  {
712
716
  initialConfig: {
713
717
  namespace: "CommentEditor",
714
- onError: (k) => {
715
- console.error(k);
718
+ onError: (w) => {
719
+ console.error(w);
716
720
  },
717
721
  theme: ke,
718
722
  nodes: n,
719
723
  editable: !0
720
724
  },
721
725
  children: [
722
- /* @__PURE__ */ C(
723
- qe,
726
+ /* @__PURE__ */ o(O, { children: l }),
727
+ /* @__PURE__ */ b(
728
+ Ge,
724
729
  {
725
- ref: b,
726
- hasFocus: c,
727
- hideBorder: d,
728
- css: g,
730
+ ref: E,
731
+ hasFocus: C,
732
+ hideBorder: p,
733
+ css: u,
729
734
  ...S,
730
735
  children: [
731
736
  /* @__PURE__ */ o(
732
737
  te,
733
738
  {
734
- contentEditable: i,
735
- placeholder: e ? /* @__PURE__ */ o(
736
- I,
739
+ contentEditable: d,
740
+ placeholder: r ? /* @__PURE__ */ o(
741
+ $,
737
742
  {
738
743
  css: {
739
744
  position: "absolute",
@@ -743,25 +748,25 @@ const Ue = () => /* @__PURE__ */ C(j, { children: [
743
748
  pointerEvents: "none",
744
749
  fontSize: "$sm"
745
750
  },
746
- children: e
751
+ children: r
747
752
  }
748
753
  ) : null,
749
754
  ErrorBoundary: ee
750
755
  }
751
756
  ),
752
- /* @__PURE__ */ o(Ue, {}),
757
+ /* @__PURE__ */ o(Ye, {}),
753
758
  a,
754
- /* @__PURE__ */ o(Ge, { isLoading: t }),
755
- /* @__PURE__ */ o(We, { children: l })
759
+ /* @__PURE__ */ o(Qe, { isLoading: t }),
760
+ !l && /* @__PURE__ */ o(We, { children: i })
756
761
  ]
757
762
  }
758
763
  ),
759
- /* @__PURE__ */ o(Ye, { state: s }),
760
- /* @__PURE__ */ o(j, { children: r })
764
+ /* @__PURE__ */ o(qe, { state: g }),
765
+ /* @__PURE__ */ o(O, { children: e })
761
766
  ]
762
767
  }
763
768
  ) });
764
- }, Lr = N({
769
+ }, yr = N({
765
770
  fontSize: "1rem",
766
771
  lineHeight: "1.5",
767
772
  "h1, h2, h3, h4, h5, h6": {
@@ -903,15 +908,17 @@ const Ue = () => /* @__PURE__ */ C(j, { children: [
903
908
  }
904
909
  });
905
910
  export {
906
- Tr as RichTextEditor,
911
+ We as FloatingToolbar,
912
+ Lr as RichTextEditor,
913
+ Ae as RichTextToolbar,
907
914
  ce as clearEditorState,
908
- br as defaultNodes,
915
+ Tr as defaultNodes,
909
916
  de as isEditorState,
910
917
  nt as isJSON,
911
918
  at as richTextContext,
912
- Lr as richTextCss,
919
+ yr as richTextCss,
913
920
  he as setStateFromPlainText,
914
- Cr as stateToHTML,
921
+ br as stateToHTML,
915
922
  Me as useHasFocusWithin,
916
923
  ve as useRichTextContext
917
924
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkitektbedriftene/fe-lib",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {