laif-ds 0.2.78 → 0.2.80

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.
Files changed (48) hide show
  1. package/dist/CHANGELOG.md +25 -0
  2. package/dist/_virtual/index3.js +5 -5
  3. package/dist/_virtual/index4.js +5 -5
  4. package/dist/_virtual/index5.js +4 -4
  5. package/dist/agent-docs/adoption-report.json +10 -10
  6. package/dist/agent-docs/components/AppEditor.md +4 -4
  7. package/dist/agent-docs/components/AppSelect.md +46 -0
  8. package/dist/agent-docs/manifest.json +5 -3
  9. package/dist/components/editor/editor-ui/content-editable.js +15 -8
  10. package/dist/components/ui/app-editor.js +88 -76
  11. package/dist/components/ui/app-select.js +232 -143
  12. package/dist/components/ui/date-picker.js +184 -153
  13. package/dist/components/ui/markdown-renderer.js +40 -30
  14. package/dist/index.d.ts +3 -1
  15. package/dist/node_modules/comma-separated-tokens/index.js +16 -5
  16. package/dist/node_modules/entities/dist/esm/decode-codepoint.js +39 -0
  17. package/dist/node_modules/entities/dist/esm/decode.js +246 -0
  18. package/dist/node_modules/entities/dist/esm/generated/decode-data-html.js +8 -0
  19. package/dist/node_modules/eventemitter3/index.js +1 -1
  20. package/dist/node_modules/hast-util-from-parse5/lib/index.js +146 -0
  21. package/dist/node_modules/hast-util-parse-selector/lib/index.js +21 -0
  22. package/dist/node_modules/hast-util-raw/lib/index.js +218 -0
  23. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
  24. package/dist/node_modules/hast-util-to-parse5/lib/index.js +119 -0
  25. package/dist/node_modules/hastscript/lib/create-h.js +113 -0
  26. package/dist/node_modules/hastscript/lib/index.js +9 -0
  27. package/dist/node_modules/hastscript/lib/svg-case-sensitive-tag-names.js +45 -0
  28. package/dist/node_modules/parse5/dist/common/doctype.js +99 -0
  29. package/dist/node_modules/parse5/dist/common/error-codes.js +8 -0
  30. package/dist/node_modules/parse5/dist/common/foreign-content.js +211 -0
  31. package/dist/node_modules/parse5/dist/common/html.js +251 -0
  32. package/dist/node_modules/parse5/dist/common/token.js +15 -0
  33. package/dist/node_modules/parse5/dist/common/unicode.js +74 -0
  34. package/dist/node_modules/parse5/dist/parser/formatting-element-list.js +85 -0
  35. package/dist/node_modules/parse5/dist/parser/index.js +2272 -0
  36. package/dist/node_modules/parse5/dist/parser/open-element-stack.js +241 -0
  37. package/dist/node_modules/parse5/dist/serializer/index.js +3 -0
  38. package/dist/node_modules/parse5/dist/tokenizer/index.js +1941 -0
  39. package/dist/node_modules/parse5/dist/tokenizer/preprocessor.js +89 -0
  40. package/dist/node_modules/parse5/dist/tree-adapters/default.js +163 -0
  41. package/dist/node_modules/recharts/es6/util/Events.js +1 -1
  42. package/dist/node_modules/rehype-raw/lib/index.js +13 -0
  43. package/dist/node_modules/space-separated-tokens/index.js +8 -3
  44. package/dist/node_modules/unified/lib/index.js +1 -1
  45. package/dist/node_modules/vfile-location/lib/index.js +43 -0
  46. package/dist/node_modules/web-namespaces/index.js +12 -0
  47. package/dist/styles.v3.css +1 -1
  48. package/package.json +2 -1
