@symbo.ls/utils 3.14.2 → 3.14.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.
Files changed (122) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/array.cjs +1 -0
  3. package/dist/cjs/assets.cjs +1 -0
  4. package/dist/cjs/browser.cjs +1 -0
  5. package/dist/cjs/cache.cjs +1 -0
  6. package/dist/cjs/cdn.cjs +3 -0
  7. package/dist/cjs/component.cjs +1 -0
  8. package/dist/cjs/cookie.cjs +1 -0
  9. package/dist/cjs/date.cjs +1 -0
  10. package/dist/cjs/detectHeight.cjs +1 -0
  11. package/dist/cjs/element.cjs +1 -0
  12. package/dist/cjs/env.cjs +2 -0
  13. package/dist/cjs/events.cjs +1 -0
  14. package/dist/cjs/extends.cjs +1 -0
  15. package/dist/cjs/fibonacci.cjs +1 -0
  16. package/dist/cjs/files.cjs +1 -0
  17. package/dist/cjs/function.cjs +1 -0
  18. package/dist/cjs/globals.cjs +1 -0
  19. package/dist/cjs/if.cjs +1 -0
  20. package/dist/cjs/index.cjs +1 -0
  21. package/dist/cjs/key.cjs +1 -0
  22. package/dist/cjs/keys.cjs +1 -0
  23. package/dist/cjs/load.cjs +1 -0
  24. package/dist/cjs/log.cjs +1 -0
  25. package/dist/cjs/metadata.cjs +2 -0
  26. package/dist/cjs/methods.cjs +10 -0
  27. package/dist/cjs/node.cjs +1 -0
  28. package/dist/cjs/object.cjs +12 -0
  29. package/dist/cjs/projectKeys.cjs +1 -0
  30. package/dist/cjs/props.cjs +1 -0
  31. package/dist/cjs/scaling.cjs +1 -0
  32. package/dist/cjs/scope.cjs +1 -0
  33. package/dist/cjs/sharedLibraries.cjs +1 -0
  34. package/dist/cjs/state.cjs +1 -0
  35. package/dist/cjs/string-extra.cjs +1 -0
  36. package/dist/cjs/string.cjs +3 -0
  37. package/dist/cjs/style.cjs +1 -0
  38. package/dist/cjs/tags.cjs +1 -0
  39. package/dist/cjs/triggerEvent.cjs +1 -0
  40. package/dist/cjs/types.cjs +1 -0
  41. package/dist/cjs/update.cjs +1 -0
  42. package/dist/esm/array.js +1 -0
  43. package/dist/esm/assets.js +1 -0
  44. package/dist/esm/browser.js +1 -0
  45. package/dist/esm/cache.js +1 -0
  46. package/dist/esm/cdn.js +3 -0
  47. package/dist/esm/component.js +1 -0
  48. package/dist/esm/cookie.js +1 -0
  49. package/dist/esm/date.js +1 -0
  50. package/dist/esm/detectHeight.js +1 -0
  51. package/dist/esm/element.js +1 -0
  52. package/dist/esm/env.js +2 -0
  53. package/dist/esm/events.js +1 -0
  54. package/dist/esm/extends.js +1 -0
  55. package/dist/esm/fibonacci.js +1 -0
  56. package/dist/esm/files.js +1 -0
  57. package/dist/esm/function.js +1 -0
  58. package/dist/esm/globals.js +1 -0
  59. package/dist/esm/if.js +1 -0
  60. package/dist/esm/index.js +1 -0
  61. package/dist/esm/key.js +1 -0
  62. package/dist/esm/keys.js +1 -0
  63. package/dist/esm/load.js +1 -0
  64. package/dist/esm/log.js +1 -0
  65. package/dist/esm/metadata.js +2 -0
  66. package/dist/esm/methods.js +10 -0
  67. package/dist/esm/node.js +1 -0
  68. package/dist/esm/object.js +12 -0
  69. package/dist/esm/projectKeys.js +1 -0
  70. package/dist/esm/props.js +1 -0
  71. package/dist/esm/scaling.js +1 -0
  72. package/dist/esm/scope.js +1 -0
  73. package/dist/esm/sharedLibraries.js +1 -0
  74. package/dist/esm/state.js +1 -0
  75. package/dist/esm/string-extra.js +1 -0
  76. package/dist/esm/string.js +3 -0
  77. package/dist/esm/style.js +1 -0
  78. package/dist/esm/tags.js +1 -0
  79. package/dist/esm/triggerEvent.js +1 -0
  80. package/dist/esm/types.js +1 -0
  81. package/dist/esm/update.js +1 -0
  82. package/package.json +35 -18
  83. package/array.js +0 -162
  84. package/assets.js +0 -117
  85. package/browser.js +0 -13
  86. package/cache.js +0 -7
  87. package/cdn.js +0 -83
  88. package/component.js +0 -25
  89. package/cookie.js +0 -78
  90. package/date.js +0 -10
  91. package/detectHeight.js +0 -42
  92. package/element.js +0 -148
  93. package/env.js +0 -15
  94. package/events.js +0 -19
  95. package/extends.js +0 -519
  96. package/fibonacci.js +0 -9
  97. package/files.js +0 -3
  98. package/function.js +0 -145
  99. package/globals.js +0 -8
  100. package/if.js +0 -30
  101. package/index.js +0 -42
  102. package/key.js +0 -20
  103. package/keys.js +0 -176
  104. package/load.js +0 -236
  105. package/log.js +0 -12
  106. package/metadata.js +0 -392
  107. package/methods.js +0 -684
  108. package/node.js +0 -37
  109. package/object.js +0 -837
  110. package/projectKeys.js +0 -30
  111. package/props.js +0 -327
  112. package/scaling.js +0 -15
  113. package/scope.js +0 -32
  114. package/sharedLibraries.js +0 -184
  115. package/state.js +0 -203
  116. package/string-extra.js +0 -69
  117. package/string.js +0 -206
  118. package/style.js +0 -23
  119. package/tags.js +0 -176
  120. package/triggerEvent.js +0 -102
  121. package/types.js +0 -55
  122. package/update.js +0 -27
