@platecms/delta-smart-text 0.3.0 → 0.4.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platecms/delta-smart-text",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Provides a component to display smart text by using slate.",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -16,44 +16,41 @@
16
16
  "type": "module",
17
17
  "exports": {
18
18
  ".": {
19
+ "types": "./index.d.ts",
19
20
  "import": "./index.mjs",
20
- "require": "./index.js",
21
- "types": "./index.d.ts"
21
+ "require": "./index.js"
22
22
  },
23
23
  "./index.css": "./index.css"
24
24
  },
25
25
  "dependencies": {
26
- "@fortawesome/free-regular-svg-icons": "6.7.2",
27
- "@fortawesome/free-solid-svg-icons": "6.7.2",
28
- "@fortawesome/react-fontawesome": "0.2.2",
29
- "@platecms/delta-cast": "0.4.8",
30
- "@platecms/delta-plate-resource-notation": "1.4.1",
31
- "@graphql-codegen/cli": "5.0.3",
26
+ "@platecms/delta-cast": "0.4.0",
27
+ "@platecms/delta-plate-resource-notation": "0.4.0",
28
+ "@graphql-codegen/cli": "5.0.7",
32
29
  "@graphql-typed-document-node/core": "3.2.0",
33
- "@platecms/delta-cast-util-to-plaintext": "1.0.3",
34
- "@reduxjs/toolkit": "2.5.1",
30
+ "@platecms/delta-cast-util-to-plaintext": "0.4.0",
31
+ "@reduxjs/toolkit": "2.8.2",
35
32
  "class-transformer": "0.5.1",
36
- "graphql": "16.10.0",
33
+ "graphql": "16.11.0",
37
34
  "is-hotkey": "0.2.0",
38
35
  "lodash": "4.17.21",
39
- "prismjs": "1.29.0",
40
- "react": "19.0.0",
41
- "react-dom": "19.0.0",
36
+ "prismjs": "1.30.0",
37
+ "react": "19.1.1",
38
+ "react-dom": "19.1.1",
42
39
  "react-redux": "9.2.0",
43
40
  "redux-watch": "1.2.0",
44
41
  "reflect-metadata": "0.2.2",
45
- "slate": "0.112.0",
46
- "slate-react": "0.112.1",
42
+ "slate": "0.118.0",
43
+ "slate-react": "0.117.4",
47
44
  "tslib": "2.8.1",
48
- "uuid": "11.0.5",
49
- "vue": "3.5.13",
50
- "@vitejs/plugin-vue": "4.5.0",
51
- "vite-plugin-dts": "4.5.0",
52
- "@tailwindcss/vite": "4.0.6",
53
- "@vitejs/plugin-react": "4.3.4",
45
+ "uuid": "11.1.0",
46
+ "vue": "3.5.18",
47
+ "@vitejs/plugin-vue": "6.0.1",
48
+ "vite-plugin-dts": "4.5.4",
49
+ "@tailwindcss/vite": "4.1.12",
50
+ "@vitejs/plugin-react": "5.0.0",
54
51
  "zwitch": "2.0.4",
55
- "@apollo/client": "3.13.1",
56
- "@testing-library/react": "^16.3.0",
57
- "react-tooltip": "^5.28.1"
52
+ "@apollo/client": "3.13.9",
53
+ "@testing-library/react": "16.3.0",
54
+ "react-tooltip": "5.29.1"
58
55
  }
59
56
  }
@@ -1,7 +1,8 @@
1
1
  import { default as React, HTMLAttributes, ReactNode } from 'react';
2
2
  import { DeltaElement } from '../types';
