onejs-core 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +2 -2
- package/.prettierrc +5 -5
- package/.vscode/settings.json +5 -5
- package/LICENSE +20 -20
- package/README.md +102 -102
- package/definitions/Assemblies/OneJS.Runtime.Ext.d.ts +6 -6
- package/definitions/Assemblies/OneJS.Runtime.d.ts +826 -826
- package/definitions/Assemblies/OneJS.Samples.d.ts +20 -20
- package/definitions/Assemblies/Unity.Mathematics.d.ts +9221 -9221
- package/definitions/Assemblies/UnityEditor.CoreModule.d.ts +32614 -32614
- package/definitions/Assemblies/UnityEngine.AIModule.d.ts +998 -998
- package/definitions/Assemblies/UnityEngine.AnimationModule.d.ts +3308 -3308
- package/definitions/Assemblies/UnityEngine.AssetBundleModule.d.ts +337 -337
- package/definitions/Assemblies/UnityEngine.AudioModule.d.ts +1154 -1154
- package/definitions/Assemblies/UnityEngine.CoreModule.d.ts +29587 -29587
- package/definitions/Assemblies/UnityEngine.PhysicsModule.d.ts +3137 -3137
- package/definitions/Assemblies/UnityEngine.TerrainModule.d.ts +1270 -1270
- package/definitions/Assemblies/UnityEngine.UIElementsModule.d.ts +32718 -32718
- package/definitions/Assemblies/UnityEngine.UnityAnalyticsCommonModule.d.ts +274 -274
- package/definitions/Assemblies/index.d.ts +16 -16
- package/definitions/Assemblies/mscorlib.d.ts +19416 -19416
- package/definitions/augments.d.ts +66 -66
- package/definitions/globals.d.ts +53 -53
- package/definitions/index.d.ts +11 -11
- package/definitions/jsx.d.ts +570 -570
- package/definitions/modules.d.ts +32 -32
- package/definitions/onejs.d.ts +171 -171
- package/definitions/preact.jsx.d.ts +6 -6
- package/definitions/proto-overrides.d.ts +41 -41
- package/definitions/puerts.d.ts +30 -30
- package/definitions/unity-engine.d.ts +22 -22
- package/dist/csharp/index.d.ts +3 -0
- package/dist/csharp/index.js +3 -0
- package/dist/dom/document.d.ts +30 -0
- package/dist/dom/document.js +89 -0
- package/dist/dom/dom-style.d.ts +9 -0
- package/dist/dom/dom-style.js +27 -0
- package/dist/dom/dom.d.ts +83 -0
- package/dist/dom/dom.js +313 -0
- package/dist/dom/index.d.ts +4 -0
- package/dist/dom/index.js +4 -0
- package/dist/dom/selector.d.ts +0 -0
- package/dist/dom/selector.js +0 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +45 -0
- package/dist/math/index.d.ts +86 -0
- package/dist/math/index.js +361 -0
- package/dist/preloads/inject.d.ts +3 -0
- package/dist/preloads/inject.js +36 -0
- package/dist/styling/index.d.ts +10 -0
- package/dist/styling/index.js +28 -0
- package/dist/styling/utils/generateAlphabeticName.d.ts +1 -0
- package/dist/styling/utils/generateAlphabeticName.js +16 -0
- package/dist/styling/utils/generateComponentId.d.ts +1 -0
- package/dist/styling/utils/generateComponentId.js +5 -0
- package/dist/styling/utils/hash.d.ts +5 -0
- package/dist/styling/utils/hash.js +34 -0
- package/dist/utils/arrays.d.ts +1 -0
- package/dist/utils/arrays.js +10 -0
- package/dist/utils/color-palettes.d.ts +2 -0
- package/dist/utils/color-palettes.js +2 -0
- package/dist/utils/color-parser.d.ts +161 -0
- package/dist/utils/color-parser.js +241 -0
- package/dist/utils/float-parser.d.ts +7 -0
- package/dist/utils/float-parser.js +23 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.js +15 -0
- package/dist/utils/responsive.d.ts +4 -0
- package/dist/utils/responsive.js +23 -0
- package/dist/utils/subscribe.d.ts +4 -0
- package/dist/utils/subscribe.js +10 -0
- package/dist/utils/system.d.ts +1 -0
- package/dist/utils/system.js +16 -0
- package/dist/utils/toJsArray.d.ts +1 -0
- package/dist/utils/toJsArray.js +10 -0
- package/dom/document.ts +115 -115
- package/dom/dom-style.ts +36 -36
- package/dom/dom.ts +376 -376
- package/dom/index.ts +3 -3
- package/index.ts +59 -59
- package/jsr.json +9 -9
- package/math/README.md +212 -212
- package/math/index.ts +487 -487
- package/package.json +33 -33
- package/preloads/inject.ts +43 -43
- package/scripts/esbuild/copy-assets.mjs +94 -94
- package/scripts/esbuild/decorator-fix.mjs +17 -17
- package/scripts/esbuild/import-transform.mjs +100 -100
- package/scripts/esbuild/index.mjs +3 -3
- package/scripts/esbuild/watch-output.mjs +38 -38
- package/scripts/postcss/cleanup-plugin.cjs +89 -89
- package/scripts/postcss/onejs-tw-config.cjs +252 -252
- package/scripts/postcss/optional-import-plugin.cjs +26 -26
- package/scripts/postcss/tailwind-logging-plugin.cjs +11 -11
- package/scripts/postcss/unwrap-is-plugin.cjs +16 -16
- package/scripts/postcss/uss-transform-plugin.cjs +92 -92
- package/scripts/switch.cjs +290 -290
- package/styling/index.tsx +32 -32
- package/styling/utils/generateAlphabeticName.ts +20 -20
- package/styling/utils/generateComponentId.ts +5 -5
- package/styling/utils/hash.ts +46 -46
- package/tsconfig.json +24 -24
- package/typings.d.ts +5 -5
- package/utils/arrays.ts +10 -10
- package/utils/color-palettes.ts +2 -2
- package/utils/color-parser.ts +248 -248
- package/utils/float-parser.ts +30 -30
- package/utils/index.ts +15 -15
- package/utils/subscribe.ts +16 -16
- package/utils/system.ts +16 -16
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
export function outputWatcherPlugin(options = {}) {
|
|
2
|
-
return {
|
|
3
|
-
name: "onejs-watch-output",
|
|
4
|
-
setup(build) {
|
|
5
|
-
build.onStart(() => {
|
|
6
|
-
// Clear the terminal
|
|
7
|
-
process.stdout.write('\x1Bc');
|
|
8
|
-
console.log("[esbuild] starting build...");
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
build.onEnd((result) => {
|
|
12
|
-
console.log("[esbuild] watching...");
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Keeping this one for backward-compatibility reasons. Please use `outputWatcherPlugin` instead.
|
|
20
|
-
*/
|
|
21
|
-
export const watchOutputPlugin = {
|
|
22
|
-
name: "onejs-watch-output",
|
|
23
|
-
setup(build) {
|
|
24
|
-
build.onStart(() => {
|
|
25
|
-
// Clear the terminal
|
|
26
|
-
process.stdout.write('\x1Bc');
|
|
27
|
-
console.log("[esbuild] starting build...");
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
build.onEnd((result) => {
|
|
31
|
-
// if (result.errors.length > 0) {
|
|
32
|
-
// console.error("[esbuild] build failed");
|
|
33
|
-
// } else {
|
|
34
|
-
// console.log("[esbuild] build succeeded");
|
|
35
|
-
// }
|
|
36
|
-
console.log("[esbuild] watching...");
|
|
37
|
-
});
|
|
38
|
-
}
|
|
1
|
+
export function outputWatcherPlugin(options = {}) {
|
|
2
|
+
return {
|
|
3
|
+
name: "onejs-watch-output",
|
|
4
|
+
setup(build) {
|
|
5
|
+
build.onStart(() => {
|
|
6
|
+
// Clear the terminal
|
|
7
|
+
process.stdout.write('\x1Bc');
|
|
8
|
+
console.log("[esbuild] starting build...");
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
build.onEnd((result) => {
|
|
12
|
+
console.log("[esbuild] watching...");
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Keeping this one for backward-compatibility reasons. Please use `outputWatcherPlugin` instead.
|
|
20
|
+
*/
|
|
21
|
+
export const watchOutputPlugin = {
|
|
22
|
+
name: "onejs-watch-output",
|
|
23
|
+
setup(build) {
|
|
24
|
+
build.onStart(() => {
|
|
25
|
+
// Clear the terminal
|
|
26
|
+
process.stdout.write('\x1Bc');
|
|
27
|
+
console.log("[esbuild] starting build...");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
build.onEnd((result) => {
|
|
31
|
+
// if (result.errors.length > 0) {
|
|
32
|
+
// console.error("[esbuild] build failed");
|
|
33
|
+
// } else {
|
|
34
|
+
// console.log("[esbuild] build succeeded");
|
|
35
|
+
// }
|
|
36
|
+
console.log("[esbuild] watching...");
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
39
|
}
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* postcss-cleanup-plugin
|
|
3
|
-
*
|
|
4
|
-
* A PostCSS plugin that removes unwanted CSS rules and declarations based on the `remove` array in options.
|
|
5
|
-
*
|
|
6
|
-
* Usage example:
|
|
7
|
-
*
|
|
8
|
-
* ```js
|
|
9
|
-
* plugins: [
|
|
10
|
-
* require('./postcss-cleanup-plugin')({
|
|
11
|
-
* remove: [
|
|
12
|
-
* ".someClass", // Remove rules containing this class
|
|
13
|
-
* "line-height:", // Remove any line-height property
|
|
14
|
-
* "display: grid" // Remove only display property if value is grid
|
|
15
|
-
* ]
|
|
16
|
-
* })
|
|
17
|
-
* ]
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* How it works:
|
|
21
|
-
* 1) Entries beginning with "." (e.g. ".foo") cause removal of entire rules containing that class.
|
|
22
|
-
* 2) Entries ending with ":" but no value (e.g. "prop:") remove any declaration with the property "prop".
|
|
23
|
-
* 3) Entries with both property and value (e.g. "prop: value") remove only those exact prop-value declarations.
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
module.exports = (opts = {}) => {
|
|
27
|
-
const removeEntries = opts.remove || [];
|
|
28
|
-
|
|
29
|
-
// We'll gather them into 3 buckets:
|
|
30
|
-
const classesToRemove = new Set();
|
|
31
|
-
const propertiesToRemoveCompletely = new Set(); // e.g. "line-height:"
|
|
32
|
-
const propertyValuePairsToRemove = []; // e.g. "display: grid"
|
|
33
|
-
|
|
34
|
-
removeEntries.forEach(entry => {
|
|
35
|
-
// 1) If entry starts with ".", assume it's a class to remove
|
|
36
|
-
if (entry.startsWith('.')) {
|
|
37
|
-
classesToRemove.add(entry.slice(1)); // remove leading dot
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// 2) Otherwise, see if there's a ":" for a property
|
|
42
|
-
const parts = entry.split(':').map(s => s.trim());
|
|
43
|
-
if (parts.length === 2) {
|
|
44
|
-
const [prop, value] = parts;
|
|
45
|
-
// If there's no value after the colon => remove that property entirely
|
|
46
|
-
if (!value) {
|
|
47
|
-
propertiesToRemoveCompletely.add(prop);
|
|
48
|
-
} else {
|
|
49
|
-
propertyValuePairsToRemove.push({ prop, value });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
postcssPlugin: 'postcss-cleanup-plugin',
|
|
56
|
-
Once(root, { result }) {
|
|
57
|
-
root.walkRules(rule => {
|
|
58
|
-
// If ANY selector contains an unwanted class, remove the entire rule
|
|
59
|
-
if (
|
|
60
|
-
rule.selectors.some(sel =>
|
|
61
|
-
[...classesToRemove].some(cls => sel.includes(`.${cls}`))
|
|
62
|
-
)
|
|
63
|
-
) {
|
|
64
|
-
rule.remove();
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Otherwise, remove targeted declarations
|
|
69
|
-
rule.walkDecls(decl => {
|
|
70
|
-
// If the property is in the "remove completely" set, drop it
|
|
71
|
-
if (propertiesToRemoveCompletely.has(decl.prop)) {
|
|
72
|
-
decl.remove();
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// If it matches one of the prop-value pairs, drop it
|
|
77
|
-
for (const { prop, value } of propertyValuePairsToRemove) {
|
|
78
|
-
if (decl.prop === prop && decl.value === value) {
|
|
79
|
-
decl.remove();
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
module.exports.postcss = true;
|
|
1
|
+
/**
|
|
2
|
+
* postcss-cleanup-plugin
|
|
3
|
+
*
|
|
4
|
+
* A PostCSS plugin that removes unwanted CSS rules and declarations based on the `remove` array in options.
|
|
5
|
+
*
|
|
6
|
+
* Usage example:
|
|
7
|
+
*
|
|
8
|
+
* ```js
|
|
9
|
+
* plugins: [
|
|
10
|
+
* require('./postcss-cleanup-plugin')({
|
|
11
|
+
* remove: [
|
|
12
|
+
* ".someClass", // Remove rules containing this class
|
|
13
|
+
* "line-height:", // Remove any line-height property
|
|
14
|
+
* "display: grid" // Remove only display property if value is grid
|
|
15
|
+
* ]
|
|
16
|
+
* })
|
|
17
|
+
* ]
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* How it works:
|
|
21
|
+
* 1) Entries beginning with "." (e.g. ".foo") cause removal of entire rules containing that class.
|
|
22
|
+
* 2) Entries ending with ":" but no value (e.g. "prop:") remove any declaration with the property "prop".
|
|
23
|
+
* 3) Entries with both property and value (e.g. "prop: value") remove only those exact prop-value declarations.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
module.exports = (opts = {}) => {
|
|
27
|
+
const removeEntries = opts.remove || [];
|
|
28
|
+
|
|
29
|
+
// We'll gather them into 3 buckets:
|
|
30
|
+
const classesToRemove = new Set();
|
|
31
|
+
const propertiesToRemoveCompletely = new Set(); // e.g. "line-height:"
|
|
32
|
+
const propertyValuePairsToRemove = []; // e.g. "display: grid"
|
|
33
|
+
|
|
34
|
+
removeEntries.forEach(entry => {
|
|
35
|
+
// 1) If entry starts with ".", assume it's a class to remove
|
|
36
|
+
if (entry.startsWith('.')) {
|
|
37
|
+
classesToRemove.add(entry.slice(1)); // remove leading dot
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 2) Otherwise, see if there's a ":" for a property
|
|
42
|
+
const parts = entry.split(':').map(s => s.trim());
|
|
43
|
+
if (parts.length === 2) {
|
|
44
|
+
const [prop, value] = parts;
|
|
45
|
+
// If there's no value after the colon => remove that property entirely
|
|
46
|
+
if (!value) {
|
|
47
|
+
propertiesToRemoveCompletely.add(prop);
|
|
48
|
+
} else {
|
|
49
|
+
propertyValuePairsToRemove.push({ prop, value });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
postcssPlugin: 'postcss-cleanup-plugin',
|
|
56
|
+
Once(root, { result }) {
|
|
57
|
+
root.walkRules(rule => {
|
|
58
|
+
// If ANY selector contains an unwanted class, remove the entire rule
|
|
59
|
+
if (
|
|
60
|
+
rule.selectors.some(sel =>
|
|
61
|
+
[...classesToRemove].some(cls => sel.includes(`.${cls}`))
|
|
62
|
+
)
|
|
63
|
+
) {
|
|
64
|
+
rule.remove();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Otherwise, remove targeted declarations
|
|
69
|
+
rule.walkDecls(decl => {
|
|
70
|
+
// If the property is in the "remove completely" set, drop it
|
|
71
|
+
if (propertiesToRemoveCompletely.has(decl.prop)) {
|
|
72
|
+
decl.remove();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// If it matches one of the prop-value pairs, drop it
|
|
77
|
+
for (const { prop, value } of propertyValuePairsToRemove) {
|
|
78
|
+
if (decl.prop === prop && decl.value === value) {
|
|
79
|
+
decl.remove();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
module.exports.postcss = true;
|
|
90
90
|
|