vaadin-component-factory / vcf-dark-mode-switch Goto Github PK
View Code? Open in Web Editor NEWVaadin Component Factory Dark Mode Switch
Home Page: https://vcf-dark-mode-switch.netlify.com/
License: Apache License 2.0
Vaadin Component Factory Dark Mode Switch
Home Page: https://vcf-dark-mode-switch.netlify.com/
License: Apache License 2.0
The component should automatically detect if dark mode should be enabled, if the user has not made an explicit choice about the color mode yet.
Sidenote: it would be great if the user could “reset” the switch to “auto mode” so that the OS level setting (media query) would be respected. Not exactly sure how that could work in the UI.
To help developers, it would be great to store the user's selection in localStorage
and restore the value from there on page reload.
First version implementation.
I want to use in Java both ToggleButton and vcf-dark-mode-switch. However, my application breaks in the browser and the console reports:
Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "vcf-toggle-button" has already been used with this registry
Using ToggleButton
:
<dependency>
<groupId>com.vaadin.componentfactory</groupId>
<artifactId>togglebutton</artifactId>
<version>1.0.0</version>
</dependency>
Using DarkModeSwitch
:
@Tag("vcf-dark-mode-switch")
@NpmPackage(value = "@vaadin-component-factory/vcf-dark-mode-switch", version = "1.0.1")
@JsModule("@vaadin-component-factory/vcf-dark-mode-switch")
public class DarkModeSwitch extends AbstractSinglePropertyField<DarkModeSwitch, Boolean> {
public DarkModeSwitch() {
super("darkMode", false, false);
}
}
(I am not sure if DarkModeSwitch
can extend ToggleButton
in some way, or it's composition so that would not work.)
npx find-duplicate-dependencies
says:
This package has the following duplicate dependencies:
@vaadin-component-factory/vcf-toggle-button :
[ { name: '@vaadin-component-factory/vcf-toggle-button',
version: '0.1.6',
from: '@vaadin-component-factory/vcf-toggle-button@^0.1.1',
path: 'no-name/@vaadin-component-factory/vcf-dark-mode-switch' },
{ name: '@vaadin-component-factory/vcf-toggle-button',
version: '1.0.1',
from: '@vaadin-component-factory/[email protected]',
path: 'no-name' } ]
Please run "npm dedupe" to see if that could be fixed. If not, manually resolve version conflicts
...which indicates, that there are duplicates. IIUC ^0.1.1
means version above 1.0.0
is not accepted so I think the solution is to change the dependency of vcf-dark-mode-switch
on vcf-toggle-button
to a newer version, f.e. ^1.0.1
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.