3
- export declare function Element({ attributes, children, element, }: {
3
+ export declare function Element({ attributes, children, element, lastKey, }: {
4
4
  attributes: HTMLAttributes<HTMLElement>;
5
5
  children: ReactNode;
6
6
  element: DeltaElement;
7
+ lastKey: string | undefined;
7
8
  }): React.ReactElement;
@@ -0,0 +1,6 @@
1
+ export declare function FontAwesomeIcon({ icon, className, size, spin, }: {
2
+ icon: [string, string];
3
+ className?: string;
4
+ size?: "lg" | "md" | "sm" | "xs";
5
+ spin?: boolean;
6
+ }): React.ReactElement;
@@ -1,7 +1,3 @@
1
- import { default as React, HTMLAttributes, ReactNode } from 'react';
2
- import { DeltaLeaf } from '../types';
3
- export declare function Leaf(props: {
4
- attributes: HTMLAttributes<HTMLElement>;
5
- leaf: DeltaLeaf;
6
- children?: ReactNode;
7
- }): React.ReactElement;
1
+ import { default as React } from 'react';
2
+ import { RenderLeafProps } from 'slate-react';
3
+ export declare function Leaf(props: RenderLeafProps): React.ReactElement;
@@ -0,0 +1,8 @@
1
+ import { default as React, HTMLAttributes, ReactNode } from 'react';
2
+ import { LinkElement as LinkElementType } from '../../types';
3
+ export declare function LinkElement({ attributes, children, element, }: {
4
+ attributes: HTMLAttributes<HTMLElement>;
5
+ children: ReactNode;
6
+ element: LinkElementType;
7
+ }): React.ReactElement;
8
+ export default LinkElement;
@@ -0,0 +1,7 @@
1
+ export declare function TextInput({ onChange, name, value, placeholder, label, }: {
2
+ onChange: (value: string) => void;
3
+ name?: string;
4
+ label: string;
5
+ value: string;
6
+ placeholder: string;
7
+ }): React.ReactElement;
@@ -1,4 +1,10 @@
1
1
  import { default as React } from 'react';
2
- export declare function ContentAndFormatMenu({ uuid }: {
2
+ export declare function ContentAndFormatMenu({ uuid, ref, linkMenuIsOpen, openLinkMenu, searchValue, }: {
3
3
  uuid: string;
4
+ ref: React.RefObject<{
5
+ escapeContentAndFormatMenu: () => void;
6
+ } | null>;
7
+ linkMenuIsOpen: boolean;
8
+ openLinkMenu: () => void;
9
+ searchValue: string | null;
4
10
  }): React.ReactElement | null;
@@ -0,0 +1,8 @@
1
+ import { GridPlacement } from '../../../../../__generated__/graphql';
2
+ export declare function AnchorInput({ label, value, contentExperiencePrn, gridPlacementPrn, onGridPlacementChanged, }: {
3
+ label: string;
4
+ value: string;
5
+ contentExperiencePrn: string;
6
+ gridPlacementPrn: string | undefined;
7
+ onGridPlacementChanged: (gridPlacement?: GridPlacement) => void;
8
+ }): React.ReactElement | null;
@@ -0,0 +1,11 @@
1
+ import { ContentExperience } from '../../../../../__generated__/graphql';
2
+ import { LinkData } from './LinkMenu';
3
+ export declare function LinkInput({ onChange, onContentExperienceChanged, value, placeholder, label, contentExperiencePrn, gridPlacementPrn, }: {
4
+ onChange: (partial: Partial<LinkData>) => void;
5
+ onContentExperienceChanged: (contentExperience?: ContentExperience) => void;
6
+ value: string;
7
+ placeholder?: string;
8
+ label: string;
9
+ contentExperiencePrn?: string;
10
+ gridPlacementPrn?: string;
11
+ }): React.ReactElement;
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+ import { LinkElement } from '../../../types';
3
+ export interface LinkData {
4
+ text: string;
5
+ url: string;
6
+ target: LinkElement["target"];
7
+ internal?: {
8
+ prn: string;
9
+ anchor?: boolean;
10
+ };
11
+ }
12
+ export declare function LinkMenu({ showLinkTextInput, buttonText, menuClass, showMenu, onClose, }: {
13
+ showLinkTextInput?: boolean;
14
+ buttonText: string;
15
+ menuClass?: string;
16
+ showMenu?: boolean;
17
+ onClose: () => void;
18
+ }): React.ReactElement | null;
@@ -1,7 +1,6 @@
1
- import { IconDefinition } from '@fortawesome/free-regular-svg-icons';
2
1
  import { default as React, ReactNode } from 'react';
3
2
  export declare function MenuButton({ icon, text, onClick, children, }: {
4
- icon?: IconDefinition;
3
+ icon?: [string, string];
5
4
  text: string;
6
5
  onClick?: (event: React.MouseEvent) => void;
7
6
  children?: ReactNode;
@@ -1,6 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { IconDefinition } from '@fortawesome/free-regular-svg-icons';
3
2
  export declare function MenuHeader({ text, icon }: {
4
3
  text: string;
5
- icon?: IconDefinition;
4
+ icon?: [string, string];
6
5
  }): React.ReactElement;
@@ -1,9 +1,8 @@
1
1
  import { default as React, ReactNode } from 'react';
2
2
  import { HeadingElement, ListElement } from '../../types';
3
- import { IconDefinition } from '@fortawesome/free-regular-svg-icons';
4
3
  export declare function ToolbarBlockButton({ format, properties, icon, children, }: {
5
4
  format: "code" | "heading" | "list";
6
- icon: IconDefinition;
5
+ icon: [string, string];
7
6
  properties?: {
8
7
  level?: HeadingElement["level"];
9
8
  ordered?: ListElement["ordered"];
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export declare function ToolbarLinkButton({ icon, mode, }: {
3
+ icon: [string, string];
4
+ mode?: "create" | "edit";
5
+ }): React.ReactElement;
6
+ export default ToolbarLinkButton;
@@ -1,7 +1,6 @@
1
1
  import { default as React } from 'react';
2
- import { IconDefinition } from '@fortawesome/free-regular-svg-icons';
3
2
  declare function ToolbarMarkButton({ format, icon, }: {
4
3
  format: "bold" | "italic" | "strikethrough" | "underline";
5
- icon: IconDefinition;
4
+ icon: [string, string];
6
5
  }): React.ReactElement;
7
6
  export default ToolbarMarkButton;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function ToolbarDisplayLink(): React.ReactElement;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function UnlinkButton(): React.ReactElement;
package/react/types.d.ts CHANGED
@@ -11,7 +11,7 @@ declare module "slate" {
11
11
  export interface DeltaLeafMarkdown {
12
12
  title?: boolean;
13
13
  }
14
- export type DeltaElement = BlockquoteElement | CodeElement | ContentValueElement | HeadingElement | ListElement | ListItemElement | ParagraphElement;
14
+ export type DeltaElement = BlockquoteElement | CodeElement | ContentValueElement | HeadingElement | LinkElement | ListElement | ListItemElement | ParagraphElement;
15
15
  export type DeltaLeaf = DeltaLeafMarkdown & {
16
16
  text: string;
17
17
  bold?: true;
@@ -23,7 +23,7 @@ export type DeltaLeaf = DeltaLeafMarkdown & {
23
23
  };
24
24
  export interface ParagraphElement {
25
25
  type: "paragraph";
26
- children: (ContentValueElement | DeltaLeaf)[];
26
+ children: (ContentValueElement | DeltaLeaf | LinkElement)[];
27
27
  }
28
28
  export interface HeadingElement {
29
29
  type: "heading";
@@ -53,3 +53,13 @@ export interface ContentValueElement {
53
53
  root: Root | undefined;
54
54
  children: DeltaLeaf[];
55
55
  }
56
+ export interface LinkElement {
57
+ type: "link";
58
+ url: string;
59
+ children: DeltaLeaf[];
60
+ target?: "_parent" | "_top" | "blank" | "self";
61
+ internal?: {
62
+ prn: string;
63
+ anchor?: boolean;
64
+ };
65
+ }
@@ -1,4 +1,4 @@
1
- import { BaseEditor, Editor } from 'slate';
1
+ import { BaseEditor, Editor, Element } from 'slate';
2
2
  import { DeltaLeaf, HeadingElement, ListElement } from '../types';
3
3
  import { ReactEditor } from 'slate-react';
4
4
  import { default as React } from 'react';
@@ -13,3 +13,5 @@ export declare function toggleBlock(editor: BaseEditor & ReactEditor, format: "c
13
13
  ordered?: ListElement["ordered"];
14
14
  }): void;
15
15
  export declare function useClickOutside(ref: React.RefObject<HTMLElement | null>, callback: () => void): void;
16
+ export declare function findElement(editor: Editor, elementType: string): [Element, number[]] | undefined;
17
+ export declare function hasElementSelected(editor: Editor, elementType: string): boolean;