lunchboxjs 0.2.1020 → 2.0.0-beta.1
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/lunchboxjs.cjs +46 -0
- package/dist/lunchboxjs.d.ts +1 -0
- package/dist/lunchboxjs.js +1632 -1962
- package/dist/lunchboxjs.umd.cjs +46 -0
- package/package.json +36 -81
- package/LICENSE.md +0 -7
- package/README.md +0 -17
- package/dist/lunchboxjs.es.d.ts +0 -1
- package/dist/lunchboxjs.min.js +0 -1
- package/dist/lunchboxjs.module.js +0 -1924
- package/dist/lunchboxjs.umd.d.ts +0 -1
- package/src/components/LunchboxEventHandlers.tsx +0 -237
- package/src/components/LunchboxWrapper/LunchboxScene.tsx +0 -8
- package/src/components/LunchboxWrapper/LunchboxWrapper.tsx +0 -341
- package/src/components/LunchboxWrapper/prepCanvas.ts +0 -55
- package/src/components/LunchboxWrapper/resizeCanvas.ts +0 -41
- package/src/components/autoGeneratedComponents.ts +0 -175
- package/src/components/index.ts +0 -31
- package/src/core/createNode.ts +0 -71
- package/src/core/extend.ts +0 -25
- package/src/core/index.ts +0 -7
- package/src/core/instantiateThreeObject/index.ts +0 -37
- package/src/core/instantiateThreeObject/processProps.ts +0 -40
- package/src/core/interaction.ts +0 -55
- package/src/core/minidom.ts +0 -256
- package/src/core/update.ts +0 -149
- package/src/core/updateObjectProp.ts +0 -153
- package/src/index.ts +0 -400
- package/src/keys.ts +0 -31
- package/src/nodeOps/createElement.ts +0 -34
- package/src/nodeOps/index.ts +0 -83
- package/src/nodeOps/insert.ts +0 -165
- package/src/nodeOps/remove.ts +0 -32
- package/src/plugins/bridge/BridgeComponent.tsx +0 -60
- package/src/plugins/bridge/bridge.ts +0 -9
- package/src/types.ts +0 -186
- package/src/utils/find.ts +0 -24
- package/src/utils/get.ts +0 -18
- package/src/utils/index.ts +0 -60
- package/src/utils/isNumber.ts +0 -87
- package/src/utils/set.ts +0 -14
package/src/utils/index.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Lunch } from '..'
|
|
2
|
-
|
|
3
|
-
export * from './find'
|
|
4
|
-
|
|
5
|
-
// replacement functions from lodash & https://youmightnotneed.com/lodash
|
|
6
|
-
export * from './get'
|
|
7
|
-
export * from './isNumber'
|
|
8
|
-
export * from './set'
|
|
9
|
-
|
|
10
|
-
// MAKE SURE THESE MATCH VALUES IN types.EventKey
|
|
11
|
-
/** Type check on whether target is a Lunchbox.EventKey */
|
|
12
|
-
export const isEventKey = (target: any): target is Lunch.EventKey => {
|
|
13
|
-
return [
|
|
14
|
-
'onClick',
|
|
15
|
-
'onContextMenu',
|
|
16
|
-
'onDoubleClick',
|
|
17
|
-
'onPointerUp',
|
|
18
|
-
'onPointerDown',
|
|
19
|
-
'onPointerOver',
|
|
20
|
-
'onPointerOut',
|
|
21
|
-
'onPointerEnter',
|
|
22
|
-
'onPointerLeave',
|
|
23
|
-
'onPointerMove',
|
|
24
|
-
// 'onPointerMissed',
|
|
25
|
-
// 'onUpdate',
|
|
26
|
-
'onWheel',
|
|
27
|
-
].includes(target)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const isLunchboxComponent = (
|
|
31
|
-
node: any
|
|
32
|
-
): node is Lunch.LunchboxComponent => {
|
|
33
|
-
return node?.$el && node?.$el?.hasOwnProperty?.('instance')
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const isLunchboxDomComponent = (node: any): node is Lunch.DomMeta => {
|
|
37
|
-
if ((node as Lunch.MetaBase)?.metaType === 'domMeta') return true
|
|
38
|
-
|
|
39
|
-
return node?.props?.['data-lunchbox']
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const isLunchboxStandardNode = (
|
|
43
|
-
node: any
|
|
44
|
-
): node is Lunch.StandardMeta => {
|
|
45
|
-
return node?.metaType === 'standardMeta'
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const isLunchboxRootNode = (node: any): node is Lunch.RootMeta => {
|
|
49
|
-
return node.isLunchboxRootNode
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const waitFor = async (get: () => any) => {
|
|
53
|
-
let output = get()
|
|
54
|
-
while (!output) {
|
|
55
|
-
await new Promise((resolve) => requestAnimationFrame(resolve))
|
|
56
|
-
output = get()
|
|
57
|
-
console.log(output)
|
|
58
|
-
}
|
|
59
|
-
return output
|
|
60
|
-
}
|
package/src/utils/isNumber.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
const buildIsNumber = () => {
|
|
2
|
-
/**
|
|
3
|
-
* lodash (Custom Build) <https://lodash.com/>
|
|
4
|
-
* Build: `lodash modularize exports="npm" -o ./`
|
|
5
|
-
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
|
6
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
7
|
-
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
8
|
-
* Available under MIT license <https://lodash.com/license>
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/** `Object#toString` result references. */
|
|
12
|
-
const numberTag = '[object Number]'
|
|
13
|
-
|
|
14
|
-
/** Used for built-in method references. */
|
|
15
|
-
const objectProto = Object.prototype
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Used to resolve the
|
|
19
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
|
20
|
-
* of values.
|
|
21
|
-
*/
|
|
22
|
-
const objectToString = objectProto.toString
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
26
|
-
* and has a `typeof` result of "object".
|
|
27
|
-
*
|
|
28
|
-
* @static
|
|
29
|
-
* @memberOf _
|
|
30
|
-
* @since 4.0.0
|
|
31
|
-
* @category Lang
|
|
32
|
-
* @param {*} value The value to check.
|
|
33
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
34
|
-
* @example
|
|
35
|
-
*
|
|
36
|
-
* _.isObjectLike({});
|
|
37
|
-
* // => true
|
|
38
|
-
*
|
|
39
|
-
* _.isObjectLike([1, 2, 3]);
|
|
40
|
-
* // => true
|
|
41
|
-
*
|
|
42
|
-
* _.isObjectLike(_.noop);
|
|
43
|
-
* // => false
|
|
44
|
-
*
|
|
45
|
-
* _.isObjectLike(null);
|
|
46
|
-
* // => false
|
|
47
|
-
*/
|
|
48
|
-
function isObjectLike(value: any) {
|
|
49
|
-
return !!value && typeof value == 'object'
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Checks if `value` is classified as a `Number` primitive or object.
|
|
54
|
-
*
|
|
55
|
-
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
|
|
56
|
-
* classified as numbers, use the `_.isFinite` method.
|
|
57
|
-
*
|
|
58
|
-
* @static
|
|
59
|
-
* @memberOf _
|
|
60
|
-
* @since 0.1.0
|
|
61
|
-
* @category Lang
|
|
62
|
-
* @param {*} value The value to check.
|
|
63
|
-
* @returns {boolean} Returns `true` if `value` is a number, else `false`.
|
|
64
|
-
* @example
|
|
65
|
-
*
|
|
66
|
-
* _.isNumber(3);
|
|
67
|
-
* // => true
|
|
68
|
-
*
|
|
69
|
-
* _.isNumber(Number.MIN_VALUE);
|
|
70
|
-
* // => true
|
|
71
|
-
*
|
|
72
|
-
* _.isNumber(Infinity);
|
|
73
|
-
* // => true
|
|
74
|
-
*
|
|
75
|
-
* _.isNumber('3');
|
|
76
|
-
* // => false
|
|
77
|
-
*/
|
|
78
|
-
const output = function isNumber(value: any) {
|
|
79
|
-
return (
|
|
80
|
-
typeof value == 'number' ||
|
|
81
|
-
(isObjectLike(value) && objectToString.call(value) == numberTag)
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
return output
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export const isNumber = buildIsNumber()
|
package/src/utils/set.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const set = (
|
|
2
|
-
obj: Record<string, any>,
|
|
3
|
-
path: string | string[],
|
|
4
|
-
value: any
|
|
5
|
-
) => {
|
|
6
|
-
// Regex explained: https://regexr.com/58j0k
|
|
7
|
-
const pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g)
|
|
8
|
-
|
|
9
|
-
pathArray?.reduce((acc: Record<string, any>, key: string, i: number) => {
|
|
10
|
-
if (acc[key] === undefined) acc[key] = {}
|
|
11
|
-
if (i === pathArray.length - 1) acc[key] = value
|
|
12
|
-
return acc[key]
|
|
13
|
-
}, obj)
|
|
14
|
-
}
|