phaser-wind 0.6.1 → 0.7.0
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/dist/phaser-wind.js +1228 -0
- package/dist/phaser-wind.min.js +1 -0
- package/dist/theme/theme-manager.d.ts.map +1 -1
- package/dist/theme/theme-manager.js +1 -1
- package/dist/theme/theme-manager.js.map +1 -1
- package/dist/utils/__tests__/merge.test.d.ts +2 -0
- package/dist/utils/__tests__/merge.test.d.ts.map +1 -0
- package/dist/utils/__tests__/merge.test.js +433 -0
- package/dist/utils/__tests__/merge.test.js.map +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/merge.d.ts +24 -0
- package/dist/utils/merge.d.ts.map +1 -0
- package/dist/utils/merge.js +79 -0
- package/dist/utils/merge.js.map +1 -0
- package/package.json +9 -6
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep merge utility function that recursively merges objects
|
|
3
|
+
* Similar to lodash.merge but implemented natively
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Checks if a value is a plain object (not array, null, or other types)
|
|
7
|
+
*/
|
|
8
|
+
const isPlainObject = (value) => {
|
|
9
|
+
return (value !== null &&
|
|
10
|
+
typeof value === 'object' &&
|
|
11
|
+
!Array.isArray(value) &&
|
|
12
|
+
Object.prototype.toString.call(value) === '[object Object]');
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Deep clone utility function that creates new references for all nested objects
|
|
16
|
+
* @param obj - The object to clone
|
|
17
|
+
* @returns A deep clone of the object with new references
|
|
18
|
+
*/
|
|
19
|
+
const deepClone = (obj) => {
|
|
20
|
+
if (obj === null || typeof obj !== 'object') {
|
|
21
|
+
return obj;
|
|
22
|
+
}
|
|
23
|
+
if (Array.isArray(obj)) {
|
|
24
|
+
return obj.map(item => deepClone(item));
|
|
25
|
+
}
|
|
26
|
+
if (isPlainObject(obj)) {
|
|
27
|
+
const cloned = {};
|
|
28
|
+
for (const key in obj) {
|
|
29
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
30
|
+
cloned[key] = deepClone(obj[key]);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return cloned;
|
|
34
|
+
}
|
|
35
|
+
return obj;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Deep merge multiple objects into the first one
|
|
39
|
+
* @param target - The target object to merge into
|
|
40
|
+
* @param sources - Source objects to merge from
|
|
41
|
+
* @returns The merged object
|
|
42
|
+
*/
|
|
43
|
+
export const merge = (target, ...sources) => {
|
|
44
|
+
if (!isPlainObject(target)) {
|
|
45
|
+
return target;
|
|
46
|
+
}
|
|
47
|
+
// Start with a deep clone of the target
|
|
48
|
+
let result = deepClone(target);
|
|
49
|
+
for (const source of sources) {
|
|
50
|
+
if (!isPlainObject(source)) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
// Deep clone the source to ensure we create new references
|
|
54
|
+
const clonedSource = deepClone(source);
|
|
55
|
+
for (const key in clonedSource) {
|
|
56
|
+
if (Object.prototype.hasOwnProperty.call(clonedSource, key)) {
|
|
57
|
+
const sourceValue = clonedSource[key];
|
|
58
|
+
const targetValue = result[key];
|
|
59
|
+
if (isPlainObject(sourceValue) && isPlainObject(targetValue)) {
|
|
60
|
+
result[key] = merge(targetValue, sourceValue);
|
|
61
|
+
}
|
|
62
|
+
else if (sourceValue !== undefined) {
|
|
63
|
+
result[key] = sourceValue;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Deep merge that creates a new object without mutating the original
|
|
72
|
+
* @param target - The target object
|
|
73
|
+
* @param sources - Source objects to merge from
|
|
74
|
+
* @returns A new merged object
|
|
75
|
+
*/
|
|
76
|
+
export const mergeDeep = (target, ...sources) => {
|
|
77
|
+
return merge({}, target, ...sources);
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;GAEG;AACH,MAAM,aAAa,GAAG,CAAC,KAAc,EAAwB,EAAE;IAC7D,OAAO,CACL,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrB,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAC5D,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,SAAS,GAAG,CAAI,GAAM,EAAK,EAAE;IACjC,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,GAAG,CAAC;IACb,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAM,CAAC;IAC/C,CAAC;IAED,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,EAA6B,CAAC;QAC7C,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;YACtB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;gBACnD,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QACD,OAAO,MAAW,CAAC;IACrB,CAAC;I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AAM,EAAE,GAAG,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phaser-wind",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Wind theme like Tailwind CSS for Phaser games",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,11 +10,16 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"import": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts"
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
|
+
"./umd": "./dist/phaser-wind.js",
|
|
15
|
+
"./umd.min": "./dist/phaser-wind.min.js"
|
|
14
16
|
},
|
|
15
17
|
"files": [
|
|
16
18
|
"dist"
|
|
17
19
|
],
|
|
20
|
+
"browser": "./dist/phaser-wind.js",
|
|
21
|
+
"unpkg": "./dist/phaser-wind.min.js",
|
|
22
|
+
"jsdelivr": "./dist/phaser-wind.min.js",
|
|
18
23
|
"keywords": [
|
|
19
24
|
"phaser",
|
|
20
25
|
"game-development",
|
|
@@ -48,7 +53,7 @@
|
|
|
48
53
|
"eslint-plugin-sonarjs": "^3.0.5",
|
|
49
54
|
"eslint-plugin-unicorn": "^50.0.1",
|
|
50
55
|
"tsx": "^4.20.5",
|
|
51
|
-
"typescript": "^5.3
|
|
56
|
+
"typescript": "^5.9.3",
|
|
52
57
|
"vitest": "^3.2.4"
|
|
53
58
|
},
|
|
54
59
|
"peerDependencies": {
|
|
@@ -57,9 +62,7 @@
|
|
|
57
62
|
"publishConfig": {
|
|
58
63
|
"access": "public"
|
|
59
64
|
},
|
|
60
|
-
"dependencies": {
|
|
61
|
-
"lodash.merge": "^4.6.2"
|
|
62
|
-
},
|
|
65
|
+
"dependencies": {},
|
|
63
66
|
"scripts": {
|
|
64
67
|
"build": "tsc --build --force",
|
|
65
68
|
"dev": "tsc --build --watch",
|