package/dist/CHANGELOG.md CHANGED
@@ -5,6 +5,31 @@ All notable technical changes to the laif-ds core will be documented in this fil
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [laif-ds@0.2.80]
9
+
10
+ ### 🚀 Added
11
+
12
+ - **AppSelect**: Added `selectableAll` prop (multi-select only, default `true`) — renders a tri-state checkbox toggle to the left of the search bar with four icon states (`Square` / `SquareMinus` / `SquareCheck` / `SquareDot`). Both select-all and deselect-all are scoped to the current search filter, preserving out-of-view selections and `fixed: true` items
13
+ - **DatePicker**: Added range dragging — in range mode, click and drag the `from` or `to` handle to extend or shrink the selected interval; the range automatically inverts when handles cross over
14
+
15
+ ### 🔧 Changed
16
+
17
+ - **AppSelect**: Prevented automatic focus of the search input on popover open via `onOpenAutoFocus` — fixes the mobile soft-keyboard collapsing the visual viewport and pushing the dropdown off-screen
18
+ - **DatePicker**: Reworked range click behavior — a third click on a completed range now starts a new range from that day instead of resetting to empty; clicking an end-date earlier than the current `from` resets the start anchor to that day
19
+
20
+ ## [laif-ds@0.2.79]
21
+
22
+ ### 🚀 Added
23
+
24
+ - **MarkdownRenderer**: Added support for raw HTML rendering via `rehype-raw`, including native `<u>...</u>` underline tags
25
+ - **Storybook**: Added dedicated `MarkdownRenderer` stories with underline and full-formatting examples
26
+
27
+ ### 🔧 Changed
28
+
29
+ - **AppEditor**: Switched external underline markdown format from `++text++` to standard HTML `<u>text</u>` while keeping internal conversion compatibility
30
+ - **AppEditor**: Improved editor layout flexibility with `wrpClassName` and updated content container sizing behavior
31
+ - **Documentation and Stories**: Updated `AppEditor` docs and stories to reflect `<u>...</u>` underline usage
32
+
8
33
  ## [laif-ds@0.2.78]
9
34
 
10
35
  ### 🐛 Fixed
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
3
- import { __require as e } from "../node_modules/style-to-js/cjs/index.js";
4
- var t = e();
5
- const a = /* @__PURE__ */ r(t);
2
+ import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
+ import { __require as t } from "../node_modules/eventemitter3/index2.js";
4
+ var r = t();
5
+ const m = /* @__PURE__ */ e(r);
6
6
  export {
7
- a as default
7
+ m as default
8
8
  };
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
- import { __require as r } from "../node_modules/extend/index.js";
4
- var t = r();
5
- const x = /* @__PURE__ */ e(t);
2
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
3
+ import { __require as e } from "../node_modules/style-to-js/cjs/index.js";
4
+ var t = e();
5
+ const a = /* @__PURE__ */ r(t);
6
6
  export {
7
- x as default
7
+ a as default
8
8
  };
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
- import { __require as t } from "../node_modules/eventemitter3/index2.js";
4
- var r = t();
5
- const m = /* @__PURE__ */ e(r);
3
+ import { __require as r } from "../node_modules/extend/index.js";
4
+ var t = r();
5
+ const x = /* @__PURE__ */ e(t);
6
6
  export {
7
- m as default
7
+ x as default
8
8
  };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-04-01T08:26:06.498Z",
3
+ "generatedAt": "2026-05-05T15:26:14.216Z",
4
4
  "package": {
5
5
  "name": "laif-ds",
6
- "version": "0.2.78"
6
+ "version": "0.2.80"
7
7
  },
8
8
  "summary": {
9
- "scannedFiles": 393,
9
+ "scannedFiles": 394,
10
10
  "deprecatedComponentsCount": 2,
11
11
  "deprecatedComponentsUsedCount": 0,
12
12
  "componentsWithoutExamplesCount": 5,
@@ -528,6 +528,13 @@
528
528
  "src/components/ui/multiple-selector.tsx"
529
529
  ]
530
530
  },
531
+ {
532
+ "className": "bg-muted/50 rounded p-4 text-sm",
533
+ "occurrences": 7,
534
+ "files": [
535
+ "src/components/stories/app-select.stories.tsx"
536
+ ]
537
+ },
531
538
  {
532
539
  "className": "border-d-border border px-3 py-1 text-center text-sm font-light",
533
540
  "occurrences": 7,
@@ -565,13 +572,6 @@
565
572
  "src/components/stories/playground.stories.tsx"
566
573
  ]
567
574
  },
