
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
sunlit-theme
Advanced tools
一个基于 Vue 3 的日/夜主题切换组件,灵感来自 [Sunlit Place](https://www.sunlit.place/) 和 [Daylight Computer](https://daylightcomputer.com/)。
一个基于 Vue 3 的日/夜主题切换组件,灵感来自 Sunlit Place 和 Daylight Computer。

v-model 双向绑定useSunlitTheme Hook,方便在整个应用中使用npm install sunlit-theme
# 或者使用 yarn
yarn add sunlit-theme
# 或者使用 pnpm
pnpm add sunlit-theme
<template>
<SunlitToggle v-model="isDark" />
</template>
<script setup>
import { ref } from "vue";
import { SunlitToggle } from "sunlit-theme";
import "sunlit-theme/style.css";
const isDark = ref(false);
</script>
<template>
<SunlitToggle v-model="isDark" />
<button @click="toggle">程序化切换</button>
</template>
<script setup>
import { SunlitToggle, useSunlitTheme } from "sunlit-theme";
import "sunlit-theme/style.css";
const { isDark, toggle } = useSunlitTheme({
initialDark: false,
onChange: (value) => {
console.log(`主题已切换为: ${value ? "夜间" : "日间"}模式`);
},
});
</script>
<template>
<SunlitToggle v-model="isDark">
<!-- 自定义按钮内容 -->
<template #button>
<span> {{ isDark ? "变亮" : "变暗" }} </span>
</template>
<!-- 自定义状态显示 -->
<template #status>
<div class="custom-status">
<div class="icon">{{ isDark ? "" : "" }}</div>
<div class="text">当前: {{ isDark ? "夜间模式" : "日间模式" }}</div>
</div>
</template>
</SunlitToggle>
</template>
<script setup>
import { ref } from "vue";
import { SunlitToggle } from "sunlit-theme";
import "sunlit-theme/style.css";
const isDark = ref(false);
</script>
import { createApp } from "vue";
import App from "./App.vue";
import SunlitTheme from "sunlit-theme";
import "sunlit-theme/style.css";
const app = createApp(App);
app.use(SunlitTheme);
app.mount("#app");
| 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| modelValue | boolean | false | 用于 v-model 绑定 |
| label | string | '切换模式' | 按钮显示文本 |
| animationEnabled | boolean | true | 是否启用动画 |
| 事件名 | 参数 | 说明 |
|---|---|---|
| update:modelValue | (value: boolean) | v-model 更新事件 |
| change | (value: boolean) | 主题切换事件 |
| 插槽名 | 说明 |
|---|---|
| button | 自定义按钮内容 |
| status | 自定义状态显示内容 |
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| initialDark | boolean | false | 初始主题状态 |
| storageKey | string | 'sunlit-theme-mode' | 本地存储的键名 |
| onChange | (isDark: boolean) => void | undefined | 主题变化时的回调 |
| enableStorage | boolean | true | 是否启用本地存储 |
| updateHtmlClass | boolean | true | 是否更新 HTML 类名 |
| darkClassName | string | 'dark-mode' | 暗色模式对应的类名 |
| 属性名 | 类型 | 说明 |
|---|---|---|
| isDark | Ref<boolean> | 当前主题状态的响应式引用 |
| toggle | () => void | 切换主题的函数 |
| setDark | (value: boolean) => void | 设置主题状态的函数 |
pnpm install
pnpm dev
pnpm build:lib
MIT
FAQs
一个基于 Vue 3 的日/夜主题切换组件,灵感来自 [Sunlit Place](https://www.sunlit.place/) 和 [Daylight Computer](https://daylightcomputer.com/)。
The npm package sunlit-theme receives a total of 0 weekly downloads. As such, sunlit-theme popularity was classified as not popular.
We found that sunlit-theme demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.