package/triggerEvent.js DELETED
@@ -1,102 +0,0 @@
1
- 'use strict'
2
-
3
- import { isFunction } from './types.js'
4
- import { resolveHandler, runPluginHook } from './function.js'
5
-
6
- const getOnOrPropsEvent = (param, element) => {
7
- const propKey = 'on' + param.charAt(0).toUpperCase() + param.slice(1)
8
- return element[propKey]
9
- }
10
-
11
- export const applyEvent = (param, element, state, context, options) => {
12
- param = resolveHandler(param, element)
13
- if (!isFunction(param)) return
14
- try {
15
- const result = param.call(
16
- element,
17
- element,
18
- state || element.state,
19
- context || element.context,
20
- options
21
- )
22
- if (result && typeof result.then === 'function') {
23
- result.catch((err) => {
24
- element.error = err
25
- if (err instanceof ReferenceError) console.warn('[DOMQL] Async event warning:', err.message)
26
- else console.error('[DOMQL] Async event error:', err)
27
- })
28
- }
29
- return result
30
- } catch (err) {
31
- element.error = err
32
- // In SSR/brender mode, ReferenceErrors for missing client-only helpers
33
- // are expected (e.g. DOM animation functions). Log concisely.
34
- if (err instanceof ReferenceError) {
35
- console.warn('[DOMQL] Event handler warning:', err.message)
36
- } else {
37
- console.error('[DOMQL] Event handler error:', err)
38
- }
39
- if (element.context?.strictMode) throw err
40
- }
41
- }
42
-
43
- export const triggerEventOn = (param, element, options) => {
44
- if (!element) {
45
- throw new Error('Element is required')
46
- }
47
- runPluginHook(param, element, options)
48
- const appliedFunction = getOnOrPropsEvent(param, element)
49
- if (appliedFunction) {
50
- const { state, context } = element
51
- return applyEvent(appliedFunction, element, state, context, options)
52
- }
53
- }
54
-
55
- export const applyEventUpdate = (
56
- param,
57
- updatedObj,
58
- element,
59
- state,
60
- context,
61
- options
62
- ) => {
63
- param = resolveHandler(param, element)
64
- if (!isFunction(param)) return
65
- try {
66
- const result = param.call(
67
- element,
68
- updatedObj,
69
- element,
70
- state || element.state,
71
- context || element.context,
72
- options
73
- )
74
- if (result && typeof result.then === 'function') {
75
- result.catch((err) => {
76
- element.error = err
77
- console.error('[DOMQL] Async event update error:', err)
78
- })
79
- }
80
- return result
81
- } catch (err) {
82
- element.error = err
83
- console.error('[DOMQL] Event update error:', err)
84
- if (element.context?.strictMode) throw err
85
- }
86
- }
87
-
88
- export const triggerEventOnUpdate = (param, updatedObj, element, options) => {
89
- runPluginHook(param, element, updatedObj, options)
90
- const appliedFunction = getOnOrPropsEvent(param, element)
91
- if (appliedFunction) {
92
- const { state, context } = element
93
- return applyEventUpdate(
94
- appliedFunction,
95
- updatedObj,
96
- element,
97
- state,
98
- context,
99
- options
100
- )
101
- }
102
- }
package/types.js DELETED
@@ -1,55 +0,0 @@
1
- 'use strict'
2
-
3
- import { isHtmlElement, isNode } from './node.js'
4
-
5
- export const isObject = arg => {
6
- if (arg === null) return false
7
- return typeof arg === 'object' && arg.constructor === Object
8
- }
9
-
10
- export const isString = arg => typeof arg === 'string'
11
-
12
- export const isNumber = arg => typeof arg === 'number'
13
-
14
- export const isFunction = arg => typeof arg === 'function'
15
-
16
- export const isBoolean = arg => arg === true || arg === false
17
-
18
- export const isNull = arg => arg === null
19
-
20
- export const isArray = arg => Array.isArray(arg)
21
-
22
- export const isDate = d => d instanceof Date
23
-
24
- export const isObjectLike = arg => {
25
- if (arg === null) return false
26
- // if (isArray(arg)) return false
27
- return typeof arg === 'object'
28
- }
29
-
30
- export const isDefined = arg => arg !== undefined
31
-
32
- export const isUndefined = arg => arg === undefined
33
-
34
- export const TYPES = {
35
- boolean: isBoolean,
36
- array: isArray,
37
- object: isObject,
38
- string: isString,
39
- date: isDate,
40
- number: isNumber,
41
- null: isNull,
42
- function: isFunction,
43
- objectLike: isObjectLike,
44
- node: isNode,
45
- htmlElement: isHtmlElement,
46
- defined: isDefined
47
- }
48
-
49
- export const is = arg => {
50
- return (...args) => args.some(val => TYPES[val](arg))
51
- }
52
-
53
- export const isNot = arg => {
54
- return (...args) => !args.some(val => TYPES[val](arg))
55
- }
package/update.js DELETED
@@ -1,27 +0,0 @@
1
- 'use strict'
2
-
3
- import { createSnapshotId } from './key.js'
4
-
5
- const snapshot = {
6
- snapshotId: createSnapshotId
7
- }
8
-
9
- export const captureSnapshot = (element, options) => {
10
- const ref = element.__ref
11
-
12
- const { currentSnapshot, calleeElement } = options
13
- const isCallee = calleeElement === element
14
- if (!calleeElement || isCallee) {
15
- const createdStanpshot = snapshot.snapshotId()
16
- ref.__currentSnapshot = createdStanpshot
17
- return [createdStanpshot, element]
18
- }
19
-
20
- const snapshotOnCallee = calleeElement.__ref.__currentSnapshot
21
-
22
- if (currentSnapshot < snapshotOnCallee) {
23
- return [snapshotOnCallee, calleeElement, true]
24
- }
25
-
26
- return [snapshotOnCallee, calleeElement]
27
- }