568
- {
569
- "className": "bg-muted/50 rounded p-4 text-sm",
570
- "occurrences": 6,
571
- "files": [
572
- "src/components/stories/app-select.stories.tsx"
573
- ]
574
- },
575
575
  {
576
576
  "className": "mb-2 text-sm font-medium",
577
577
  "occurrences": 6,
@@ -23,7 +23,7 @@ Rich text editor powered by Lexical with optional Markdown sync. Supports config
23
23
  ## Behavior
24
24
 
25
25
  - **Markdown sync**: When `onlyMarkdown=true`, initializes from Markdown and emits Markdown on every change.
26
- - **Extended Markdown**: Supports standard Markdown plus underline syntax using `++text++` (e.g., `++underlined text++`).
26
+ - **Extended Markdown**: Supports standard Markdown plus underline syntax using `<u>text</u>` (e.g., `<u>underlined text</u>`).
27
27
  - **Toolbars**:
28
28
  - `history`: undo/redo toolbar.
29
29
  - `block-format`: heading levels (h1-h3), numbered/bulleted/check lists, blockquote.
@@ -71,7 +71,7 @@ import * as React from "react";
71
71
  import { AppEditor } from "laif-ds";
72
72
 
73
73
  export function MarkdownDefault() {
74
- const initial = "**Titolo** con testo in ++markdown++ e *corsivo*";
74
+ const initial = "**Titolo** con testo in <u>markdown</u> e *corsivo*";
75
75
  const [md, setMd] = React.useState(initial);
76
76
  return (
77
77
  <AppEditor
@@ -90,7 +90,7 @@ import * as React from "react";
90
90
  import { AppEditor } from "laif-ds";
91
91
 
92
92
  export function UnderlineExample() {
93
- const initial = "Testo normale ++testo sottolineato++ altro normale";
93
+ const initial = "Testo normale <u>testo sottolineato</u> altro normale";
94
94
  const [md, setMd] = React.useState(initial);
95
95
  return (
96
96
  <AppEditor
@@ -109,5 +109,5 @@ export function UnderlineExample() {
109
109
  - **Sizing**: Control height via `className` (e.g., `h-96`). Default height is `h-72`.
110
110
  - **Performance**: Prefer Markdown mode for content pipelines that store Markdown; use `onlyMarkdown=false` for plain text initialization.
111
111
  - **Accessibility**: Toolbar buttons and editor area follow Lexical best practices.
112
- - **Underline Syntax**: Uses `++text++` format which is not standard Markdown but supported in this component for rich text export/import.
112
+ - **Underline Syntax**: Uses `<u>text</u>` HTML tags for underline, which is standard HTML and natively supported by both this component and `MarkdownRenderer` via `rehype-raw`.
113
113
  - **Theme**: Uses design system tokens for consistent styling with `border-d-border`, `bg-d-background`, etc.
@@ -74,6 +74,7 @@ export type MultiSelectProps = BaseProps & {
74
74
  renderValue?: (option: AppSelectOption) => React.ReactNode; // Custom render for selected values
75
75
  maxSelected?: number; // Maximum number of selectable items
76
76
  showChipsInsteadOfCount?: boolean; // Display chips instead of count (default: false)
77
+ selectableAll?: boolean; // Shows tri-state select-all toggle next to the search bar (default: true)
77
78
  };
78
79
  ```
79
80
 
@@ -154,6 +155,19 @@ When options have a `group` property:
154
155
  - Options without a group value (empty string, undefined, or missing) appear under the `noGroupLabel` heading
155
156
  - Grouping is based on the `group` property of `AppSelectOption`
156
157
 
158
+ ### Select All / Deselect All
159
+
160
+ In multiple mode with `selectableAll={true}` (default):
161
+
162
+ - A single tri-state checkbox-style toggle appears at the left of the search bar — replacing the search icon (or in a slim header bar when `searchable` is off)
163
+ - **`Square`** icon → no filtered options selected; click selects all matching the current filter (respects `maxSelected` cap)
164
+ - **`SquareMinus`** icon → some filtered options selected; click completes the selection (within the cap)
165
+ - **`SquareCheck`** icon → all filtered options selected (or `maxSelected` cap reached); click deselects only the currently-filtered items — **out-of-view selections and `fixed: true` items are preserved**
166
+ - **`SquareDot`** icon (disabled) → search yields no matches; the button stays visible but inactive so the layout doesn't collapse
167
+ - Both actions are scoped to the current search filter — symmetric, predictable, and prevents accidental data loss
168
+ - Uses `role="checkbox"` with dynamic `aria-checked` (`true` / `false` / `"mixed"`) and a hardcoded English `aria-label` (no per-project i18n required)
169
+ - Available only on multi-select; type-rejected on single-select. Opt out with `selectableAll={false}`
170
+
157
171
  ### Max Selection Limit
158
172
 
159
173
  In multiple mode with `maxSelected` set:
@@ -420,6 +434,37 @@ export function SelectWithDisabled() {
420
434
  }
421
435
  ```
422
436
 
437
+ ### Multiple with Select All / Deselect All
438
+
439
+ ```tsx
440
+ import { AppSelect } from "laif-ds";
441
+ import { useState } from "react";
442
+
443
+ const options = [
444
+ { value: "react", label: "React" },
445
+ { value: "vue", label: "Vue" },
446
+ { value: "angular", label: "Angular" },
447
+ { value: "svelte", label: "Svelte" },
448
+ ];
449
+
450
+ export function SelectAllExample() {
451
+ const [values, setValues] = useState<(string | number)[]>([]);
452
+
453
+ return (
454
+ <AppSelect
455
+ multiple
456
+ selectableAll
457
+ searchable
458
+ options={options}
459
+ value={values}
460
+ onValueChange={setValues}
461
+ placeholder="Select frameworks"
462
+ label="Frameworks"
463
+ />
464
+ );
465
+ }
466
+ ```
467
+
423
468
  ### Custom Render Value
424
469
 
425
470
  ```tsx
@@ -462,3 +507,4 @@ export function CustomRenderSelect() {
462
507
  - **Performance**: Efficient rendering with useMemo for computed values
463
508
  - **Custom Rendering**: Use `renderValue` prop to customize how selected options appear in the trigger
464
509
  - **Controlled Component Detection**: Uses `props.hasOwnProperty('value')` to determine if component is controlled, ensuring stable behavior even when value is `undefined`
510
+ - **Mobile Keyboard**: Popover prevents default auto-focus on open via `onOpenAutoFocus`, so the soft keyboard does not pop up automatically when `searchable` is enabled. This avoids the visual-viewport collapse that previously caused the dropdown to flip off-screen on mobile. Tap the search input to focus it explicitly when needed.
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schemaVersion": "1.1.0",
3
- "generatedAt": "2026-04-01T08:26:06.241Z",
3
+ "generatedAt": "2026-05-05T15:26:13.593Z",
4
4
  "package": {
5
5
  "name": "laif-ds",
6
- "version": "0.2.78"
6
+ "version": "0.2.80"
7
7
  },
8
8
  "stats": {
9
9
  "documentedComponentCount": 92,
@@ -847,6 +847,7 @@
847
847
  "Search Functionality",
848
848
  "Creatable Options",
849
849
  "Grouping",
850
+ "Select All / Deselect All",
850
851
  "Max Selection Limit",
851
852
  "Chips Display",
852
853
  "Disabled Options",
@@ -858,6 +859,7 @@
858
859
  "Custom JSX Labels",
859
860
  "Clearable Single Select",
860
861
  "With Disabled Options",
862
+ "Multiple with Select All / Deselect All",
861
863
  "Custom Render Value"
862
864
  ],
863
865
  "controlledPattern": "controlled-uncontrolled-documented",
@@ -6059,5 +6061,5 @@
6059
6061
  ]
6060
6062
  }
6061
6063
  ],
6062
- "checksum": "0b6344f7d2690a68a50014348017a8d4b0c42453fc08075f4e723fa0f2d7c19d"
6064
+ "checksum": "5365e3750a199ac2ef62a230e7ec5a26fa46e3494a332e48d9f832d003ac6a1b"
6063
6065
  }
@@ -1,20 +1,27 @@
1
1
  "use client";
2
2
  import { jsx as t } from "react/jsx-runtime";
3
- import { ContentEditable as l } from "../../../node_modules/@lexical/react/LexicalContentEditable.prod.js";
4
- function a({
3
+ import { ContentEditable as r } from "../../../node_modules/@lexical/react/LexicalContentEditable.prod.js";
4
+ import { cn as o } from "../../../lib/utils.js";
5
+ function s({
5
6
  placeholder: e,
6
- className: o,
7
- placeholderClassName: n
7
+ className: n,
8
+ placeholderClassName: l
8
9
  }) {
9
10
  return /* @__PURE__ */ t(
10
- l,
11
+ r,
11
12
  {
12
- className: o ?? "ContentEditable__root relative block min-h-72 min-h-full overflow-auto px-8 py-4 focus:outline-none",
13
+ className: o(
14
+ "ContentEditable__root relative block overflow-auto px-8 py-4 focus:outline-none",
15
+ n
16
+ ),
13
17
  "aria-placeholder": e,
14
18
  placeholder: /* @__PURE__ */ t(
15
19
  "div",
16
20
  {
17
- className: n ?? "text-muted-foreground pointer-events-none absolute top-0 left-0 overflow-hidden px-8 py-[18px] text-ellipsis select-none",
21
+ className: o(
22
+ "text-muted-foreground pointer-events-none absolute top-0 left-0 overflow-hidden px-8 py-[18px] text-ellipsis select-none",
23
+ l
24
+ ),
18
25
  children: e
19
26
  }
20
27
  )
@@ -22,5 +29,5 @@ function a({
22
29
  );
23
30
  }
24
31
  export {
25
- a as ContentEditable
32
+ s as ContentEditable
26
33
  };
@@ -1,157 +1,169 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as t, Fragment as s } from "react/jsx-runtime";
2
+ import { jsx as r, jsxs as e, Fragment as s } from "react/jsx-runtime";
3
3
  import { ListNode as S, ListItemNode as T } from "../../node_modules/@lexical/list/LexicalList.prod.js";
4
- import { $convertToMarkdownString as k, $convertFromMarkdownString as w, TRANSFORMERS as L } from "../../node_modules/@lexical/markdown/LexicalMarkdown.prod.js";
5
- import { CheckListPlugin as A } from "../../node_modules/@lexical/react/LexicalCheckListPlugin.prod.js";
6
- import { ClearEditorPlugin as j } from "../../node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js";
7
- import { LexicalComposer as O } from "../../node_modules/@lexical/react/LexicalComposer.prod.js";
4
+ import { $convertToMarkdownString as L, $convertFromMarkdownString as k, TRANSFORMERS as A } from "../../node_modules/@lexical/markdown/LexicalMarkdown.prod.js";
5
+ import { CheckListPlugin as j } from "../../node_modules/@lexical/react/LexicalCheckListPlugin.prod.js";
6
+ import { ClearEditorPlugin as O } from "../../node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js";
7
+ import { LexicalComposer as $ } from "../../node_modules/@lexical/react/LexicalComposer.prod.js";
8
8
  import { useLexicalComposerContext as B } from "../../node_modules/@lexical/react/LexicalComposerContext.prod.js";
9
9
  import { LexicalErrorBoundary as D } from "../../node_modules/@lexical/react/LexicalErrorBoundary.prod.js";
10
10
  import { HistoryPlugin as H } from "../../node_modules/@lexical/react/LexicalHistoryPlugin.prod.js";
11
11
  import { ListPlugin as I } from "../../node_modules/@lexical/react/LexicalListPlugin.prod.js";
12
- import { OnChangePlugin as $ } from "../../node_modules/@lexical/react/LexicalOnChangePlugin.prod.js";
13
- import { RichTextPlugin as M } from "../../node_modules/@lexical/react/LexicalRichTextPlugin.prod.js";
14
- import { HeadingNode as _, QuoteNode as z } from "../../node_modules/@lexical/rich-text/LexicalRichText.prod.js";
15
- import { ParagraphNode as d, TextNode as p, $getRoot as f } from "../../node_modules/lexical/Lexical.prod.js";
16
- import { useState as Q, useEffect as U } from "react";
17
- import { ContentEditable as J } from "../editor/editor-ui/content-editable.js";
18
- import { ActionsPlugin as q } from "../editor/plugins/actions/actions-plugin.js";
19
- import { ClearEditorActionPlugin as G } from "../editor/plugins/actions/clear-editor-plugin.js";
20
- import { CounterCharacterPlugin as K } from "../editor/plugins/actions/counter-character-plugin.js";
21
- import { FormatBulletedList as W } from "../editor/plugins/toolbar/block-format/format-bulleted-list.js";
22
- import { FormatCheckList as X } from "../editor/plugins/toolbar/block-format/format-check-list.js";
23
- import { FormatHeading as Y } from "../editor/plugins/toolbar/block-format/format-heading.js";
24
- import { FormatNumberedList as Z } from "../editor/plugins/toolbar/block-format/format-numbered-list.js";
25
- import { FormatParagraph as V } from "../editor/plugins/toolbar/block-format/format-paragraph.js";
26
- import { FormatQuote as rr } from "../editor/plugins/toolbar/block-format/format-quote.js";
27
- import { BlockFormatDropDown as or } from "../editor/plugins/toolbar/block-format-toolbar-plugin.js";
12
+ import { OnChangePlugin as M } from "../../node_modules/@lexical/react/LexicalOnChangePlugin.prod.js";
13
+ import { RichTextPlugin as U } from "../../node_modules/@lexical/react/LexicalRichTextPlugin.prod.js";
14
+ import { HeadingNode as z, QuoteNode as Q } from "../../node_modules/@lexical/rich-text/LexicalRichText.prod.js";
15
+ import { ParagraphNode as d, TextNode as f, $getRoot as p } from "../../node_modules/lexical/Lexical.prod.js";
16
+ import { useState as _, useEffect as J } from "react";
17
+ import { ContentEditable as q } from "../editor/editor-ui/content-editable.js";
18
+ import { ActionsPlugin as G } from "../editor/plugins/actions/actions-plugin.js";
19
+ import { ClearEditorActionPlugin as K } from "../editor/plugins/actions/clear-editor-plugin.js";
20
+ import { CounterCharacterPlugin as W } from "../editor/plugins/actions/counter-character-plugin.js";
21
+ import { FormatBulletedList as X } from "../editor/plugins/toolbar/block-format/format-bulleted-list.js";
22
+ import { FormatCheckList as Y } from "../editor/plugins/toolbar/block-format/format-check-list.js";
23
+ import { FormatHeading as Z } from "../editor/plugins/toolbar/block-format/format-heading.js";
24
+ import { FormatNumberedList as V } from "../editor/plugins/toolbar/block-format/format-numbered-list.js";
25
+ import { FormatParagraph as rr } from "../editor/plugins/toolbar/block-format/format-paragraph.js";
26
+ import { FormatQuote as or } from "../editor/plugins/toolbar/block-format/format-quote.js";
27
+ import { BlockFormatDropDown as er } from "../editor/plugins/toolbar/block-format-toolbar-plugin.js";
28
28
  import { FontFormatToolbarPlugin as l } from "../editor/plugins/toolbar/font-format-toolbar-plugin.js";
29
29
  import { ToolbarPlugin as c } from "../editor/plugins/toolbar/toolbar-plugin.js";
30
30
  import { editorTheme as tr } from "../editor/themes/editor-theme.js";
31
- import { TooltipProvider as er } from "./tooltip.js";
32
- import { HistoryToolbarPlugin as ir } from "../editor/plugins/toolbar/history-toolbar-plugin.js";
33
- const nr = "Start typing...", ar = {
31
+ import { TooltipProvider as ir } from "./tooltip.js";
32
+ import { HistoryToolbarPlugin as nr } from "../editor/plugins/toolbar/history-toolbar-plugin.js";
33
+ import { cn as ar } from "../../lib/utils.js";
34
+ const lr = "Start typing...", mr = {
34
35
  format: ["underline"],
35
36
  tag: "++",
36
37
  type: "text-format"
37
- }, x = [
38
- ...L,
39
- ar
40
- ];
41
- function lr({
38
+ }, v = [
39
+ ...A,
40
+ mr
41
+ ], sr = (o) => o.replace(/<u>(.*?)<\/u>/g, "++$1++"), cr = (o) => o.replace(/\+\+(.+?)\+\+/g, "<u>$1</u>");
42
+ function dr({
42
43
  defaultValue: o,
43
44
  onlyMarkdown: i
44
45
  }) {
45
46
  const [n] = B();
46
- return U(() => {
47
+ return J(() => {
47
48
  o && n.update(() => {
48
- i ? w(o, x) : f().append(
49
- new d().append(new p(o))
49
+ i ? k(
50
+ sr(o),
51
+ v
52
+ ) : p().append(
53
+ new d().append(new f(o))
50
54
  );
51
- const a = f();
55
+ const a = p();
52
56
  (a.getFirstChild() ?? a).selectStart();
53
57
  });
54
58
  }, [n, o, i]), null;
55
59
  }
56
- function $r({
60
+ function _r({
57
61
  defaultValue: o,
58
62
  onMarkdownEdit: i,
59
63
  plugins: n = [],
60
64
  toolbars: a = [],
61
- placeholder: F = nr,
65
+ placeholder: F = lr,
62
66
  onlyMarkdown: h = !0,
63
- className: C = "overflow-hidden rounded-lg border border-d-border"
67
+ className: C = "rounded-lg border border-d-border",
68
+ wrpClassName: E = ""
64
69
  }) {
65
- const [, E] = Q(null), P = {
70
+ const [, P] = _(null), w = {
66
71
  namespace: "AppEditor",
67
72
  theme: tr,
68
73
  nodes: [
69
- _,
70
- d,
71
- p,
72
74
  z,
75
+ d,
76
+ f,
77
+ Q,
73
78
  S,
74
79
  T
75
80
  ],
76
- onError: (e) => {
77
- console.error(e);
81
+ onError: (t) => {
82
+ console.error(t);
78
83
  },
79
84
  ...o && !h ? {
80
85
  editorState: () => {
81
- f().append(
82
- new d().append(new p(o))
86
+ p().append(
87
+ new d().append(new f(o))
83
88
  );
84
89
  }
85
90
  } : {}
86
- }, u = (e) => n.includes(e), m = (e) => a.includes(e), g = u("clear"), v = u("counter"), N = m("block-format"), y = m("font-format"), b = m("history");
87
- return /* @__PURE__ */ r("div", { className: "bg-d-background", children: /* @__PURE__ */ r(O, { initialConfig: P, children: /* @__PURE__ */ t(er, { children: [
91
+ }, u = (t) => n.includes(t), m = (t) => a.includes(t), g = u("clear"), x = u("counter"), b = m("block-format"), y = m("font-format"), N = m("history");
92
+ return /* @__PURE__ */ r("div", { className: ar("bg-d-background flex h-96 flex-col", E), children: /* @__PURE__ */ r($, { initialConfig: w, children: /* @__PURE__ */ e(ir, { children: [
88
93
  o && /* @__PURE__ */ r(
89
- lr,
94
+ dr,
90
95
  {
91
96
  defaultValue: o,
92
97
  onlyMarkdown: h
93
98
  }
94
99
  ),
95
- /* @__PURE__ */ t("div", { className: "border-d-border flex items-center border-b", children: [
96
- b && /* @__PURE__ */ r(c, { children: () => /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ r(ir, {}) }) }),
97
- N && /* @__PURE__ */ r(c, { children: () => /* @__PURE__ */ r(s, { children: /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ t(or, { children: [
100
+ /* @__PURE__ */ e("div", { className: "border-d-border flex items-center border-b", children: [
101
+ N && /* @__PURE__ */ r(c, { children: () => /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ r(nr, {}) }) }),
102
+ b && /* @__PURE__ */ r(c, { children: () => /* @__PURE__ */ r(s, { children: /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ e(er, { children: [
103
+ /* @__PURE__ */ r(rr, {}),
104
+ /* @__PURE__ */ r(Z, { levels: ["h1", "h2", "h3"] }),
98
105
  /* @__PURE__ */ r(V, {}),
99
- /* @__PURE__ */ r(Y, { levels: ["h1", "h2", "h3"] }),
100
- /* @__PURE__ */ r(Z, {}),
101
- /* @__PURE__ */ r(W, {}),
102
106
  /* @__PURE__ */ r(X, {}),
103
- /* @__PURE__ */ r(rr, {})
107
+ /* @__PURE__ */ r(Y, {}),
108
+ /* @__PURE__ */ r(or, {})
104
109
  ] }) }) }) }),
105
- y && /* @__PURE__ */ r(c, { children: () => /* @__PURE__ */ t("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: [
110
+ y && /* @__PURE__ */ r(c, { children: () => /* @__PURE__ */ e("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: [
106
111
  /* @__PURE__ */ r(l, { format: "bold" }),
107
112
  /* @__PURE__ */ r(l, { format: "italic" }),
108
113
  /* @__PURE__ */ r(l, { format: "underline" }),
109
114
  /* @__PURE__ */ r(l, { format: "strikethrough" })
110
115
  ] }) })
111
116
  ] }),
112
- /* @__PURE__ */ t("div", { className: "relative", children: [
113
- b && /* @__PURE__ */ r(H, {}),
117
+ /* @__PURE__ */ e("div", { className: "relative flex min-h-0 w-full flex-1 flex-col", children: [
118
+ N && /* @__PURE__ */ r(H, {}),
114
119
  /* @__PURE__ */ r(
115
- M,
120
+ U,
116
121
  {
117
122
  ErrorBoundary: D,
118
- contentEditable: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r("div", { ref: E, children: /* @__PURE__ */ r(
119
- J,
123
+ contentEditable: /* @__PURE__ */ r(
124
+ "div",
120
125
  {
121
- placeholder: F,
122
- className: `ContentEditable__root relative block h-72 min-h-full overflow-auto px-8 py-4 focus:outline-none ${C}`
126
+ ref: P,
127
+ className: "flex min-h-0 w-full flex-1 overflow-auto",
128
+ children: /* @__PURE__ */ r(
129
+ q,
130
+ {
131
+ placeholder: F,
132
+ className: `border-d-border w-full rounded-none border-b ${C}`
133
+ }
134
+ )
123
135
  }
124
- ) }) })
136
+ )
125
137
  }
126
138
  ),
127
- N && /* @__PURE__ */ t(s, { children: [
139
+ b && /* @__PURE__ */ e(s, { children: [
128
140
  /* @__PURE__ */ r(I, {}),
129
- /* @__PURE__ */ r(A, {})
141
+ /* @__PURE__ */ r(j, {})
130
142
  ] }),
131
- (g || v) && /* @__PURE__ */ r(q, { children: /* @__PURE__ */ t("div", { className: "clear-both flex items-center justify-between gap-2 p-1", children: [
143
+ (g || x) && /* @__PURE__ */ r(G, { children: /* @__PURE__ */ e("div", { className: "clear-both flex items-center justify-between gap-2 p-1", children: [
132
144
  /* @__PURE__ */ r("div", { className: "flex flex-1 justify-start" }),
133
- /* @__PURE__ */ r("div", { children: v && /* @__PURE__ */ r(K, { charset: "UTF-16" }) }),
134
- /* @__PURE__ */ r("div", { className: "flex flex-1 justify-end gap-2", children: g && /* @__PURE__ */ t(s, { children: [
135
- /* @__PURE__ */ r(G, {}),
136
- /* @__PURE__ */ r(j, {})
145
+ /* @__PURE__ */ r("div", { children: x && /* @__PURE__ */ r(W, { charset: "UTF-16" }) }),
146
+ /* @__PURE__ */ r("div", { className: "flex flex-1 justify-end gap-2", children: g && /* @__PURE__ */ e(s, { children: [
147
+ /* @__PURE__ */ r(K, {}),
148
+ /* @__PURE__ */ r(O, {})
137
149
  ] }) })
138
150
  ] }) })
139
151
  ] }),
140
152
  /* @__PURE__ */ r(
141
- $,
153
+ M,
142
154
  {
143
155
  ignoreSelectionChange: !0,
144
- onChange: (e) => {
156
+ onChange: (t) => {
145
157
  if (!i) return;
146
- const R = e.read(
147
- () => k(x)
158
+ const R = t.read(
159
+ () => L(v)
148
160
  );
149
- i(R);
161
+ i(cr(R));
150
162
  }
151
163
  }
152
164
  )
153
165
  ] }) }) });
154
166
  }
155
167
  export {
156
- $r as AppEditor
168
+ _r as AppEditor
157
169
  };