Skip to content

Commit

Permalink
Release v1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Feb 23, 2022
1 parent b645d97 commit ad2918b
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 67 deletions.
6 changes: 4 additions & 2 deletions dist/pretty-print-json.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*! pretty-print-json v1.2.2 ~~ https://pretty-print-json.js.org ~~ MIT License */
/*! pretty-print-json v1.2.3 ~~ https://pretty-print-json.js.org ~~ MIT License */

/* Layout */
.json-container { font-family: menlo, consolas, monospace; font-style: normal; font-weight: bold; line-height: 1.4em; font-size: 0.9rem; transition: background-color 400ms; }
a.json-link { text-decoration: none; border-bottom: 1px solid; outline: none; }
a.json-link:hover { background-color: transparent; outline: none; }
ol.json-lines { white-space: normal; padding-inline-start: 3em; margin: 0px; }
ol.json-lines >li { white-space: pre; text-indent: 0.7em; line-height: 1.5em; padding: 0px; }
ol.json-lines >li::marker { font-family: system-ui, sans-serif; font-weight: normal; }
Expand Down Expand Up @@ -35,7 +37,7 @@ ol.json-lines >li:hover { background-color: lemonchiffon; }
.dark-mode a.json-link { color: mediumorchid; }
.dark-mode a.json-link:visited { color: slategray; }
.dark-mode a.json-link:hover { color: violet; }
.dark-mode a.json-link:active { color: silver; }
.dark-mode a.json-link:active { color: slategray; }
.dark-mode ol.json-lines >li::marker { color: silver; }
.dark-mode ol.json-lines >li:nth-child(odd) { background-color: #222222; }
.dark-mode ol.json-lines >li:nth-child(even) { background-color: #161616; }
Expand Down
2 changes: 1 addition & 1 deletion dist/pretty-print-json.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! pretty-print-json v1.2.2 ~~ https://pretty-print-json.js.org ~~ MIT License
//! pretty-print-json v1.2.3 ~~ https://pretty-print-json.js.org ~~ MIT License

export declare type FormatOptions = {
indent?: number;
Expand Down
6 changes: 4 additions & 2 deletions dist/pretty-print-json.dark-mode.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*! pretty-print-json v1.2.2 ~~ https://pretty-print-json.js.org ~~ MIT License */
/*! pretty-print-json v1.2.3 ~~ https://pretty-print-json.js.org ~~ MIT License */

/* Layout */
.json-container { font-family: menlo, consolas, monospace; font-style: normal; font-weight: bold; line-height: 1.4em; font-size: 0.9rem; transition: background-color 400ms; }
a.json-link { text-decoration: none; border-bottom: 1px solid; outline: none; }
a.json-link:hover { background-color: transparent; outline: none; }
ol.json-lines { white-space: normal; padding-inline-start: 3em; margin: 0px; }
ol.json-lines >li { white-space: pre; text-indent: 0.7em; line-height: 1.5em; padding: 0px; }
ol.json-lines >li::marker { font-family: system-ui, sans-serif; font-weight: normal; }
Expand All @@ -18,7 +20,7 @@ ol.json-lines >li::marker { font-family: system-ui, sans-serif; font-weight: nor
a.json-link { color: mediumorchid; }
a.json-link:visited { color: slategray; }
a.json-link:hover { color: violet; }
a.json-link:active { color: silver; }
a.json-link:active { color: slategray; }
ol.json-lines >li::marker { color: silver; }
ol.json-lines >li:nth-child(odd) { background-color: #222222; }
ol.json-lines >li:nth-child(even) { background-color: #161616; }
Expand Down
15 changes: 7 additions & 8 deletions dist/pretty-print-json.dev.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! pretty-print-json v1.2.2 ~~ https://pretty-print-json.js.org ~~ MIT License
//! pretty-print-json v1.2.3 ~~ https://pretty-print-json.js.org ~~ MIT License

const prettyPrintJson = {
version: '1.2.2',
version: '1.2.3',
toHtml(thing, options) {
const defaults = { indent: 3, lineNumbers: false, linkUrls: true, quoteKeys: false };
const settings = { ...defaults, ...options };
Expand All @@ -21,8 +21,6 @@ const prettyPrintJson = {
const display = strType && settings.linkUrls ? value.replace(urlRegex, makeLink) : value;
return spanTag(type, display);
};
const lineTag = (s) => ` <li>${s}</li>`;
const orderedListTag = (s) => ['<ol class=json-lines>', s, '</ol>'].join('\n');
const replacer = (match, p1, p2, p3, p4) => {
const part = { indent: p1, key: p2, value: p3, end: p4 };
const findName = settings.quoteKeys ? /(.*)(): / : /"([\w$]+)": |(.*): /;
Expand All @@ -31,13 +29,14 @@ const prettyPrintJson = {
const keyHtml = part.key ? spanTag('key', keyName) + spanTag('mark', ': ') : '';
const valueHtml = part.value ? buildValueHtml(part.value) : '';
const endHtml = spanTag('mark', part.end);
const result = indentHtml + keyHtml + valueHtml + endHtml;
return settings.lineNumbers ? lineTag(result) : result;
return indentHtml + keyHtml + valueHtml + endHtml;
};
const jsonLine = /^( *)("[^"]+": )?("[^"]*"|[\w.+-]*)?([{}[\],]*)?$/mg;
const json = JSON.stringify(thing, null, settings.indent) || 'undefined';
const result = htmlEntities(json).replace(jsonLine, replacer);
return settings.lineNumbers ? orderedListTag(result) : result;
const html = htmlEntities(json).replace(jsonLine, replacer);
const makeLine = (line) => ` <li>${line}</li>`;
const addLineNumbers = (html) => ['<ol class=json-lines>', ...html.split('\n').map(makeLine), '</ol>'].join('\n');
return settings.lineNumbers ? addLineNumbers(html) : html;
},
};
if (typeof window === "object") window.prettyPrintJson = prettyPrintJson;
15 changes: 7 additions & 8 deletions dist/pretty-print-json.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! pretty-print-json v1.2.2 ~~ https://pretty-print-json.js.org ~~ MIT License
//! pretty-print-json v1.2.3 ~~ https://pretty-print-json.js.org ~~ MIT License

const prettyPrintJson = {
version: '1.2.2',
version: '1.2.3',
toHtml(thing, options) {
const defaults = { indent: 3, lineNumbers: false, linkUrls: true, quoteKeys: false };
const settings = { ...defaults, ...options };
Expand All @@ -21,8 +21,6 @@ const prettyPrintJson = {
const display = strType && settings.linkUrls ? value.replace(urlRegex, makeLink) : value;
return spanTag(type, display);
};
const lineTag = (s) => ` <li>${s}</li>`;
const orderedListTag = (s) => ['<ol class=json-lines>', s, '</ol>'].join('\n');
const replacer = (match, p1, p2, p3, p4) => {
const part = { indent: p1, key: p2, value: p3, end: p4 };
const findName = settings.quoteKeys ? /(.*)(): / : /"([\w$]+)": |(.*): /;
Expand All @@ -31,13 +29,14 @@ const prettyPrintJson = {
const keyHtml = part.key ? spanTag('key', keyName) + spanTag('mark', ': ') : '';
const valueHtml = part.value ? buildValueHtml(part.value) : '';
const endHtml = spanTag('mark', part.end);
const result = indentHtml + keyHtml + valueHtml + endHtml;
return settings.lineNumbers ? lineTag(result) : result;
return indentHtml + keyHtml + valueHtml + endHtml;
};
const jsonLine = /^( *)("[^"]+": )?("[^"]*"|[\w.+-]*)?([{}[\],]*)?$/mg;
const json = JSON.stringify(thing, null, settings.indent) || 'undefined';
const result = htmlEntities(json).replace(jsonLine, replacer);
return settings.lineNumbers ? orderedListTag(result) : result;
const html = htmlEntities(json).replace(jsonLine, replacer);
const makeLine = (line) => ` <li>${line}</li>`;
const addLineNumbers = (html) => ['<ol class=json-lines>', ...html.split('\n').map(makeLine), '</ol>'].join('\n');
return settings.lineNumbers ? addLineNumbers(html) : html;
},
};
export { prettyPrintJson };
4 changes: 2 additions & 2 deletions dist/pretty-print-json.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions dist/pretty-print-json.umd.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! pretty-print-json v1.2.2 ~~ https://pretty-print-json.js.org ~~ MIT License
//! pretty-print-json v1.2.3 ~~ https://pretty-print-json.js.org ~~ MIT License

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
Expand All @@ -13,7 +13,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.prettyPrintJson = void 0;
const prettyPrintJson = {
version: '1.2.2',
version: '1.2.3',
toHtml(thing, options) {
const defaults = { indent: 3, lineNumbers: false, linkUrls: true, quoteKeys: false };
const settings = { ...defaults, ...options };
Expand All @@ -33,8 +33,6 @@
const display = strType && settings.linkUrls ? value.replace(urlRegex, makeLink) : value;
return spanTag(type, display);
};
const lineTag = (s) => ` <li>${s}</li>`;
const orderedListTag = (s) => ['<ol class=json-lines>', s, '</ol>'].join('\n');
const replacer = (match, p1, p2, p3, p4) => {
const part = { indent: p1, key: p2, value: p3, end: p4 };
const findName = settings.quoteKeys ? /(.*)(): / : /"([\w$]+)": |(.*): /;
Expand All @@ -43,13 +41,14 @@
const keyHtml = part.key ? spanTag('key', keyName) + spanTag('mark', ': ') : '';
const valueHtml = part.value ? buildValueHtml(part.value) : '';
const endHtml = spanTag('mark', part.end);
const result = indentHtml + keyHtml + valueHtml + endHtml;
return settings.lineNumbers ? lineTag(result) : result;
return indentHtml + keyHtml + valueHtml + endHtml;
};
const jsonLine = /^( *)("[^"]+": )?("[^"]*"|[\w.+-]*)?([{}[\],]*)?$/mg;
const json = JSON.stringify(thing, null, settings.indent) || 'undefined';
const result = htmlEntities(json).replace(jsonLine, replacer);
return settings.lineNumbers ? orderedListTag(result) : result;
const html = htmlEntities(json).replace(jsonLine, replacer);
const makeLine = (line) => ` <li>${line}</li>`;
const addLineNumbers = (html) => ['<ol class=json-lines>', ...html.split('\n').map(makeLine), '</ol>'].join('\n');
return settings.lineNumbers ? addLineNumbers(html) : html;
},
};
exports.prettyPrintJson = prettyPrintJson;
Expand Down
6 changes: 3 additions & 3 deletions docs/dynamic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<link rel=preconnect href=https://fonts.gstatic.com crossorigin>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/[email protected]/dist/dna.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/web-ignition@1.4/dist/reset.min.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/web-ignition@1.5/dist/reset.min.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/[email protected]/dist/pretty-print-json.css>
<style>
body {
Expand Down Expand Up @@ -48,7 +48,7 @@ <h2>ES Module Dynamic Loading</h2>

<main>
<p>Page load:<br><code></code></p>
<p><button>Load Module</button></p>
<p><button>Load Module Now</button></p>
<pre><output></output></pre>
</main>

Expand All @@ -60,7 +60,7 @@ <h2>ES Module Dynamic Loading</h2>

<script src=https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js></script>
<script src=https://cdn.jsdelivr.net/npm/[email protected]/dist/dna.min.js></script>
<script src=https://cdn.jsdelivr.net/npm/web-ignition@1.4/dist/lib-x.min.js></script>
<script src=https://cdn.jsdelivr.net/npm/web-ignition@1.5/dist/lib-x.min.js></script>
<script>
const app = {
loadModule(module) {
Expand Down
Loading

0 comments on commit ad2918b

Please sign in to comment.