@react-fabric/lexical 1.0.0-beta.60 → 1.0.0-beta.61
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/dist/cjs/{packages/lexical/src/components → components}/StickyComponent.js +2 -3
- package/dist/cjs/{packages/lexical/src/editor → editor}/LexicalEditor.js +5 -5
- package/dist/cjs/{packages/lexical/src/hooks → hooks}/useFormatWatcher.js +101 -95
- package/dist/cjs/i18n/ar.json.js +24 -0
- package/dist/cjs/i18n/en.json.js +24 -0
- package/dist/cjs/i18n/index.js +33 -0
- package/dist/cjs/{packages/lexical/src/index.js → index.js} +1 -0
- package/dist/cjs/{packages/lexical/src/plugins → plugins}/DraggableBlockPlugin.js +5 -5
- package/dist/cjs/{packages/lexical/src/plugins → plugins}/ToolbarPlugin.js +35 -22
- package/dist/esm/{packages/lexical/src/components → components}/StickyComponent.js +2 -3
- package/dist/esm/{packages/lexical/src/editor → editor}/LexicalEditor.js +4 -4
- package/dist/esm/{packages/lexical/src/hooks → hooks}/useFormatWatcher.js +43 -37
- package/dist/esm/i18n/ar.json.js +21 -0
- package/dist/esm/i18n/en.json.js +21 -0
- package/dist/esm/i18n/index.js +33 -0
- package/dist/esm/{packages/lexical/src/index.js → index.js} +1 -0
- package/dist/esm/{packages/lexical/src/plugins → plugins}/DraggableBlockPlugin.js +2 -2
- package/dist/esm/{packages/lexical/src/plugins → plugins}/ToolbarPlugin.js +36 -23
- package/dist/types/hooks/useFormatWatcher.d.ts +1 -0
- package/dist/types/i18n/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +5 -5
- package/src/components/StickyComponent.tsx +2 -3
- package/src/hooks/useFormatWatcher.ts +3 -0
- package/src/i18n/ar.json +16 -0
- package/src/i18n/en.json +16 -0
- package/src/i18n/index.ts +28 -0
- package/src/index.ts +2 -0
- package/src/plugins/ToolbarPlugin.tsx +34 -23
- package/dist/cjs/_virtual/prism.js +0 -5
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -474
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -21
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -27
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.dev.js +0 -1537
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.js +0 -25
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.prod.js +0 -57
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.dev.js +0 -252
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.js +0 -19
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.prod.js +0 -18
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.dev.js +0 -572
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.js +0 -17
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.prod.js +0 -25
- package/dist/cjs/node_modules/@lexical/list/LexicalList.dev.js +0 -1614
- package/dist/cjs/node_modules/@lexical/list/LexicalList.js +0 -29
- package/dist/cjs/node_modules/@lexical/list/LexicalList.prod.js +0 -36
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -838
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.js +0 -29
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -26
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -1057
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.js +0 -39
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -45
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.dev.js +0 -4207
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.js +0 -23
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.prod.js +0 -68
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -1166
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.js +0 -47
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -81
- package/dist/cjs/node_modules/@mdi/js/mdi.js +0 -8
- package/dist/cjs/node_modules/prismjs/components/prism-c.js +0 -82
- package/dist/cjs/node_modules/prismjs/components/prism-clike.js +0 -33
- package/dist/cjs/node_modules/prismjs/components/prism-cpp.js +0 -101
- package/dist/cjs/node_modules/prismjs/components/prism-css.js +0 -66
- package/dist/cjs/node_modules/prismjs/components/prism-java.js +0 -126
- package/dist/cjs/node_modules/prismjs/components/prism-javascript.js +0 -174
- package/dist/cjs/node_modules/prismjs/components/prism-markdown.js +0 -417
- package/dist/cjs/node_modules/prismjs/components/prism-markup.js +0 -188
- package/dist/cjs/node_modules/prismjs/components/prism-objectivec.js +0 -14
- package/dist/cjs/node_modules/prismjs/components/prism-powershell.js +0 -60
- package/dist/cjs/node_modules/prismjs/components/prism-python.js +0 -67
- package/dist/cjs/node_modules/prismjs/components/prism-rust.js +0 -130
- package/dist/cjs/node_modules/prismjs/components/prism-sql.js +0 -34
- package/dist/cjs/node_modules/prismjs/components/prism-swift.js +0 -150
- package/dist/cjs/node_modules/prismjs/components/prism-typescript.js +0 -62
- package/dist/cjs/node_modules/prismjs/prism.js +0 -1951
- package/dist/esm/_virtual/prism.js +0 -5
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -465
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -19
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -18
- package/dist/esm/node_modules/@lexical/code/LexicalCode.dev.js +0 -1512
- package/dist/esm/node_modules/@lexical/code/LexicalCode.js +0 -21
- package/dist/esm/node_modules/@lexical/code/LexicalCode.prod.js +0 -32
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.dev.js +0 -251
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.js +0 -18
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.prod.js +0 -17
- package/dist/esm/node_modules/@lexical/link/LexicalLink.dev.js +0 -563
- package/dist/esm/node_modules/@lexical/link/LexicalLink.js +0 -17
- package/dist/esm/node_modules/@lexical/link/LexicalLink.prod.js +0 -16
- package/dist/esm/node_modules/@lexical/list/LexicalList.dev.js +0 -1595
- package/dist/esm/node_modules/@lexical/list/LexicalList.js +0 -23
- package/dist/esm/node_modules/@lexical/list/LexicalList.prod.js +0 -17
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -830
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.js +0 -23
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -18
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -1028
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.js +0 -28
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -16
- package/dist/esm/node_modules/@lexical/table/LexicalTable.dev.js +0 -4156
- package/dist/esm/node_modules/@lexical/table/LexicalTable.js +0 -20
- package/dist/esm/node_modules/@lexical/table/LexicalTable.prod.js +0 -17
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -1102
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.js +0 -32
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -17
- package/dist/esm/node_modules/@mdi/js/mdi.js +0 -7
- package/dist/esm/node_modules/prismjs/components/prism-c.js +0 -82
- package/dist/esm/node_modules/prismjs/components/prism-clike.js +0 -33
- package/dist/esm/node_modules/prismjs/components/prism-cpp.js +0 -101
- package/dist/esm/node_modules/prismjs/components/prism-css.js +0 -66
- package/dist/esm/node_modules/prismjs/components/prism-java.js +0 -126
- package/dist/esm/node_modules/prismjs/components/prism-javascript.js +0 -174
- package/dist/esm/node_modules/prismjs/components/prism-markdown.js +0 -417
- package/dist/esm/node_modules/prismjs/components/prism-markup.js +0 -188
- package/dist/esm/node_modules/prismjs/components/prism-objectivec.js +0 -14
- package/dist/esm/node_modules/prismjs/components/prism-powershell.js +0 -60
- package/dist/esm/node_modules/prismjs/components/prism-python.js +0 -67
- package/dist/esm/node_modules/prismjs/components/prism-rust.js +0 -130
- package/dist/esm/node_modules/prismjs/components/prism-sql.js +0 -34
- package/dist/esm/node_modules/prismjs/components/prism-swift.js +0 -150
- package/dist/esm/node_modules/prismjs/components/prism-typescript.js +0 -62
- package/dist/esm/node_modules/prismjs/prism.js +0 -1951
- /package/dist/cjs/{packages/lexical/src/editor → editor}/theme.js +0 -0
- /package/dist/cjs/{packages/lexical/src/nodes → nodes}/StickyNode.js +0 -0
- /package/dist/cjs/{packages/lexical/src/plugins → plugins}/StickyPlugin.js +0 -0
- /package/dist/cjs/{packages/lexical/src/utils → utils}/index.js +0 -0
- /package/dist/esm/{packages/lexical/src/editor → editor}/theme.js +0 -0
- /package/dist/esm/{packages/lexical/src/nodes → nodes}/StickyNode.js +0 -0
- /package/dist/esm/{packages/lexical/src/plugins → plugins}/StickyPlugin.js +0 -0
- /package/dist/esm/{packages/lexical/src/utils → utils}/index.js +0 -0
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as LexicalUtils_dev from './LexicalUtils.dev.js';
|
|
4
|
-
import * as LexicalUtils_prod from './LexicalUtils.prod.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const mod = process.env.NODE_ENV !== 'production' ? LexicalUtils_dev : LexicalUtils_prod;
|
|
15
|
-
const $descendantsMatching = mod.$descendantsMatching;
|
|
16
|
-
const $findMatchingParent = mod.$findMatchingParent;
|
|
17
|
-
const $getAdjacentCaret = mod.$getAdjacentCaret;
|
|
18
|
-
const $getNearestBlockElementAncestorOrThrow = mod.$getNearestBlockElementAncestorOrThrow;
|
|
19
|
-
const $getNearestNodeOfType = mod.$getNearestNodeOfType;
|
|
20
|
-
const $insertFirst = mod.$insertFirst;
|
|
21
|
-
const $insertNodeToNearestRoot = mod.$insertNodeToNearestRoot;
|
|
22
|
-
const $unwrapAndFilterDescendants = mod.$unwrapAndFilterDescendants;
|
|
23
|
-
const addClassNamesToElement = mod.addClassNamesToElement;
|
|
24
|
-
const calculateZoomLevel = mod.calculateZoomLevel;
|
|
25
|
-
const isBlockDomNode = mod.isBlockDomNode;
|
|
26
|
-
const isHTMLAnchorElement = mod.isHTMLAnchorElement;
|
|
27
|
-
const isHTMLElement = mod.isHTMLElement;
|
|
28
|
-
const mergeRegister = mod.mergeRegister;
|
|
29
|
-
const objectKlassEquals = mod.objectKlassEquals;
|
|
30
|
-
const removeClassNamesFromElement = mod.removeClassNamesFromElement;
|
|
31
|
-
|
|
32
|
-
export { $descendantsMatching, $findMatchingParent, $getAdjacentCaret, $getNearestBlockElementAncestorOrThrow, $getNearestNodeOfType, $insertFirst, $insertNodeToNearestRoot, $unwrapAndFilterDescendants, addClassNamesToElement, calculateZoomLevel, isBlockDomNode, isHTMLAnchorElement, isHTMLElement, mergeRegister, objectKlassEquals, removeClassNamesFromElement };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { isHTMLElement, $getRoot, $isElementNode, $getChildCaret, $getSiblingCaret, $getAdjacentChildCaret, $getChildCaretOrSelf, makeStepwiseIterator, $isChildCaret, $cloneWithProperties, $setSelection, $getSelection, $getPreviousSelection, $isRangeSelection, $caretFromPoint, $createParagraphNode, $normalizeCaret, $setSelectionFromCaretRange, $getCollapsedCaretRange, $getCaretInDirection, $splitAtPointCaretNext, $isTextPointCaret, $isSiblingCaret, $rewindSiblingCaret, $getState, $setState, getDOMTextNode } from 'lexical';
|
|
4
|
-
export { $splitNode, isBlockDomNode, isHTMLAnchorElement, isHTMLElement, isInlineDomNode } from 'lexical';
|
|
5
|
-
import { createRectsFromDOMRange } from '../selection/LexicalSelection.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the MIT license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
function N(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const M="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,R=M&&"documentMode"in document?document.documentMode:null,T=M&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),B=M&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_=!(!M||!("InputEvent"in window)||R)&&"getTargetRanges"in new window.InputEvent("input"),k=M&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),K=M&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,H=M&&/Android/.test(navigator.userAgent),O=M&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$=M&&H&&O,D=M&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!O;function I(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}function j(...t){return ()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0;}}function F(t){return `${t}px`}const U={attributes:!0,characterData:!0,childList:!0,subtree:!0};function z(e,n,o){let r=null,i=null,l=null,u=[];const s=document.createElement("div");function c(){null===r&&N(182),null===i&&N(183);const{left:t,top:l}=i.getBoundingClientRect(),c=createRectsFromDOMRange(e,n);var f,a;s.isConnected||(a=s,(f=i).insertBefore(a,f.firstChild));let d=!1;for(let e=0;e<c.length;e++){const n=c[e],o=u[e]||document.createElement("div"),r=o.style;"absolute"!==r.position&&(r.position="absolute",d=!0);const i=F(n.left-t);r.left!==i&&(r.left=i,d=!0);const f=F(n.top-l);r.top!==f&&(o.style.top=f,d=!0);const a=F(n.width);r.width!==a&&(o.style.width=a,d=!0);const g=F(n.height);r.height!==g&&(o.style.height=g,d=!0),o.parentNode!==s&&(s.append(o),d=!0),u[e]=o;}for(;u.length>c.length;)u.pop();d&&o(u);}function f(){i=null,r=null,null!==l&&l.disconnect(),l=null,s.remove();for(const t of u)t.remove();u=[];}s.style.position="relative";const a=e.registerRootListener((function n(){const o=e.getRootElement();if(null===o)return f();const u=o.parentElement;if(!isHTMLElement(u))return f();f(),r=o,i=u,l=new MutationObserver((t=>{const o=e.getRootElement(),l=o&&o.parentElement;if(o!==r||l!==i)return n();for(const e of t)if(!s.contains(e.target))return c()})),l.observe(u,U),c();}));return ()=>{a(),f();}}function V(t,e,n){if("text"!==t.type&&$isElementNode(e)){const o=e.getDOMSlot(n);return [o.element,o.getFirstChildOffset()+t.offset]}return [getDOMTextNode(n)||n,t.offset]}function W(t,o){let r=null,i=null,l=null,u=null,s=null,c=null,f=()=>{};function a(a){a.read((()=>{const a=$getSelection();if(!$isRangeSelection(a))return r=null,l=null,u=null,c=null,f(),void(f=()=>{});const[d,g]=function(t){const e=t.getStartEndPoints();return t.isBackward()?[e[1],e[0]]:e}(a),p=d.getNode(),m=p.getKey(),h=d.offset,v=g.getNode(),y=v.getKey(),w=g.offset,x=t.getElementByKey(m),E=t.getElementByKey(y),S=null===r||x!==i||h!==l||m!==r.getKey(),A=null===u||E!==s||w!==c||y!==u.getKey();if((S||A)&&null!==x&&null!==E){const e=function(t,e,n,o,r,i,l){const u=(t._window?t._window.document:document).createRange();return u.setStart(...V(e,n,o)),u.setEnd(...V(r,i,l)),u}(t,d,p,x,g,v,E);f(),f=z(t,e,(t=>{if(void 0===o)for(const e of t){const t=e.style;"Highlight"!==t.background&&(t.background="Highlight"),"HighlightText"!==t.color&&(t.color="HighlightText"),t.marginTop!==F(-1.5)&&(t.marginTop=F(-1.5)),t.paddingTop!==F(4)&&(t.paddingTop=F(4)),t.paddingBottom!==F(0)&&(t.paddingBottom=F(0));}else o(t);}));}r=p,i=x,l=h,u=v,s=E,c=w;}));}return a(t.getEditorState()),j(t.registerUpdateListener((({editorState:t})=>a(t))),(()=>{f();}))}function G(t){let e=null;const n=()=>{const n=getSelection(),o=n&&n.anchorNode,r=t.getRootElement();null!==o&&null!==r&&r.contains(o)?null!==e&&(e(),e=null):null===e&&(e=W(t));};return document.addEventListener("selectionchange",n),()=>{null!==e&&e(),document.removeEventListener("selectionchange",n);}}const q=_,J=M,Q=H,X=$,Y=T,Z=D,tt=O,et=B,nt=K,ot=k;function rt(t,...e){const n=I(...e);n.length>0&&t.classList.add(...n);}function it(t,...e){const n=I(...e);n.length>0&&t.classList.remove(...n);}function lt(t,e){for(const n of e)if(t.type.startsWith(n))return !0;return !1}function ut(t,e){const n=t[Symbol.iterator]();return new Promise(((t,o)=>{const r=[],i=()=>{const{done:l,value:u}=n.next();if(l)return t(r);const s=new FileReader;s.addEventListener("error",o),s.addEventListener("load",(()=>{const t=s.result;"string"==typeof t&&r.push({file:u,result:t}),i();})),lt(u,e)?s.readAsDataURL(u):i();};i();}))}function st(t,e){return Array.from(at(t,e))}function ct(t){return t?t.getAdjacentCaret():null}function ft(t,e){return Array.from(ht(t,e))}function at(t,e){return dt("next",t,e)}function dt(t,e,n){const r=$getRoot(),d=e||r,g=$isElementNode(d)?$getChildCaret(d,t):$getSiblingCaret(d,t),p=pt(d),m=n?$getAdjacentChildCaret($getChildCaretOrSelf($getSiblingCaret(n,t))):function(t,e){const n=$t($getSiblingCaret(t,e));return n&&n[0]}(d,t);let h=p;return makeStepwiseIterator({hasNext:t=>null!==t,initial:g,map:t=>({depth:h,node:t.origin}),step:t=>{if(t.isSameNodeCaret(m))return null;$isChildCaret(t)&&h++;const e=$t(t);return !e||e[0].isSameNodeCaret(m)?null:(h+=e[1],e[0])}})}function gt(t){const e=$t($getSiblingCaret(t,"next"));return e&&[e[0].origin,e[1]]}function pt(t){let e=-1;for(let n=t;null!==n;n=n.getParent())e++;return e}function mt(t){const e=$t($getChildCaretOrSelf($getSiblingCaret(t,"previous")),"root");return e&&e[0].origin}function ht(t,e){return dt("previous",t,e)}function vt(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent();}return null}function yt(t){const e=wt(t,(t=>$isElementNode(t)&&!t.isInline()));return $isElementNode(e)||N(4,t.__key),e}const wt=(t,e)=>{let n=t;for(;n!==$getRoot()&&null!=n;){if(e(n))return n;n=n.getParent();}return null};function xt(t,e,n,o){const r=t=>t instanceof e;return t.registerNodeTransform(e,(t=>{const e=(t=>{const e=t.getChildren();for(let t=0;t<e.length;t++){const n=e[t];if(r(n))return null}let n=t,o=t;for(;null!==n;)if(o=n,n=n.getParent(),r(n))return {child:o,parent:n};return null})(t);if(null!==e){const{child:r,parent:i}=e;if(r.is(t)){o(i,t);const e=r.getNextSiblings(),l=e.length;if(i.insertAfter(r),0!==l){const t=n(i);r.insertAfter(t);for(let n=0;n<l;n++)t.append(e[n]);}i.canBeEmpty()||0!==i.getChildrenSize()||i.remove();}}}))}function Et(t,e){const n=new Map,o=t._pendingEditorState;for(const[t,o]of e._nodeMap)n.set(t,$cloneWithProperties(o));o&&(o._nodeMap=n),t._dirtyType=2;const r=e._selection;$setSelection(null===r?null:r.clone());}function St(t){const o=$getSelection()||$getPreviousSelection();let r;if($isRangeSelection(o))r=$caretFromPoint(o.focus,"next");else {if(null!=o){const t=o.getNodes(),e=t[t.length-1];e&&(r=$getSiblingCaret(e,"next"));}r=r||$getChildCaret($getRoot(),"previous").getFlipped().insert($createParagraphNode());}const c=At(t,r),f=$getAdjacentChildCaret(c),d=$isChildCaret(f)?$normalizeCaret(f):c;return $setSelectionFromCaretRange($getCollapsedCaretRange(d)),t.getLatest()}function At(t,e,n){let o=$getCaretInDirection(e,"next");for(let t=o;t;t=$splitAtPointCaretNext(t,n))o=t;return $isTextPointCaret(o)&&N(283),o.insert(t.isInline()?$createParagraphNode().append(t):t),$getCaretInDirection($getSiblingCaret(t.getLatest(),"next"),e.direction)}function Ct(t,e){const n=e();return t.replace(n),n.append(t),n}function Lt(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}function Pt(t,e){const n=[];for(let o=0;o<t.length;o++){const r=e(t[o]);null!==r&&n.push(r);}return n}function bt(t,e){$getChildCaret(t,"next").insert(e);}let Nt=!(et||!J)&&void 0;function Mt(t){let e=1;if(function(){if(void 0===Nt){const t=document.createElement("div");t.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(t);const e=t.getBoundingClientRect();t.style.setProperty("zoom","2"),Nt=t.getBoundingClientRect().width===e.width,document.body.removeChild(t);}return Nt}())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue("zoom")),t=t.parentElement;return e}function Rt(t){return null!==t._parentEditor}function Tt(t,e){return Bt(t,e,null)}function Bt(t,e,n){let r=!1;for(const i of Kt(t))e(i)?null!==n&&n(i):(r=!0,$isElementNode(i)&&Bt(i,e,n||(t=>i.insertAfter(t))),i.remove());return r}function _t(t,e){const n=[],r=Array.from(t).reverse();for(let t=r.pop();void 0!==t;t=r.pop())if(e(t))n.push(t);else if($isElementNode(t))for(const e of Kt(t))r.push(e);return n}function kt(t){return Ht($getChildCaret(t,"next"))}function Kt(t){return Ht($getChildCaret(t,"previous"))}function Ht(t){return makeStepwiseIterator({hasNext:$isSiblingCaret,initial:t.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function Ot(t){$rewindSiblingCaret($getSiblingCaret(t,"next")).splice(1,t.getChildren());}function $t(t,e="root"){let n=0,o=t,r=$getAdjacentChildCaret(o);for(;null===r;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=$getAdjacentChildCaret(o);}return r&&[r,n]}function Dt(t){const e=e=>$getState(e,t),n=(e,n)=>$setState(e,t,n);return {$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(t){return n(this,t)},stateConfig:t}}
|
|
16
|
-
|
|
17
|
-
export { _t as $descendantsMatching, st as $dfs, at as $dfsIterator, Pt as $filter, wt as $findMatchingParent, kt as $firstToLastIterator, ct as $getAdjacentCaret, $t as $getAdjacentSiblingOrParentSiblingCaret, pt as $getDepth, yt as $getNearestBlockElementAncestorOrThrow, vt as $getNearestNodeOfType, mt as $getNextRightPreorderNode, gt as $getNextSiblingOrParentSibling, bt as $insertFirst, St as $insertNodeToNearestRoot, At as $insertNodeToNearestRootAtCaret, Rt as $isEditorIsNestedEditor, Kt as $lastToFirstIterator, Et as $restoreEditorState, ft as $reverseDfs, ht as $reverseDfsIterator, Tt as $unwrapAndFilterDescendants, Ot as $unwrapNode, Ct as $wrapNodeInElement, q as CAN_USE_BEFORE_INPUT, J as CAN_USE_DOM, Q as IS_ANDROID, X as IS_ANDROID_CHROME, Y as IS_APPLE, Z as IS_APPLE_WEBKIT, tt as IS_CHROME, et as IS_FIREFOX, nt as IS_IOS, ot as IS_SAFARI, rt as addClassNamesToElement, Mt as calculateZoomLevel, lt as isMimeType, Dt as makeStateWrapper, W as markSelection, ut as mediaFileReader, j as mergeRegister, Lt as objectKlassEquals, z as positionNodeOnRange, xt as registerNestedElementResolver, it as removeClassNamesFromElement, G as selectionAlwaysOnDisplay };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
// Material Design Icons v7.4.47
|
|
4
|
-
var mdiClose = "M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z";
|
|
5
|
-
var mdiFormatColorFill = "M19,11.5C19,11.5 17,13.67 17,15A2,2 0 0,0 19,17A2,2 0 0,0 21,15C21,13.67 19,11.5 19,11.5M5.21,10L10,5.21L14.79,10M16.56,8.94L7.62,0L6.21,1.41L8.59,3.79L3.44,8.94C2.85,9.5 2.85,10.47 3.44,11.06L8.94,16.56C9.23,16.85 9.62,17 10,17C10.38,17 10.77,16.85 11.06,16.56L16.56,11.06C17.15,10.47 17.15,9.5 16.56,8.94Z";
|
|
6
|
-
|
|
7
|
-
export { mdiClose, mdiFormatColorFill };
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
Prism.languages.c = Prism.languages.extend('clike', {
|
|
4
|
-
'comment': {
|
|
5
|
-
pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
|
|
6
|
-
greedy: true
|
|
7
|
-
},
|
|
8
|
-
'string': {
|
|
9
|
-
// https://en.cppreference.com/w/c/language/string_literal
|
|
10
|
-
pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
|
|
11
|
-
greedy: true
|
|
12
|
-
},
|
|
13
|
-
'class-name': {
|
|
14
|
-
pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
|
|
15
|
-
lookbehind: true
|
|
16
|
-
},
|
|
17
|
-
'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,
|
|
18
|
-
'function': /\b[a-z_]\w*(?=\s*\()/i,
|
|
19
|
-
'number': /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
|
|
20
|
-
'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
Prism.languages.insertBefore('c', 'string', {
|
|
24
|
-
'char': {
|
|
25
|
-
// https://en.cppreference.com/w/c/language/character_constant
|
|
26
|
-
pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
|
|
27
|
-
greedy: true
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
Prism.languages.insertBefore('c', 'string', {
|
|
32
|
-
'macro': {
|
|
33
|
-
// allow for multiline macro definitions
|
|
34
|
-
// spaces after the # character compile fine with gcc
|
|
35
|
-
pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
|
|
36
|
-
lookbehind: true,
|
|
37
|
-
greedy: true,
|
|
38
|
-
alias: 'property',
|
|
39
|
-
inside: {
|
|
40
|
-
'string': [
|
|
41
|
-
{
|
|
42
|
-
// highlight the path of the include statement as a string
|
|
43
|
-
pattern: /^(#\s*include\s*)<[^>]+>/,
|
|
44
|
-
lookbehind: true
|
|
45
|
-
},
|
|
46
|
-
Prism.languages.c['string']
|
|
47
|
-
],
|
|
48
|
-
'char': Prism.languages.c['char'],
|
|
49
|
-
'comment': Prism.languages.c['comment'],
|
|
50
|
-
'macro-name': [
|
|
51
|
-
{
|
|
52
|
-
pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
|
|
53
|
-
lookbehind: true
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
|
|
57
|
-
lookbehind: true,
|
|
58
|
-
alias: 'function'
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
// highlight macro directives as keywords
|
|
62
|
-
'directive': {
|
|
63
|
-
pattern: /^(#\s*)[a-z]+/,
|
|
64
|
-
lookbehind: true,
|
|
65
|
-
alias: 'keyword'
|
|
66
|
-
},
|
|
67
|
-
'directive-hash': /^#/,
|
|
68
|
-
'punctuation': /##|\\(?=[\r\n])/,
|
|
69
|
-
'expression': {
|
|
70
|
-
pattern: /\S[\s\S]*/,
|
|
71
|
-
inside: Prism.languages.c
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
Prism.languages.insertBefore('c', 'function', {
|
|
78
|
-
// highlight predefined macros as constants
|
|
79
|
-
'constant': /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
delete Prism.languages.c['boolean'];
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
Prism.languages.clike = {
|
|
4
|
-
'comment': [
|
|
5
|
-
{
|
|
6
|
-
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
|
7
|
-
lookbehind: true,
|
|
8
|
-
greedy: true
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
pattern: /(^|[^\\:])\/\/.*/,
|
|
12
|
-
lookbehind: true,
|
|
13
|
-
greedy: true
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
'string': {
|
|
17
|
-
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
|
18
|
-
greedy: true
|
|
19
|
-
},
|
|
20
|
-
'class-name': {
|
|
21
|
-
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
|
22
|
-
lookbehind: true,
|
|
23
|
-
inside: {
|
|
24
|
-
'punctuation': /[.\\]/
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
|
28
|
-
'boolean': /\b(?:false|true)\b/,
|
|
29
|
-
'function': /\b\w+(?=\()/,
|
|
30
|
-
'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
31
|
-
'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
32
|
-
'punctuation': /[{}[\];(),.:]/
|
|
33
|
-
};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
(function (Prism) {
|
|
4
|
-
|
|
5
|
-
var keyword = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;
|
|
6
|
-
var modName = /\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g, function () { return keyword.source; });
|
|
7
|
-
|
|
8
|
-
Prism.languages.cpp = Prism.languages.extend('c', {
|
|
9
|
-
'class-name': [
|
|
10
|
-
{
|
|
11
|
-
pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source
|
|
12
|
-
.replace(/<keyword>/g, function () { return keyword.source; })),
|
|
13
|
-
lookbehind: true
|
|
14
|
-
},
|
|
15
|
-
// This is intended to capture the class name of method implementations like:
|
|
16
|
-
// void foo::bar() const {}
|
|
17
|
-
// However! The `foo` in the above example could also be a namespace, so we only capture the class name if
|
|
18
|
-
// it starts with an uppercase letter. This approximation should give decent results.
|
|
19
|
-
/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
|
|
20
|
-
// This will capture the class name before destructors like:
|
|
21
|
-
// Foo::~Foo() {}
|
|
22
|
-
/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,
|
|
23
|
-
// This also intends to capture the class name of method implementations but here the class has template
|
|
24
|
-
// parameters, so it can't be a namespace (until C++ adds generic namespaces).
|
|
25
|
-
/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/
|
|
26
|
-
],
|
|
27
|
-
'keyword': keyword,
|
|
28
|
-
'number': {
|
|
29
|
-
pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
|
|
30
|
-
greedy: true
|
|
31
|
-
},
|
|
32
|
-
'operator': />>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
|
|
33
|
-
'boolean': /\b(?:false|true)\b/
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
Prism.languages.insertBefore('cpp', 'string', {
|
|
37
|
-
'module': {
|
|
38
|
-
// https://en.cppreference.com/w/cpp/language/modules
|
|
39
|
-
pattern: RegExp(
|
|
40
|
-
/(\b(?:import|module)\s+)/.source +
|
|
41
|
-
'(?:' +
|
|
42
|
-
// header-name
|
|
43
|
-
/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source +
|
|
44
|
-
'|' +
|
|
45
|
-
// module name or partition or both
|
|
46
|
-
/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g, function () { return modName; }) +
|
|
47
|
-
')'
|
|
48
|
-
),
|
|
49
|
-
lookbehind: true,
|
|
50
|
-
greedy: true,
|
|
51
|
-
inside: {
|
|
52
|
-
'string': /^[<"][\s\S]+/,
|
|
53
|
-
'operator': /:/,
|
|
54
|
-
'punctuation': /\./
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
'raw-string': {
|
|
58
|
-
pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
|
|
59
|
-
alias: 'string',
|
|
60
|
-
greedy: true
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
Prism.languages.insertBefore('cpp', 'keyword', {
|
|
65
|
-
'generic-function': {
|
|
66
|
-
pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
|
|
67
|
-
inside: {
|
|
68
|
-
'function': /^\w+/,
|
|
69
|
-
'generic': {
|
|
70
|
-
pattern: /<[\s\S]+/,
|
|
71
|
-
alias: 'class-name',
|
|
72
|
-
inside: Prism.languages.cpp
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
Prism.languages.insertBefore('cpp', 'operator', {
|
|
79
|
-
'double-colon': {
|
|
80
|
-
pattern: /::/,
|
|
81
|
-
alias: 'punctuation'
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
Prism.languages.insertBefore('cpp', 'class-name', {
|
|
86
|
-
// the base clause is an optional list of parent classes
|
|
87
|
-
// https://en.cppreference.com/w/cpp/language/class
|
|
88
|
-
'base-clause': {
|
|
89
|
-
pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
|
|
90
|
-
lookbehind: true,
|
|
91
|
-
greedy: true,
|
|
92
|
-
inside: Prism.languages.extend('cpp', {})
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
Prism.languages.insertBefore('inside', 'double-colon', {
|
|
97
|
-
// All untokenized words that are not namespaces should be class names
|
|
98
|
-
'class-name': /\b[a-z_]\w*\b(?!\s*::)/i
|
|
99
|
-
}, Prism.languages.cpp['base-clause']);
|
|
100
|
-
|
|
101
|
-
}(Prism));
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
(function (Prism) {
|
|
4
|
-
|
|
5
|
-
var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
6
|
-
|
|
7
|
-
Prism.languages.css = {
|
|
8
|
-
'comment': /\/\*[\s\S]*?\*\//,
|
|
9
|
-
'atrule': {
|
|
10
|
-
pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
|
11
|
-
inside: {
|
|
12
|
-
'rule': /^@[\w-]+/,
|
|
13
|
-
'selector-function-argument': {
|
|
14
|
-
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
15
|
-
lookbehind: true,
|
|
16
|
-
alias: 'selector'
|
|
17
|
-
},
|
|
18
|
-
'keyword': {
|
|
19
|
-
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
20
|
-
lookbehind: true
|
|
21
|
-
}
|
|
22
|
-
// See rest below
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
'url': {
|
|
26
|
-
// https://drafts.csswg.org/css-values-3/#urls
|
|
27
|
-
pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
|
28
|
-
greedy: true,
|
|
29
|
-
inside: {
|
|
30
|
-
'function': /^url/i,
|
|
31
|
-
'punctuation': /^\(|\)$/,
|
|
32
|
-
'string': {
|
|
33
|
-
pattern: RegExp('^' + string.source + '$'),
|
|
34
|
-
alias: 'url'
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
'selector': {
|
|
39
|
-
pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
|
40
|
-
lookbehind: true
|
|
41
|
-
},
|
|
42
|
-
'string': {
|
|
43
|
-
pattern: string,
|
|
44
|
-
greedy: true
|
|
45
|
-
},
|
|
46
|
-
'property': {
|
|
47
|
-
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
48
|
-
lookbehind: true
|
|
49
|
-
},
|
|
50
|
-
'important': /!important\b/i,
|
|
51
|
-
'function': {
|
|
52
|
-
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
53
|
-
lookbehind: true
|
|
54
|
-
},
|
|
55
|
-
'punctuation': /[(){};:,]/
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
|
59
|
-
|
|
60
|
-
var markup = Prism.languages.markup;
|
|
61
|
-
if (markup) {
|
|
62
|
-
markup.tag.addInlined('style', 'css');
|
|
63
|
-
markup.tag.addAttribute('style', 'css');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
}(Prism));
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
(function (Prism) {
|
|
4
|
-
|
|
5
|
-
var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
|
|
6
|
-
|
|
7
|
-
// full package (optional) + parent classes (optional)
|
|
8
|
-
var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
|
|
9
|
-
|
|
10
|
-
// based on the java naming conventions
|
|
11
|
-
var className = {
|
|
12
|
-
pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
|
|
13
|
-
lookbehind: true,
|
|
14
|
-
inside: {
|
|
15
|
-
'namespace': {
|
|
16
|
-
pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
|
|
17
|
-
inside: {
|
|
18
|
-
'punctuation': /\./
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
'punctuation': /\./
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
Prism.languages.java = Prism.languages.extend('clike', {
|
|
26
|
-
'string': {
|
|
27
|
-
pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
|
|
28
|
-
lookbehind: true,
|
|
29
|
-
greedy: true
|
|
30
|
-
},
|
|
31
|
-
'class-name': [
|
|
32
|
-
className,
|
|
33
|
-
{
|
|
34
|
-
// variables, parameters, and constructor references
|
|
35
|
-
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
|
36
|
-
pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
|
|
37
|
-
lookbehind: true,
|
|
38
|
-
inside: className.inside
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
// class names based on keyword
|
|
42
|
-
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
|
43
|
-
pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
|
|
44
|
-
lookbehind: true,
|
|
45
|
-
inside: className.inside
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
'keyword': keywords,
|
|
49
|
-
'function': [
|
|
50
|
-
Prism.languages.clike.function,
|
|
51
|
-
{
|
|
52
|
-
pattern: /(::\s*)[a-z_]\w*/,
|
|
53
|
-
lookbehind: true
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
'number': /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
|
|
57
|
-
'operator': {
|
|
58
|
-
pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
|
|
59
|
-
lookbehind: true
|
|
60
|
-
},
|
|
61
|
-
'constant': /\b[A-Z][A-Z_\d]+\b/
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
Prism.languages.insertBefore('java', 'string', {
|
|
65
|
-
'triple-quoted-string': {
|
|
66
|
-
// http://openjdk.java.net/jeps/355#Description
|
|
67
|
-
pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
|
|
68
|
-
greedy: true,
|
|
69
|
-
alias: 'string'
|
|
70
|
-
},
|
|
71
|
-
'char': {
|
|
72
|
-
pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
|
|
73
|
-
greedy: true
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
Prism.languages.insertBefore('java', 'class-name', {
|
|
78
|
-
'annotation': {
|
|
79
|
-
pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
|
|
80
|
-
lookbehind: true,
|
|
81
|
-
alias: 'punctuation'
|
|
82
|
-
},
|
|
83
|
-
'generics': {
|
|
84
|
-
pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
|
|
85
|
-
inside: {
|
|
86
|
-
'class-name': className,
|
|
87
|
-
'keyword': keywords,
|
|
88
|
-
'punctuation': /[<>(),.:]/,
|
|
89
|
-
'operator': /[?&|]/
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
'import': [
|
|
93
|
-
{
|
|
94
|
-
pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
|
|
95
|
-
lookbehind: true,
|
|
96
|
-
inside: {
|
|
97
|
-
'namespace': className.inside.namespace,
|
|
98
|
-
'punctuation': /\./,
|
|
99
|
-
'operator': /\*/,
|
|
100
|
-
'class-name': /\w+/
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
|
|
105
|
-
lookbehind: true,
|
|
106
|
-
alias: 'static',
|
|
107
|
-
inside: {
|
|
108
|
-
'namespace': className.inside.namespace,
|
|
109
|
-
'static': /\b\w+$/,
|
|
110
|
-
'punctuation': /\./,
|
|
111
|
-
'operator': /\*/,
|
|
112
|
-
'class-name': /\w+/
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
],
|
|
116
|
-
'namespace': {
|
|
117
|
-
pattern: RegExp(
|
|
118
|
-
/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/
|
|
119
|
-
.source.replace(/<keyword>/g, function () { return keywords.source; })),
|
|
120
|
-
lookbehind: true,
|
|
121
|
-
inside: {
|
|
122
|
-
'punctuation': /\./,
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}(Prism));
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
Prism.languages.javascript = Prism.languages.extend('clike', {
|
|
4
|
-
'class-name': [
|
|
5
|
-
Prism.languages.clike['class-name'],
|
|
6
|
-
{
|
|
7
|
-
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
8
|
-
lookbehind: true
|
|
9
|
-
}
|
|
10
|
-
],
|
|
11
|
-
'keyword': [
|
|
12
|
-
{
|
|
13
|
-
pattern: /((?:^|\})\s*)catch\b/,
|
|
14
|
-
lookbehind: true
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
|
|
18
|
-
lookbehind: true
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
|
22
|
-
'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
23
|
-
'number': {
|
|
24
|
-
pattern: RegExp(
|
|
25
|
-
/(^|[^\w$])/.source +
|
|
26
|
-
'(?:' +
|
|
27
|
-
(
|
|
28
|
-
// constant
|
|
29
|
-
/NaN|Infinity/.source +
|
|
30
|
-
'|' +
|
|
31
|
-
// binary integer
|
|
32
|
-
/0[bB][01]+(?:_[01]+)*n?/.source +
|
|
33
|
-
'|' +
|
|
34
|
-
// octal integer
|
|
35
|
-
/0[oO][0-7]+(?:_[0-7]+)*n?/.source +
|
|
36
|
-
'|' +
|
|
37
|
-
// hexadecimal integer
|
|
38
|
-
/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
|
|
39
|
-
'|' +
|
|
40
|
-
// decimal bigint
|
|
41
|
-
/\d+(?:_\d+)*n/.source +
|
|
42
|
-
'|' +
|
|
43
|
-
// decimal number (integer or float) but no bigint
|
|
44
|
-
/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
|
|
45
|
-
) +
|
|
46
|
-
')' +
|
|
47
|
-
/(?![\w$])/.source
|
|
48
|
-
),
|
|
49
|
-
lookbehind: true
|
|
50
|
-
},
|
|
51
|
-
'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
|
|
55
|
-
|
|
56
|
-
Prism.languages.insertBefore('javascript', 'keyword', {
|
|
57
|
-
'regex': {
|
|
58
|
-
pattern: RegExp(
|
|
59
|
-
// lookbehind
|
|
60
|
-
// eslint-disable-next-line regexp/no-dupe-characters-character-class
|
|
61
|
-
/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
|
|
62
|
-
// Regex pattern:
|
|
63
|
-
// There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
|
|
64
|
-
// classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
|
|
65
|
-
// with the only syntax, so we have to define 2 different regex patterns.
|
|
66
|
-
/\//.source +
|
|
67
|
-
'(?:' +
|
|
68
|
-
/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
|
|
69
|
-
'|' +
|
|
70
|
-
// `v` flag syntax. This supports 3 levels of nested character classes.
|
|
71
|
-
/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
|
|
72
|
-
')' +
|
|
73
|
-
// lookahead
|
|
74
|
-
/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
|
|
75
|
-
),
|
|
76
|
-
lookbehind: true,
|
|
77
|
-
greedy: true,
|
|
78
|
-
inside: {
|
|
79
|
-
'regex-source': {
|
|
80
|
-
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
|
81
|
-
lookbehind: true,
|
|
82
|
-
alias: 'language-regex',
|
|
83
|
-
inside: Prism.languages.regex
|
|
84
|
-
},
|
|
85
|
-
'regex-delimiter': /^\/|\/$/,
|
|
86
|
-
'regex-flags': /^[a-z]+$/,
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
// This must be declared before keyword because we use "function" inside the look-forward
|
|
90
|
-
'function-variable': {
|
|
91
|
-
pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
|
|
92
|
-
alias: 'function'
|
|
93
|
-
},
|
|
94
|
-
'parameter': [
|
|
95
|
-
{
|
|
96
|
-
pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
|
97
|
-
lookbehind: true,
|
|
98
|
-
inside: Prism.languages.javascript
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
|
102
|
-
lookbehind: true,
|
|
103
|
-
inside: Prism.languages.javascript
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
107
|
-
lookbehind: true,
|
|
108
|
-
inside: Prism.languages.javascript
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
|
|
112
|
-
lookbehind: true,
|
|
113
|
-
inside: Prism.languages.javascript
|
|
114
|
-
}
|
|
115
|
-
],
|
|
116
|
-
'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
Prism.languages.insertBefore('javascript', 'string', {
|
|
120
|
-
'hashbang': {
|
|
121
|
-
pattern: /^#!.*/,
|
|
122
|
-
greedy: true,
|
|
123
|
-
alias: 'comment'
|
|
124
|
-
},
|
|
125
|
-
'template-string': {
|
|
126
|
-
pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
|
|
127
|
-
greedy: true,
|
|
128
|
-
inside: {
|
|
129
|
-
'template-punctuation': {
|
|
130
|
-
pattern: /^`|`$/,
|
|
131
|
-
alias: 'string'
|
|
132
|
-
},
|
|
133
|
-
'interpolation': {
|
|
134
|
-
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
|
|
135
|
-
lookbehind: true,
|
|
136
|
-
inside: {
|
|
137
|
-
'interpolation-punctuation': {
|
|
138
|
-
pattern: /^\$\{|\}$/,
|
|
139
|
-
alias: 'punctuation'
|
|
140
|
-
},
|
|
141
|
-
rest: Prism.languages.javascript
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
'string': /[\s\S]+/
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
'string-property': {
|
|
148
|
-
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
|
|
149
|
-
lookbehind: true,
|
|
150
|
-
greedy: true,
|
|
151
|
-
alias: 'property'
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
Prism.languages.insertBefore('javascript', 'operator', {
|
|
156
|
-
'literal-property': {
|
|
157
|
-
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
|
158
|
-
lookbehind: true,
|
|
159
|
-
alias: 'property'
|
|
160
|
-
},
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
if (Prism.languages.markup) {
|
|
164
|
-
Prism.languages.markup.tag.addInlined('script', 'javascript');
|
|
165
|
-
|
|
166
|
-
// add attribute support for all DOM events.
|
|
167
|
-
// https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
|
|
168
|
-
Prism.languages.markup.tag.addAttribute(
|
|
169
|
-
/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
|
|
170
|
-
'javascript'
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
Prism.languages.js = Prism.languages.javascript;
|