@symbo.ls/utils 2.33.41 → 2.34.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/utils",
3
- "version": "2.33.41",
3
+ "version": "2.34.0",
4
4
  "author": "symbo.ls",
5
5
  "files": [
6
6
  "src",
@@ -24,7 +24,8 @@
24
24
  },
25
25
  "license": "ISC",
26
26
  "dependencies": {
27
- "@domql/utils": "^2.33.41"
27
+ "@domql/element": "^2.34.0",
28
+ "@domql/utils": "^2.34.0"
28
29
  },
29
- "gitHead": "1dffcfb13a8308462abc598b71292a2f58dc58f5"
30
+ "gitHead": "36ad7eff7cf19c4b684e754e04fa80c88448c3aa"
30
31
  }
@@ -0,0 +1,55 @@
1
+ import { REGISTRY } from '@domql/element/mixins/registry.js'
2
+
3
+ export function temporaryDomqlHack(value) {
4
+ if (this && !this.getUserSettings?.('useDomql3')) return value
5
+ let obj = { ...value }
6
+ const on = obj.on
7
+ if (this.call('isObject', on)) {
8
+ delete obj.on
9
+ const transformedOn = {}
10
+ for (const key in on) {
11
+ const transformedKey = 'on' + key.charAt(0).toUpperCase() + key.slice(1)
12
+ transformedOn[transformedKey] = on[key]
13
+ }
14
+ obj = { ...transformedOn, ...obj }
15
+ }
16
+ const props = obj.props
17
+ if (this.call('isObject', props)) {
18
+ delete obj.props
19
+ obj = { ...props, ...obj }
20
+ }
21
+ const extendObj = {}
22
+ if (obj.extend) {
23
+ extendObj.extends = obj.extend
24
+ delete obj.extend
25
+ }
26
+ if (obj.childExtend) {
27
+ extendObj.childExtends = obj.childExtend
28
+ delete obj.childExtend
29
+ }
30
+ return { ...extendObj, ...obj }
31
+ }
32
+
33
+ export function temporaryDomqlHackReverse(value) {
34
+ if (this && !this.getUserSettings?.('useDomql3')) return value
35
+ const obj = { ...value }
36
+ if (obj.extends) {
37
+ obj.extend = obj.extends
38
+ delete obj.extends
39
+ }
40
+ if (obj.childExtends) {
41
+ obj.childExtend = obj.childExtends
42
+ delete obj.childExtends
43
+ }
44
+ for (const key in obj) {
45
+ const allowed = ['transform', 'class']
46
+ if ((REGISTRY[key] && !allowed.includes(key)) || /^[A-Z]/.test(key))
47
+ continue
48
+ else {
49
+ obj.props = obj.props || {}
50
+ obj.props[key] = obj[key]
51
+ delete obj[key]
52
+ }
53
+ }
54
+ return obj
55
+ }
package/src/index.js CHANGED
@@ -8,8 +8,9 @@ export * from './date.js'
8
8
  export * from './fibonacci.js'
9
9
  export * from './load.js'
10
10
  export * from './files.js'
11
+ export * from './domqlv3hacks.js'
11
12
 
12
- export const copyStringToClipboard = async str => {
13
+ export const copyStringToClipboard = async (str) => {
13
14
  try {
14
15
  await navigator.clipboard.writeText(str)
15
16
  } catch (err) {
@@ -17,7 +18,7 @@ export const copyStringToClipboard = async str => {
17
18
  }
18
19
  }
19
20
 
20
- export const copyJavaScriptToClipboard = async jsCode => {
21
+ export const copyJavaScriptToClipboard = async (jsCode) => {
21
22
  try {
22
23
  // Create a Blob for the JavaScript code with the 'text/javascript' MIME type
23
24
  const blob = new Blob([jsCode], { type: 'text/javascript' })
@@ -34,11 +35,11 @@ export const copyJavaScriptToClipboard = async jsCode => {
34
35
  }
35
36
  }
36
37
 
37
- export const removeChars = str => {
38
+ export const removeChars = (str) => {
38
39
  return str.replace(/[^a-zA-Z0-9_]/g, '')
39
40
  }
40
41
 
41
- export const toCamelCase = str => {
42
+ export const toCamelCase = (str) => {
42
43
  return str
43
44
  .replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
44
45
  return index === 0 ? word.toLowerCase() : word.toUpperCase()
@@ -46,13 +47,13 @@ export const toCamelCase = str => {
46
47
  .replaceAll(/\s+/g, '')
47
48
  }
48
49
 
49
- export const toTitleCase = str =>
50
+ export const toTitleCase = (str) =>
50
51
  str &&
51
- str.replace(/\w\S*/g, txt => {
52
+ str.replace(/\w\S*/g, (txt) => {
52
53
  return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
53
54
  })
54
55
 
55
- export const toDashCase = val =>
56
+ export const toDashCase = (val) =>
56
57
  val
57
58
  .replace(/[^a-zA-Z0-9]/g, ' ') // Replace non-alphanumeric characters with spaces
58
59
  .trim() // Remove leading and trailing spaces
@@ -67,7 +68,7 @@ export const toDescriptionCase = (str = '') => {
67
68
  return result.charAt(0).toUpperCase() + result.slice(1)
68
69
  }
69
70
 
70
- export const arrayzeValue = val => {
71
+ export const arrayzeValue = (val) => {
71
72
  if (isArray(val)) return val
72
73
  if (isString(val)) return val.split(' ')
73
74
  if (isObject(val)) return Object.values(val)