@glifox/gnosis 0.0.12 → 0.0.14
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/gnosis.mjs +3 -0
- package/dist/gnosis.umd.js +1 -1
- package/package.json +9 -8
package/dist/gnosis.mjs
CHANGED
|
@@ -235,6 +235,9 @@ const le = (e, t) => {
|
|
|
235
235
|
},
|
|
236
236
|
"& .cm-line .lm, & .cm-line .TaskMark, & .cm-line .tm, & .cm-line .ls-text-line": {
|
|
237
237
|
verticalAlign: "top"
|
|
238
|
+
},
|
|
239
|
+
"& .cb-content .ls-text-line, & .cb-spacer .ls-text-line": {
|
|
240
|
+
width: "unset !important"
|
|
238
241
|
}
|
|
239
242
|
}), ge = () => [
|
|
240
243
|
q(ce, {}, { eventHandlers: { mousedown: le } }),
|
package/dist/gnosis.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(h,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("@codemirror/language-data"),require("@codemirror/lang-markdown"),require("@lezer/markdown"),require("@lezer/highlight"),require("@codemirror/view"),require("@codemirror/language"),require("codemirror"),require("@codemirror/state")):typeof define=="function"&&define.amd?define(["exports","@codemirror/language-data","@codemirror/lang-markdown","@lezer/markdown","@lezer/highlight","@codemirror/view","@codemirror/language","codemirror","@codemirror/state"],w):(h=typeof globalThis<"u"?globalThis:h||self,w(h.gnosis={},h.languageData,h.langMarkdown,h.markdown,h.highlight,h.view,h.language,h.CodeMirror,h.state))})(this,function(h,w,H,ee,S,l,I,q,P){"use strict";var Re=Object.defineProperty;var We=(h,w,H)=>w in h?Re(h,w,{enumerable:!0,configurable:!0,writable:!0,value:H}):h[w]=H;var E=(h,w,H)=>We(h,typeof w!="symbol"?w+"":w,H);const p=S.Tag.define("none"),te={props:[S.styleTags({"Blockquote/...":p,HorizontalRule:p,"ATXHeading1/... SetextHeading1/...":p,"ATXHeading2/... SetextHeading2/...":p,"ATXHeading3/...":p,"ATXHeading4/...":p,"ATXHeading5/...":p,"ATXHeading6/...":p,"Comment CommentBlock":p,Escape:p,Entity:p,"Emphasis/...":p,"StrongEmphasis/...":p,"Strikethrough/...":p,"TableHeader/...":p,"Link/... Image/...":p,"OrderedList/... BulletList/...":p,"BlockQuote/...":p,"InlineCode CodeText":p,"URL Autolink":p,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark StrikethroughMark":p,"CodeInfo LinkLabel TaskMarker TableDelimiter":p,LinkTitle:p,Paragraph:p,"QuoteType/.. QuoteTypeMark QuoteTypeText":p})]},M=(e,n,r={})=>{const s=class{constructor(c){E(this,"decorations");E(this,"conf");this.conf=n,this.decorations=e(c,this.conf)}update(c){(c.docChanged||c.viewportChanged||c.selectionSet)&&(this.decorations=e(c.view,this.conf))}};return l.ViewPlugin.fromClass(s,{decorations:a=>a.decorations,...r})},D=(e,n,r)=>{const s=e.state.selection.ranges;for(let a of s)if(a.from>=n&&a.from<=r||a.to>=n&&a.to<=r||a.from<=n&&a.to>=r)return!0;return!1},x=(e,n)=>{for(const{from:r,to:s}of e.visibleRanges)I.syntaxTree(e.state).iterate({...n,from:r,to:s})};function ne(e,n){const r=["Document"],s={},a={HorizontalRule:(o,t,i=!0)=>[l.Decoration.line({class:"hr "+(i?"sw":"")}).range(o),l.Decoration.mark({class:"mk"}).range(o,t)]},c=[];return x(e,{enter:({type:o,from:t,to:i})=>(o.name in a&&c.push(...a[o.name](t,i,D(e,t,i))),r.includes(o.name)||o.name in s)}),l.Decoration.set(c,!1)}const oe=()=>q.EditorView.baseTheme({"& .hr":{position:"relative"},"& .hr > .mk":{fontSize:"0"},"& .hr.sw > .mk":{fontSize:"inherit"},"&light .hr::before ":{backgroundColor:"var(--cm-hr, black)"},"&dark .hr::before ":{backgroundColor:"var(--cm-hr, white)"},"&.cm-focused .hr.sw::before":{width:"0",height:"0"},"& .hr::before":{content:'""',position:"absolute",width:"calc(100% - 12px)",height:".2ch"}}),Q=()=>[M(ne,{}),oe()];function re(e,n){const r=["FencedCode"],s={StrongEmphasis:(o=!0,t,i)=>l.Decoration.mark({class:"il st "+(o?"sw":"")}).range(t,i),Strikethrough:(o=!0,t,i)=>l.Decoration.mark({class:"il sk "+(o?"sw":"")}).range(t,i),InlineCode:(o=!0,t,i)=>l.Decoration.mark({class:"il ic "+(o?"sw":"")}).range(t,i),Emphasis:(o=!0,t,i)=>l.Decoration.mark({class:"il it "+(o?"sw":"")}).range(t,i),Mark:(o,t)=>l.Decoration.mark({class:"mkl"}).range(o,t)},a=["EmphasisMark","CodeMark","StrikethroughMark"],c=[];return x(e,{enter:({type:{name:o},from:t,to:i})=>a.includes(o)?(c.push(s.Mark(t,i)),!1):(o in s&&c.push(s[o](D(e,t,i),t,i)),!r.includes(o))}),l.Decoration.set(c,!1)}const se=q.EditorView.baseTheme({"& .it ":{fontStyle:"italic"},"& .st ":{fontWeight:"bold"},"& .sk ":{textDecoration:"line-through"},"& .ic ":{fontFamily:"monospace",paddingInline:".6ch",borderRadius:".6ch",backgroundColor:"var(--cm-ic-background, hsl(from black h s l / .2))"}}),ie=q.EditorView.baseTheme({".il .mkl":{fontSize:"0"},"&.cm-focused .il.sw > .mkl":{fontSize:"inherit"}}),Z=()=>[M(re,{}),se,ie];class ae extends l.WidgetType{constructor(r){super();E(this,"checked",!1);this.checked=r}toDOM(){let r=document.createElement("span");r.setAttribute("aria-hidden","true"),r.className="TaskMark";let s=r.appendChild(document.createElement("input"));return s.type="checkbox",s.checked=this.checked,r}ignoreEvent(){return!1}}function ce(e,n){const r=["Document","ListItem","Task","Blockquote"],s={BulletList:{class:"bl",offset:2},OrderedList:{class:"ol",offset:3}},a={ListMark:(i,d,u,g=!0)=>l.Decoration.mark({class:`${u.class} lm ${g?"sw":""}`}).range(i,d),TaskMarker:(i,d,u,g=!0)=>{const C=e.state.doc.sliceString(i+1,d-1)==="x";return g?l.Decoration.mark({class:`tm ${C?"ck":""}`}).range(i,d):l.Decoration.replace({widget:new ae(C)}).range(i,d)}},c={ListItem:(i,d,u,g)=>{const C=u.offset+(g?4:0),f=i+C,m=`calc(100% - ${Math.max(0,C)+4}ch)`;return f>=d?[]:[l.Decoration.mark({class:"ls-text-line",attributes:{style:`width: ${m}`}}).range(f,d)]}},o=[],t=[];return x(e,{enter:({name:i,from:d,to:u,node:g})=>i in s?(t.push({name:i,from:d,to:u}),!0):(i in a&&o.push(a[i](d,u,s[t.slice(-1)[0].name],D(e,d,u))),i in c&&o.push(...c[i](d,u,s[t.slice(-1)[0].name],g.getChild("Task")!==null)),r.includes(i)),leave:({name:i,from:d,to:u})=>{const g=t.slice(-1)[0];g&&g.name===i&&g.from===d&&g.to===u&&t.pop()}}),l.Decoration.set(o,!0)}const le=(e,n)=>{var s;let r=e.target;if(r.nodeName==="INPUT"&&((s=r.parentElement)!=null&&s.classList.contains("TaskMark")))return de(n,n.posAtDOM(r))},de=(e,n)=>{const r=n-2,s=n-1;let a=e.state.doc.sliceString(Math.max(0,r),s),c;if(a==="x")c={from:r,to:s,insert:" "};else if(a===" ")c={from:r,to:s,insert:"x"};else return!1;return e.dispatch({changes:c}),!0},ue=()=>q.EditorView.baseTheme({"& .lm.bl":{position:"relative",paddingInlineStart:"1ch",color:"transparent"},"& .lm.bl::before":{content:'""',display:"inline",position:"absolute",borderRadius:"50%",top:"50%",left:".5ch",transform:"translate(0, -50%)",height:".4em",width:".4em"},"&light .lm.bl::before":{backgroundColor:"var(--cm-list-bullet, light-dark(black, white))"},"&dark .lm.bl::before":{backgroundColor:"var(--cm-list-bullet, light-dark(black, white))"},"&.cm-focused .lm.bl.sw, &.cm-focused .lm.bl.sw::before":{backgroundColor:"transparent",color:"inherit"},"& .ls-text-line":{display:"inline-block",ariaHidden:"true"},"& .cm-line .lm, & .cm-line .TaskMark, & .cm-line .tm, & .cm-line .ls-text-line":{verticalAlign:"top"}}),V=()=>[M(ce,{},{eventHandlers:{mousedown:le}}),ue()],ge=(e,n)=>{var s;let r=e.target;if(r.nodeName==="BUTTON"&&((s=r.parentElement)!=null&&s.classList.contains("wg-codeblock"))){const a=["FencedCode","CodeBlock"];let c="";const o={enter:({type:{name:t},from:i,to:d,node:u})=>(a.includes(t)&&(c=he(n,u.toTree(),i,d)),!a.includes(t))};return I.syntaxTree(n.state).iterate({...o,from:n.posAtDOM(r),to:n.posAtDOM(r)+2}),navigator.clipboard.writeText(c),!0}},he=(e,n,r,s)=>{const a=["CodeMark","CodeInfo"];let c=e.state.doc.sliceString(r,s),o=new Set;n.iterate({enter({type:{name:u},from:g,node:C}){a.includes(u)&&o.add(e.state.doc.lineAt(g+r).number)}});const t=e.state.doc.lineAt(r),i=r-t.from,d=[];return c.split(`
|
|
1
|
+
(function(h,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("@codemirror/language-data"),require("@codemirror/lang-markdown"),require("@lezer/markdown"),require("@lezer/highlight"),require("@codemirror/view"),require("@codemirror/language"),require("codemirror"),require("@codemirror/state")):typeof define=="function"&&define.amd?define(["exports","@codemirror/language-data","@codemirror/lang-markdown","@lezer/markdown","@lezer/highlight","@codemirror/view","@codemirror/language","codemirror","@codemirror/state"],w):(h=typeof globalThis<"u"?globalThis:h||self,w(h.gnosis={},h.languageData,h.langMarkdown,h.markdown,h.highlight,h.view,h.language,h.CodeMirror,h.state))})(this,function(h,w,H,ee,S,l,I,q,P){"use strict";var Re=Object.defineProperty;var We=(h,w,H)=>w in h?Re(h,w,{enumerable:!0,configurable:!0,writable:!0,value:H}):h[w]=H;var E=(h,w,H)=>We(h,typeof w!="symbol"?w+"":w,H);const p=S.Tag.define("none"),te={props:[S.styleTags({"Blockquote/...":p,HorizontalRule:p,"ATXHeading1/... SetextHeading1/...":p,"ATXHeading2/... SetextHeading2/...":p,"ATXHeading3/...":p,"ATXHeading4/...":p,"ATXHeading5/...":p,"ATXHeading6/...":p,"Comment CommentBlock":p,Escape:p,Entity:p,"Emphasis/...":p,"StrongEmphasis/...":p,"Strikethrough/...":p,"TableHeader/...":p,"Link/... Image/...":p,"OrderedList/... BulletList/...":p,"BlockQuote/...":p,"InlineCode CodeText":p,"URL Autolink":p,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark StrikethroughMark":p,"CodeInfo LinkLabel TaskMarker TableDelimiter":p,LinkTitle:p,Paragraph:p,"QuoteType/.. QuoteTypeMark QuoteTypeText":p})]},M=(e,n,r={})=>{const s=class{constructor(c){E(this,"decorations");E(this,"conf");this.conf=n,this.decorations=e(c,this.conf)}update(c){(c.docChanged||c.viewportChanged||c.selectionSet)&&(this.decorations=e(c.view,this.conf))}};return l.ViewPlugin.fromClass(s,{decorations:a=>a.decorations,...r})},D=(e,n,r)=>{const s=e.state.selection.ranges;for(let a of s)if(a.from>=n&&a.from<=r||a.to>=n&&a.to<=r||a.from<=n&&a.to>=r)return!0;return!1},x=(e,n)=>{for(const{from:r,to:s}of e.visibleRanges)I.syntaxTree(e.state).iterate({...n,from:r,to:s})};function ne(e,n){const r=["Document"],s={},a={HorizontalRule:(o,t,i=!0)=>[l.Decoration.line({class:"hr "+(i?"sw":"")}).range(o),l.Decoration.mark({class:"mk"}).range(o,t)]},c=[];return x(e,{enter:({type:o,from:t,to:i})=>(o.name in a&&c.push(...a[o.name](t,i,D(e,t,i))),r.includes(o.name)||o.name in s)}),l.Decoration.set(c,!1)}const oe=()=>q.EditorView.baseTheme({"& .hr":{position:"relative"},"& .hr > .mk":{fontSize:"0"},"& .hr.sw > .mk":{fontSize:"inherit"},"&light .hr::before ":{backgroundColor:"var(--cm-hr, black)"},"&dark .hr::before ":{backgroundColor:"var(--cm-hr, white)"},"&.cm-focused .hr.sw::before":{width:"0",height:"0"},"& .hr::before":{content:'""',position:"absolute",width:"calc(100% - 12px)",height:".2ch"}}),Q=()=>[M(ne,{}),oe()];function re(e,n){const r=["FencedCode"],s={StrongEmphasis:(o=!0,t,i)=>l.Decoration.mark({class:"il st "+(o?"sw":"")}).range(t,i),Strikethrough:(o=!0,t,i)=>l.Decoration.mark({class:"il sk "+(o?"sw":"")}).range(t,i),InlineCode:(o=!0,t,i)=>l.Decoration.mark({class:"il ic "+(o?"sw":"")}).range(t,i),Emphasis:(o=!0,t,i)=>l.Decoration.mark({class:"il it "+(o?"sw":"")}).range(t,i),Mark:(o,t)=>l.Decoration.mark({class:"mkl"}).range(o,t)},a=["EmphasisMark","CodeMark","StrikethroughMark"],c=[];return x(e,{enter:({type:{name:o},from:t,to:i})=>a.includes(o)?(c.push(s.Mark(t,i)),!1):(o in s&&c.push(s[o](D(e,t,i),t,i)),!r.includes(o))}),l.Decoration.set(c,!1)}const se=q.EditorView.baseTheme({"& .it ":{fontStyle:"italic"},"& .st ":{fontWeight:"bold"},"& .sk ":{textDecoration:"line-through"},"& .ic ":{fontFamily:"monospace",paddingInline:".6ch",borderRadius:".6ch",backgroundColor:"var(--cm-ic-background, hsl(from black h s l / .2))"}}),ie=q.EditorView.baseTheme({".il .mkl":{fontSize:"0"},"&.cm-focused .il.sw > .mkl":{fontSize:"inherit"}}),Z=()=>[M(re,{}),se,ie];class ae extends l.WidgetType{constructor(r){super();E(this,"checked",!1);this.checked=r}toDOM(){let r=document.createElement("span");r.setAttribute("aria-hidden","true"),r.className="TaskMark";let s=r.appendChild(document.createElement("input"));return s.type="checkbox",s.checked=this.checked,r}ignoreEvent(){return!1}}function ce(e,n){const r=["Document","ListItem","Task","Blockquote"],s={BulletList:{class:"bl",offset:2},OrderedList:{class:"ol",offset:3}},a={ListMark:(i,d,u,g=!0)=>l.Decoration.mark({class:`${u.class} lm ${g?"sw":""}`}).range(i,d),TaskMarker:(i,d,u,g=!0)=>{const C=e.state.doc.sliceString(i+1,d-1)==="x";return g?l.Decoration.mark({class:`tm ${C?"ck":""}`}).range(i,d):l.Decoration.replace({widget:new ae(C)}).range(i,d)}},c={ListItem:(i,d,u,g)=>{const C=u.offset+(g?4:0),f=i+C,m=`calc(100% - ${Math.max(0,C)+4}ch)`;return f>=d?[]:[l.Decoration.mark({class:"ls-text-line",attributes:{style:`width: ${m}`}}).range(f,d)]}},o=[],t=[];return x(e,{enter:({name:i,from:d,to:u,node:g})=>i in s?(t.push({name:i,from:d,to:u}),!0):(i in a&&o.push(a[i](d,u,s[t.slice(-1)[0].name],D(e,d,u))),i in c&&o.push(...c[i](d,u,s[t.slice(-1)[0].name],g.getChild("Task")!==null)),r.includes(i)),leave:({name:i,from:d,to:u})=>{const g=t.slice(-1)[0];g&&g.name===i&&g.from===d&&g.to===u&&t.pop()}}),l.Decoration.set(o,!0)}const le=(e,n)=>{var s;let r=e.target;if(r.nodeName==="INPUT"&&((s=r.parentElement)!=null&&s.classList.contains("TaskMark")))return de(n,n.posAtDOM(r))},de=(e,n)=>{const r=n-2,s=n-1;let a=e.state.doc.sliceString(Math.max(0,r),s),c;if(a==="x")c={from:r,to:s,insert:" "};else if(a===" ")c={from:r,to:s,insert:"x"};else return!1;return e.dispatch({changes:c}),!0},ue=()=>q.EditorView.baseTheme({"& .lm.bl":{position:"relative",paddingInlineStart:"1ch",color:"transparent"},"& .lm.bl::before":{content:'""',display:"inline",position:"absolute",borderRadius:"50%",top:"50%",left:".5ch",transform:"translate(0, -50%)",height:".4em",width:".4em"},"&light .lm.bl::before":{backgroundColor:"var(--cm-list-bullet, light-dark(black, white))"},"&dark .lm.bl::before":{backgroundColor:"var(--cm-list-bullet, light-dark(black, white))"},"&.cm-focused .lm.bl.sw, &.cm-focused .lm.bl.sw::before":{backgroundColor:"transparent",color:"inherit"},"& .ls-text-line":{display:"inline-block",ariaHidden:"true"},"& .cm-line .lm, & .cm-line .TaskMark, & .cm-line .tm, & .cm-line .ls-text-line":{verticalAlign:"top"},"& .cb-content .ls-text-line, & .cb-spacer .ls-text-line":{width:"unset !important"}}),V=()=>[M(ce,{},{eventHandlers:{mousedown:le}}),ue()],ge=(e,n)=>{var s;let r=e.target;if(r.nodeName==="BUTTON"&&((s=r.parentElement)!=null&&s.classList.contains("wg-codeblock"))){const a=["FencedCode","CodeBlock"];let c="";const o={enter:({type:{name:t},from:i,to:d,node:u})=>(a.includes(t)&&(c=he(n,u.toTree(),i,d)),!a.includes(t))};return I.syntaxTree(n.state).iterate({...o,from:n.posAtDOM(r),to:n.posAtDOM(r)+2}),navigator.clipboard.writeText(c),!0}},he=(e,n,r,s)=>{const a=["CodeMark","CodeInfo"];let c=e.state.doc.sliceString(r,s),o=new Set;n.iterate({enter({type:{name:u},from:g,node:C}){a.includes(u)&&o.add(e.state.doc.lineAt(g+r).number)}});const t=e.state.doc.lineAt(r),i=r-t.from,d=[];return c.split(`
|
|
2
2
|
`).forEach((u,g)=>{o.has(g+t.number)||d.push(u.slice(i))}),d.join(`
|
|
3
3
|
`)};class $ extends l.WidgetType{constructor(r,s,a){super();E(this,"classes","");this.classes=r,this.width=s,this.marginLeft=a}toDOM(){let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),r.className=this.classes+" vacio",r.textContent=" ",r.style.width=this.width,r.style.marginLeft=this.marginLeft,r}ignoreEvent(){return!1}}const me=e=>`<svg class="cb-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
4
|
<path class="cb-icon-path cb.i1" fill-rule="evenodd" clip-rule="evenodd" d="M15 0C15.5304 0 16.0391 0.210714 16.4142 0.585786C16.7893 0.960859 17 1.46957 17 2V12C17 12.5304 16.7893 13.0391 16.4142 13.4142C16.0391 13.7893 15.5304 14 15 14H14V6C14 4.93913 13.5786 3.92172 12.8284 3.17157C12.0783 2.42143 11.0609 2 10 2H7C6.64895 1.99924 6.30395 2.09135 6 2.267V2C6 1.46957 6.21071 0.960859 6.58579 0.585786C6.96086 0.210714 7.46957 0 8 0H15Z"/>
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glifox/gnosis",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"author": "feraxhp",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/gnosis.umd.js",
|
|
7
7
|
"module": "dist/gnosis.mjs",
|
|
8
|
+
"types": "dist/gnosis.d.ts",
|
|
8
9
|
"repository": {
|
|
9
10
|
"type": "git",
|
|
10
11
|
"url": "git+https://github.com/glifox/gnosis.git"
|
|
@@ -35,12 +36,6 @@
|
|
|
35
36
|
"vite": "^6.0.7",
|
|
36
37
|
"vite-plugin-dts": "^4.5.4"
|
|
37
38
|
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"dev": "cd dev && vite --host",
|
|
40
|
-
"sample": "cd sample && vite --host",
|
|
41
|
-
"build": "vite build",
|
|
42
|
-
"publish": "vite build && npm publish"
|
|
43
|
-
},
|
|
44
39
|
"keywords": [
|
|
45
40
|
"WYSIWYG",
|
|
46
41
|
"markdown",
|
|
@@ -50,5 +45,11 @@
|
|
|
50
45
|
],
|
|
51
46
|
"publishConfig": {
|
|
52
47
|
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"dev": "cd dev && vite --host",
|
|
51
|
+
"sample": "cd sample && vite --host",
|
|
52
|
+
"build": "vite build",
|
|
53
|
+
"pub": "vite build && npm publish"
|
|
53
54
|
}
|
|
54
|
-
}
|
|
55
|
+
}
|