client: use JSON5 as exported

This commit is contained in:
jean-emmanuel 2025-09-18 00:11:33 +02:00
parent ca2fce8d05
commit 55ea9f5f0b
5 changed files with 15 additions and 14 deletions

View file

@ -1,5 +1,6 @@
import osc from '../../osc.mjs'
import {isJSON, isJSONObject} from '../../utils.mjs'
import {JSON5} from '../../globals.mjs'
export default class OscReceiver {
@ -9,7 +10,7 @@ export default class OscReceiver {
if (typeof value === 'string' && isJSON(value)) {
try {
this.value = JSON.parseFlex(value)
this.value = JSON5.parse(value)
} catch (err) {
this.value = value
}
@ -72,7 +73,7 @@ export default class OscReceiver {
if (value.length < 2) value = value[0]
if (typeof value === 'string' && isJSONObject(value)) {
try {
this.value = JSON.parseFlex(value)
this.value = JSON5.parse(value)
} catch (err) {
this.value = value
}

View file

@ -11,7 +11,7 @@ import * as resize from '../../events/resize.mjs'
import OscReceiver from './osc-receiver.mjs'
import {deepCopy, deepEqual, isJSON} from '../../utils.mjs'
import Script from '../scripts/script.mjs'
import {PXSCALE} from '../../globals.mjs'
import {PXSCALE, JSON5} from '../../globals.mjs'
var updateWidget = ()=>{},
uiConsole, widgetTree, widgetDragResize, sessionManager
@ -712,7 +712,7 @@ class Widget extends EventEmitter {
if (typeof value === 'string' && isJSON(value)) {
try {
value = JSON.parseFlex(value)
value = JSON5.parse(value)
} catch (err) {}
}

View file

@ -2,7 +2,7 @@ import html from 'nanohtml'
import {mapToScale} from '../utils.mjs'
import Canvas from '../common/canvas.mjs'
import StaticProperties from '../mixins/static_properties.mjs'
import {PXSCALE} from '../../globals.mjs'
import {PXSCALE, JSON5} from '../../globals.mjs'
export default class Plot extends StaticProperties(Canvas, {bypass: true}) {
@ -227,7 +227,7 @@ export default class Plot extends StaticProperties(Canvas, {bypass: true}) {
if (typeof v == 'string') {
try {
v = JSON.parseFlex(v)
v = JSON5.parse(v)
} catch(err) {}
}