@yoopta/lists 2.0.0 → 4.0.0-rc.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/README.md +2 -2
- package/dist/elements/BulletedList.d.ts +5 -0
- package/dist/elements/BulletedList.d.ts.map +1 -0
- package/dist/elements/NumberedList.d.ts +5 -0
- package/dist/elements/NumberedList.d.ts.map +1 -0
- package/dist/elements/TodoList.d.ts +5 -0
- package/dist/elements/TodoList.d.ts.map +1 -0
- package/dist/events/onKeyDown.d.ts +4 -0
- package/dist/events/onKeyDown.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/plugin/BulletedList.d.ts +5 -0
- package/dist/plugin/BulletedList.d.ts.map +1 -0
- package/dist/plugin/NumberedList.d.ts +5 -0
- package/dist/plugin/NumberedList.d.ts.map +1 -0
- package/dist/plugin/TodoList.d.ts +5 -0
- package/dist/plugin/TodoList.d.ts.map +1 -0
- package/dist/plugin/index.d.ts +6 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PluginElementRenderProps } from '@yoopta/editor';
|
|
3
|
+
declare const BulletedListRender: ({ attributes, element, children }: PluginElementRenderProps<unknown>) => JSX.Element;
|
|
4
|
+
export { BulletedListRender };
|
|
5
|
+
//# sourceMappingURL=BulletedList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BulletedList.d.ts","sourceRoot":"","sources":["../../src/elements/BulletedList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,QAAA,MAAM,kBAAkB,sCAAuC,yBAAyB,OAAO,CAAC,gBAS/F,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PluginElementRenderProps } from '@yoopta/editor';
|
|
3
|
+
declare const NumberedListRender: ({ attributes, children, blockId, element }: PluginElementRenderProps<unknown>) => JSX.Element;
|
|
4
|
+
export { NumberedListRender };
|
|
5
|
+
//# sourceMappingURL=NumberedList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberedList.d.ts","sourceRoot":"","sources":["../../src/elements/NumberedList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,wBAAwB,EAGzB,MAAM,gBAAgB,CAAC;AAExB,QAAA,MAAM,kBAAkB,+CAAgD,yBAAyB,OAAO,CAAC,gBAoBxG,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PluginElementRenderProps } from '@yoopta/editor';
|
|
3
|
+
declare const TodoListRender: ({ attributes, element, children }: PluginElementRenderProps) => JSX.Element;
|
|
4
|
+
export { TodoListRender };
|
|
5
|
+
//# sourceMappingURL=TodoList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TodoList.d.ts","sourceRoot":"","sources":["../../src/elements/TodoList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,QAAA,MAAM,cAAc,sCAAuC,wBAAwB,gBASlF,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { YooEditor, PluginEventHandlerOptions } from '@yoopta/editor';
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
export declare function onKeyDown(editor: YooEditor, slate: Editor, { hotkeys, defaultBlock }: PluginEventHandlerOptions): (event: any) => void;
|
|
4
|
+
//# sourceMappingURL=onKeyDown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onKeyDown.d.ts","sourceRoot":"","sources":["../../src/events/onKeyDown.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,yBAAyB,EAK1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAiB,MAAM,OAAO,CAAC;AAK9C,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,yBAAyB,wBAoF/G"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LISTS } from './plugin';
|
|
2
|
+
import { NumberedListElement, BulletedListElement, TodoListElement } from './types';
|
|
3
|
+
import './styles.css';
|
|
4
|
+
declare module 'slate' {
|
|
5
|
+
interface CustomTypes {
|
|
6
|
+
Element: NumberedListElement | BulletedListElement | TodoListElement;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export default LISTS;
|
|
10
|
+
declare const NumberedList: import("@yoopta/editor").YooptaPlugin<"numbered-list", import("./types").ListElementProps, Record<string, unknown>>;
|
|
11
|
+
declare const BulletedList: import("@yoopta/editor").YooptaPlugin<"bulleted-list", BulletedListElement, Record<string, unknown>>;
|
|
12
|
+
declare const TodoList: import("@yoopta/editor").YooptaPlugin<"todo-list", import("./types").TodoListElementProps, Record<string, unknown>>;
|
|
13
|
+
export { NumberedListElement, BulletedListElement, TodoListElement, NumberedList, BulletedList, TodoList, };
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACpF,OAAO,cAAc,CAAC;AAEtB,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,WAAW;QACnB,OAAO,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,eAAe,CAAC;KACtE;CACF;AAED,eAAe,KAAK,CAAC;AAErB,QAAA,MAAM,YAAY,qHAAqB,CAAC;AACxC,QAAA,MAAM,YAAY,sGAAqB,CAAC;AACxC,QAAA,MAAM,QAAQ,qHAAiB,CAAC;AAEhC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EAEf,YAAY,EACZ,YAAY,EACZ,QAAQ,GACT,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{findPluginBlockBySelectionPath as e,buildBlockData as t,buildBlockElement as s,YooptaPlugin as o}from"@yoopta/editor";import{jsxs as i,jsx as n}from"react/jsx-runtime";import{Editor as r,Element as l}from"slate";function d(o,i,{hotkeys:n,defaultBlock:d}){return a=>{r.withoutNormalizing(i,(()=>{var p;const c=e(o);if(!i.selection||!c)return;const m=i.selection,{anchor:u}=m;if(n.isEnter(a)){a.preventDefault();const e=r.above(i,{at:u,match:e=>!r.isEditor(e)&&l.isElement(e)&&("numbered-list"===e.type||"bulleted-list"===e.type||"todo-list"===e.type),mode:"highest"});if(!e)return;const[n,m]=e,y=(null===(p=n.props)||void 0===p?void 0:p.position)||0,h=r.isEnd(i,u,m),f=r.isStart(i,u,m),b=r.string(i,m),x=0===c.meta.depth,v=b.trim().length>0;if(!v){if(x){const e=c.meta.order;return o.deleteBlock({blockId:c.id}),void o.insertBlock(d,{at:[e],focus:!0})}return void o.decreaseBlockDepth({blockId:c.id})}if(f){const e=t({type:c.type,meta:{order:c.meta.order,depth:c.meta.depth},value:[s({type:n.type,props:{nodeType:"block",position:y-1}})]});return void o.insertBlock(e,{at:[c.meta.order],focus:!1})}if(v&&!f&&!h)return void o.splitBlock({slate:i,focus:!0});const g=t({type:c.type,meta:{order:c.meta.order+1,depth:c.meta.depth},value:[s({type:n.type,props:{nodeType:"block",position:y+1}})]});o.insertBlock(g,{at:[c.meta.order+1],focus:!0})}else;}))}}const a={BulletedList:new o({type:"BulletedList",elements:{"bulleted-list":{render:({attributes:e,element:t,children:s})=>i("div",Object.assign({"data-element-type":t.type,className:"flex items-center pl-4 space-x-2 py-[3px]"},e,{children:[n("span",Object.assign({className:"min-w-[10px] w-auto",contentEditable:!1},{children:"•"})),n("span",Object.assign({className:"flex-grow"},{children:s}))]}))}},options:{displayLabel:"BulletedList",shortcuts:["-"]},events:{onKeyDown:d}}),NumberedList:new o({type:"NumberedList",elements:{"numbered-list":{render:({attributes:e,children:t,blockId:s,element:o})=>{return i("div",Object.assign({"data-element-type":o.type},e,{className:"flex items-center pl-4 space-x-2 py-[3px]"},{children:[i("span",Object.assign({className:"min-w-[10px] w-auto"},{children:[("number"==typeof(null===(r=o.props)||void 0===r?void 0:r.position)?null===(l=o.props)||void 0===l?void 0:l.position:0)+1,"."]})),n("span",Object.assign({className:"flex-grow"},{children:t}))]}));var r,l},props:{nodeType:"block",position:0}}},options:{displayLabel:"Numbered List",shortcuts:["1."]},events:{onKeyDown:d}}),TodoList:new o({type:"TodoList",elements:{"todo-list":{render:({attributes:e,element:t,children:s})=>{const{checked:o=!1}=t.props||{};return i("div",Object.assign({"data-element-type":t.type,className:"flex items-center pl-4 space-x-2 py-[3px]"},e,{children:[n("input",{type:"checkbox",className:"form-checkbox min-w-[10px] w-auto",checked:o}),n("div",Object.assign({className:"flex-grow"},{children:s}))]}))},props:{checked:!1}}},options:{displayLabel:"Todo List",shortcuts:["[]"]},events:{onKeyDown:d}})};!function(e,t){void 0===t&&(t={});var s=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===s&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}(".\\!block{display:block!important}.block{display:block}.flex{display:flex}.w-auto{width:auto}.min-w-\\[10px\\]{min-width:10px}.flex-grow{flex-grow:1}.items-center{align-items:center}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.py-\\[3px\\]{padding-bottom:3px;padding-top:3px}.pl-4{padding-left:1rem}");const p=a.NumberedList,c=a.BulletedList,m=a.TodoList;export{c as BulletedList,p as NumberedList,m as TodoList,a as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { YooptaPlugin } from '@yoopta/editor';
|
|
2
|
+
import { BulletedListElement } from '../types';
|
|
3
|
+
declare const BulletedList: YooptaPlugin<"bulleted-list", BulletedListElement, Record<string, unknown>>;
|
|
4
|
+
export { BulletedList };
|
|
5
|
+
//# sourceMappingURL=BulletedList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BulletedList.d.ts","sourceRoot":"","sources":["../../src/plugin/BulletedList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,mBAAmB,EAA0B,MAAM,UAAU,CAAC;AAEvE,QAAA,MAAM,YAAY,6EAchB,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberedList.d.ts","sourceRoot":"","sources":["../../src/plugin/NumberedList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,QAAA,MAAM,YAAY,0EAkBhB,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TodoList.d.ts","sourceRoot":"","sources":["../../src/plugin/TodoList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,oBAAoB,EAAsB,MAAM,UAAU,CAAC;AAEpE,QAAA,MAAM,QAAQ,0EAiBZ,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const LISTS: {
|
|
2
|
+
BulletedList: import("@yoopta/editor").YooptaPlugin<"bulleted-list", import("..").BulletedListElement, Record<string, unknown>>;
|
|
3
|
+
NumberedList: import("@yoopta/editor").YooptaPlugin<"numbered-list", import("../types").ListElementProps, Record<string, unknown>>;
|
|
4
|
+
TodoList: import("@yoopta/editor").YooptaPlugin<"todo-list", import("../types").TodoListElementProps, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK;;;;CAIjB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SlateElement } from '@yoopta/editor';
|
|
2
|
+
export type BulletedListPluginKeys = 'bulleted-list';
|
|
3
|
+
export type NumberedListPluginKeys = 'numbered-list';
|
|
4
|
+
export type TodoListPluginKeys = 'todo-list';
|
|
5
|
+
export type ListElementProps = {
|
|
6
|
+
position: number;
|
|
7
|
+
};
|
|
8
|
+
export type NumberedListElement = SlateElement<'numbered-list', ListElementProps>;
|
|
9
|
+
export type BulletedListElement = SlateElement<'bulleted-list', ListElementProps>;
|
|
10
|
+
export type TodoListElement = SlateElement<'todo-list', TodoListElementProps>;
|
|
11
|
+
export type TodoListElementProps = {
|
|
12
|
+
checked: boolean;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAAG,eAAe,CAAC;AACrD,MAAM,MAAM,sBAAsB,GAAG,eAAe,CAAC;AACrD,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;AAClF,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;AAClF,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;AAE9E,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/lists",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-rc.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dist/"
|
|
15
15
|
],
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@yoopta/editor": ">=
|
|
17
|
+
"@yoopta/editor": ">=4.0.0-rc.0",
|
|
18
18
|
"react": ">=17.0.2",
|
|
19
19
|
"react-dom": ">=17.0.2",
|
|
20
20
|
"slate": ">=0.72.3",
|
|
@@ -28,9 +28,12 @@
|
|
|
28
28
|
"url": "git+https://github.com/Darginec05/Editor-Yoopta.git"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
|
-
"test": "node ./__tests__/yoopta-
|
|
31
|
+
"test": "node ./__tests__/yoopta-lists.test.js",
|
|
32
|
+
"start": "rollup --config rollup.config.js --watch --bundleConfigAsCjs --environment NODE_ENV:development",
|
|
33
|
+
"prepublishOnly": "yarn build",
|
|
34
|
+
"build": "rollup --config rollup.config.js --bundleConfigAsCjs --environment NODE_ENV:production"
|
|
32
35
|
},
|
|
33
36
|
"bugs": {
|
|
34
37
|
"url": "https://github.com/Darginec05/Editor-Yoopta/issues"
|
|
35
38
|
}
|
|
36
|
-
}
|
|
39
|
+
}
|