Skip to content

Commit

Permalink
Release v2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Jun 16, 2023
1 parent e4ee459 commit bab6cfc
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 86 deletions.
2 changes: 1 addition & 1 deletion dist/css/pretty-print-json.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! pretty-print-json v2.0.1 ~~ https://pretty-print-json.js.org ~~ MIT License */
/*! pretty-print-json v2.0.2 ~~ 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; }
Expand Down
2 changes: 1 addition & 1 deletion dist/css/pretty-print-json.dark-mode.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! pretty-print-json v2.0.1 ~~ https://pretty-print-json.js.org ~~ MIT License */
/*! pretty-print-json v2.0.2 ~~ 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; }
Expand Down
2 changes: 1 addition & 1 deletion dist/css/pretty-print-json.dark-mode.min.css

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

2 changes: 1 addition & 1 deletion dist/css/pretty-print-json.min.css

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

2 changes: 1 addition & 1 deletion dist/css/pretty-print-json.prefers.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! pretty-print-json v2.0.1 ~~ https://pretty-print-json.js.org ~~ MIT License */
/*! pretty-print-json v2.0.2 ~~ 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; }
Expand Down
2 changes: 1 addition & 1 deletion dist/css/pretty-print-json.prefers.min.css

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

4 changes: 2 additions & 2 deletions dist/pretty-print-json.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! pretty-print-json v2.0.1 ~~ https://pretty-print-json.js.org ~~ MIT License
//! pretty-print-json v2.0.2 ~~ https://pretty-print-json.js.org ~~ MIT License

export type FormatSettings = {
indent: number;
Expand All @@ -12,6 +12,6 @@ export type FormatOptions = Partial<FormatSettings>;
export type JsonType = 'key' | 'string' | 'number' | 'boolean' | 'null' | 'mark';
declare const prettyPrintJson: {
version: string;
toHtml(thing: unknown, options?: FormatOptions): string;
toHtml(data: unknown, options?: FormatOptions): string;
};
export { prettyPrintJson };
8 changes: 4 additions & 4 deletions dist/pretty-print-json.dev.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! pretty-print-json v2.0.1 ~~ https://pretty-print-json.js.org ~~ MIT License
//! pretty-print-json v2.0.2 ~~ https://pretty-print-json.js.org ~~ MIT License

const prettyPrintJson = {
version: '2.0.1',
toHtml(thing, options) {
version: '2.0.2',
toHtml(data, options) {
const defaults = {
indent: 3,
lineNumbers: false,
Expand Down Expand Up @@ -43,7 +43,7 @@ const prettyPrintJson = {
return indentHtml + keyHtml + valueHtml + endHtml;
};
const jsonLine = /^( *)("[^"]+": )?("[^"]*"|[\w.+-]*)?([{}[\],]*)?$/mg;
const json = JSON.stringify(thing, null, settings.indent) || 'undefined';
const json = JSON.stringify(data, null, settings.indent) || 'undefined';
const html = json.replace(invalidHtml, toHtml).replace(jsonLine, replacer);
const makeLine = (line) => ` <li>${line}</li>`;
const addLineNumbers = (html) => ['<ol class=json-lines>', ...html.split('\n').map(makeLine), '</ol>'].join('\n');
Expand Down
8 changes: 4 additions & 4 deletions dist/pretty-print-json.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! pretty-print-json v2.0.1 ~~ https://pretty-print-json.js.org ~~ MIT License
//! pretty-print-json v2.0.2 ~~ https://pretty-print-json.js.org ~~ MIT License

const prettyPrintJson = {
version: '2.0.1',
toHtml(thing, options) {
version: '2.0.2',
toHtml(data, options) {
const defaults = {
indent: 3,
lineNumbers: false,
Expand Down Expand Up @@ -43,7 +43,7 @@ const prettyPrintJson = {
return indentHtml + keyHtml + valueHtml + endHtml;
};
const jsonLine = /^( *)("[^"]+": )?("[^"]*"|[\w.+-]*)?([{}[\],]*)?$/mg;
const json = JSON.stringify(thing, null, settings.indent) || 'undefined';
const json = JSON.stringify(data, null, settings.indent) || 'undefined';
const html = json.replace(invalidHtml, toHtml).replace(jsonLine, replacer);
const makeLine = (line) => ` <li>${line}</li>`;
const addLineNumbers = (html) => ['<ol class=json-lines>', ...html.split('\n').map(makeLine), '</ol>'].join('\n');
Expand Down
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.

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

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
Expand All @@ -13,8 +13,8 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.prettyPrintJson = void 0;
const prettyPrintJson = {
version: '2.0.1',
toHtml(thing, options) {
version: '2.0.2',
toHtml(data, options) {
const defaults = {
indent: 3,
lineNumbers: false,
Expand Down Expand Up @@ -55,7 +55,7 @@
return indentHtml + keyHtml + valueHtml + endHtml;
};
const jsonLine = /^( *)("[^"]+": )?("[^"]*"|[\w.+-]*)?([{}[\],]*)?$/mg;
const json = JSON.stringify(thing, null, settings.indent) || 'undefined';
const json = JSON.stringify(data, null, settings.indent) || 'undefined';
const html = json.replace(invalidHtml, toHtml).replace(jsonLine, replacer);
const makeLine = (line) => ` <li>${line}</li>`;
const addLineNumbers = (html) => ['<ol class=json-lines>', ...html.split('\n').map(makeLine), '</ol>'].join('\n');
Expand Down
27 changes: 14 additions & 13 deletions docs/dynamic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<link rel=preconnect href=https://fonts.gstatic.com crossorigin>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4/css/all.min.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/pretty-print-json@2.0/dist/css/pretty-print-json.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/dna-engine@2.3/dist/dna-engine.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/web-ignition@1.7/dist/reset.min.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/dna-engine@3.0/dist/dna-engine.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/web-ignition@2.0/dist/reset.min.css>
<style>
body {
max-width: 700px;
Expand All @@ -42,17 +42,16 @@
opacity: 1;
}
</style>
<script defer src=https://cdn.jsdelivr.net/npm/jquery@3.6/dist/jquery.min.js></script>
<script defer src=https://cdn.jsdelivr.net/npm/dna-engine@2.3/dist/dna-engine.min.js></script>
<script defer src=https://cdn.jsdelivr.net/npm/web-ignition@1.7/dist/lib-x.min.js></script>
<script defer src=https://cdn.jsdelivr.net/npm/dna-engine@3.0/dist/dna-engine.min.js></script>
<script defer src=https://cdn.jsdelivr.net/npm/web-ignition@2.0/dist/lib-x.min.js></script>
<script data-on-load=app.setup data-wait-for=libX>
const app = {
loadModule(module) {
const buttonClicked = new Date();
const url = 'https://cdn.jsdelivr.net/npm/pretty-print-json@2.0/dist/pretty-print-json.js';
$('main pre').addClass('active');
globalThis.document.querySelectorAll('main pre').classList.add('active');
import(url).then(module => {
const pageLoaded = $('body').data().pageLoaded;
const pageLoaded = Number(globalThis.document.body.dataset.pageLoaded);
const moduleLoaded = new Date();
const message = {
message: 'ES Module Dynamic Loading',
Expand All @@ -67,15 +66,17 @@
loadModule: moduleLoaded - buttonClicked,
},
};
const html = module.prettyPrintJson.toHtml(message);
$('main output').hide().html(html).slideDown();
const html = module.prettyPrintJson.toHtml(message);
const output = globalThis.document.querySelector('main output');
output.innerHTML = html;
dna.ui.fadeSlideIn(output);
});
},
setup() {
const pageLoaded = new Date();
$('body').data().pageLoaded = pageLoaded;
$('main code').text(pageLoaded.toString());
$('main button').on({ click: app.loadModule });
const pageLoaded = String(new Date());
globalThis.document.body.dataset.pageLoaded = pageLoaded;
globalThis.document.querySelector('main code').textContent = pageLoaded;
dna.dom.onClick(app.loadModule, 'main button');
libX.ui.autoDisableButtons();
},
};
Expand Down
Loading

0 comments on commit bab6cfc

Please sign in to comment.