Skip to content

Commit

Permalink
fix: i18n, build and demo assets
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinchappell committed Oct 30, 2024
1 parent 3a6ae42 commit e7eb92f
Show file tree
Hide file tree
Showing 31 changed files with 174 additions and 118 deletions.
39 changes: 18 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 16 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
"name": "formeo",
"version": "2.1.4",
"type": "module",
"main": "dist/formeo.min.js",
"main": "dist/formeo.cjs.js",
"module": "dist/formeo.es.js",
"unpkg": "dist/formeo.umd.js",
"exports": {
".": {
"import": "./dist/formeo.es.js",
"require": "./dist/formeo.cjs.js",
"default": "./dist/formeo.umd.js"
}
},
"files": [
"dist/*",
"demo/**/*"
Expand Down Expand Up @@ -55,10 +64,9 @@
"scripts": {
"dev": "vite",
"preview": "vite preview",
"analyze": "webpack --mode production -p --progress --config tools/webpack.config --analyze",
"build": "npm-run-all -p build:icons build:formeo build:demo",
"build:formeo": "vite build --mode lib",
"build:formeo:watch": "npm run build:formeo -- --watch",
"build:lib": "vite build --config vite.config.lib.mjs",
"build": "npm-run-all -p build:icons build:demo",
"prebuild": "npm run build:lib",
"build:demo": "vite build --mode demo",
"build:demo:watch": "vite build --mode demo --watch",
"build:icons": "node ./tools/generate-sprite",
Expand All @@ -68,6 +76,7 @@
"test:ci": "yarn test --coverage",
"start": "npm-run-all build:icons dev",
"semantic-release": "semantic-release --ci --debug",
"copy:lang": "node ./tools/copy-directory.mjs ./node_modules/formeo-i18n/dist/lang ./src/demo/assets/lang",
"travis-deploy-once": "travis-deploy-once --pro",
"prepush": "yarn test",
"defaults": "webpack-defaults"
Expand All @@ -92,9 +101,9 @@
"vite-plugin-static-copy": "^2.0.0"
},
"dependencies": {
"formeo-i18n": "^2.1.3",
"@draggable/formeo-languages": "^3.1.3",
"@draggable/i18n": "^1.0.7",
"lodash": "^4.17.21",
"mi18n": "^1.0.2",
"sortablejs": "^1.15.3"
},
"release": {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/common/actions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import { SESSION_FORMDATA_KEY, CONDITION_TEMPLATE } from '../constants.js'
import { identity, sessionStorage } from './utils/index.mjs'
import events from './events.js'
Expand Down
14 changes: 11 additions & 3 deletions src/lib/js/common/dom.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import h, { forEach } from './helpers.mjs'
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import animate from './animation.js'
import Components from '../components/index.js'
import { uuid, componentType, merge } from './utils/index.mjs'
Expand Down Expand Up @@ -735,7 +735,11 @@ class DOM {
removeClasses(nodeList, className) {
const removeClass = {
string: elem => elem.classList.remove(className),
array: elem => className.forEach(name => elem.classList.remove(name)),
array: elem => {
for (const name of className) {
elem.classList.remove(name)
}
},
}
removeClass.object = removeClass.string // handles regex map
h.forEach(nodeList, removeClass[this.childType(className)])
Expand All @@ -750,7 +754,11 @@ class DOM {
addClasses(nodeList, className) {
const addClass = {
string: elem => elem.classList.add(className),
array: elem => className.forEach(name => elem.classList.add(name)),
array: elem => {
for (const name of className) {
elem.classList.add(name)
}
},
}
h.forEach(nodeList, addClass[this.childType(className)])
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/autocomplete.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import animate from '../common/animation.js'
import dom from '../common/dom.js'
import Components from './index.js'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/columns/column.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Sortable from 'sortablejs'
import Component from '../component.js'
import h from '../../common/helpers.mjs'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/control.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import dom from '../../common/dom.js'
import { fetchDependencies } from '../../common/loaders.js'
import { uuid } from '../../common/utils/index.mjs'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/form/button.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Control from '../control.js'

class ButtonControl extends Control {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/form/checkbox-group.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateOptionConfig } from './shared.js'
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Control from '../control.js'

class CheckboxGroupControl extends Control {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/form/input.date.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Control from '../control.js'

class DateControl extends Control {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/form/input.file.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Control from '../control.js'

class FileControl extends Control {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/form/input.hidden.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Control from '../control.js'

class HiddenControl extends Control {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/form/input.number.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Control from '../control.js'

class NumberControl extends Control {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/form/input.text.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Control from '../control.js'
// import Components from '../..'

Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/form/radio-group.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateOptionConfig } from './shared.js'
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Control from '../control.js'

class RadioGroupControl extends Control {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/form/select.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import { generateOptionConfig } from './shared.js'
import Control from '../control.js'

Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/form/shared.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import { toTitleCase } from '../../../common/utils/string.mjs'

export const generateOptionConfig = (type, count = 3) =>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/form/textarea.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Control from '../control.js'

class TextAreaControl extends Control {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/html/header.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Control from '../control.js'

const headerTags = Array.from(Array(5).keys())
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/html/hr.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Control from '../control.js'

class HRControl extends Control {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/html/paragraph.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Control from '../control.js'

class ParagraphControl extends Control {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/controls/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Sortable from 'sortablejs'
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import actions from '../../common/actions.js'
import { indexOfNode, orderObjectsBy } from '../../common/helpers.mjs'
import events from '../../common/events.js'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/fields/edit-panel-item.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import { orderObjectsBy, indexOfNode } from '../../common/helpers.mjs'
import dom from '../../common/dom.js'
import animate from '../../common/animation.js'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/fields/edit-panel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import dom from '../../common/dom.js'
import actions from '../../common/actions.js'
import EditPanelItem from './edit-panel-item.mjs'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/fields/field.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import dom from '../../common/dom.js'
import Panels from '../panels.js'
import { clone, throttle, unique } from '../../common/utils/index.mjs'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/panels.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Sortable from 'sortablejs'
import h, { indexOfNode } from '../common/helpers.mjs'
import dom from '../common/dom.js'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/components/rows/row.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import Sortable from 'sortablejs'
import Component from '../component.js'
import dom from '../../common/dom.js'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/js/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mi18n from 'mi18n'
import mi18n from '@draggable/i18n'
import { isIE } from './common/helpers'
const EN_US = import.meta.env.EN_US

Expand Down
4 changes: 2 additions & 2 deletions src/lib/js/editor.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import '../sass/formeo.scss'
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import dom from './common/dom.js'
import Events from './common/events.js'
import Actions from './common/actions.js'
import Controls from './components/controls/index.js'
import Components from './components/index.js'
import { loadPolyfills, insertStyle, insertIcons, ajax } from './common/loaders.js'
import { SESSION_LOCALE_KEY, FALLBACK_SVG_SPRITE } from './constants.js'
import { sessionStorage, merge } from './common/utils/index.mjs'
import { merge } from './common/utils/index.mjs'
import { defaults } from './config.js'
import sprite from '../icons/formeo-sprite.svg?raw'

Expand Down
Loading

0 comments on commit e7eb92f

Please sign in to comment.