fix loading, minify with rollup

This commit is contained in:
j 2026-02-18 17:02:08 +01:00
commit dd5237e4ed
156 changed files with 794 additions and 971 deletions

45
source/Ox/Ox.js Normal file
View file

@ -0,0 +1,45 @@
'use strict';
import Ox from './js/Ox.Global.js';
import './js/Core.js';
import './js/Function.js';
import './js/Polyfill.js';
import './js/Array.js';
import './js/String.js';
import './js/Collection.js';
import './js/Math.js';
import './js/Async.js';
import './js/Color.js';
import './js/Constants.js';
import './js/Date.js';
import './js/DOM.js';
import './js/Encoding.js';
import './js/Format.js';
import './js/Geo.js';
import './js/Hash.js';
import './js/HTML.js';
import './js/JavaScript.js';
import './js/Locale.js';
import './js/Object.js';
import './js/RegExp.js';
import './js/Request.js';
import './js/Type.js';
import './js/Video.js';
export default Ox;
export { Ox };
// For backward compatibility with global usage
if (typeof globalThis !== 'undefined') {
// FIXME: examples/ui/widget_design_patterns writes to Ox before load
if (typeof globalThis.Ox != 'undefined') {
Object.keys(globalThis.Ox).forEach(key => {
if (typeof Ox[key] == 'undefined') {
Ox[key] = globalThis.Ox[key]
}
})
}
globalThis.Ox = Ox;
}

View file

@ -1,37 +0,0 @@
'use strict';
import Ox from './js/Namespace.js';
import * as Ox_Core from './js/Core.js';
import * as Ox_Function from './js/Function.js';
import * as Ox_Polyfill from './js/Polyfill.js';
import * as Ox_Array from './js/Array.js';
import * as Ox_String from './js/String.js';
import * as Ox_Collection from './js/Collection.js';
import * as Ox_Math from './js/Math.js';
import * as Ox_Async from './js/Async.js';
import * as Ox_Color from './js/Color.js';
import * as Ox_Constants from './js/Constants.js';
import * as Ox_Date from './js/Date.js';
import * as Ox_DOM from './js/DOM.js';
import * as Ox_Encoding from './js/Encoding.js';
import * as Ox_Format from './js/Format.js';
import * as Ox_Geo from './js/Geo.js';
import * as Ox_Hash from './js/Hash.js';
import * as Ox_HTML from './js/HTML.js';
import * as Ox_JavaScript from './js/JavaScript.js';
import * as Ox_Locale from './js/Locale.js';
import * as Ox_Object from './js/Object.js';
import * as Ox_RegExp from './js/RegExp.js';
import * as Ox_Request from './js/Request.js';
import * as Ox_Type from './js/Type.js';
import * as Ox_Video from './js/Video.js';
export default Ox;
export { Ox };
// For backward compatibility with global usage
if (typeof globalThis !== 'undefined') {
globalThis.Ox = Ox;
}

View file

@ -1,6 +1,6 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.api <f> Turns an array into a list API

View file

@ -1,6 +1,6 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
(function() {

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.avg <f> Returns the average of an array's values, or an object's properties

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.hsl <f> Takes RGB values and returns HSL values

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
//@ Ox.AMPM <[s]> ['AM', 'PM']
Ox.AMPM = ['AM', 'PM'];

View file

@ -2,7 +2,7 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.load <f> Loads OxJS and, optionally, one or more modules
@ -79,7 +79,7 @@ Ox.load = function() {
fn(function() {
Ox.forEach(modules, async function(options, module) {
console.log("load module!", module, options)
const obj = await import('../../' + module + '/index.js?' + Ox.VERSION);
const obj = await import(Ox.PATH + module + '/' + module + '.js?' + Ox.VERSION);
Ox.load[module](options, function(success) {
succeeded += success;
if (++loaded == length) {

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.$ <f> Generic HTML element, mimics jQuery

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
//@ Ox.getDate <f> Get the day of a date, optionally UTC
// see Ox.setSeconds for source code

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.encodeBase26 <b> Encode a number as bijective base26

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.formatArea <f> Formats a number of meters as square meters or kilometers

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.cache <f> Memoize a function

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
(function() {

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
(function() {

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.oshash <f> Calculates oshash for a given file or blob object. Async.

View file

@ -1,5 +1,7 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
var globalEval = eval;
/*@
Ox.doc <f> Generates documentation for annotated JavaScript
@ -828,7 +830,7 @@ Ox.test = function(argument, callback) {
);
}
Ox.Log('TEST', statement);
actual = eval(statement);
actual = globalEval(statement);
if (!isAsync && test.expected) {
Ox.test.data[id].results.push({
actual: stringifyResult(actual),
@ -837,7 +839,7 @@ Ox.test = function(argument, callback) {
section: item.section,
statement: statement,
passed: Ox.isEqual(
actual, eval('(' + test.expected + ')')
actual, globalEval('(' + test.expected + ')')
)
});
}

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
(function() {

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.acosh <f> Inverse hyperbolic cosine

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.extend <function> Extends an object with one or more other objects

View file

@ -1,5 +1,7 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
var globalEval = eval;
(function(window) {
@ -210,7 +212,7 @@ import Ox from './Namespace.js';
}
return {
parse: function parse(string) {
return eval('(' + string + ')');
return globalEval('(' + string + ')');
},
stringify: function stringify(value) {
var ret = 'null', type = Ox.typeOf(value);
@ -397,7 +399,7 @@ import Ox from './Namespace.js';
].forEach(function(item) {
var object = item[0], keys = item[1];
keys.forEach(function(key) {
if (!key in object) {
if (!(key in object)) {
if (canDefineProperty) {
Object.defineProperty(object, key, {
configurable: true,

View file

@ -1,4 +1,4 @@
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.escapeRegExp <f> Escapes a string for use in a regular expression

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.get <f> Get a remote resource

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.char <f> Alias for String.fromCharCode

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.checkType <f> Throws a TypeError if a value is not of a given type

View file

@ -1,5 +1,5 @@
'use strict';
import Ox from './Namespace.js';
import Ox from './Ox.Global.js';
/*@
Ox.getVideoFormat <f> Get supported video format