Releases: Patternslib/Patterns
Release 9.8.0
9.8.0 (2022-12-23)
Breaking Changes
-
pat-validation: Remove error-template option. (78c544b)
This is a breaking change.
Due to a Content-Security-Policy problem with dom.template when unsafe-eval
is not set - which you wouldn't set if possible - we had to remove the
error-template parameter. Instead the template is now defined in a
error_template
method on the Patten class and can be customized by
subclassing and extending the pat-validation pattern or by patching it via
Pattern.prototype.
Features
-
pat-sortable: Support initialization after injection. (afaf388)
-
core events: Add dragstart and dragend event factories. (73d7fc7)
-
pat-sortable: Initialize sorting on cloned elements. (d7abbc0)
Fix sorting behavior on cloned elements, which broke on Patternslib 9.8.0-alpha.0.
-
core basepattern: Add a destroy method. (f9ca65a)
The destroy method removes the pattern instance from the element.
This is necessary to re-initialize the same pattern on the same element. -
core events: Support await_pattern_init with pattern double registration attempt. (e8640a9)
When a pattern is tried to be initialized on the same element twice, throw
an event and use that event in await_pattern_init to reject the promise.
When using await_pattern_init you might want to try/catch the block to
handle any possible double-registration errors. -
core events: Support once-events in add_event_listener. (fc0e333)
Add support for once-events in add_event_listener and unregister them when
called from the event_listener_map. -
Build: Include the build in the npm package. (544b589)
The compiled build is now included in npm packages by including the dist
directory in .npmignore. To not increase the package size too much the
JavaScript map files are not included. Now you can include Patternslib by
using unpkg or jsDelivr like so:
https://unpkg.com/@patternslib/[email protected]/dist/bundle.min.js
or
https://cdn.jsdelivr.net/npm/@patternslib/[email protected]/dist/bundle.min.js
-
core dom: Add is_input method. (554e32e)
Add
is_input
to test if a element is of input type. This is basically the
same as$(":input")
from Sizzle/jQuery. -
pat-markdown: Soft-depend on pat-syntax-highlight. (cf0f6e3)
Only highlight code blocks when the pattern is available.
Not hard-depending and importing pat-syntax-highlight fixes a problem where
only including pat-markup also included pat-syntax-highlight and it's big
highlight.js library.This can reduce the generated bundle size significantly.
-
pat-tooltip: Soft-depend on pat-markdown. (1f81238)
Only register the markdown data type handler when the pattern is available.
Not hard-depending and importing pat-markdown fixes a problem where only
including pat-tooltip also included pat-markdown and pat-syntax-highlight
with it's big highlight.js library.This can reduce the generated bundle size significantly.
-
core basepattern: Provide the parser as static attribute. (49db677)
This change is backwards compatible Change the parser attribute to a static
attribute and provide it also on the object. This change was necessary
because pat-inject was using the parser on a registered Pattern class to
rebase URL configurations in the rebaseHTML method. There was no access to
the parser attribute on non-instatiated objects before, now it is. -
pat-autosuggest: Add a configurable separator for multiple values. (21cbe8f)
Bug Fixes
-
pat-sortable: Initialize already existing sortable handles. (b3f5077)
Also allow the sortable itself to be the handle.
-
pat-sortable: Show dragable item image while dragging. (1c9eb80)
-
pat-sortable: sortable-handle needs to be injected at last element of the sortable item. (db02541)
-
Build: Load modernizr early and non-asynchronously. (8bc9b66)
Include the modernizr bundle by injecting a script tag. This ensures
modernizr is loaded synchronously and executing early and sets it's feature
detection classes before the layout is done by the browser.You can disable loading of modernizr by setting the following before the
<script>window.__patternslib_disable_modernizr = true;</script>
Patternslib bundle.min.js is included:Also, the "js" class is set on the HTML root tag when a "no-js" class was
present regardless of the__patternslib_disable_modernizr
setting.Since Patternslib 9.0.0-alpha.0 where we introduced webpack module
federation for our bundles, Modernizr is loaded asynchronously and applying
it's CSS classes a tick too late. For example, the change from the "no-js"
to the "js" class was done while the tiles have already been drawn and
visible on the screen, resulting in screen flickering. There are a number
of projects which depend on Modernizr being applied early. -
Build: Separate modernizr into a own bundle. (875b041)
-
Build: Also include necessary
_sass
directory in the npm package. (70da6b1) -
Build: Also include the webpack configs in the npm package. (f6bf2bf)
Previous packages depending on @patternslib/patternslib also extended
Patternslib' webpack configs. Include these configs for backwards
compatibility. -
pat-bumper: Remove style import from the patterns SCSS file. (094010b)
-
pat-tooltip: Cleanup tooltip after it's destroyed. (ac27e20)
When the tooltip is destroyed, also call the tooltip's BasePattern destroy
method to clean up and release the tooltip from the element. After that it
can be instantiated on the same element again. This change was necessary
after the recent BasePattern change. -
pat-validation: Make sure to cancel submit events on invalid forms. (e218af2)
Make sure that submit events are canceled on invalid forms by using a
capturing event handler which is invoked before non-capturing events.The previous commit exposed a problem with the submit event handling, where
the then non-capturing submit event handler was registered later than the
one from pat-inject because pat-validation's async init method where
pat-inject's init method is yet non-async. That happened even the
pat-validation's pattern initialization is enforced to run first due to
registration reordering in the Pattern registry. Now with the capturing
event handler this problem is fixed. -
Build: Fix tiptap error. (6e67655)
Fix tiptap "Unhandled Promise Rejection" error due to multiple versions of
a tiptap dependency installed. Removing yarn.lock in re-installing solves
this. -
pat-clone-code: Fix a Content-Security-Policy problem. (e38f987)
Do not use dom.template for the wrapper template to not get caught by the
browser's Content-Security-Policy. If set, a unsafe-eval error would be
thrown and the pattern refuse to run. -
pat-bumper: Fix runtime error due to reference to wrong container. (893d392)
-
pat-collapsible: Class-based patterns cannot be jQuery plugins. (eedcc47)
-
pat-syntax-highlight:...
Release 9.8.0-beta.6
9.8.0-beta.6 (2022-12-22)
Bug Fixes
- pat-sortable: Initialize already existing sortable handles. (b3f5077)Also allow the sortable itself to be the handle.
Release 9.8.0-beta.5
Release 9.8.0-beta.4
9.8.0-beta.4 (2022-12-22)
Bug Fixes
Release 9.8.0-beta.3
9.8.0-beta.3 (2022-12-22)
Features
- core events: Add dragstart and dragend event factories. (73d7fc7)
Bug Fixes
- Build: Load modernizr early and non-asynchronously. (8bc9b66)Include the modernizr bundle by injecting a script tag. This ensures
modernizr is loaded synchronously and executing early and sets it's
feature detection classes before the layout is done by the browser.
This reverts the breaking change from the previous Patternslib 9.8.0-beta.2
release. The separate modernizr.min.js build file is still kept, but
modernizr is included by the main Patternslib bundle. There is no need
to add another script tag to include modernizr.
You can disable loading of modernizr by setting the following before the
Patternslib bundle.min.js is included:
Also, the "js" class is set on the HTML root tag when a "no-js" class
was present regardless of the "__patternslib_disable_modernizr" setting.
Since Patternslib 9.0.0-alpha.0 where we introduced webpack module
federation for our bundles, Modernizr is loaded asynchronously and
applying it's CSS classes a tick too late. For example, the change from
the "no-js" to the "js" class was done while the tiles have already been
drawn and visible on the screen, resulting in screen flickering. There
are a number of projects which depend on Modernizr being applied early.
- pat-sortable: Initialize sorting on cloned elements. (d7abbc0)Fix sorting behavior on cloned elements, which broke on Patternslib 9.8.0-alpha.0.
Maintenance
Release 9.8.0-beta.2
9.8.0-beta.2 (2022-12-20)
Bug Fixes
-
Build: Also include necessary _sass directory in the npm package. (70da6b1)
-
Build: Also include the webpack configs in the npm package. (f6bf2bf)Previous packages depending on @patternslib/patternslib also extended
Patternslib' webpack configs. Include these configs for backwards
compatibility. -
pat-bumper: Remove style import from the patterns SCSS file. (094010b)
Breaking Changes
- Build: Separate modernizr into a own bundle. (875b041)Since Patternslib 9.0.0-alpha.0 where we introduced webpack module
federation for our bundles, Modernizr is loaded asynchronously and
applying it's CSS classes a tick too late. For example, the change from
theno-js
to thejs
class was done while the tiles have already been
drawn and visible on the screen, resulting in screen flickering. There
are a number of projects which depend on Modernizr being applied early.
This change now fixes the problem by separating the Modernizr build from
the Patternslib bundle.
If you depend on Modernzir, please include the new modernizr.min.js
bundle in
a script tag, preferably before the Patternslib bundle bundle.min.js
.
The global switch "window.__patternslib_disable_modernizr" is also removed, as
it got useless.
Maintenance
-
Add modernizr.min.js bundle to main index.js demo file for demonstration. (96a7ed2)
-
Build: Directly build the modernizr bundle. (ee2acdc)Do not use an webpack entry to build the modernizr bundle with an
webpack runtime overhead. Instead, build it directly but abusing the
webpack CopyPlugin transform mechanism. We could also build the
modernizr bundle from the Makefile but that wouldn't provide the file
when watching or when running webpack-dev-server. -
Build: Optimize modernizr configuration. (e1fd8de)Remove unnecessary tests in .modernizrrc.js and slim down the build size.
-
Upgrade dependencies. Also Upgrade to jQuery 3.6.2. (071e084)
Release 9.8.0-beta.1
9.8.0-beta.1 (2022-12-11)
Features
-
core basepattern: Add a destroy method. (f9ca65a)The destroy method removes the pattern instance from the element.
This is necessary to re-initialize the same pattern on the same element. -
core events: Support await_pattern_init with pattern double registration attempt. (e8640a9)When a pattern is tried to be initialized on the same element twice,
throw an event and use that event in await_pattern_init to reject
the promise. When using await_pattern_init you might want to
try/catch the block to handle any possible double-registration
errors. -
core events: Support once-events in add_event_listener. (fc0e333)Add support for once-events in add_event_listener and unregister them
when called from the event_listener_map.
Bug Fixes
-
pat-tooltip: Cleanup tooltip after it's destroyed. (ac27e20)When the tooltip is destroyed, also call the tooltip's BasePattern destroy
method to clean up and release the tooltip from the element. After that
it can be instantiated on the same element again.
This change was necessary after the recent BasePattern change. -
pat-validation: Make sure to cancel submit events on invalid forms. (e218af2)Make sure that submit events are canceled on invalid forms by using a
capturing event handler which is invoked before non-capturing events.
The previous commit exposed a problem with the submit event handling,
where the then non-capturing submit event handler was registered
later than the one from pat-inject because pat-validation's async
init method where pat-inject's init method is yet non-async. That
happened even the pat-validation's pattern initialization is
enforced to run first due to registration reordering in the Pattern
registry. Now with the capturing event handler this problem is
fixed.
Maintenance
-
core basepattern: Use identity instead equality comaprison instead in tests for stricter testing. (ce962d2)
-
Exclude more files from npm packages. (c312b96)
-
Only include dist/ and src/ directories in the npm package. (babc4b6)
-
pat-validation: Change to class based pattern. (11543ea)This is needed for better customization in deriving projects.
-
Upgrade dependencies. (399105f)
-
Use browserslist defaults. (8867fd8)
Release 9.8.0-beta.0
9.8.0-beta.0 (2022-12-07)
Bug Fixes
- Build: Fix tiptap error. (6e67655)Fix tiptap "Unhandled Promise Rejection" error due to multiple versions
of a tiptap dependency installed. Removing yarn.lock in re-installing
solves this.
Release 9.8.0-alpha.3
9.8.0-alpha.3 (2022-12-07)
Bug Fixes
- pat-clone-code: Fix a Content-Security-Policy problem. (e38f987)Do not use dom.template for the wrapper template to not get caught by
the browser's Content-Security-Policy. If set, a unsafe-eval error would
be thrown and the pattern refuse to run.
Breaking Changes
- pat-validation: Remove error-template option. (78c544b)This is a breaking change.
Due to a Content-Security-Policy problem with dom.template when
unsafe-eval is not set - which you wouldn't set if possible - we had to
remove the error-template parameter. Instead the template is now defined
in a error_template method on the Patten class and can be customized by
subclassing and extending the pat-validation pattern or by patching it
via Pattern.prototype.
Maintenance
-
Build: Upgrade dependencies. (fed2716)
-
core dom template: Warn about using dom.template due to a CSR probmel. (989fa9f)Warn about a problem of dom.template with a Content-Security-Policy set.
If a CSR rule is set then dom.template would break the code unless
'unsafe-eval' is allowed (which you wouldn't normally allow when using a CSR).
Therefore it is not recommended to use this template function. -
pat-clone-code: Better example, correct documentation. (028ba07)
-
Remove IE related code paths. (9de0d95)
Release 9.8.0-alpha.2
9.8.0-alpha.2 (2022-12-07)
Features
- Build: Include the build in the npm package. (544b589)The compiled build is now included in npm packages by including the dist
directory in .npmignore. To not increase the package size too much the
JavaScript map files are not included. Now you can include Patternslib
by using unpkg or jsDelivr like so:
https://unpkg.com/@patternslib/[email protected]/dist/bundle.min.js
or
https://cdn.jsdelivr.net/npm/@patternslib/[email protected]/dist/bundle.min.js
-
core dom: Add is_input method. (554e32e)Add "is_input" to test if a element is of input type.
This is basically the same as $(":input") from Sizzle/jQuery. -
pat-markdown: Soft-depend on pat-syntax-highlight. (cf0f6e3)Only highlight code blocks when the pattern is available.
Not hard-depending and importing pat-syntax-highlight fixes a problem
where only including pat-markup also included pat-syntax-highlight and
it's big highlight.js library.
This can reduce the generated bundle size significantly.
- pat-tooltip: Soft-depend on pat-markdown. (1f81238)Only register the markdown data type handler when the pattern is available.
Not hard-depending and importing pat-markdown fixes a problem where only
including pat-tooltip also included pat-markdown and
pat-syntax-highlight with it's big highlight.js library.
This can reduce the generated bundle size significantly.
Bug Fixes
-
pat-bumper: Fix runtime error due to reference to wrong container. (893d392)
-
pat-collapsible: Class-based patterns cannot be jQuery plugins. (eedcc47)
-
pat-syntax-highlight: Do not load all languages. (c34d4a0)Change the import so that no language is included by default.
Instead import the languages dynamically.
This reduces the download size when pat-syntaax-highlight is used
significantly.
- pat-syntax-highlight: Fix language registration. (19bbb53)Fix a typo where all languages were registered as "javascript".
Maintenance
-
Add deprecation note for public_path. (f6d8124)
-
Build: Remove the IE11 polyfills-loader. (6eaddec)Clear out the polyfills-loader script but keep the module for backwards
compatibility. No IE11 compatibility polyfills are included anymore as
support for IE11 has recently really and finally dropped. The
polyfills-loader.js file is still shipped but empty for compatibility
with projects including the polyfills loader. -
Build: Remove unused prismljs and google-code-prettify modules. (ed808e5)
-
Build: Update browserslist setting. (a29b9e8)Explicitly remove ie11 from browserslist.
It wasn't used due to the "not dead" setting anyways. -
Build: Upgrade @patternslib/dev. (ed8d13a)
-
Build: Upgrade pat-tiptap to 4.7.0. (ad0be10)
-
core basepattern: Avoid code linting problem. (d2836bd)Avoid code linting problem and make clear the init method is/can be
asynchronous. -
pat-markdown: Improve registering the markdown handler for pat-inject. (3f17e99)Wait a tick before registering the markdown type handler for pat-inject.
With that there is no need for pat-inject to be imported before
pat-markdown, as long as it is imported side by side with pat-markdown.