Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to using Webpack for JavaScript and CSS #104

Draft
wants to merge 35 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b1a16b5
work in progress webpack Swat
gauthierm Jul 27, 2017
d69f4b1
COnvert more classes to ES6 modules
gauthierm Dec 30, 2017
ebe0194
Convert remaining two classes to ES6
gauthierm Dec 31, 2017
8984c0e
Use ES6 import and export for modules
gauthierm Dec 31, 2017
b4bd07f
Add bundle file for webpack
gauthierm Dec 31, 2017
90081c9
Make the demo app work again
gauthierm Dec 31, 2017
0533d41
Add readme for demo
gauthierm Dec 31, 2017
4bf068e
Fix minor typos
gauthierm Dec 31, 2017
ba67c88
Add webpack config and update demo to use it
gauthierm Dec 31, 2017
d11c369
Import CSS in JS
gauthierm Dec 31, 2017
8d9116c
Add fileloader and extract text plugins
gauthierm Dec 31, 2017
9b0e349
Add styles to layout
gauthierm Dec 31, 2017
82f746c
Fix method signature
gauthierm Dec 31, 2017
9abf7ce
Use Webpack shimming to modularize YUI2 components
gauthierm Jan 1, 2018
32d27ed
Better formatting of loader options
gauthierm Jan 1, 2018
bcaf7ad
Remove unused file
gauthierm Jan 1, 2018
2c439fb
Remove widget html head entries from PHP
gauthierm Jan 1, 2018
4e60cc1
Add, remove and update demos
gauthierm Jan 2, 2018
5062ecf
Modularize more of YUI
gauthierm Jan 2, 2018
6ae294d
Add a class for SwatNoteBook
gauthierm Jan 2, 2018
20f6486
Import YUI modules in swat widgets
gauthierm Jan 2, 2018
b397d77
Remove YAHOO deps from frame disclosure
gauthierm Jan 2, 2018
170e5d5
Fix bundling bugs with YUI2 element and dom
gauthierm Jan 2, 2018
e17e95e
Fix bugs with calendar and image cropper
gauthierm Jan 2, 2018
438f04b
Exclude color entry
gauthierm Jan 2, 2018
d882cca
ws
gauthierm Jan 2, 2018
5617c79
Modularize CSS for date and time entry
gauthierm Jan 2, 2018
cf6c6d1
Modularize more actions CSS
gauthierm Jan 2, 2018
6f04ae9
Modularize YUI ColorAnim
gauthierm Jan 2, 2018
0aaf2b4
Import abstract overlay styles
gauthierm Jan 2, 2018
027bf1c
Minor fixes to textarea
gauthierm Jan 2, 2018
53eceff
Make table-view-input-row work
gauthierm Jan 2, 2018
c985e1b
Update to TinyMCE 4.x and make work with webpack
gauthierm Jan 3, 2018
0ee197f
Remove TinyMCE sources
gauthierm Jan 3, 2018
33587e2
Don't use Concentrate to display head entries
gauthierm Jan 4, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 0 additions & 12 deletions Swat/SwatAbstractOverlay.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,7 @@ abstract class SwatAbstractOverlay extends SwatInputControl implements SwatState
public function __construct($id = null)
{
parent::__construct($id);

$this->requires_id = true;

$yui = new SwatYUI(array('dom', 'event', 'container'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());

$this->addJavaScript(
'packages/swat/javascript/swat-abstract-overlay.js'
);

$this->addJavaScript(
'packages/swat/javascript/swat-z-index-manager.js'
);
}

// }}}
Expand Down
7 changes: 0 additions & 7 deletions Swat/SwatAccordion.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,7 @@ class SwatAccordion extends SwatNoteBook
public function __construct($id = null)
{
parent::__construct($id);

$this->requires_id = true;

$yui = new SwatYUI(array('yahoo', 'dom', 'event', 'animation'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());

$this->addStyleSheet('packages/swat/styles/swat-accordion.css');
$this->addJavaScript('packages/swat/javascript/swat-accordion.js');
}

// }}}
Expand Down
20 changes: 0 additions & 20 deletions Swat/SwatActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,6 @@ class SwatActions extends SwatControl implements SwatUIParent
*/
private $selector;

// }}}
// {{{ public function __construct()

/**
* Creates a new actions list
*
* @param string $id a non-visible unique id for this widget.
*
* @see SwatWidget::__construct()
*/
public function __construct($id = null)
{
parent::__construct($id);

$yui = new SwatYUI(array('dom', 'event', 'animation'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());
$this->addJavaScript('packages/swat/javascript/swat-actions.js');
$this->addStyleSheet('packages/swat/styles/swat-actions.css');
}

// }}}
// {{{ public function init()

Expand Down
38 changes: 8 additions & 30 deletions Swat/SwatButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ class SwatButton extends SwatInputControl
public function __construct($id = null)
{
parent::__construct($id);

$yui = new SwatYUI(array('dom', 'event', 'animation'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());
$this->addJavaScript('packages/swat/javascript/swat-button.js');

$this->requires_id = true;
}

Expand Down Expand Up @@ -365,36 +360,19 @@ protected function getJavaScriptClass()
*/
protected function getInlineJavaScript()
{
$show_processing_throbber = $this->show_processing_throbber
? 'true'
: 'false';
$options = [
'show_processing_throbber' => $this->show_processing_throbber,
'processing_message' => $this->processing_throbber_message,
'confirmation_message' => $this->confirmation_message,
];

$javascript = sprintf(
"var %s_obj = new %s('%s', %s);",
$javascript = sprintf("var %s_obj = new %s(%s, %s);",
$this->id,
$this->getJavaScriptClass(),
$this->id,
$show_processing_throbber
SwatString::quoteJavaScriptString($this->id),
json_encode($options)
);

if ($this->show_processing_throbber) {
$javascript .= sprintf(
"\n%s_obj.setProcessingMessage(%s);",
$this->id,
SwatString::quoteJavaScriptString(
$this->processing_throbber_message
)
);
}

if ($this->confirmation_message !== null) {
$javascript .= sprintf(
"\n%s_obj.setConfirmationMessage(%s);",
$this->id,
SwatString::quoteJavaScriptString($this->confirmation_message)
);
}

return $javascript;
}

Expand Down
10 changes: 0 additions & 10 deletions Swat/SwatCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,7 @@ class SwatCalendar extends SwatControl
public function __construct($id = null)
{
parent::__construct($id);

$this->requires_id = true;

$yui = new SwatYUI(array('dom', 'container'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());

$this->addStyleSheet('packages/swat/styles/swat-calendar.css');
$this->addJavaScript('packages/swat/javascript/swat-calendar.js');
$this->addJavaScript(
'packages/swat/javascript/swat-z-index-manager.js'
);
}

// }}}
Expand Down
6 changes: 0 additions & 6 deletions Swat/SwatCascadeFlydown.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ class SwatCascadeFlydown extends SwatFlydown
public function __construct($id = null)
{
parent::__construct($id);

$this->requires_id = true;

$yui = new SwatYUI(array('event'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());

$this->addJavaScript('packages/swat/javascript/swat-cascade.js');
}

// }}}
Expand Down
9 changes: 0 additions & 9 deletions Swat/SwatChangeOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,6 @@ public function __construct($id = null)
{
parent::__construct($id);
$this->requires_id = true;

$yui = new SwatYUI(array('dom', 'event'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());

$this->addStyleSheet('packages/swat/styles/swat-change-order.css');
$this->addJavaScript('packages/swat/javascript/swat-change-order.js');
$this->addJavaScript(
'packages/swat/javascript/swat-z-index-manager.js'
);
}

// }}}
Expand Down
3 changes: 0 additions & 3 deletions Swat/SwatCheckAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ public function __construct($id = null)
{
parent::__construct($id);
$this->title = Swat::_('Select All');
$yui = new SwatYUI(array('event'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());
$this->addJavaScript('packages/swat/javascript/swat-check-all.js');
}

// }}}
Expand Down
6 changes: 0 additions & 6 deletions Swat/SwatCheckboxCellRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ public function __construct()

$this->makePropertyStatic('id');

$yui = new SwatYUI(array('dom'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());
$this->addJavaScript(
'packages/swat/javascript/swat-checkbox-cell-renderer.js'
);

// auto-generate an id to use if no id is set
$this->id = $this->getUniqueId();
}
Expand Down
26 changes: 0 additions & 26 deletions Swat/SwatCheckboxEntryList.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,32 +54,6 @@ class SwatCheckboxEntryList extends SwatCheckboxList
*/
protected $entry_widgets = array();

// }}}
// {{{ public function __construct()

/**
* Creates a new checkbox entry list
*
* @param string $id a non-visible unique id for this widget.
*
* @see SwatCheckboxList::__construct()
*/
public function __construct($id = null)
{
parent::__construct($id);

$yui = new SwatYUI(array('dom', 'event'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());

$this->addJavaScript(
'packages/swat/javascript/swat-checkbox-entry-list.js'
);

$this->addStyleSheet(
'packages/swat/styles/swat-checkbox-entry-list.css'
);
}

// }}}
// {{{ public function display()

Expand Down
4 changes: 0 additions & 4 deletions Swat/SwatCheckboxList.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ public function __construct($id = null)
{
parent::__construct($id);
$this->requires_id = true;
$yui = new SwatYUI(array('event'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());
$this->addJavaScript('packages/swat/javascript/swat-checkbox-list.js');
$this->addStyleSheet('packages/swat/styles/swat.css');
}

// }}}
Expand Down
4 changes: 0 additions & 4 deletions Swat/SwatDateEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ public function __construct($id = null)
$this->setValidRange(-20, 20);

$this->requires_id = true;

$yui = new SwatYUI(array('event'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());
$this->addJavaScript('packages/swat/javascript/swat-date-entry.js');
}

// }}}
Expand Down
17 changes: 0 additions & 17 deletions Swat/SwatDetailsView.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,6 @@ class SwatDetailsView extends SwatControl implements SwatUIParent
*/
private $fields_by_id = array();

// }}}
// {{{ public function __construct()

/**
* Creates a new details view
*
* @param string $id a non-visible unique id for this widget.
*
* @see SwatWidget::__construct()
*/
public function __construct($id = null)
{
parent::__construct($id);

$this->addStyleSheet('packages/swat/styles/swat-details-view.css');
}

// }}}
// {{{ public function init()

Expand Down
6 changes: 0 additions & 6 deletions Swat/SwatDisclosure.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ public function __construct($id = null)
{
parent::__construct($id);
$this->requires_id = true;

$yui = new SwatYUI(array('dom', 'animation'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());

$this->addJavaScript('packages/swat/javascript/swat-disclosure.js');
$this->addStyleSheet('packages/swat/styles/swat-disclosure.css');
}

// }}}
Expand Down
6 changes: 0 additions & 6 deletions Swat/SwatFieldset.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,7 @@ class SwatFieldset extends SwatDisplayableContainer implements SwatTitleable
public function __construct($id = null)
{
parent::__construct($id);

$this->requires_id = true;

// JavaScript for IE peekaboo hack
$yui = new SwatYUI(array('event'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());
$this->addJavaScript('packages/swat/javascript/swat-fieldset.js');
}

// }}}
Expand Down
9 changes: 0 additions & 9 deletions Swat/SwatForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ public function __construct($id = null)
}

$this->requires_id = true;

$this->addJavaScript('packages/swat/javascript/swat-form.js');
}

// }}}
Expand Down Expand Up @@ -325,13 +323,6 @@ public function display()
$this->displayHiddenFields();
$form_tag->close();

if ($this->connection_close_uri != '') {
$yui = new SwatYUI(array('event'));
$this->html_head_entry_set->addEntrySet(
$yui->getHtmlHeadEntrySet()
);
}

Swat::displayInlineJavaScript($this->getInlineJavaScript());
}

Expand Down
17 changes: 0 additions & 17 deletions Swat/SwatFrameDisclosure.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,6 @@
*/
class SwatFrameDisclosure extends SwatDisclosure
{
// {{{ public function __construct()

/**
* Creates a new frame disclosure container
*
* @param string $id a non-visible unique id for this widget.
*
* @see SwatWidget::__construct()
*/
public function __construct($id = null)
{
parent::__construct($id);

$this->addStyleSheet('packages/swat/styles/swat-frame-disclosure.css');
}

// }}}
// {{{ public function display()

/**
Expand Down
10 changes: 9 additions & 1 deletion Swat/SwatGroupedFlydown.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ class SwatGroupedFlydown extends SwatTreeFlydown
*
* @throws SwatException if the tree more than 3 levels deep.
*/
public function setTree(SwatTreeFlydownNode $tree)
public function setTree($tree)
{
if (!$tree instanceof SwatTreeFlydownNode) {
throw new SwatInvalidClassException(
'Tree must be an intance of SwatDataTreeNode.',
0,
$tree
);
}

$this->checkTree($tree);
parent::setTree($tree);
}
Expand Down
6 changes: 0 additions & 6 deletions Swat/SwatImageCropper.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,7 @@ class SwatImageCropper extends SwatInputControl
public function __construct($id = null)
{
parent::__construct($id);

$this->requires_id = true;

$yui = new SwatYUI(array('imagecropper'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());

$this->addJavaScript('packages/swat/javascript/swat-image-cropper.js');
}

// }}}
Expand Down
17 changes: 0 additions & 17 deletions Swat/SwatImagePreviewDisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,7 @@ class SwatImagePreviewDisplay extends SwatImageDisplay
public function __construct($id = null)
{
parent::__construct($id);

$this->requires_id = true;

$yui = new SwatYUI(array('dom', 'event'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());

$this->addJavaScript(
'packages/swat/javascript/swat-z-index-manager.js'
);

$this->addJavaScript(
'packages/swat/javascript/swat-image-preview-display.js'
);

$this->addStyleSheet(
'packages/swat/styles/swat-image-preview-display.css'
);

$this->title = Swat::_('View Larger Image');
}

Expand Down
Loading