Library for quickly applying rich interaction patterns without the need to write any JavaScript.
Repo Patternslib/Patterns, read from GitHub 11 min ago. Patternslib has not joined Take My Repo.
core signals: Add a TC39 signals polyfill. (0aaf81b)
The TC39 signals specification for data binding.
See: https://github.com/tc39/proposal-signals
Uses: https://github.com/proposal-signals/signal-polyfill
pat-bind: Add new pattern for data binding. (3ffce05)
Allow await bundle registration. (57aaa54)
Allow the module federation loader to await the registration of the
Patterns in this bundle.
core registry: replace option to override an already registered pattern (11bf659)
The first registration of a pattern name wins, so an add-on bundle
could not override a core pattern under its own name — it had to
blacklist the original and register a replacement under a different
name with the original trigger, and then bridge the original's
options by hand.
registry.register(pattern, name, { replace: true }) now replaces an
existing registration; Base.extend accepts replace: true as
pattern property. Together with the registry waiting for Module
Federation remotes before the initial scan, the replacement is in
place for the initial scan no matter whether the remote or the core
bundle registered first. Replacing after the registry was initialized
logs a warning: already initialized elements keep the previous
pattern, only new elements get the replacement. The blacklist still
wins over a replacement.
Also documents the new Module Federation globals in the README.
core registry: wait for Module Federation remotes before the initial scan (f353956)
Module Federation remote bundles (add-ons) register their patterns and
components asynchronously after document ready, while the registry
scanned the DOM right at document ready. Whether an add-on's pattern
override or component registration was in place for the initial scan
was a race between the remote's chunk loading and the host's own
initialization — usually won by the remote, but not guaranteed.
registry.init() now awaits window.__patternslib_mf_initialized,
the promise provided by the Module Federation helper of
@patternslib/dev, before the initial scan. Without a Module Federation
host on the page nothing changes. A timeout (default 5000ms,
window.__patternslib_mf_init_timeout) makes sure a broken or slow
remote cannot block the page; the scan then runs anyway with a
warning. Repeated init() calls while waiting are ignored.