From 4e8e5e1d5058558aae90c74a3a4409d3cce395fa Mon Sep 17 00:00:00 2001 From: Ben Hatsor <34835685+benhatsor@users.noreply.github.com> Date: Wed, 30 Oct 2024 22:27:09 +0200 Subject: [PATCH 1/5] Update dev-marked-alert.js --- .../extensions/markdown/dev-marked-alert.js | 93 ++++++++++--------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/live-view/extensions/markdown/dev-marked-alert.js b/live-view/extensions/markdown/dev-marked-alert.js index 387e1c76ac..49cd254020 100644 --- a/live-view/extensions/markdown/dev-marked-alert.js +++ b/live-view/extensions/markdown/dev-marked-alert.js @@ -1,8 +1,9 @@ -(function(n, s) { - typeof exports == "object" && typeof module < "u" ? module.exports = s() : typeof define == "function" && define.amd ? define(s) : (n = typeof globalThis < "u" ? globalThis : n || self, n.markedAlert = s()) +(function(i, n) { + typeof exports == "object" && typeof module < "u" ? module.exports = n() : typeof define == "function" && define.amd ? define(n) : (i = typeof globalThis < "u" ? globalThis : i || self, i.markedAlert = n()) })(this, function() { "use strict"; - const n = [{ + + const i = [{ type: "note", icon: ' ' }, { @@ -19,73 +20,75 @@ icon: ' ' }]; - function s(a) { - return a.length ? Object.values([...n, ...a].reduce((r, o) => (r[o.type] = o, r), {})) : n + function n(a) { + return a.length ? Object.values([...i, ...a].reduce((s, c) => (s[c.type] = c, s), {})) : i } - function c(a) { - return `^(?:\\[\\!${a.toUpperCase()}\\])s*? -?` + function d(a) { + return `^(?:\\[!${a.toUpperCase()}])\\s*? +*` } - function u(a) { + function f(a) { return a.slice(0, 1).toUpperCase() + a.slice(1).toLowerCase() } - function f(a = {}) { + function g(a = {}) { const { - className: r = "markdown-alert", - variants: o = [] - } = a, g = s(o); + className: s = "markdown-alert", + variants: c = [] + } = a, m = n(c); return { - walkTokens(e) { - var t, p, d; - if (e.type !== "blockquote") return; - const l = g.find(({ - type: i - }) => new RegExp(c(i)).test(e.text)); - if (l) { + walkTokens(t) { + var e, v, u; + if (t.type !== "blockquote") return; + const o = m.find(({ + type: r + }) => new RegExp(d(r)).test(t.text)); + if (o) { const { - type: i, - icon: m, - title: w = u(i), - titleClassName: Z = `${r}-title` - } = l; - Object.assign(e, { + type: r, + icon: w, + title: Z = f(r), + titleClassName: x = `${s}-title` + } = o, h = new RegExp(d(r)); + Object.assign(t, { type: "alert", meta: { - className: r, - variant: i, - icon: m, - title: w, - titleClassName: Z + className: s, + variant: r, + icon: w, + title: Z, + titleClassName: x } }); - const v = (t = e.tokens) == null ? void 0 : t[0]; - if ((p = v.raw) == null ? void 0 : p.replace(new RegExp(c(i)), "").trim()) { - const h = v.tokens[0]; - Object.assign(h, { - raw: h.raw.replace(new RegExp(c(i)), ""), - text: h.text.replace(new RegExp(c(i)), "") + const l = (e = t.tokens) == null ? void 0 : e[0]; + if ((v = l.raw) == null ? void 0 : v.replace(h, "").trim()) { + l.tokens = l.tokens.filter(y => y.type !== "br"); + const p = l.tokens[0]; + Object.assign(p, { + raw: p.raw.replace(h, ""), + text: p.text.replace(h, "") }) - } else(d = e.tokens) == null || d.shift() + } else(u = t.tokens) == null || u.shift() } }, extensions: [{ name: "alert", level: "block", renderer({ - meta: e, - tokens: l = [] + meta: t, + tokens: o = [] }) { - let t = `
+ let e = `
`; - return t += `

`, t += e.icon, t += e.title, t += `

-`, t += this.parser.parse(l), t += `
-`, t + return e += `

`, e += t.icon, e += t.title, e += `

+`, e += this.parser.parse(o), e += `
+`, e } }] } } - return f + return g }); + From 941bddba37646289af38e1f034ee9b8c6d49cd97 Mon Sep 17 00:00:00 2001 From: Ben Hatsor <34835685+benhatsor@users.noreply.github.com> Date: Wed, 30 Oct 2024 22:27:44 +0200 Subject: [PATCH 2/5] Update marked.min.js --- live-view/extensions/markdown/marked.min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/live-view/extensions/markdown/marked.min.js b/live-view/extensions/markdown/marked.min.js index 67247a65f3..ba292a429c 100644 --- a/live-view/extensions/markdown/marked.min.js +++ b/live-view/extensions/markdown/marked.min.js @@ -17,10 +17,10 @@ (function(h,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(h=typeof globalThis<"u"?globalThis:h||self,h.markedFootnote=p())})(this,function(){"use strict";function h(t,c){const n={type:"footnotes",raw:c,rawItems:[],items:[]};return{name:"footnote",level:"block",childTokens:["content"],tokenizer(r){t.hasFootnotes||(this.lexer.tokens.push(n),t.tokens=this.lexer.tokens,t.hasFootnotes=!0,n.rawItems=[],n.items=[]);const e=/^\[\^([^\]\n]+)\]:(?:[ \t]+|[\n]*?|$)([^\n]*?(?:\n|$)(?:\n*?[ ]{4,}[^\n]*)*)/.exec(r);if(e){const[o,f,u=""]=e;let l=u.split(` `).reduce((i,s)=>i+` `+s.replace(/^(?:[ ]{4}|[\t])/,""),"");const d=l.trimEnd().split(` `).pop();l+=d&&/^[ \t]*?[>\-*][ ]|[`]{3,}$|^[ \t]*?[|].+[|]$/.test(d)?` `:"";const a={type:"footnote",raw:o,label:f,refs:[],content:this.lexer.blockTokens(l)};return n.rawItems.push(a),a}},renderer(){return""}}}function p(t,c=!1){let n=0;return{name:"footnoteRef",level:"inline",tokenizer(r){const e=/^\[\^([^\]\n]+)\]/.exec(r);if(e){const[o,f]=e,u=this.lexer.tokens[0],l=u.rawItems.filter(s=>s.label===f);if(!l.length)return;const d=l[0],a=u.items.filter(s=>s.label===f)[0],i={type:"footnoteRef",raw:o,id:"",label:f};return a?(i.id=a.refs[0].id,a.refs.push(i)):(n++,i.id=String(n),d.refs.push(i),u.items.push(d)),i}},renderer({id:r,label:e}){n=0;const o=encodeURIComponent(e);return`${c?`[${r}]`:r}`}}}function $(t){return{name:"footnotes",renderer({raw:c,items:n=[]}){if(n.length===0)return"";const r=n.reduce((o,{label:f,content:u,refs:l})=>{const d=encodeURIComponent(f),a=this.parser.parse(u).trimEnd(),i=a.endsWith("

");let s=`
  • `;return s+=i?a.replace(/<\/p>$/,""):a,l.forEach((b,m)=>{s+=` ${m>0?`↩${m+1}`:"↩"}`}),s+=i?`

    `:` `,s+=`
  • `,o+s},"");let e=`
    `;return e+=`

    ${c.trimEnd()}

    `,e+=`
      ${r}
    `,e+=`
    `,e}}}function k(t={}){const{prefixId:c="footnote-",description:n="Footnotes",refMarkers:r}=t,e={hasFootnotes:!1,tokens:[]};return{extensions:[h(e,n),p(c,r),$(c)],walkTokens(o){o.type==="footnotes"&&e.tokens.indexOf(o)===0&&o.items.length&&(e.tokens[0]={type:"space",raw:""},e.tokens.push(o)),e.hasFootnotes&&(e.hasFootnotes=!1)}}}return k}); /* - * marked-alert 2.0.2 + * marked-alert 2.1.1 */ -(function(i, n) { typeof exports == "object" && typeof module < "u" ? module.exports = n() : typeof define == "function" && define.amd ? define(n) : (i = typeof globalThis < "u" ? globalThis : i || self, i.markedAlert = n()) })(this, function() { "use strict"; const i = [{ type: "note", icon: ' ' }, { type: "tip", icon: ' ' }, { type: "important", icon: '' }, { type: "warning", icon: ' ' }, { type: "caution", icon: ' ' }]; function n(a) { return a.length ? Object.values([...i, ...a].reduce((s, r) => (s[r.type] = r, s), {})) : i } function h(a) { return `^(?:\\[\\!${a.toUpperCase()}\\])s*? ?` } function f(a) { return a.slice(0, 1).toUpperCase() + a.slice(1).toLowerCase() } function m(a = {}) { const { className: s = "markdown-alert", variants: r = [] } = a, g = n(r); return { walkTokens(e) { var t, p, d, v; if (e.type !== "blockquote") return; const o = g.find(({ type: c }) => new RegExp(h(c)).test(e.text)); if (o) { const { type: c, icon: Z, title: w = f(c), titleClassName: x = `${s}-title` } = o; Object.assign(e, { type: "alert", meta: { className: s, variant: c, icon: Z, title: w, titleClassName: x } }); const l = (t = e.tokens) == null ? void 0 : t[0], u = (p = l.raw) == null ? void 0 : p.replace(new RegExp(h(c)), "").trim(); u ? (l.tokens = this.Lexer.lexInline(u), (d = e.tokens) == null || d.splice(0, 1, l)) : (v = e.tokens) == null || v.shift() } }, extensions: [{ name: "alert", level: "block", renderer({ meta: e, tokens: o = [] }) { let t = `
    `; return t += `

    `, t += e.icon, t += e.title, t += `

    `, t += this.parser.parse(o), t += `
    `, t } }] } } return m }); +(function(i, n) { typeof exports == "object" && typeof module < "u" ? module.exports = n() : typeof define == "function" && define.amd ? define(n) : (i = typeof globalThis < "u" ? globalThis : i || self, i.markedAlert = n()) })(this, function() { "use strict"; const i = [{ type: "note", icon: ' ' }, { type: "tip", icon: ' ' }, { type: "important", icon: '' }, { type: "warning", icon: ' ' }, { type: "caution", icon: ' ' }]; function n(a) { return a.length ? Object.values([...i, ...a].reduce((s, c) => (s[c.type] = c, s), {})) : i } function d(a) { return `^(?:\\[!${a.toUpperCase()}])\\s*? *` } function f(a) { return a.slice(0, 1).toUpperCase() + a.slice(1).toLowerCase() } function g(a = {}) { const { className: s = "markdown-alert", variants: c = [] } = a, m = n(c); return { walkTokens(t) { var e, v, u; if (t.type !== "blockquote") return; const o = m.find(({ type: r }) => new RegExp(d(r)).test(t.text)); if (o) { const { type: r, icon: w, title: Z = f(r), titleClassName: x = `${s}-title` } = o, h = new RegExp(d(r)); Object.assign(t, { type: "alert", meta: { className: s, variant: r, icon: w, title: Z, titleClassName: x } }); const l = (e = t.tokens) == null ? void 0 : e[0]; if ((v = l.raw) == null ? void 0 : v.replace(h, "").trim()) { l.tokens = l.tokens.filter(y => y.type !== "br"); const p = l.tokens[0]; Object.assign(p, { raw: p.raw.replace(h, ""), text: p.text.replace(h, "") }) } else(u = t.tokens) == null || u.shift() } }, extensions: [{ name: "alert", level: "block", renderer({ meta: t, tokens: o = [] }) { let e = `
    `; return e += `

    `, e += t.icon, e += t.title, e += `

    `, e += this.parser.parse(o), e += `
    `, e } }] } } return g }); /* * marked-bidi 1.0.11 From 647c087099f052b832d39f776d28a7fd04e84b6d Mon Sep 17 00:00:00 2001 From: Ben Hatsor <34835685+benhatsor@users.noreply.github.com> Date: Wed, 30 Oct 2024 22:28:00 +0200 Subject: [PATCH 3/5] Update service-worker.js --- service-worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service-worker.js b/service-worker.js index dfd7b896a9..52d1b63dce 100644 --- a/service-worker.js +++ b/service-worker.js @@ -1,6 +1,6 @@ // update worker name when updating cached files -const WORKER_NAME = 'codeit-worker-v784'; +const WORKER_NAME = 'codeit-worker-v785'; self.importScripts('/worker/client-channel.js'); From d46fb016f0c2d795dba52a14cf6e2771c3b9a783 Mon Sep 17 00:00:00 2001 From: Ben Hatsor <34835685+benhatsor@users.noreply.github.com> Date: Sat, 30 Nov 2024 18:45:37 +0200 Subject: [PATCH 4/5] Update dev-marked-alert.js --- .../extensions/markdown/dev-marked-alert.js | 51 +++++++++---------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/live-view/extensions/markdown/dev-marked-alert.js b/live-view/extensions/markdown/dev-marked-alert.js index 49cd254020..04c46fbd17 100644 --- a/live-view/extensions/markdown/dev-marked-alert.js +++ b/live-view/extensions/markdown/dev-marked-alert.js @@ -2,7 +2,6 @@ typeof exports == "object" && typeof module < "u" ? module.exports = n() : typeof define == "function" && define.amd ? define(n) : (i = typeof globalThis < "u" ? globalThis : i || self, i.markedAlert = n()) })(this, function() { "use strict"; - const i = [{ type: "note", icon: ' ' @@ -29,66 +28,64 @@ *` } - function f(a) { + function g(a) { return a.slice(0, 1).toUpperCase() + a.slice(1).toLowerCase() } - function g(a = {}) { + function m(a = {}) { const { className: s = "markdown-alert", variants: c = [] - } = a, m = n(c); + } = a, w = n(c); return { - walkTokens(t) { - var e, v, u; - if (t.type !== "blockquote") return; - const o = m.find(({ + walkTokens(e) { + var t, v, u, f; + if (e.type !== "blockquote") return; + const o = w.find(({ type: r - }) => new RegExp(d(r)).test(t.text)); + }) => new RegExp(d(r)).test(e.text)); if (o) { const { type: r, - icon: w, - title: Z = f(r), - titleClassName: x = `${s}-title` + icon: Z, + title: x = g(r), + titleClassName: y = `${s}-title` } = o, h = new RegExp(d(r)); - Object.assign(t, { + Object.assign(e, { type: "alert", meta: { className: s, variant: r, - icon: w, - title: Z, - titleClassName: x + icon: Z, + title: x, + titleClassName: y } }); - const l = (e = t.tokens) == null ? void 0 : e[0]; + const l = (t = e.tokens) == null ? void 0 : t[0]; if ((v = l.raw) == null ? void 0 : v.replace(h, "").trim()) { - l.tokens = l.tokens.filter(y => y.type !== "br"); const p = l.tokens[0]; Object.assign(p, { raw: p.raw.replace(h, ""), text: p.text.replace(h, "") - }) - } else(u = t.tokens) == null || u.shift() + }), ((u = l.tokens[1]) == null ? void 0 : u.type) === "br" && l.tokens.splice(1, 1) + } else(f = e.tokens) == null || f.shift() } }, extensions: [{ name: "alert", level: "block", renderer({ - meta: t, + meta: e, tokens: o = [] }) { - let e = `
    + let t = `
    `; - return e += `

    `, e += t.icon, e += t.title, e += `

    -`, e += this.parser.parse(o), e += `
    -`, e + return t += `

    `, t += e.icon, t += e.title, t += `

    +`, t += this.parser.parse(o), t += `
    +`, t } }] } } - return g + return m }); - From f1b275edf48238048df020138d424ae357aa51b8 Mon Sep 17 00:00:00 2001 From: Ben Hatsor <34835685+benhatsor@users.noreply.github.com> Date: Sat, 30 Nov 2024 18:46:04 +0200 Subject: [PATCH 5/5] Update marked.min.js --- live-view/extensions/markdown/marked.min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/live-view/extensions/markdown/marked.min.js b/live-view/extensions/markdown/marked.min.js index ba292a429c..76e166a0e2 100644 --- a/live-view/extensions/markdown/marked.min.js +++ b/live-view/extensions/markdown/marked.min.js @@ -17,10 +17,10 @@ (function(h,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(h=typeof globalThis<"u"?globalThis:h||self,h.markedFootnote=p())})(this,function(){"use strict";function h(t,c){const n={type:"footnotes",raw:c,rawItems:[],items:[]};return{name:"footnote",level:"block",childTokens:["content"],tokenizer(r){t.hasFootnotes||(this.lexer.tokens.push(n),t.tokens=this.lexer.tokens,t.hasFootnotes=!0,n.rawItems=[],n.items=[]);const e=/^\[\^([^\]\n]+)\]:(?:[ \t]+|[\n]*?|$)([^\n]*?(?:\n|$)(?:\n*?[ ]{4,}[^\n]*)*)/.exec(r);if(e){const[o,f,u=""]=e;let l=u.split(` `).reduce((i,s)=>i+` `+s.replace(/^(?:[ ]{4}|[\t])/,""),"");const d=l.trimEnd().split(` `).pop();l+=d&&/^[ \t]*?[>\-*][ ]|[`]{3,}$|^[ \t]*?[|].+[|]$/.test(d)?` `:"";const a={type:"footnote",raw:o,label:f,refs:[],content:this.lexer.blockTokens(l)};return n.rawItems.push(a),a}},renderer(){return""}}}function p(t,c=!1){let n=0;return{name:"footnoteRef",level:"inline",tokenizer(r){const e=/^\[\^([^\]\n]+)\]/.exec(r);if(e){const[o,f]=e,u=this.lexer.tokens[0],l=u.rawItems.filter(s=>s.label===f);if(!l.length)return;const d=l[0],a=u.items.filter(s=>s.label===f)[0],i={type:"footnoteRef",raw:o,id:"",label:f};return a?(i.id=a.refs[0].id,a.refs.push(i)):(n++,i.id=String(n),d.refs.push(i),u.items.push(d)),i}},renderer({id:r,label:e}){n=0;const o=encodeURIComponent(e);return`${c?`[${r}]`:r}`}}}function $(t){return{name:"footnotes",renderer({raw:c,items:n=[]}){if(n.length===0)return"";const r=n.reduce((o,{label:f,content:u,refs:l})=>{const d=encodeURIComponent(f),a=this.parser.parse(u).trimEnd(),i=a.endsWith("

    ");let s=`
  • `;return s+=i?a.replace(/<\/p>$/,""):a,l.forEach((b,m)=>{s+=` ${m>0?`↩${m+1}`:"↩"}`}),s+=i?`

    `:` `,s+=`
  • `,o+s},"");let e=`
    `;return e+=`

    ${c.trimEnd()}

    `,e+=`
      ${r}
    `,e+=`
    `,e}}}function k(t={}){const{prefixId:c="footnote-",description:n="Footnotes",refMarkers:r}=t,e={hasFootnotes:!1,tokens:[]};return{extensions:[h(e,n),p(c,r),$(c)],walkTokens(o){o.type==="footnotes"&&e.tokens.indexOf(o)===0&&o.items.length&&(e.tokens[0]={type:"space",raw:""},e.tokens.push(o)),e.hasFootnotes&&(e.hasFootnotes=!1)}}}return k}); /* - * marked-alert 2.1.1 + * marked-alert 2.1.2 */ -(function(i, n) { typeof exports == "object" && typeof module < "u" ? module.exports = n() : typeof define == "function" && define.amd ? define(n) : (i = typeof globalThis < "u" ? globalThis : i || self, i.markedAlert = n()) })(this, function() { "use strict"; const i = [{ type: "note", icon: ' ' }, { type: "tip", icon: ' ' }, { type: "important", icon: '' }, { type: "warning", icon: ' ' }, { type: "caution", icon: ' ' }]; function n(a) { return a.length ? Object.values([...i, ...a].reduce((s, c) => (s[c.type] = c, s), {})) : i } function d(a) { return `^(?:\\[!${a.toUpperCase()}])\\s*? *` } function f(a) { return a.slice(0, 1).toUpperCase() + a.slice(1).toLowerCase() } function g(a = {}) { const { className: s = "markdown-alert", variants: c = [] } = a, m = n(c); return { walkTokens(t) { var e, v, u; if (t.type !== "blockquote") return; const o = m.find(({ type: r }) => new RegExp(d(r)).test(t.text)); if (o) { const { type: r, icon: w, title: Z = f(r), titleClassName: x = `${s}-title` } = o, h = new RegExp(d(r)); Object.assign(t, { type: "alert", meta: { className: s, variant: r, icon: w, title: Z, titleClassName: x } }); const l = (e = t.tokens) == null ? void 0 : e[0]; if ((v = l.raw) == null ? void 0 : v.replace(h, "").trim()) { l.tokens = l.tokens.filter(y => y.type !== "br"); const p = l.tokens[0]; Object.assign(p, { raw: p.raw.replace(h, ""), text: p.text.replace(h, "") }) } else(u = t.tokens) == null || u.shift() } }, extensions: [{ name: "alert", level: "block", renderer({ meta: t, tokens: o = [] }) { let e = `
    `; return e += `

    `, e += t.icon, e += t.title, e += `

    `, e += this.parser.parse(o), e += `
    `, e } }] } } return g }); +(function(i, n) { typeof exports == "object" && typeof module < "u" ? module.exports = n() : typeof define == "function" && define.amd ? define(n) : (i = typeof globalThis < "u" ? globalThis : i || self, i.markedAlert = n()) })(this, function() { "use strict"; const i = [{ type: "note", icon: ' ' }, { type: "tip", icon: ' ' }, { type: "important", icon: '' }, { type: "warning", icon: ' ' }, { type: "caution", icon: ' ' }]; function n(a) { return a.length ? Object.values([...i, ...a].reduce((s, c) => (s[c.type] = c, s), {})) : i } function d(a) { return `^(?:\\[!${a.toUpperCase()}])\\s*? *` } function g(a) { return a.slice(0, 1).toUpperCase() + a.slice(1).toLowerCase() } function m(a = {}) { const { className: s = "markdown-alert", variants: c = [] } = a, w = n(c); return { walkTokens(e) { var t, v, u, f; if (e.type !== "blockquote") return; const o = w.find(({ type: r }) => new RegExp(d(r)).test(e.text)); if (o) { const { type: r, icon: Z, title: x = g(r), titleClassName: y = `${s}-title` } = o, h = new RegExp(d(r)); Object.assign(e, { type: "alert", meta: { className: s, variant: r, icon: Z, title: x, titleClassName: y } }); const l = (t = e.tokens) == null ? void 0 : t[0]; if ((v = l.raw) == null ? void 0 : v.replace(h, "").trim()) { const p = l.tokens[0]; Object.assign(p, { raw: p.raw.replace(h, ""), text: p.text.replace(h, "") }), ((u = l.tokens[1]) == null ? void 0 : u.type) === "br" && l.tokens.splice(1, 1) } else(f = e.tokens) == null || f.shift() } }, extensions: [{ name: "alert", level: "block", renderer({ meta: e, tokens: o = [] }) { let t = `
    `; return t += `

    `, t += e.icon, t += e.title, t += `

    `, t += this.parser.parse(o), t += `
    `, t } }] } } return m }); /* * marked-bidi 1.0.11