@yoopta/headings 2.0.1 → 4.0.0-rc.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-present Akhmed Ibragimov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -1,18 +1,33 @@
1
- import { HeadingOne } from './ui/HeadingOne';
2
- import { HeadingTwo } from './ui/HeadingTwo';
3
- import { HeadingThree } from './ui/HeadingThree';
4
- import { YooEditor } from '@yoopta/editor';
1
+ import { HeadingTwo } from './plugin/HeadingTwo';
2
+ import { HeadingOne } from './plugin/HeadingOne';
3
+ import { HeadingThree } from './plugin/HeadingThree';
5
4
  import { HeadingOneElement, HeadingThreeElement, HeadingTwoElement } from './types';
5
+ import './styles.css';
6
6
  declare module 'slate' {
7
7
  interface CustomTypes {
8
- Editor: YooEditor;
9
8
  Element: HeadingOneElement | HeadingTwoElement | HeadingThreeElement;
10
9
  }
11
10
  }
12
11
  declare const Headings: {
13
- HeadingOne: import("@yoopta/editor").YooptaPlugin<import("./types").HeadingOptions, HeadingOneElement>;
14
- HeadingTwo: import("@yoopta/editor").YooptaPlugin<import("./types").HeadingOptions, HeadingTwoElement>;
15
- HeadingThree: import("@yoopta/editor").YooptaPlugin<import("./types").HeadingOptions, HeadingThreeElement>;
12
+ HeadingOne: import("@yoopta/editor").YooptaPlugin<"heading-one", {
13
+ nodeType: "block";
14
+ }, {
15
+ displayLabel: string;
16
+ shortcuts: string[];
17
+ }>;
18
+ HeadingTwo: import("@yoopta/editor").YooptaPlugin<"heading-two", {
19
+ nodeType: "block";
20
+ }, {
21
+ displayLabel: string;
22
+ shortcuts: string[];
23
+ }>;
24
+ HeadingThree: import("@yoopta/editor").YooptaPlugin<"heading-three", {
25
+ nodeType: "block";
26
+ }, {
27
+ displayLabel: string;
28
+ shortcuts: string[];
29
+ }>;
16
30
  };
17
31
  export default Headings;
18
32
  export { HeadingOne, HeadingTwo, HeadingThree, HeadingOneElement, HeadingTwoElement, HeadingThreeElement };
