Update MiniColors to 2.3.6 - #11
Merged
Merged
Conversation
The colour pickers ran jQuery miniColors 1.5.0, from 2011. The maintained
release is @claviska/jquery-minicolors 2.3.6 -- the scoped package, since the
unscoped one is stale and not the author's.
2.x renames the plugin and reworks its callbacks, so the call sites moved
with it rather than hiding behind a shim:
.miniColors({move: fn}) -> .minicolors({change: fn})
.miniColors({hide: fn}) -> .minicolors({hide: fn}), which now takes no
argument and whose `this` is the element, so
the value is read back from the input
.miniColors("value", c) -> .minicolors("value", c)
.miniColors("disabled",b) -> .prop("disabled", b); 2.x has no such method
and checks the input's own property instead
Both halves come from the same release. The five sprite images of 1.5 are
replaced by the single sheet 2.3.6 ships, and the stylesheet keeps its
historical jquery.miniColors.css spelling: it differs from upstream's name
only in case, which is the same file on a case-insensitive filesystem, and
eXeLearning links this path from its own editor page.
Two adjustments were needed for the panel to be usable. 1.5 appended its
picker to the body; 2.x renders it inside the input's wrapper, which puts it
inside the float panel's stacking context. Left-aligned it spilled past the
inspector's edge where the canvas painted over it, so it opens right-aligned;
and every float panel sits at z-index 1000, so the navigator -- later in the
document -- covered the colour grid until the panel holding an open picker is
lifted above its siblings.
The upstream JavaScript carries no version string, so a banner records it.
Vendored from @claviska/jquery-minicolors@2.3.6, MIT, upstream sha256
85037c6c1928b9a7163b63f5b58aa72a3fbc5fee9cc9e10bcd1f804c6eb2e853.
Two clean builds are byte-identical. eXeLearning's browser suite passes all
25 tests, including picking a colour from the real gradient and checking the
node re-renders and the value survives deselect and reselect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The colour pickers ran jQuery miniColors 1.5.0, from 2011. The maintained release is
@claviska/jquery-minicolors2.3.6 — the scoped package; the unscopedjquery-minicolorson npm is stale and not the author's.API migration
2.x renames the plugin and reworks its callbacks. The call sites moved with it rather than hiding behind a shim named
.miniColors():.miniColors({ move: fn }).minicolors({ change: fn }).miniColors({ hide: fn(hex) }).minicolors({ hide: fn() })— no argument, andthisis the element rather than a jQuery object, so the value is read back from the input.miniColors("value", c).minicolors("value", c).miniColors("disabled", b).prop("disabled", b)— 2.x has no such method and checks the input's own propertyBoth halves come from the same release: the five sprite images of 1.5 are replaced by the single sheet 2.3.6 ships. The stylesheet keeps its historical
jquery.miniColors.cssspelling — it differs from upstream's name only in case, which is the same file on a case-insensitive filesystem, and eXeLearning links this path from its own editor page.Two adjustments the panel needed
1.5 appended its picker to
document.body. 2.x renders the panel inside the input's own wrapper, which puts it inside the float panel's stacking context — and that changes what can cover it:position: 'bottom right'), keeping it within the panel.z-index: 1000, and the navigator comes after the inspector in the document, so it painted straight over the grid. The panel holding an open picker is now lifted above its siblings.Both were found by measuring
elementFromPointover the grid — the widget looked fine and simply ignored clicks.Provenance
The upstream JavaScript carries no version string, so a banner records it.
Validation
npm ci && npm test && npm run buildff9f393782d4…)The browser coverage picks a colour from the real gradient through the initialised widget, then checks the rendered node colour changed and that the value survives deselecting and reselecting the node — a model round-trip, not just the input. Branch colour likewise. Those tests passed against 1.5.0 before this change, which is what makes them a description of existing behaviour.
The Inspector is otherwise untouched; no redesign.