@code-coaching/vuetiful 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +1 -1
- package/dist/styles/all.css +439 -536
- package/dist/types/index.d.ts +0 -1
- package/dist/types/utils/theme/theme-switcher.vue.d.ts +1 -1
- package/dist/types/utils/theme/theme.d.ts +4 -4
- package/dist/vuetiful.es.mjs +12 -15
- package/dist/vuetiful.umd.js +7 -7
- package/package.json +1 -1
- package/src/index.ts +0 -9
- package/src/themes/{theme-vuetiful.css → theme-skeleton.css} +8 -8
- package/src/themes/{theme-modern.css → theme-vuetiful-0.0.1.css} +14 -14
- package/src/utils/theme/theme.ts +15 -15
package/dist/types/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
48
48
|
chosenTheme: Readonly<import("vue").Ref<string>>;
|
|
49
49
|
themes: Readonly<import("vue").Ref<readonly {
|
|
50
50
|
readonly name: string;
|
|
51
|
-
readonly url
|
|
51
|
+
readonly url: string;
|
|
52
52
|
}[]>>;
|
|
53
53
|
showPopup: import("vue").Ref<boolean>;
|
|
54
54
|
listClasses: import("vue").ComputedRef<string>;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { Ref } from "vue";
|
|
2
2
|
interface Theme {
|
|
3
3
|
name: string;
|
|
4
|
-
url
|
|
4
|
+
url: string;
|
|
5
5
|
}
|
|
6
6
|
declare const useTheme: () => {
|
|
7
7
|
themes: Readonly<Ref<readonly {
|
|
8
8
|
readonly name: string;
|
|
9
|
-
readonly url
|
|
9
|
+
readonly url: string;
|
|
10
10
|
}[]>>;
|
|
11
11
|
chosenTheme: Readonly<Ref<string>>;
|
|
12
12
|
initializeTheme: (callback?: Function | undefined) => void;
|
|
13
13
|
loadTheme: (themeName: string, callback?: Function | undefined) => void;
|
|
14
14
|
THEMES: {
|
|
15
15
|
VUETIFUL: string;
|
|
16
|
-
MODERN: string;
|
|
17
16
|
ROCKET: string;
|
|
18
17
|
SAHARA: string;
|
|
19
18
|
SEAFOAM: string;
|
|
20
19
|
SEASONAL: string;
|
|
20
|
+
SKELETON: string;
|
|
21
21
|
VINTAGE: string;
|
|
22
22
|
};
|
|
23
23
|
overwriteThemes: (newThemes: Array<Theme>) => void;
|
|
24
24
|
registerAllBuiltInThemes: () => Array<Theme>;
|
|
25
|
-
registerTheme: (name: string, url
|
|
25
|
+
registerTheme: (name: string, url: string) => Theme;
|
|
26
26
|
};
|
|
27
27
|
export { useTheme };
|
package/dist/vuetiful.es.mjs
CHANGED
|
@@ -87,7 +87,6 @@ var components = /* @__PURE__ */ Object.freeze({
|
|
|
87
87
|
});
|
|
88
88
|
var main = "";
|
|
89
89
|
var tailwind = "";
|
|
90
|
-
var themeVuetiful = "";
|
|
91
90
|
const MAGIC_NUM = 100;
|
|
92
91
|
var MyConstants = /* @__PURE__ */ Object.freeze({
|
|
93
92
|
__proto__: null,
|
|
@@ -309,21 +308,24 @@ var MyUtil = {
|
|
|
309
308
|
const { isBrowser } = usePlatform();
|
|
310
309
|
const THEMES = {
|
|
311
310
|
VUETIFUL: "vuetiful",
|
|
312
|
-
MODERN: "modern",
|
|
313
311
|
ROCKET: "rocket",
|
|
314
312
|
SAHARA: "sahara",
|
|
315
313
|
SEAFOAM: "seafoam",
|
|
316
314
|
SEASONAL: "seasonal",
|
|
315
|
+
SKELETON: "skeleton",
|
|
317
316
|
VINTAGE: "vintage"
|
|
318
317
|
};
|
|
318
|
+
const builtInUrl = (name) => {
|
|
319
|
+
return `https://code-coaching.dev/vuetiful-themes/theme-${name}.css`;
|
|
320
|
+
};
|
|
319
321
|
const builtInThemes = [
|
|
320
|
-
{ name: THEMES.VUETIFUL },
|
|
321
|
-
{ name: THEMES.
|
|
322
|
-
{ name: THEMES.
|
|
323
|
-
{ name: THEMES.
|
|
324
|
-
{ name: THEMES.
|
|
325
|
-
{ name: THEMES.
|
|
326
|
-
{ name: THEMES.VINTAGE }
|
|
322
|
+
{ name: THEMES.VUETIFUL, url: builtInUrl(`${THEMES.VUETIFUL}-0.0.1`) },
|
|
323
|
+
{ name: THEMES.ROCKET, url: builtInUrl(`${THEMES.ROCKET}`) },
|
|
324
|
+
{ name: THEMES.SAHARA, url: builtInUrl(`${THEMES.SAHARA}`) },
|
|
325
|
+
{ name: THEMES.SEAFOAM, url: builtInUrl(`${THEMES.SEAFOAM}`) },
|
|
326
|
+
{ name: THEMES.SEASONAL, url: builtInUrl(`${THEMES.SEASONAL}`) },
|
|
327
|
+
{ name: THEMES.SKELETON, url: builtInUrl(`${THEMES.SKELETON}`) },
|
|
328
|
+
{ name: THEMES.VINTAGE, url: builtInUrl(`${THEMES.VINTAGE}`) }
|
|
327
329
|
];
|
|
328
330
|
const themes = ref([...builtInThemes]);
|
|
329
331
|
const defaultTheme = THEMES.VUETIFUL;
|
|
@@ -355,9 +357,6 @@ const useTheme = () => {
|
|
|
355
357
|
chosenTheme.value = theme.name;
|
|
356
358
|
const existingStyle = document.getElementById("theme");
|
|
357
359
|
let themeUrl = theme.url;
|
|
358
|
-
if (!themeUrl) {
|
|
359
|
-
themeUrl = `https://code-coaching.dev/vuetiful-themes/theme-${theme.name}.css`;
|
|
360
|
-
}
|
|
361
360
|
const link = document.createElement("link");
|
|
362
361
|
link.id = "theme";
|
|
363
362
|
link.href = themeUrl;
|
|
@@ -379,9 +378,7 @@ const useTheme = () => {
|
|
|
379
378
|
return [...builtInThemes];
|
|
380
379
|
};
|
|
381
380
|
const registerTheme = (name, url) => {
|
|
382
|
-
|
|
383
|
-
return { url, name };
|
|
384
|
-
return { name };
|
|
381
|
+
return { url, name };
|
|
385
382
|
};
|
|
386
383
|
const overwriteThemes = (newThemes) => {
|
|
387
384
|
themes.value = [...newThemes];
|
package/dist/vuetiful.umd.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
${
|
|
1
|
+
(function(d,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(d=typeof globalThis!="undefined"?globalThis:d||self,e(d["@code-coaching/vuetiful"]={},d.Vue))})(this,function(d,e){"use strict";var L=(t,s)=>{const c=t.__vccOpts||t;for(const[m,u]of s)c[m]=u;return c};const z=e.defineComponent({props:{bgLight:{type:String,default:"bg-primary-50"},bgDark:{type:String,default:"bg-primary-900"},textOnLight:{type:String,default:"text-primary-900"},textOnDark:{type:String,default:"text-primary-50"},width:{type:String,default:"w-fit"},height:{type:String,default:"h-fit"},ring:{type:String,default:"ring-[1px] ring-primary-500/30"},rounded:{type:String,default:"rounded-token"},msg:{type:String}},setup(t,{attrs:s}){const{currentMode:c,MODE:m}=E(),u="transition-all duration-[200ms]",l=e.computed(()=>c.value===m.LIGHT?t.bgLight:t.bgDark),o=e.computed(()=>c.value===m.LIGHT?t.textOnLight:t.textOnDark);return{classes:e.computed(()=>{var n;return`${u}
|
|
2
|
+
${l.value}
|
|
3
3
|
${o.value}
|
|
4
4
|
${t.width}
|
|
5
5
|
${t.height}
|
|
6
6
|
${t.ring}
|
|
7
7
|
${t.rounded}
|
|
8
|
-
${(n=s.class)!=null?n:""}`})}}});function
|
|
8
|
+
${(n=s.class)!=null?n:""}`})}}});function x(t,s,c,m,u,l){return e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(`cc-button btn ${t.classes}`)},[t.msg?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(t.msg),1)],64)):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default")],2)}var b=L(z,[["render",x]]),D=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",VButton:b}),me="",ue="";const G=100;var K=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",MAGIC_NUM:G});const O=()=>({isBrowser:typeof window!="undefined"}),{isBrowser:C}=O(),w={LIGHT:!0,DARK:!1},A=e.ref(w.DARK),B=e.ref(w.DARK),M=e.ref(void 0),E=()=>{const t=()=>{const n=window.matchMedia("(prefers-color-scheme: light)").matches;return m(n),n},s=()=>{if(C){const n=localStorage.getItem("modeUserPrefers");n!==null&&(M.value=n==="true")}return M.value},c=()=>{const n=t(),a=s();return a!==void 0?a:n},m=n=>{A.value=n,C&&localStorage.setItem("modeOsPrefers",n.toString())},u=n=>{M.value=n,C&&localStorage.setItem("modeUserPrefers",n.toString())},l=n=>{const a=document.documentElement.classList,h="dark";n===w.LIGHT?a.remove(h):a.add(h),B.value=n},o=()=>{const n=c();l(n)},r=()=>{const n=window.matchMedia("(prefers-color-scheme: light)"),a=h=>{const p=document.documentElement.classList,g="dark";h===w.LIGHT?p.remove(g):p.add(g),l(h)};a(n.matches),n.onchange=()=>{a(n.matches)}};return{modeOsPrefers:e.readonly(A),modeUserPrefers:e.readonly(M),currentMode:e.readonly(B),getModeOsPrefers:t,getModeUserPrefers:s,getModeAutoPrefers:c,setModeUserPrefers:u,setModeCurrent:l,autoModeWatcher:r,initializeMode:o,MODE:w}},F=e.defineComponent({props:{bgLight:{type:String,default:"bg-surface-50"},bgDark:{type:String,default:"bg-surface-900"},textLight:{type:String,default:"text-surface-50"},textDark:{type:String,default:"text-surface-900"},width:{type:String,default:"w-12"},height:{type:String,default:"h-6"},ring:{type:String,default:"ring-[1px] ring-surface-500/30"},rounded:{type:String,default:"rounded-token"}},setup(t,{attrs:s}){const{initializeMode:c,setModeCurrent:m,setModeUserPrefers:u,currentMode:l,MODE:o}=E();e.onMounted(()=>{c()});const r="transition-all duration-[200ms]",n="cursor-pointer",a="aspect-square scale-[0.8] flex justify-center items-center",h="w-[70%] aspect-square",p={sun:"M361.5 1.2c5 2.1 8.6 6.6 9.6 11.9L391 121l107.9 19.8c5.3 1 9.8 4.6 11.9 9.6s1.5 10.7-1.6 15.2L446.9 256l62.3 90.3c3.1 4.5 3.7 10.2 1.6 15.2s-6.6 8.6-11.9 9.6L391 391 371.1 498.9c-1 5.3-4.6 9.8-9.6 11.9s-10.7 1.5-15.2-1.6L256 446.9l-90.3 62.3c-4.5 3.1-10.2 3.7-15.2 1.6s-8.6-6.6-9.6-11.9L121 391 13.1 371.1c-5.3-1-9.8-4.6-11.9-9.6s-1.5-10.7 1.6-15.2L65.1 256 2.8 165.7c-3.1-4.5-3.7-10.2-1.6-15.2s6.6-8.6 11.9-9.6L121 121 140.9 13.1c1-5.3 4.6-9.8 9.6-11.9s10.7-1.5 15.2 1.6L256 65.1 346.3 2.8c4.5-3.1 10.2-3.7 15.2-1.6zM352 256c0 53-43 96-96 96s-96-43-96-96s43-96 96-96s96 43 96 96zm32 0c0-70.7-57.3-128-128-128s-128 57.3-128 128s57.3 128 128 128s128-57.3 128-128z",moon:"M223.5 32C100 32 0 132.3 0 256S100 480 223.5 480c60.6 0 115.5-24.2 155.8-63.4c5-4.9 6.3-12.5 3.1-18.7s-10.1-9.7-17-8.5c-9.8 1.7-19.8 2.6-30.1 2.6c-96.9 0-175.5-78.8-175.5-176c0-65.8 36-123.1 89.3-153.3c6.1-3.5 9.2-10.5 7.7-17.3s-7.3-11.9-14.3-12.5c-6.3-.5-12.6-.8-19-.8z"},g=()=>{const f=!l.value;u(f),m(f)},T=f=>{["Enter","Space"].includes(f.code)&&(f.preventDefault(),f.currentTarget.click())},$=e.computed(()=>l.value===o.LIGHT?t.bgLight:t.bgDark),_=e.computed(()=>l.value===o.LIGHT?t.bgDark:t.bgLight),y=e.computed(()=>l.value===o.LIGHT?"translate-x-[100%]":""),ce=e.computed(()=>l.value===o.LIGHT?t.textLight:t.textDark),le=e.computed(()=>{var f;return`${n} ${r} ${t.width} ${t.height} ${t.ring} ${t.rounded} ${$.value} ${(f=s.class)!=null?f:""}`}),ie=e.computed(()=>`${a} ${r} ${t.height} ${t.rounded} ${_.value} ${y.value}`),de=e.computed(()=>`${h}`);return{classesTrack:le,classesThumb:ie,classesIcon:de,svgPath:p,onToggleHandler:g,onKeyDown:T,currentMode:l,iconFill:ce}}}),R=["aria-checked","title"],j=["d"];function q(t,s,c,m,u,l){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(`lightswitch-track ${t.classesTrack}`),onClick:s[0]||(s[0]=(...o)=>t.onToggleHandler&&t.onToggleHandler(...o)),onKeydown:s[1]||(s[1]=(...o)=>t.onKeyDown&&t.onKeyDown(...o)),"on:keyup":"","on:keypress":"",role:"switch","aria-label":"Light Switch","aria-checked":t.currentMode,title:`Toggle ${t.currentMode===!1?"Dark":"Light"} Mode`,tabindex:"0"},[e.createElementVNode("div",{class:e.normalizeClass(`lightswitch-thumb ${t.classesThumb}`)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(`lightswitch-icon ${t.classesIcon} ${t.iconFill}`),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},[e.createElementVNode("path",{fill:"currentColor",d:t.currentMode?t.svgPath.sun:t.svgPath.moon},null,8,j)],2))],2)],42,R)}var V=L(F,[["render",q]]);function W(t,s){return t+s}var J={add:W};const{isBrowser:N}=O(),i={VUETIFUL:"vuetiful",ROCKET:"rocket",SAHARA:"sahara",SEAFOAM:"seafoam",SEASONAL:"seasonal",SKELETON:"skeleton",VINTAGE:"vintage"},S=t=>`https://code-coaching.dev/vuetiful-themes/theme-${t}.css`,P=[{name:i.VUETIFUL,url:S(`${i.VUETIFUL}-0.0.1`)},{name:i.ROCKET,url:S(`${i.ROCKET}`)},{name:i.SAHARA,url:S(`${i.SAHARA}`)},{name:i.SEAFOAM,url:S(`${i.SEAFOAM}`)},{name:i.SEASONAL,url:S(`${i.SEASONAL}`)},{name:i.SKELETON,url:S(`${i.SKELETON}`)},{name:i.VINTAGE,url:S(`${i.VINTAGE}`)}],k=e.ref([...P]),I=i.VUETIFUL,U=e.ref(I),H=()=>{const t=o=>{const r=k.value.find(n=>n.name===o);!r||N&&(localStorage.setItem("vuetiful-theme",r.name),document.body.setAttribute("data-theme",r.name))},s=o=>{if(N){const r=localStorage.getItem("vuetiful-theme");c(r||I,o)}},c=(o,r)=>{let n=k.value.find($=>$.name===o);n||(n=k.value.find($=>$.name===I)||k.value[0]);const a=n;U.value=a.name;const h=document.getElementById("theme");let p=a.url;const g=document.createElement("link");g.id="theme",g.href=p,g.type="text/css",g.rel="stylesheet",g.onload=()=>{h&&h.remove(),t(a.name),r&&r()};const T=document.querySelector("head");T&&T.appendChild(g)},m=()=>[...P],u=(o,r)=>({url:r,name:o}),l=o=>{k.value=[...o]};return{themes:e.readonly(k),chosenTheme:e.readonly(U),initializeTheme:s,loadTheme:c,THEMES:i,overwriteThemes:l,registerAllBuiltInThemes:m,registerTheme:u}};var he="";const Q=e.defineComponent({components:{DarkModeSwitch:V,VButton:b},props:{bgLight:{type:String,default:"bg-surface-50"},bgDark:{type:String,default:"bg-surface-900"},textOnLight:{type:String,default:"text-surface-900"},textOnDark:{type:String,default:"text-surface-50"},width:{type:String,default:"w-60"},height:{type:String,default:"max-h-64 lg:max-h-[500px]"},ring:{type:String,default:"ring-[1px] ring-surface-500/30"},rounded:{type:String,default:"rounded-token"},roundedContainer:{type:String,default:"rounded-container-token"},buttonClasses:{type:String,default:"w-24"}},setup(t,{attrs:s}){const{initializeTheme:c,loadTheme:m,themes:u,chosenTheme:l}=H(),{currentMode:o,MODE:r}=E(),n=e.ref(!1);e.onMounted(()=>{c()});const a="transition-all duration-[200ms]";function h(y){["Enter","Space"].includes(y.code)&&(y.preventDefault(),y.currentTarget.click())}const p=e.computed(()=>o.value===r.LIGHT?t.bgLight:t.bgDark),g=e.computed(()=>o.value===r.LIGHT?t.textOnLight:t.textOnDark),T=e.computed(()=>{var y;return`${a}
|
|
9
|
+
${p.value}
|
|
9
10
|
${g.value}
|
|
10
|
-
${h.value}
|
|
11
11
|
${t.width}
|
|
12
12
|
${t.ring}
|
|
13
13
|
${t.roundedContainer}
|
|
14
|
-
${(y=s.class)!=null?y:""}`})
|
|
15
|
-
${t.height}`),
|
|
14
|
+
${(y=s.class)!=null?y:""}`}),$=e.computed(()=>`${a}
|
|
15
|
+
${t.height}`),_=e.computed(()=>`${a}
|
|
16
16
|
${t.ring}
|
|
17
|
-
${t.rounded}`);return{onKeyDown:
|
|
17
|
+
${t.rounded}`);return{onKeyDown:h,loadTheme:m,currentMode:o,classes:T,chosenTheme:l,themes:u,showPopup:n,listClasses:$,listItemClasses:_}}}),X=t=>(e.pushScopeId("data-v-3283243a"),t=t(),e.popScopeId(),t),Y={class:"cc-theme-switcher"},Z={class:"space-y-4"},v={class:"flex items-center justify-between"},ee=X(()=>e.createElementVNode("h6",null,"Mode",-1)),te={class:"flex flex-col gap-4"},ne=["onClick"];function oe(t,s,c,m,u,l){const o=e.resolveComponent("VButton"),r=e.resolveComponent("DarkModeSwitch");return e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(o,{class:e.normalizeClass(`cc-theme-switcher__button ${t.buttonClasses}`),onClick:s[0]||(s[0]=n=>t.showPopup=!t.showPopup)},{default:e.withCtx(()=>[e.createTextVNode(" Theme ")]),_:1},8,["class"]),t.showPopup?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["cc-theme-switcher__popup p-4 shadow-xl",t.classes])},[e.createElementVNode("div",Z,[e.createElementVNode("section",v,[ee,e.createVNode(r)]),e.createElementVNode("nav",{class:e.normalizeClass(["list-nav -m-4 overflow-y-auto p-4",t.listClasses])},[e.createElementVNode("ul",te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.themes,(n,a)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(["h-full w-full p-2 text-center capitalize hover:cursor-pointer hover:bg-primary-100 hover:text-primary-900",`${t.listItemClasses} ${t.chosenTheme===n.name?"bg-primary-50 text-primary-900":"bg-surface-200 text-surface-900"}`]),key:a,onClick:h=>t.loadTheme(n.name)},e.toDisplayString(n.name),11,ne))),128))])],2)])],2)):e.createCommentVNode("",!0)])}var se=L(Q,[["render",oe],["__scopeId","data-v-3283243a"]]);function re(t){for(const s in D)t.component(s,D[s])}var ae={install:re};d.DarkModeSwitch=V,d.MyConstants=K,d.MyUtil=J,d.ThemeSwitcher=se,d.VButton=b,d.default=ae,d.useDarkMode=E,d.useTheme=H,Object.defineProperty(d,"__esModule",{value:!0}),d[Symbol.toStringTag]="Module"});
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -10,15 +10,6 @@ function install(app: any) {
|
|
|
10
10
|
import "./assets/main.css";
|
|
11
11
|
import "./styles/tailwind.css";
|
|
12
12
|
|
|
13
|
-
import "./themes/theme-vuetiful.css";
|
|
14
|
-
// import "./themes/theme-modern.css";
|
|
15
|
-
// import "./themes/theme-rocket.css";
|
|
16
|
-
// import "./themes/theme-sahara.css";
|
|
17
|
-
// import "./themes/theme-seafoam.css";
|
|
18
|
-
// import "./themes/theme-seasonal.css";
|
|
19
|
-
// import "./themes/theme-test.css";
|
|
20
|
-
// import "./themes/theme-vintage.css";
|
|
21
|
-
|
|
22
13
|
export default { install };
|
|
23
14
|
|
|
24
15
|
export * from "./components";
|
|
@@ -99,19 +99,19 @@
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/* Headings */
|
|
102
|
-
[data-theme='
|
|
103
|
-
[data-theme='
|
|
104
|
-
[data-theme='
|
|
105
|
-
[data-theme='
|
|
106
|
-
[data-theme='
|
|
107
|
-
[data-theme='
|
|
102
|
+
[data-theme='skeleton'] h1,
|
|
103
|
+
[data-theme='skeleton'] h2,
|
|
104
|
+
[data-theme='skeleton'] h3,
|
|
105
|
+
[data-theme='skeleton'] h4,
|
|
106
|
+
[data-theme='skeleton'] h5,
|
|
107
|
+
[data-theme='skeleton'] h6 {
|
|
108
108
|
font-weight: bold;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
/* Applied to body with `<body data-theme="
|
|
111
|
+
/* Applied to body with `<body data-theme="skeleton">` */
|
|
112
112
|
/* Created with: https://csshero.org/mesher/ */
|
|
113
113
|
/* prettier-ignore */
|
|
114
|
-
[data-theme='
|
|
114
|
+
[data-theme='skeleton'] {
|
|
115
115
|
background-image:
|
|
116
116
|
radial-gradient(at 0% 0%, rgba(var(--color-secondary-500) / 0.33) 0px, transparent 50%),
|
|
117
117
|
radial-gradient(at 98% 1%, rgba(var(--color-error-500) / 0.33) 0px, transparent 50%);
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
--theme-font-family-heading: 'Quicksand', sans-serif;
|
|
8
8
|
--theme-font-color-base: var(--color-surface-900);
|
|
9
9
|
--theme-font-color-dark: var(--color-tertiary-50);
|
|
10
|
-
--theme-rounded-base:
|
|
11
|
-
--theme-rounded-container:
|
|
12
|
-
--theme-border-base:
|
|
10
|
+
--theme-rounded-base: 12px;
|
|
11
|
+
--theme-rounded-container: 12px;
|
|
12
|
+
--theme-border-base: 0px;
|
|
13
13
|
/* =~= Theme On-X Colors =~= */
|
|
14
14
|
--on-primary: 0 0 0;
|
|
15
15
|
--on-secondary: 0 0 0;
|
|
@@ -98,27 +98,27 @@
|
|
|
98
98
|
--color-surface-900: 49 50 118; /* ⬅ #313276 */
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
[data-theme='
|
|
102
|
-
[data-theme='
|
|
103
|
-
[data-theme='
|
|
104
|
-
[data-theme='
|
|
105
|
-
[data-theme='
|
|
106
|
-
[data-theme='
|
|
107
|
-
[data-theme='
|
|
108
|
-
[data-theme='
|
|
101
|
+
[data-theme='vuetiful'] h1,
|
|
102
|
+
[data-theme='vuetiful'] h2,
|
|
103
|
+
[data-theme='vuetiful'] h3,
|
|
104
|
+
[data-theme='vuetiful'] h4,
|
|
105
|
+
[data-theme='vuetiful'] h5,
|
|
106
|
+
[data-theme='vuetiful'] h6,
|
|
107
|
+
[data-theme='vuetiful'] a,
|
|
108
|
+
[data-theme='vuetiful'] button {
|
|
109
109
|
font-weight: bold;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
/* Applied to body with `<body data-theme="
|
|
112
|
+
/* Applied to body with `<body data-theme="vuetiful">` */
|
|
113
113
|
/* Created with: https://csshero.org/mesher/ */
|
|
114
|
-
[data-theme='
|
|
114
|
+
[data-theme='vuetiful'] {
|
|
115
115
|
/* prettier-ignore */
|
|
116
116
|
background-image:
|
|
117
117
|
radial-gradient(at 76% 0%, hsla(189,100%,56%,0.36) 0px, transparent 50%),
|
|
118
118
|
radial-gradient(at 1% 0%, hsla(340,100%,76%,0.26) 0px, transparent 50%),
|
|
119
119
|
radial-gradient(at 20% 100%, hsla(241,100%,70%,0.47) 0px, transparent 50%);
|
|
120
120
|
}
|
|
121
|
-
.dark [data-theme='
|
|
121
|
+
.dark [data-theme='vuetiful'] {
|
|
122
122
|
/* prettier-ignore */
|
|
123
123
|
background-image:
|
|
124
124
|
radial-gradient(at 76% 0%, hsla(189,100%,56%,0.20) 0px, transparent 50%),
|
package/src/utils/theme/theme.ts
CHANGED
|
@@ -5,27 +5,31 @@ const { isBrowser } = usePlatform();
|
|
|
5
5
|
|
|
6
6
|
interface Theme {
|
|
7
7
|
name: string;
|
|
8
|
-
url
|
|
8
|
+
url: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const THEMES = {
|
|
12
12
|
VUETIFUL: "vuetiful",
|
|
13
|
-
MODERN: "modern",
|
|
14
13
|
ROCKET: "rocket",
|
|
15
14
|
SAHARA: "sahara",
|
|
16
15
|
SEAFOAM: "seafoam",
|
|
17
16
|
SEASONAL: "seasonal",
|
|
17
|
+
SKELETON: "skeleton",
|
|
18
18
|
VINTAGE: "vintage",
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
const builtInUrl = (name: string): string => {
|
|
22
|
+
return `https://code-coaching.dev/vuetiful-themes/theme-${name}.css`;
|
|
23
|
+
};
|
|
24
|
+
|
|
21
25
|
const builtInThemes: Array<Theme> = [
|
|
22
|
-
{ name: THEMES.VUETIFUL },
|
|
23
|
-
{ name: THEMES.
|
|
24
|
-
{ name: THEMES.
|
|
25
|
-
{ name: THEMES.
|
|
26
|
-
{ name: THEMES.
|
|
27
|
-
{ name: THEMES.
|
|
28
|
-
{ name: THEMES.VINTAGE },
|
|
26
|
+
{ name: THEMES.VUETIFUL, url: builtInUrl(`${THEMES.VUETIFUL}-0.0.1`) },
|
|
27
|
+
{ name: THEMES.ROCKET, url: builtInUrl(`${THEMES.ROCKET}`) },
|
|
28
|
+
{ name: THEMES.SAHARA, url: builtInUrl(`${THEMES.SAHARA}`) },
|
|
29
|
+
{ name: THEMES.SEAFOAM, url: builtInUrl(`${THEMES.SEAFOAM}`) },
|
|
30
|
+
{ name: THEMES.SEASONAL, url: builtInUrl(`${THEMES.SEASONAL}`) },
|
|
31
|
+
{ name: THEMES.SKELETON, url: builtInUrl(`${THEMES.SKELETON}`) },
|
|
32
|
+
{ name: THEMES.VINTAGE, url: builtInUrl(`${THEMES.VINTAGE}`) },
|
|
29
33
|
];
|
|
30
34
|
|
|
31
35
|
const themes: Ref<Array<Theme>> = ref([...builtInThemes]);
|
|
@@ -62,9 +66,6 @@ const useTheme = () => {
|
|
|
62
66
|
|
|
63
67
|
const existingStyle = document.getElementById("theme");
|
|
64
68
|
let themeUrl = theme.url;
|
|
65
|
-
if (!themeUrl) {
|
|
66
|
-
themeUrl = `https://code-coaching.dev/vuetiful-themes/theme-${theme.name}.css`;
|
|
67
|
-
}
|
|
68
69
|
|
|
69
70
|
const link = document.createElement("link");
|
|
70
71
|
link.id = "theme";
|
|
@@ -87,9 +88,8 @@ const useTheme = () => {
|
|
|
87
88
|
return [...builtInThemes];
|
|
88
89
|
};
|
|
89
90
|
|
|
90
|
-
const registerTheme = (name: string, url
|
|
91
|
-
|
|
92
|
-
return { name };
|
|
91
|
+
const registerTheme = (name: string, url: string): Theme => {
|
|
92
|
+
return { url, name };
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
const overwriteThemes = (newThemes: Array<Theme>): void => {
|