33
+ //# 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,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACpF,OAAO,cAAc,CAAC;AAEtB,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,WAAW;QACnB,OAAO,EAAE,iBAAiB,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;KACtE;CACF;AAED,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;CAIb,CAAC;AAEF,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{createYooptaPlugin as t,generateId as i,getElementClassname as n}from"@yoopta/editor";import{Transforms as a}from"slate";function r(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===i&&n.firstChild?n.insertBefore(a,n.firstChild):n.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}var o="w88lsSKp";r('.w88lsSKp{color:inherit;font-size:30px;font-weight:600;letter-spacing:0;line-height:39px;margin-bottom:1px;margin-top:30px;padding-bottom:2px;padding-top:2px;position:relative;white-space:pre-wrap;word-break:break-word}.w88lsSKp:hover .bxI8aAgg{opacity:1}.bxI8aAgg{align-items:center;color:#007aff;cursor:pointer;display:inline-flex;opacity:0;padding-left:.5rem}.bxI8aAgg:hover{text-decoration:underline}.bxI8aAgg:before{content:"#"}');const d=({attributes:t,children:i,element:a,HTMLAttributes:r})=>e("h1",Object.assign({id:a.id,draggable:!1},r,{className:n({element:a,HTMLAttributes:r,className:o})},t,{children:i}));d.displayName="HeadingOne";const s=t({type:"heading-one",renderer:e=>d,shortcut:["title","h1","heading one","#"],placeholder:"Heading 1",defineElement:()=>({id:i(),type:"heading-one",children:[{text:""}],nodeType:"block"}),createElement:(e,t)=>{var i;const n=Object.assign(Object.assign({},s.getPlugin.defineElement()),t);a.setNodes(e,n,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(e,t)=>`# ${t}`},html:{serialize:(e,t)=>`<h1>${t}</h1>`,deserialize:{nodeName:"H1"}}},options:{anchor:"#",searchString:"h1 title",displayLabel:"Heading 1"}});var l="Lv0jMMCW";r('.Lv0jMMCW{color:inherit;font-size:24px;font-weight:600;line-height:31px;margin-bottom:4px;margin-top:20px;padding-bottom:2px;padding-top:2px;position:relative;white-space:pre-wrap;word-break:break-word}.Lv0jMMCW:hover .Vt-SkjEH{opacity:1}.Vt-SkjEH{color:#007aff;opacity:0;padding-left:.5rem;transition:opacity .2s;user-select:none}.Vt-SkjEH:hover{text-decoration:underline}.Vt-SkjEH:before{content:"#"}');const c=({attributes:t,children:i,element:a,HTMLAttributes:r})=>e("h2",Object.assign({id:a.id,draggable:!1},r,{className:n({element:a,HTMLAttributes:r,className:l})},t,{children:i}));c.displayName="HeadingTwo";const p=t({type:"heading-two",renderer:e=>c,shortcut:["h2","subtitle","##"],placeholder:"Heading 2",defineElement:()=>({id:i(),type:"heading-two",children:[{text:""}],nodeType:"block"}),createElement:(e,t)=>{var i;const n=Object.assign(Object.assign({},p.getPlugin.defineElement()),t);a.setNodes(e,n,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(e,t)=>`## ${t}`},html:{serialize:(e,t)=>`<h2>${t}</h2>`,deserialize:{nodeName:"H2"}}},options:{anchor:"#",searchString:"h2 subtitle",displayLabel:"Heading 2"}});var h="K-i6DlWD";r('.K-i6DlWD{color:inherit;font-size:20px;font-weight:600;line-height:26px;margin-bottom:4px;margin-top:16px;padding-bottom:2px;padding-top:2px;position:relative;white-space:pre-wrap;word-break:break-word}.K-i6DlWD:hover .ur9rRlYI{opacity:1}.ur9rRlYI{color:#007aff;opacity:0;padding-left:.5rem;transition:opacity .2s;user-select:none}.ur9rRlYI:hover{text-decoration:underline}.ur9rRlYI:before{content:"#"}');const g=({attributes:t,children:i,element:a,HTMLAttributes:r})=>e("h3",Object.assign({id:a.id,draggable:!1},r,{className:n({element:a,HTMLAttributes:r,className:h})},t,{children:i}));g.displayName="HeadingThree";const m=t({type:"heading-three",renderer:e=>g,shortcut:["h3","subsubtitle","###"],placeholder:"Heading 3",defineElement:()=>({id:i(),type:"heading-three",children:[{text:""}],nodeType:"block"}),createElement:(e,t)=>{var i;const n=Object.assign(Object.assign({},m.getPlugin.defineElement()),t);a.setNodes(e,n,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(e,t)=>`### ${t}`},html:{serialize:(e,t)=>`<h3>${t}</h3>`,deserialize:{nodeName:["H3","H4","H5","H6"]}}},options:{anchor:"#",searchString:"h3 subsubtitle small heading",displayLabel:"Heading 3"}}),b={HeadingOne:s,HeadingTwo:p,HeadingThree:m};export{s as HeadingOne,m as HeadingThree,p as HeadingTwo,b as default};
1
+ import{jsx as e}from"react/jsx-runtime";import{YooptaPlugin as t}from"@yoopta/editor";const o=({attributes:t,children:o,element:n})=>e("h2",Object.assign({id:n.id,draggable:!1,"data-element-type":n.type,className:"yoo-h-scroll-m-20 yoo-h-mt-4 yoo-h-text-3xl yoo-h-font-semibold yoo-h-tracking-tight"},t,{children:o}));o.displayName="HeadingTwo";const n=new t({type:"HeadingTwo",elements:{"heading-two":{render:o,props:{nodeType:"block"}}},options:{displayLabel:"Heading 2",shortcuts:["h2","##"]}}),i=({attributes:t,children:o,element:n})=>e("h1",Object.assign({id:n.id,draggable:!1,"data-element-type":n.type,className:"yoo-h-mt-6 yoo-h-scroll-m-20 yoo-h-text-4xl yoo-h-font-bold yoo-h-tracking-tight yoo-h-lg:text-5xl"},t,{children:o}));i.displayName="HeadingOne";const a=new t({type:"HeadingOne",elements:{"heading-one":{render:i,props:{nodeType:"block"}}},options:{displayLabel:"Heading 1",shortcuts:["h1","#","*"]}}),l=({attributes:t,children:o,element:n})=>e("h3",Object.assign({id:n.id,draggable:!1,"data-element-type":n.type,className:"yoo-h-mt-2 yoo-h-scroll-m-20 yoo-h-text-2xl yoo-h-font-semibold yoo-h-tracking-tight"},t,{children:o}));l.displayName="HeadingThree";const d=new t({type:"HeadingThree",elements:{"heading-three":{render:l,props:{nodeType:"block"}}},options:{displayLabel:"Heading 3",shortcuts:["h3","###"]}});!function(e,t){void 0===t&&(t={});var o=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===o&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}(".yoo-h-mt-2{margin-top:.5rem}.yoo-h-mt-4{margin-top:1rem}.yoo-h-mt-6{margin-top:1.5rem}.yoo-h-scroll-m-20{scroll-margin:5rem}.yoo-h-text-2xl{font-size:1.5rem;line-height:2rem}.yoo-h-text-3xl{font-size:1.875rem;line-height:2.25rem}.yoo-h-text-4xl{font-size:2.25rem;line-height:2.5rem}.yoo-h-font-bold{font-weight:700}.yoo-h-font-semibold{font-weight:600}.yoo-h-tracking-tight{letter-spacing:-.025em}");const r={HeadingOne:a,HeadingTwo:n,HeadingThree:d};export{a as HeadingOne,d as HeadingThree,n as HeadingTwo,r as default};
@@ -0,0 +1,9 @@
1
+ import { YooptaPlugin } from '@yoopta/editor';
2
+ declare const HeadingOne: YooptaPlugin<"heading-one", {
3
+ nodeType: "block";
4
+ }, {
5
+ displayLabel: string;
6
+ shortcuts: string[];
7
+ }>;
8
+ export { HeadingOne };
9
+ //# sourceMappingURL=HeadingOne.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeadingOne.d.ts","sourceRoot":"","sources":["../../src/plugin/HeadingOne.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAkB9C,QAAA,MAAM,UAAU;;;;;EAcd,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { YooptaPlugin } from '@yoopta/editor';
2
+ declare const HeadingThree: YooptaPlugin<"heading-three", {
3
+ nodeType: "block";
4
+ }, {
5
+ displayLabel: string;
6
+ shortcuts: string[];
7
+ }>;
8
+ export { HeadingThree };
9
+ //# sourceMappingURL=HeadingThree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeadingThree.d.ts","sourceRoot":"","sources":["../../src/plugin/HeadingThree.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAkB9C,QAAA,MAAM,YAAY;;;;;EAchB,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { YooptaPlugin } from '@yoopta/editor';
2
+ declare const HeadingTwo: YooptaPlugin<"heading-two", {
3
+ nodeType: "block";
4
+ }, {
5
+ displayLabel: string;
6
+ shortcuts: string[];
7
+ }>;
8
+ export { HeadingTwo };
9
+ //# sourceMappingURL=HeadingTwo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeadingTwo.d.ts","sourceRoot":"","sources":["../../src/plugin/HeadingTwo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAkB9C,QAAA,MAAM,UAAU;;;;;EAcd,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,8 +1,5 @@
1
- import { YooptaBaseElement, YooptaPluginBaseOptions } from '@yoopta/editor';
2
- import { ReactNode } from 'react';
3
- export type HeadingOptions = {
4
- anchor?: ReactNode | null | false;
5
- } & YooptaPluginBaseOptions;
6
- export type HeadingOneElement = YooptaBaseElement<'heading-one'>;
7
- export type HeadingTwoElement = YooptaBaseElement<'heading-two'>;
8
- export type HeadingThreeElement = YooptaBaseElement<'heading-three'>;
1
+ import { SlateElement } from '@yoopta/editor';
2
+ export type HeadingOneElement = SlateElement<'heading-one'>;
3
+ export type HeadingTwoElement = SlateElement<'heading-two'>;
4
+ export type HeadingThreeElement = SlateElement<'heading-three'>;
5
+ //# 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,iBAAiB,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;AAC5D,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;AAC5D,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/headings",
3
- "version": "2.0.1",
3
+ "version": "4.0.0-rc.1",
4
4
  "description": "> TODO: description",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
