hx-tomselect 1.0.2 → 1.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.
Files changed (2) hide show
  1. package/hx-tomselect.js +9 -8
  2. package/package.json +1 -1
package/hx-tomselect.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function() {
2
2
  /** stable build*/
3
- const version = '07'
3
+ const version = '09'
4
4
 
5
5
  /**
6
6
  * @typedef {Object} SupportedAttribute
@@ -29,8 +29,6 @@
29
29
  *
30
30
  */
31
31
 
32
-
33
-
34
32
  /**
35
33
  * @type {SupportedAttribute[]}
36
34
  */
@@ -256,9 +254,12 @@
256
254
  maxItems: 999,
257
255
  plugins: {}
258
256
  };
259
- const debug = s.getAttribute('hx-ext')?.split(',').map(item => item.trim()).includes('debug');
260
- if (debug) { console.log(`\n\nattachTomSelect\n\n ${version}`) }
261
- if (debug) { console.log(s.attributes) }
257
+
258
+ const debug = s.getAttribute('hx-ext')?.split(',').map(item => item.trim()).includes('debug') || window.tsSelectDebugOn;
259
+ if (debug) {
260
+ console.log(`\n\nattachTomSelect\n\n ${version}`)
261
+ console.log(s.attributes)
262
+ }
262
263
 
263
264
  Array.from(s.attributes).forEach((a) => {
264
265
  const attributeConfig = attributeConfigs.find((ac) => ac.key == a.name)
@@ -299,7 +300,7 @@
299
300
  if (name === "htmx:afterProcessNode") {
300
301
  const newSelects = document.querySelectorAll('select[hx-ext*="tomselect"]:not([tom-select-success]):not([tom-select-error])')
301
302
  newSelects.forEach((s) => {
302
- if(debug){ console.log('onEvent/htmx:afterProcessNode - newSelects', s)}
303
+ if(window.tsSelectDebugOn){ console.log('onEvent/htmx:afterProcessNode - newSelects', s) }
303
304
  attachTomSelect(s)
304
305
  })
305
306
  }
@@ -308,7 +309,7 @@
308
309
  console.log('onLoad')
309
310
  const newSelects = content.querySelectorAll('select[hx-ext*="tomselect"]:not([tom-select-success]):not([tom-select-error])')
310
311
  newSelects.forEach((s) => {
311
- if(debug){ console.log('onLoad - newSelects', s)}
312
+ if(window.tsSelectDebugOn){ console.log('onLoad - newSelects', s) }
312
313
  attachTomSelect(s)
313
314
  })
314
315
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hx-tomselect",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Provides a hx-ext=\"tomselect\" htmx extention tag",
5
5
  "main": "hx-tomselect.js",
6
6
  "scripts": {