@newlogic-digital/ui 3.0.3 → 3.2.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/README.md +20 -22
- package/package.json +25 -14
- package/src/{main.json → data/main.json} +13 -11
- package/src/emails/email.css +3 -3
- package/src/emails/email.twig +1 -1
- package/src/icons.svg +32 -0
- package/src/scripts/Components/+.js +1 -2
- package/src/scripts/Components/CookieConsent.js +68 -64
- package/src/scripts/Layout/+.js +2 -1
- package/src/scripts/Layout/Header.js +18 -0
- package/src/scripts/Layout/Main.js +49 -45
- package/src/scripts/Libraries/+.js +13 -10
- package/src/scripts/Libraries/Anchor.js +18 -43
- package/src/scripts/Libraries/CookieConsent.js +42 -57
- package/src/scripts/Libraries/Dialog.js +56 -55
- package/src/scripts/Libraries/Drawer.js +23 -23
- package/src/scripts/Libraries/Form.js +37 -0
- package/src/scripts/Libraries/NativeSlider.js +86 -86
- package/src/scripts/Libraries/ReCaptcha.js +20 -18
- package/src/scripts/Libraries/Ripple.js +16 -32
- package/src/scripts/Libraries/Script.js +19 -0
- package/src/scripts/Libraries/Stimulus.js +30 -34
- package/src/scripts/Libraries/Swup.js +45 -55
- package/src/scripts/Libraries/Tabs.js +12 -18
- package/src/scripts/Libraries/Tippy.js +118 -0
- package/src/scripts/Ui/+.js +5 -3
- package/src/scripts/Ui/Checkbox.js +19 -0
- package/src/scripts/Ui/Input.js +188 -161
- package/src/scripts/Ui/Radio.js +23 -0
- package/src/scripts/Ui/Select.js +64 -37
- package/src/scripts/Ui/Text.js +25 -0
- package/src/scripts/Utils/+.js +3 -0
- package/src/scripts/Utils/Functions/+.js +6 -6
- package/src/scripts/Utils/Functions/dataValue.js +28 -25
- package/src/scripts/Utils/Functions/importScript.js +9 -11
- package/src/scripts/Utils/Functions/importStyle.js +18 -5
- package/src/scripts/Utils/Functions/inView.js +19 -21
- package/src/scripts/Utils/Functions/loadStimulus.js +22 -20
- package/src/scripts/Utils/Functions/replaceTag.js +12 -0
- package/src/scripts/Utils/cdn.js +6 -4
- package/src/scripts/Utils/global.js +10 -33
- package/src/scripts/main.js +6 -6
- package/src/styles/Components/CookieConsent.css +40 -179
- package/src/styles/Components/Dialog/Default.css +12 -15
- package/src/styles/Components/Form/CookieConsent.css +7 -12
- package/src/styles/Layout/+.css +2 -0
- package/src/styles/Layout/Header.css +54 -0
- package/src/styles/Layout/Main.css +28 -63
- package/src/styles/Layout/Nav.css +43 -0
- package/src/styles/Libraries/+.css +1 -1
- package/src/styles/Libraries/Datepicker.css +85 -39
- package/src/styles/Libraries/Dialog.css +6 -5
- package/src/styles/Libraries/Drawer.css +15 -14
- package/src/styles/Libraries/Hint.css +29 -23
- package/src/styles/Libraries/Lazysizes.css +2 -1
- package/src/styles/Libraries/NativeSlider.css +19 -18
- package/src/styles/Libraries/Ripple.css +8 -5
- package/src/styles/Libraries/Tabs.css +4 -4
- package/src/styles/Libraries/Tippy.css +87 -0
- package/src/styles/Ui/+.css +5 -1
- package/src/styles/Ui/Badge.css +33 -19
- package/src/styles/Ui/Btn.css +80 -53
- package/src/styles/Ui/Checkbox.css +80 -41
- package/src/styles/Ui/Dropdown.css +5 -0
- package/src/styles/Ui/Heading.css +12 -12
- package/src/styles/Ui/Icon.css +27 -8
- package/src/styles/Ui/Image.css +23 -0
- package/src/styles/Ui/Input.css +295 -220
- package/src/styles/Ui/Label.css +14 -0
- package/src/styles/Ui/Link.css +3 -3
- package/src/styles/Ui/Notice.css +14 -16
- package/src/styles/Ui/Progress.css +10 -21
- package/src/styles/Ui/Radio.css +3 -8
- package/src/styles/Ui/Select.css +63 -112
- package/src/styles/Ui/Switch.css +70 -0
- package/src/styles/Ui/{Wsw.css → Text.css} +61 -80
- package/src/styles/Ui/Title.css +8 -4
- package/src/styles/Utils/+.css +9 -0
- package/src/styles/Utils/default.css +75 -67
- package/src/styles/Utils/icons.css +9 -0
- package/src/styles/Utils/keyframes.css +182 -0
- package/src/styles/Utils/normalize.css +223 -0
- package/src/styles/Utils/print.css +1 -1
- package/src/styles/Utils/tailwind/+.css +2 -0
- package/src/styles/Utils/tailwind/base.css +15 -0
- package/src/styles/Utils/tailwind/gutters.css +264 -263
- package/src/styles/Utils/theme/+.css +1 -0
- package/src/styles/Utils/theme/main.css +24 -21
- package/src/styles/Utils/vars.css +58 -35
- package/src/styles/Utils/vendor.css +1 -2
- package/src/styles/main.css +8 -3
- package/src/templates/Components/CookieConsent.twig +30 -0
- package/src/templates/Components/Dialogs/Basic.twig +7 -3
- package/src/templates/Layout/Header.twig +42 -0
- package/src/templates/Layout/Main.twig +52 -67
- package/src/templates/Sections/Gdpr.twig +64 -0
- package/src/templates/Sections/Ui.twig +2093 -0
- package/src/views/dialog-basic.json.twig +3 -0
- package/src/views/gdpr.json +11 -0
- package/src/views/index.json +12 -0
- package/src/views/json-tippy.json.twig +16 -0
- package/src/views/ui.json +11 -0
- package/vite.config.js +6 -0
- package/CHANGELOG +0 -231
- package/gulpfile.js +0 -192
- package/src/icons/iconfont.css +0 -171
- package/src/icons/selection.json +0 -1
- package/src/icons/variables.css +0 -31
- package/src/scripts/Components/Form.js +0 -26
- package/src/scripts/Ui/Wsw.js +0 -25
- package/src/scripts/Utils/Functions/bodyLoaded.js +0 -12
- package/src/styles/Libraries/Animate.css +0 -184
- package/src/styles/Utils/reference.css +0 -2
- package/src/styles/Utils/tailwind/content.css +0 -24
- package/src/styles/Utils/theme/vars.css +0 -19
- package/src/styles/preload.css +0 -29
- package/src/styles/tailwind.css +0 -5
- package/src/templates/Sections/.gitkeep +0 -0
- package/src/templates/dialog-basic.twig +0 -3
- package/src/templates/index.json +0 -6
package/src/scripts/Ui/Select.js
CHANGED
|
@@ -1,54 +1,81 @@
|
|
|
1
|
-
import {LibStimulus, Controller} from
|
|
1
|
+
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
2
|
+
|
|
3
|
+
LibStimulus.register('ui-select', class extends Controller {
|
|
4
|
+
validate(element, select) {
|
|
5
|
+
element._removeDataValue('state', 'invalid valid focus')
|
|
6
|
+
|
|
7
|
+
if (element.querySelector('[class^="icon"][class*="valid"]') !== null) {
|
|
8
|
+
element.querySelector('[class^="icon"][class*="valid"]').remove()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let validationMessage = select.validationMessage
|
|
12
|
+
|
|
13
|
+
if (typeof select.dataset.validationMessage !== 'undefined') {
|
|
14
|
+
validationMessage = select.dataset.validationMessage
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (select.checkValidity()) {
|
|
18
|
+
element._addDataValue('state', 'valid')
|
|
19
|
+
} else {
|
|
20
|
+
element._addDataValue('state', 'invalid')
|
|
21
|
+
|
|
22
|
+
if (element.querySelector('[class^="icon"][class*="valid"]') === null) {
|
|
23
|
+
const icon = element.querySelector('.icon-r')
|
|
24
|
+
const elm = icon || element
|
|
25
|
+
const where = icon ? 'afterend' : 'beforeend'
|
|
26
|
+
|
|
27
|
+
elm.insertAdjacentHTML(where, `<div class="icon-r icon-invalid text-error lib-hint-top lib-hint-error" tabindex="0" aria-label="${validationMessage}"><svg><use href="#icon-exclamation-circle"></use></svg></div>`)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
2
31
|
|
|
3
|
-
LibStimulus.register("ui-select", class extends Controller {
|
|
4
32
|
connect() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
element.addEventListener(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
element._addDataValue("state", "focus");
|
|
33
|
+
const element = this.element
|
|
34
|
+
const select = element.querySelector('select')
|
|
35
|
+
const option = element.querySelectorAll('[data-option]')
|
|
36
|
+
|
|
37
|
+
element.addEventListener('click', () => {
|
|
38
|
+
if (!element._hasDataValue('state', 'focus')) {
|
|
39
|
+
element._addDataValue('state', 'focus')
|
|
13
40
|
} else {
|
|
14
|
-
element._removeDataValue(
|
|
41
|
+
element._removeDataValue('state', 'focus')
|
|
15
42
|
}
|
|
16
43
|
|
|
17
|
-
element.addEventListener(
|
|
18
|
-
element._removeDataValue(
|
|
19
|
-
element.removeEventListener(
|
|
20
|
-
}, true)
|
|
21
|
-
}, true)
|
|
22
|
-
|
|
23
|
-
select.addEventListener("change", () => {
|
|
24
|
-
element._removeDataValue("state", "invalid valid");
|
|
44
|
+
element.addEventListener('blur', function e() {
|
|
45
|
+
element._removeDataValue('state', 'focus')
|
|
46
|
+
element.removeEventListener('blur', e)
|
|
47
|
+
}, true)
|
|
48
|
+
}, true)
|
|
25
49
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
element._addDataValue("state", "invalid");
|
|
50
|
+
element.addEventListener('click', e => {
|
|
51
|
+
if ((element._hasDataValue('state', 'focus') && e.timeStamp === 0) || e.target.tagName === 'OPTION') {
|
|
52
|
+
element._removeDataValue('state', 'focus')
|
|
30
53
|
}
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
select.addEventListener('change', () => {
|
|
57
|
+
this.validate(element, select)
|
|
31
58
|
|
|
32
|
-
if (select.value ===
|
|
33
|
-
element._removeDataValue(
|
|
59
|
+
if (select.value === '') {
|
|
60
|
+
element._removeDataValue('state', 'active')
|
|
34
61
|
} else {
|
|
35
|
-
element._addDataValue(
|
|
62
|
+
element._addDataValue('state', 'active')
|
|
36
63
|
}
|
|
37
|
-
})
|
|
64
|
+
})
|
|
38
65
|
|
|
39
66
|
if (option[0] !== null) {
|
|
40
|
-
option.
|
|
41
|
-
option.addEventListener(
|
|
42
|
-
select.value = option.getAttribute(
|
|
43
|
-
select.dispatchEvent(new Event('change', {
|
|
44
|
-
})
|
|
45
|
-
})
|
|
67
|
+
option.forEach(option => {
|
|
68
|
+
option.addEventListener('click', () => {
|
|
69
|
+
select.value = option.getAttribute('data-option')
|
|
70
|
+
select.dispatchEvent(new Event('change', { bubbles: true }))
|
|
71
|
+
})
|
|
72
|
+
})
|
|
46
73
|
}
|
|
47
74
|
|
|
48
|
-
if (select.value ===
|
|
49
|
-
element._removeDataValue(
|
|
75
|
+
if (select.value === '') {
|
|
76
|
+
element._removeDataValue('state', 'active')
|
|
50
77
|
} else {
|
|
51
|
-
element._addDataValue(
|
|
78
|
+
element._addDataValue('state', 'active')
|
|
52
79
|
}
|
|
53
80
|
}
|
|
54
|
-
})
|
|
81
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
2
|
+
|
|
3
|
+
LibStimulus.register('ui-text', class extends Controller {
|
|
4
|
+
connect() {
|
|
5
|
+
const element = this.element
|
|
6
|
+
|
|
7
|
+
Array.from(element.querySelectorAll('table')).forEach(table => {
|
|
8
|
+
this.wrap(table, new DOMParser().parseFromString('<div class="elm_text_table"></div>', 'text/html').body.firstChild)
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
Array.from(element.querySelectorAll('iframe')).forEach(iframe => {
|
|
12
|
+
if (iframe.src.match(/youtube\.com/i)) {
|
|
13
|
+
this.wrap(iframe, new DOMParser().parseFromString(`<div class="elm_text_video" style="max-width: ${iframe.width.includes('%') ? iframe.width : iframe.width + 'px'}"></div>`, 'text/html').body.firstChild)
|
|
14
|
+
} else if (iframe.width && iframe.style.aspectRatio !== 'undefined') {
|
|
15
|
+
iframe.style.aspectRatio = iframe.width + '/' + iframe.height
|
|
16
|
+
iframe.style.height = 'auto'
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
wrap(el, wrapper) {
|
|
22
|
+
el.parentNode.insertBefore(wrapper, el)
|
|
23
|
+
wrapper.appendChild(el)
|
|
24
|
+
}
|
|
25
|
+
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { default as
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as
|
|
1
|
+
import './dataValue.js'
|
|
2
|
+
export { default as importScript } from './importScript.js'
|
|
3
|
+
export { default as importStyle } from './importStyle.js'
|
|
4
|
+
export { default as inView } from './inView.js'
|
|
5
|
+
export { default as loadStimulus } from './loadStimulus.js'
|
|
6
|
+
export { default as replaceTag } from './replaceTag.js'
|
|
@@ -1,49 +1,52 @@
|
|
|
1
1
|
Element.prototype._addDataValue = function(key, value) {
|
|
2
|
-
key = `data-${key}
|
|
2
|
+
key = `data-${key}`
|
|
3
3
|
|
|
4
|
-
let attribute = this.getAttribute(key)
|
|
4
|
+
let attribute = this.getAttribute(key)
|
|
5
5
|
|
|
6
6
|
if (attribute === null) {
|
|
7
|
-
this.setAttribute(key, value)
|
|
7
|
+
this.setAttribute(key, value)
|
|
8
8
|
} else {
|
|
9
|
-
value = value.split(
|
|
10
|
-
attribute = attribute.split(
|
|
9
|
+
value = value.split(' ')
|
|
10
|
+
attribute = attribute.split(' ')
|
|
11
11
|
|
|
12
|
-
value.map(value =>
|
|
13
|
-
!attribute.includes(value) && attribute.push(value)
|
|
14
|
-
});
|
|
12
|
+
value.map(value => !attribute.includes(value) && attribute.push(value))
|
|
15
13
|
|
|
16
|
-
this.setAttribute(key, attribute.join(
|
|
14
|
+
this.setAttribute(key, attribute.join(' '))
|
|
17
15
|
}
|
|
18
16
|
}
|
|
19
17
|
|
|
20
18
|
Element.prototype._removeDataValue = function(key, value) {
|
|
21
|
-
|
|
19
|
+
const result = []
|
|
22
20
|
|
|
23
|
-
key = `data-${key}
|
|
21
|
+
key = `data-${key}`
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
const attribute = this.getAttribute(key)
|
|
26
24
|
|
|
27
|
-
if (attribute === null)
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
25
|
+
if (attribute === null) return
|
|
30
26
|
|
|
31
|
-
attribute.split(
|
|
32
|
-
!value.split(" ").includes(attribute) && result.push(attribute)
|
|
33
|
-
});
|
|
27
|
+
attribute.split(' ').map(attribute => !value.split(' ').includes(attribute) && result.push(attribute))
|
|
34
28
|
|
|
35
29
|
if (result.length !== 0) {
|
|
36
|
-
this.setAttribute(key, result.join(
|
|
30
|
+
this.setAttribute(key, result.join(' '))
|
|
37
31
|
} else {
|
|
38
|
-
this.removeAttribute(key)
|
|
32
|
+
this.removeAttribute(key)
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
35
|
|
|
42
36
|
Element.prototype._hasDataValue = function(key, value) {
|
|
43
|
-
key = `data-${key}
|
|
37
|
+
key = `data-${key}`
|
|
44
38
|
|
|
45
|
-
|
|
39
|
+
const attribute = this.getAttribute(key)
|
|
40
|
+
|
|
41
|
+
if (attribute === null) return false
|
|
42
|
+
return attribute.split(' ').includes(value)
|
|
43
|
+
}
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
Element.prototype._getDataValue = function(key) {
|
|
46
|
+
key = `data-${key}`
|
|
47
|
+
|
|
48
|
+
const attribute = this.getAttribute(key)
|
|
49
|
+
|
|
50
|
+
if (attribute === null) return ''
|
|
51
|
+
return attribute
|
|
52
|
+
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
function importScript(url) {
|
|
1
|
+
export default function importScript(url) {
|
|
2
2
|
return new Promise((resolve, reject) => {
|
|
3
3
|
if (document.querySelector(`script[src="${url}"]`) === null) {
|
|
4
|
-
const script = document.createElement('script')
|
|
4
|
+
const script = document.createElement('script')
|
|
5
5
|
|
|
6
|
-
script._importScript = new Promise((
|
|
7
|
-
script.src = url
|
|
8
|
-
script.onload =
|
|
9
|
-
script.onerror =
|
|
10
|
-
})
|
|
6
|
+
script._importScript = new Promise((resolve, reject) => {
|
|
7
|
+
script.src = url
|
|
8
|
+
script.onload = resolve
|
|
9
|
+
script.onerror = reject
|
|
10
|
+
}).then(resolve).catch(reject)
|
|
11
11
|
|
|
12
|
-
document.head.appendChild(script)
|
|
12
|
+
document.head.appendChild(script)
|
|
13
13
|
} else {
|
|
14
|
-
document.querySelector(`script[src="${url}"]`)._importScript.then(resolve)
|
|
14
|
+
document.querySelector(`script[src="${url}"]`)._importScript.then(resolve)
|
|
15
15
|
}
|
|
16
16
|
})
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
export default importScript;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
export default function importStyle
|
|
2
|
-
|
|
3
|
-
document.
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export default function importStyle(url) {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
if (document.querySelector(`link[href="${url}"]`) === null) {
|
|
4
|
+
const style = document.createElement('link')
|
|
5
|
+
|
|
6
|
+
style._importStyle = new Promise((resolve, reject) => {
|
|
7
|
+
style.href = url
|
|
8
|
+
style.rel = 'stylesheet'
|
|
9
|
+
style.onload = resolve
|
|
10
|
+
style.onerror = reject
|
|
11
|
+
}).then(resolve).catch(reject)
|
|
12
|
+
|
|
13
|
+
document.head.prepend(style)
|
|
14
|
+
} else {
|
|
15
|
+
document.querySelector(`link[href="${url}"]`)._importStyle.then(resolve)
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
}
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
export default function inView(element,
|
|
2
|
-
let inView = false
|
|
1
|
+
export default function inView(element, options) {
|
|
2
|
+
let inView = false
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
return new Promise((resolve) => {
|
|
5
|
+
if (typeof IntersectionObserver === 'undefined') {
|
|
6
|
+
resolve()
|
|
7
|
+
return false
|
|
8
|
+
}
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
if (typeof options === 'undefined') {
|
|
11
|
+
options = {}
|
|
12
|
+
}
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
if (typeof options.rootMargin === 'undefined') {
|
|
15
|
+
options.rootMargin = '100px'
|
|
16
|
+
}
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
entries => {
|
|
18
|
+
new IntersectionObserver(entries => {
|
|
19
19
|
if (entries[0].isIntersecting && inView === false) {
|
|
20
|
-
inView = entries[0].isIntersecting
|
|
21
|
-
|
|
22
|
-
callback()
|
|
23
|
-
}
|
|
20
|
+
inView = entries[0].isIntersecting
|
|
21
|
+
resolve()
|
|
24
22
|
}
|
|
25
|
-
}, options
|
|
26
|
-
)
|
|
27
|
-
}
|
|
23
|
+
}, options).observe(element)
|
|
24
|
+
})
|
|
25
|
+
}
|
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const dynamicControllers = ['ui-input', 'ui-select', 'ui-text', 'ui-checkbox', 'ui-radio', 'c-cookieconsent', 'c-form-cookieconsent']
|
|
2
|
+
const dynamicActions = [['.ui-btn', 'click->lib#ripple']]
|
|
3
|
+
|
|
4
|
+
if (!('scrollBehavior' in document.documentElement.style)) {
|
|
5
|
+
dynamicActions.push(['a[href^="#"]', 'click->lib#anchor'])
|
|
6
|
+
}
|
|
3
7
|
|
|
4
8
|
function loadControllers(parent, selectors) {
|
|
5
9
|
if (parent !== null) {
|
|
6
|
-
selectors.forEach(
|
|
7
|
-
[...parent.getElementsByClassName(selector)].
|
|
8
|
-
if (element.getAttribute(
|
|
9
|
-
element.setAttribute(
|
|
10
|
+
selectors.forEach(selector => {
|
|
11
|
+
[...parent.getElementsByClassName(selector)].forEach(element => {
|
|
12
|
+
if (element.getAttribute('data-controller') === null) {
|
|
13
|
+
element.setAttribute('data-controller', selector)
|
|
10
14
|
}
|
|
11
|
-
})
|
|
12
|
-
})
|
|
15
|
+
})
|
|
16
|
+
})
|
|
13
17
|
}
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
function loadActions(parent, selectors) {
|
|
17
21
|
if (parent !== null) {
|
|
18
|
-
selectors.forEach(
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
selectors.forEach(selector => {
|
|
23
|
+
parent.querySelectorAll(selector[0]).forEach(element => {
|
|
24
|
+
const attribute = element.getAttribute('data-action')
|
|
21
25
|
|
|
22
26
|
if (attribute === null) {
|
|
23
|
-
element.setAttribute(
|
|
27
|
+
element.setAttribute('data-action', selector[1])
|
|
24
28
|
} else if (attribute.indexOf(selector[1]) === -1) {
|
|
25
|
-
element.setAttribute(
|
|
29
|
+
element.setAttribute('data-action', `${attribute} ${selector[1]}`)
|
|
26
30
|
}
|
|
27
|
-
})
|
|
28
|
-
})
|
|
31
|
+
})
|
|
32
|
+
})
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
35
|
|
|
32
|
-
function loadStimulus(selector) {
|
|
33
|
-
loadControllers(selector, dynamicControllers)
|
|
34
|
-
loadActions(selector, dynamicActions)
|
|
36
|
+
export default function loadStimulus(selector) {
|
|
37
|
+
loadControllers(selector, dynamicControllers)
|
|
38
|
+
loadActions(selector, dynamicActions)
|
|
35
39
|
}
|
|
36
|
-
|
|
37
|
-
export default loadStimulus;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default function replaceTag(documentElement) {
|
|
2
|
+
documentElement.querySelectorAll('[data-lib-replace-tag]').forEach(element => {
|
|
3
|
+
const replaceTag = document.querySelector(`[data-lib-replace-tag=${element.dataset.libReplaceTag}]`)
|
|
4
|
+
const placement = element.closest('head') ? document.head : replaceTag.parentElement
|
|
5
|
+
|
|
6
|
+
replaceTag ? (replaceTag.outerHTML = element.outerHTML) : placement.insertAdjacentHTML('beforeend', element.outerHTML)
|
|
7
|
+
|
|
8
|
+
if (element.tagName === 'SCRIPT') {
|
|
9
|
+
document.querySelector(`[data-lib-replace-tag=${element.dataset.libReplaceTag}]`)._addDataValue('controller', 'lib-script')
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
}
|
package/src/scripts/Utils/cdn.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
recaptcha: 'https://www.google.com/recaptcha/enterprise.js?render={apikey}',
|
|
3
|
+
seamless: 'https://cdn.jsdelivr.net/npm/seamless-scroll-polyfill@2.1.6/lib/bundle.min.js',
|
|
4
|
+
pickr_css: 'https://cdn.jsdelivr.net/npm/@simonwep/pickr@1.8.0/dist/themes/nano.min.css',
|
|
5
|
+
tippy: 'https://cdn.jsdelivr.net/combine/npm/tippy.js@6.3.7/dist/tippy.css,npm/tippy.js@6.3.1/dist/svg-arrow.css,npm/tippy.js@6.3.7/themes/light-border.css,npm/tippy.js@6.3.7/animations/scale.css',
|
|
6
|
+
datepicker: 'https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.2.0/dist/css/datepicker.min.css'
|
|
7
|
+
}
|
|
@@ -1,40 +1,17 @@
|
|
|
1
|
-
if ('serviceWorker' in navigator && location.protocol ===
|
|
2
|
-
window.addEventListener('load',
|
|
3
|
-
if (!document.documentElement.classList.contains(
|
|
4
|
-
navigator.serviceWorker.register('/sw.js').catch(
|
|
5
|
-
console.error('Error during service worker registration:', e)
|
|
6
|
-
})
|
|
1
|
+
if ('serviceWorker' in navigator && location.protocol === 'https:') {
|
|
2
|
+
window.addEventListener('load', () => {
|
|
3
|
+
if (!document.documentElement.classList.contains('no-sw')) {
|
|
4
|
+
navigator.serviceWorker.register('/sw.js').catch(e => {
|
|
5
|
+
console.error('Error during service worker registration:', e)
|
|
6
|
+
})
|
|
7
7
|
} else {
|
|
8
|
-
navigator.serviceWorker.getRegistrations().then(
|
|
8
|
+
navigator.serviceWorker.getRegistrations().then(registrations => {
|
|
9
9
|
if (registrations.length > 0) {
|
|
10
|
-
for (
|
|
10
|
+
for (const registration of registrations) {
|
|
11
11
|
registration.unregister()
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
})
|
|
14
|
+
})
|
|
15
15
|
}
|
|
16
|
-
})
|
|
16
|
+
})
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
if (document.body.classList.contains("is-body-preload")) {
|
|
20
|
-
document.body.classList.remove("is-body-preload");
|
|
21
|
-
setTimeout(function () {
|
|
22
|
-
document.body.classList.add("is-body-loaded");
|
|
23
|
-
}, 300);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (document.querySelector("[data-loadcss]") !== null) {
|
|
27
|
-
if (typeof document.fonts !== "undefined") {
|
|
28
|
-
document.fonts.ready.then(function () {
|
|
29
|
-
document.documentElement.classList.add("wf-active");
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
setTimeout(() => {
|
|
33
|
-
if (!document.documentElement.classList.contains("wf-active")) {
|
|
34
|
-
document.documentElement.classList.add("wf-active");
|
|
35
|
-
}
|
|
36
|
-
}, 500);
|
|
37
|
-
} else {
|
|
38
|
-
document.documentElement.classList.add("wf-active");
|
|
39
|
-
}
|
|
40
|
-
}
|
package/src/scripts/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import './Utils/global.js'
|
|
2
|
+
import './Libraries/+.js'
|
|
3
|
+
import './Layout/+.js'
|
|
4
|
+
import './Sections/+.js'
|
|
5
|
+
import './Components/+.js'
|
|
6
|
+
import './Ui/+.js'
|