@@ -17,8 +17,13 @@
17
17
  "@yoopta/editor": ">=1.9.18-rc",
18
18
  "react": ">=17.0.2",
19
19
  "react-dom": ">=17.0.2",
20
- "slate": ">=0.72.3",
21
- "slate-react": ">=0.95.0"
20
+ "slate": ">=0.99.0",
21
+ "slate-react": ">=0.99.0"
22
+ },
23
+ "devDependencies": {
24
+ "autoprefixer": "^10.0.1",
25
+ "postcss": "^8",
26
+ "tailwindcss": "^3.3.0"
22
27
  },
23
28
  "publishConfig": {
24
29
  "registry": "https://registry.yarnpkg.com"
@@ -28,9 +33,13 @@
28
33
  "url": "git+https://github.com/Darginec05/Editor-Yoopta.git"
29
34
  },
30
35
  "scripts": {
31
- "test": "node ./__tests__/@yoopta/paragraph.test.js"
36
+ "test": "node ./__tests__/@yoopta/paragraph.test.js",
37
+ "start": "rollup --config rollup.config.js --watch --bundleConfigAsCjs --environment NODE_ENV:development",
38
+ "prepublishOnly": "yarn build",
39
+ "build": "rollup --config rollup.config.js --bundleConfigAsCjs --environment NODE_ENV:production"
32
40
  },
