@limetech/lime-elements 39.44.6 → 39.45.1

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 (34) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/limel-form.cjs.entry.js +41 -9
  3. package/dist/cjs/limel-markdown.cjs.entry.js +1 -1
  4. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +778 -395
  5. package/dist/cjs/limel-text-editor-link-menu.cjs.entry.js +6 -6
  6. package/dist/cjs/{markdown-parser-ChnRAxpZ.js → markdown-parser-YH5HSSgF.js} +36 -56
  7. package/dist/collection/components/text-editor/link-menu/editor-link-menu.js +6 -6
  8. package/dist/collection/components/text-editor/prosemirror-adapter/editor-config.js +12 -1
  9. package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-command-utils/active-state-utils.js +36 -0
  10. package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-command-utils/list-utils.js +270 -0
  11. package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-command-utils/node-utils.js +15 -0
  12. package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-commands.js +81 -69
  13. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/list-key-handler.js +44 -0
  14. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +4 -3
  15. package/dist/esm/limel-form.entry.js +41 -9
  16. package/dist/esm/limel-markdown.entry.js +1 -1
  17. package/dist/esm/limel-prosemirror-adapter.entry.js +779 -396
  18. package/dist/esm/limel-text-editor-link-menu.entry.js +6 -6
  19. package/dist/esm/{markdown-parser-BSQKleVw.js → markdown-parser-DrxxGLF5.js} +36 -56
  20. package/dist/lime-elements/lime-elements.esm.js +1 -1
  21. package/dist/lime-elements/p-1f29f482.entry.js +1 -0
  22. package/dist/lime-elements/{p-3ea159fd.entry.js → p-38393fb4.entry.js} +1 -1
  23. package/dist/lime-elements/{p-1fb4bfa9.entry.js → p-421612f9.entry.js} +2 -2
  24. package/dist/lime-elements/{p-B0qhUema.js → p-C9xHOCE_.js} +2 -2
  25. package/dist/lime-elements/p-d97df2cd.entry.js +1 -0
  26. package/dist/types/components/text-editor/link-menu/editor-link-menu.d.ts +2 -2
  27. package/dist/types/components/text-editor/prosemirror-adapter/menu/menu-command-utils/active-state-utils.d.ts +6 -0
  28. package/dist/types/components/text-editor/prosemirror-adapter/menu/menu-command-utils/list-utils.d.ts +68 -0
  29. package/dist/types/components/text-editor/prosemirror-adapter/menu/menu-command-utils/node-utils.d.ts +10 -0
  30. package/dist/types/components/text-editor/prosemirror-adapter/menu/menu-commands.d.ts +10 -0
  31. package/dist/types/components/text-editor/prosemirror-adapter/plugins/list-key-handler.d.ts +14 -0
  32. package/package.json +4 -4
  33. package/dist/lime-elements/p-845cfda7.entry.js +0 -1
  34. package/dist/lime-elements/p-e8df7a2e.entry.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as i,c as t,h as e}from"./p-BGxJfR2f.js";import{t as s}from"./p-Cb9R_zmF.js";import{a,E as n}from"./p-C4_9qUMP.js";const l=class{constructor(e){i(this,e),this.cancel=t(this,"cancel"),this.save=t(this,"save"),this.linkChange=t(this,"linkChange"),this.language="en",this.isOpen=!1,this.getTranslation=i=>s.get(i,this.language),this.isValid=i=>{try{new URL(i)}catch(i){return!1}return!0},this.handleKeyDown=i=>{var t;i.key===a&&(this.saveButton&&this.saveButton.focus(),i.preventDefault(),this.isValid(null===(t=this.link)||void 0===t?void 0:t.href)&&this.handleSave(i))},this.handleCancel=i=>{i instanceof KeyboardEvent&&i.key!==n||(i.stopPropagation(),i.preventDefault(),this.cancel.emit())},this.handleSave=i=>{i.stopPropagation(),this.save.emit()},this.handleLinkInputAction=i=>{window.open(this.link.href,"_blank"),i.stopPropagation()},this.handleLinkTitleChange=i=>{var t;this.emitLinkChange(i.detail,null===(t=this.link)||void 0===t?void 0:t.href)},this.handleLinkValueChange=i=>{var t;this.emitLinkChange(null===(t=this.link)||void 0===t?void 0:t.text,i.detail)},this.emitLinkChange=(i,t)=>{this.linkChange.emit({text:i,href:t})}}connectedCallback(){this.setupGlobalHandlers()}disconnectedCallback(){this.teardownGlobalHandlers()}setupGlobalHandlers(){this.isOpen&&document.addEventListener("keyup",this.handleCancel)}teardownGlobalHandlers(){document.removeEventListener("keyup",this.handleCancel)}componentDidLoad(){this.focusOnLinkInput()}focusOnLinkInput(){if(this.linkInput){const i=this.linkInput.shadowRoot.querySelector("input");i&&requestAnimationFrame((()=>{i.focus()}))}}render(){var i,t;const s=this.isValid(this.link.href);return[e("limel-input-field",{key:"8da44ef5f8141c0b7e4cadf75babd07a62614674",label:this.getTranslation("editor-link-menu.text"),value:(null===(i=this.link)||void 0===i?void 0:i.text)||"",leadingIcon:"text_cursor",onChange:this.handleLinkTitleChange,onKeyDown:this.handleKeyDown}),e("limel-input-field",{key:"a16f2a13564809011551bf96e34e100b0683493c",label:this.getTranslation("editor-link-menu.link"),value:(null===(t=this.link)||void 0===t?void 0:t.href)||"",type:"text",leadingIcon:"-lime-text-link",trailingIcon:"external_link",invalid:!s,onChange:this.handleLinkValueChange,onAction:this.handleLinkInputAction,onKeyDown:this.handleKeyDown,ref:i=>this.linkInput=i}),e("div",{key:"ee392b700a4293eb2b2121d08bfef852f8b4404e",class:"actions"},e("limel-button",{key:"be9f4711edf45a69f8087341e61fc4183c59ba2d",label:this.getTranslation("cancel"),onClick:this.handleCancel}),e("limel-button",{key:"b958cae7915cc42133e5143589d4f454f8bb2ffa",primary:!0,label:this.getTranslation("save"),disabled:!s,onClick:this.handleSave,ref:i=>this.saveButton=i,slot:"button"}))]}};l.style=":host(limel-text-editor-link-menu){animation:fade 0.2s ease forwards;animation-delay:0.1s;opacity:0;display:flex;flex-direction:column;gap:0.5rem;padding:0.5rem;max-width:calc(100vw - 2rem);border-radius:0.5rem;background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--shadow-depth-16)}.actions{display:flex;justify-content:end;gap:0.5rem}@keyframes fade{0%{scale:0.86;opacity:0}100%{scale:1;opacity:1}}";export{l as limel_text_editor_link_menu}
