Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
minor fixes before v1.5.6 release
  • Loading branch information
michelegiorgi committed Oct 31, 2022
1 parent c49e55f commit c2d8365
Show file tree
Hide file tree
Showing 8 changed files with 681 additions and 296 deletions.
22 changes: 12 additions & 10 deletions assets/scripts/public/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Formality public script
import { cl, isConversational, getInput } from './modules/helpers'
import { cl, isConversational, isLoaded, getInput, pushEvent } from './modules/helpers'

import { initLoader } from './modules/loader'
import { loadFields, firstFocus } from './modules/fields'
Expand All @@ -16,24 +16,26 @@ let initForms = () => {
const forms = document.querySelectorAll(cl('form'))
forms.forEach((form) => {
const conversational = isConversational(form)
initLoader(form)
addStepIndexes(form)
loadFields(form, conversational)
buildNavigation(form, conversational)
submitForm(form)
initMedia(form)
const loaded = isLoaded(form)
if(!loaded) {
initLoader(form)
addStepIndexes(form)
loadFields(form, conversational)
buildNavigation(form, conversational)
submitForm(form)
initMedia(form)
}
})
firstFocus()
initHints()
initEmbeds()
dragNdrop()
}

document.addEventListener('initFormality', () => {
window.addEventListener('foFormsInit', () => {
initForms()
})

document.addEventListener('DOMContentLoaded', () => {
const initEvent = new Event('initFormality');
document.dispatchEvent(initEvent);
pushEvent('FormsInit');
})
4 changes: 4 additions & 0 deletions assets/scripts/public/modules/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export let isConversational = (form) => {
return form.classList.contains(el('form', '', 'conversational'))
}

export let isLoaded = (form) => {
return !form.classList.contains(el('form', '', 'first-loading'))
}

export let isMobile = () => {
let hasTouchScreen = false
if ('maxTouchPoints' in navigator) {
Expand Down
6 changes: 4 additions & 2 deletions assets/scripts/public/modules/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ export let conversationalNavigation = (form) => {
if (entry[0].isIntersecting) {
let active = field.id
if(current!==active) {
current = active;
const prevField = current ? form.querySelector('#' + current) : form
current = active
const sended = field.closest(cl('form', '', 'sended'))
const navList = form.querySelector(cl('nav', 'list'))
const navLink = navList.querySelector('a[href="#'+active+'"]')
const navLink = navList.querySelector('a[href="#' + active + '"]')
const scrollPx = parseInt(Math.max(0, (navLink.offsetLeft - (navList.offsetWidth/2) + (navLink.offsetWidth/2))))
const prevActives = navList.querySelectorAll('a.active')
animateScroll(scrollPx, 100, navList, false)
Expand All @@ -123,6 +124,7 @@ export let conversationalNavigation = (form) => {
if(!field.classList.contains(el('field', '', 'focus')) && !sended) {
const input = getInput(field)
input.focus()
prevField.classList.remove(el('field', '', 'focus'))
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions assets/styles/admin/layouts/editor_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@
&.wp-block--halfwidth {
@media(min-width:521px) {
width: 50%;
box-sizing: border-box;
}
}
&:before,
Expand Down Expand Up @@ -549,6 +550,7 @@
}
}
&:after {
position: static;
content: var(--formality_credits);
font-size: 0.7em;
opacity: 0.5;
Expand Down
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,30 @@
"dependencies": "yarn upgrade-interactive --latest"
},
"devDependencies": {
"@babel/plugin-syntax-jsx": "^7.16.7",
"@babel/preset-react": "^7.16.7",
"@wordpress/babel-preset-default": "^6.10.0",
"@wordpress/browserslist-config": "^4.1.2",
"@wordpress/dependency-extraction-webpack-plugin": "^3.4.1",
"@babel/plugin-syntax-jsx": "^7.18.6",
"@babel/preset-react": "^7.18.6",
"@wordpress/babel-preset-default": "^7.4.0",
"@wordpress/browserslist-config": "^5.3.0",
"@wordpress/dependency-extraction-webpack-plugin": "^4.3.0",
"babel-eslint": "^10.1.0",
"browser-sync": "^2.27.9",
"browser-sync": "^2.27.10",
"browser-sync-webpack-plugin": "^2.0.1",
"cross-env": "^7.0.2",
"eslint": "^8.15.0",
"eslint": "^8.26.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-react": "^7.29.4",
"laravel-mix": "^6.0.43",
"eslint-plugin-react": "^7.31.10",
"laravel-mix": "^6.0.49",
"laravel-mix-banner": "^0.1.4",
"laravel-mix-copy-watched": "^2.3.1",
"laravel-mix-copy-watched": "^3.0.0",
"laravel-mix-purgecss": "^6.0.0",
"npm-run-all": "^4.1",
"purgecss-with-wordpress": "^4.1.0",
"purgecss-with-wordpress": "^5.0.0",
"rimraf": "^3.0.2",
"sass": "^1.51.0",
"sass-loader": "^12.6.0",
"stylelint": "^14.8.2",
"stylelint-config-standard": "^25.0.0",
"vue-template-compiler": "^2.6.12"
"sass": "^1.55.0",
"sass-loader": "^13.1.0",
"stylelint": "^14.14.0",
"stylelint-config-standard": "^29.0.0",
"vue-template-compiler": "^2.7.13"
},
"dependencies": {
"clone-deep": "^4.0.1",
Expand Down
4 changes: 2 additions & 2 deletions public/class-formality-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ private function load_dependencies() {
}

/**
* Register the stylesheets for the public-facing side of the site.
* Register stylesheets and scripts for the public-facing side of the site.
*
* @since 1.0
*/
public function enqueue_assets() {
$isform = is_singular('formality_form');
$isform = apply_filters('formality_enqueue_assets', is_singular('formality_form'));
wp_register_style( $this->formality . "-public", plugin_dir_url(__DIR__) . 'dist/styles/formality-public.css', array(), $this->version, 'all' );
wp_register_script( $this->formality . "-public", plugin_dir_url(__DIR__) . 'dist/scripts/formality-public.js', array( 'wp-i18n' ), $this->version, !$isform );
wp_localize_script($this->formality . "-public", 'formality', array(
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ You will find **Formality** menu in your WordPress admin screen.
= 1.5.6 =
Release Date: October 31th, 2022

* Various fixes and refinements
* WordPress 6.1 compatibility
* Gutenberg 14.4.0 compatibility

Expand Down
Loading

0 comments on commit c2d8365

Please sign in to comment.