33
41
  "bugs": {
34
42
  "url": "https://github.com/Darginec05/Editor-Yoopta/issues"
35
- }
43
+ },
44
+ "gitHead": "c46f09afdb5f60f98f2065e24305a9d02ed57ca7"
36
45
  }
@@ -1,3 +0,0 @@
1
- import { HeadingOneElement, HeadingOptions } from '../types';
2
- declare const HeadingOne: import("@yoopta/editor").YooptaPlugin<HeadingOptions, HeadingOneElement>;
3
- export { HeadingOne };
@@ -1,3 +0,0 @@
1
- import { HeadingOptions, HeadingThreeElement } from '../types';
2
- declare const HeadingThree: import("@yoopta/editor").YooptaPlugin<HeadingOptions, HeadingThreeElement>;
3
- export { HeadingThree };
@@ -1,3 +0,0 @@
1
- import { HeadingOptions, HeadingTwoElement } from '../types';
2
- declare const HeadingTwo: import("@yoopta/editor").YooptaPlugin<HeadingOptions, HeadingTwoElement>;
3
- export { HeadingTwo };
@@ -1,2 +0,0 @@
1
- import { HeadingOneElement, HeadingThreeElement, HeadingTwoElement } from '../types';
2
- export declare const getHeadingAnchorFromSlateNode: (element: HeadingOneElement | HeadingTwoElement | HeadingThreeElement) => string | undefined;