@@ -32,14 +32,14 @@ export declare class TextEditorLinkMenu {
32
32
  * Emitted when the user inputs new values for the link
33
33
  */
34
34
  private linkChange;
35
- private textInput;
35
+ private linkInput;
36
36
  private saveButton;
37
37
  connectedCallback(): void;
38
38
  disconnectedCallback(): void;
39
39
  private setupGlobalHandlers;
40
40
  private teardownGlobalHandlers;
41
41
  componentDidLoad(): void;
42
- private focusOnTextInput;
42
+ private focusOnLinkInput;
43
43
  render(): any[];
44
44
  private getTranslation;
45
45
  private isValid;
@@ -0,0 +1,6 @@
1
+ import { MarkType, NodeType } from 'prosemirror-model';
2
+ import { CommandWithActive } from '../menu-commands';
3
+ export declare const setActiveMethodForMark: (command: CommandWithActive, markType: MarkType) => void;
4
+ export declare const setActiveMethodForNode: (command: CommandWithActive, nodeType: NodeType, level?: number) => void;
5
+ export declare const setActiveMethodForWrap: (command: CommandWithActive, nodeType: NodeType) => void;
6
+ //# sourceMappingURL=active-state-utils.d.ts.map
@@ -0,0 +1,68 @@
1
+ import { EditorState, Transaction } from 'prosemirror-state';
2
+ import { NodeType } from 'prosemirror-model';
3
+ type Dispatch = (tr: Transaction) => void;
4
+ export type ListContext = {
5
+ kind: 'same-type' | 'other-type';
6
+ listDepth: number;
7
+ } | {
8
+ kind: 'no-list';
9
+ listDepth: null;
10
+ singleBlock: boolean;
11
+ } | {
12
+ kind: 'mixed';
13
+ listDepth: null;
14
+ };
15
+ /**
16
+ * Whether the selection touches top-level blocks that cannot become list
17
+ * items (list_item requires a leading paragraph, so headings, blockquotes,
18
+ * code blocks and tables are not listable).
19
+ *
20
+ * @param state - the current editor state
21
+ * @returns true when a non-listable block intersects the selection
22
+ */
23
+ export declare const selectionHasNonListableBlock: (state: EditorState) => boolean;
24
+ /**
25
+ * Classifies the selection for the list command ladder.
26
+ *
27
+ * @param state - the current editor state
28
+ * @param listType - the list type the command targets
29
+ * @returns the ladder branch to take, plus the innermost list depth when
30
+ * the selection sits inside a list
31
+ */
32
+ export declare const resolveListContext: (state: EditorState, listType: NodeType) => ListContext;
33
+ /**
34
+ * Converts the innermost list around the selection to the target list type.
35
+ * bullet_list and ordered_list share the list_item+ content model, so the
36
+ * node can change type in place.
37
+ *
38
+ * @param state - the current editor state
39
+ * @param listDepth - depth of the list node, from resolveListContext
40
+ * @param targetType - the list type to convert to
41
+ * @param dispatch - the dispatch function; omit for a dry-run capability check
42
+ * @returns true when the conversion applies
43
+ */
44
+ export declare const convertInnermostList: (state: EditorState, listDepth: number, targetType: NodeType, dispatch?: Dispatch) => boolean;
45
+ /**
46
+ * Turns a mixed top-level selection (paragraphs and lists) into a single
47
+ * list of the target type: paragraph runs are wrapped, lists are converted
48
+ * in place, and adjacent same-type lists are joined. Nesting inside
49
+ * converted lists is preserved.
50
+ *
51
+ * @param state - the current editor state
52
+ * @param targetType - the list type to unify into
53
+ * @param dispatch - the dispatch function; omit for a dry-run capability check
54
+ * @returns true when the unification applies
55
+ */
56
+ export declare const unifyToList: (state: EditorState, targetType: NodeType, dispatch?: Dispatch) => boolean;
57
+ /**
58
+ * Wraps a dispatch so that after a list is wrapped around the selection,
59
+ * adjacent top-level lists of the same type are joined with it.
60
+ *
61
+ * @param state - the editor state the wrap command runs on
62
+ * @param targetType - the list type being wrapped
63
+ * @param dispatch - the dispatch function; omitted for a dry-run capability check
64
+ * @returns the wrapped dispatch, or undefined when no dispatch was given
65
+ */
66
+ export declare const joinAdjacentListsOnDispatch: (state: EditorState, targetType: NodeType, dispatch?: Dispatch) => Dispatch | undefined;
67
+ export {};
68
+ //# sourceMappingURL=list-utils.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { ResolvedPos, NodeType } from 'prosemirror-model';
2
+ /**
3
+ * Finds the depth of the nearest ancestor of a given node type.
4
+ *
5
+ * @param $pos - The resolved position in the document.
6
+ * @param type - The node type to search for.
7
+ * @returns The depth at which the node is found, or null if not found.
8
+ */
9
+ export declare const findAncestorDepthOfType: ($pos: ResolvedPos, type: NodeType) => number | null;
10
+ //# sourceMappingURL=node-utils.d.ts.map
@@ -6,6 +6,14 @@ export interface CommandWithActive extends Command {
6
6
  allowed?: (state: EditorState) => boolean;
7
7
  }
8
8
  export declare const isExternalLink: (url: string) => boolean;
9
+ /**
10
+ * Creates a command for toggling list types.
11
+ *
12
+ * @param schema - The ProseMirror schema.
13
+ * @param listTypeName - The name of the list type to toggle.
14
+ * @returns A command for toggling list types.
15
+ */
16
+ export declare const createListCommand: (schema: Schema, listTypeName: string) => CommandWithActive;
9
17
  export declare class MenuCommandFactory {
10
18
  private schema;
11
19
  constructor(schema: Schema);
@@ -16,6 +24,8 @@ export declare class MenuCommandFactory {
16
24
  'Mod-Shift-1': CommandWithActive;
17
25
  'Mod-Shift-2': CommandWithActive;
18
26
  'Mod-Shift-3': CommandWithActive;
27
+ 'Mod-Shift-7': CommandWithActive;
28
+ 'Mod-Shift-8': CommandWithActive;
19
29
  'Mod-Shift-X': CommandWithActive;
20
30
  'Mod-`': CommandWithActive;
21
31
  'Mod-Shift-C': CommandWithActive;
@@ -0,0 +1,14 @@
1
+ import { Plugin, PluginKey } from 'prosemirror-state';
2
+ import { Schema } from 'prosemirror-model';
3
+ export declare const listKeyHandlerPluginKey: PluginKey<any>;
4
+ /**
5
+ * Creates a plugin for handling Tab and Shift+Tab inside list items:
6
+ * Tab indents the item and Shift+Tab outdents it. Enter and Backspace
7
+ * are handled by the base keymap (splitListItem and joinBackward), which
8
+ * runs before this plugin.
9
+ *
10
+ * @param schema - The document schema
11
+ * @returns A ProseMirror plugin for handling list-specific key events
12
+ */
13
+ export declare function createListKeyHandlerPlugin(schema: Schema): Plugin<any>;
14
+ //# sourceMappingURL=list-key-handler.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-elements",
3
- "version": "39.44.6",
3
+ "version": "39.45.1",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -58,8 +58,8 @@
58
58
  "@playwright/test": "1.62.1",
59
59
  "@popperjs/core": "^2.11.8",
60
60
  "@rjsf/core": "^6.7.1",
61
- "@rjsf/utils": "^6.7.1",
62
- "@rjsf/validator-ajv8": "^6.7.1",
61
+ "@rjsf/utils": "^6.8.0",
62
+ "@rjsf/validator-ajv8": "^6.8.0",
63
63
  "@rollup/plugin-node-resolve": "^13.3.0",
64
64
  "@stencil/core": "^4.43.5",
65
65
  "@stencil/sass": "^3.3.3",
@@ -112,7 +112,7 @@
112
112
  "shx": "^0.4.0",
113
113
  "sirv": "^3.0.2",
114
114
  "sortablejs": "^1.15.7",
115
- "style-to-object": "^1.0.14",
115
+ "style-to-object": "^2.0.2",
116
116
  "tabulator-tables": "^6.5.2",
117
117
  "typescript": "^4.9.5",
118
118
  "unified": "^11.0.5",