c0ckp1t 1.0.0
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/LICENSE +201 -0
- package/README.md +5 -0
- package/c0ckp1t-demo/Constants.mjs +125 -0
- package/c0ckp1t-demo/components/sidebar.vue +82 -0
- package/c0ckp1t-demo/main.vue +39 -0
- package/c0ckp1t-demo/pages/devices.vue +63 -0
- package/c0ckp1t-demo/pages/homepage.vue +63 -0
- package/c0ckp1t-demo/pages/report.vue +63 -0
- package/c0ckp1t-demo/store.mjs +133 -0
- package/components/ExecButton.vue +62 -0
- package/components/FsTree.vue +550 -0
- package/components/Markdown.mjs +274 -0
- package/components/MarkdownUtils.mjs +180 -0
- package/components/Tree.mjs +175 -0
- package/components/code-mirror.vue +445 -0
- package/components/vue3-ace-editor.vue +331 -0
- package/components/xbutton.vue +45 -0
- package/components/xcard-h.vue +175 -0
- package/components/xcard.vue +76 -0
- package/components/xcheck.vue +35 -0
- package/components/xcheckbox.vue +52 -0
- package/components/xcode.vue +139 -0
- package/components/xcollapse.vue +52 -0
- package/components/xcolor.vue +84 -0
- package/components/xdropdown.vue +104 -0
- package/components/xdropdown2.vue +140 -0
- package/components/xhidden.vue +30 -0
- package/components/xinput.vue +101 -0
- package/components/xinput2.vue +101 -0
- package/components/xjson.vue +95 -0
- package/components/xkv.vue +41 -0
- package/components/xlabel.vue +56 -0
- package/components/xlist.vue +83 -0
- package/components/xmap.vue +106 -0
- package/components/xmarkdown.vue +269 -0
- package/components/xnav.vue +98 -0
- package/components/xsection.vue +164 -0
- package/components/xsound.vue +251 -0
- package/components/xtable-open.vue +179 -0
- package/components/xtabs.vue +72 -0
- package/components/xterminal.vue +456 -0
- package/components/xtextarea.vue +83 -0
- package/components/xtoggle.vue +68 -0
- package/components/xtoggle3.vue +67 -0
- package/components/xtree.vue +140 -0
- package/components/xupload.vue +129 -0
- package/core/Content.mjs +92 -0
- package/core/DocUtils.mjs +189 -0
- package/core/GlobalStore.mjs +329 -0
- package/core/Island.mjs +429 -0
- package/core/IslandDefault.mjs +229 -0
- package/core/JsUtils.mjs +483 -0
- package/core/Logging.mjs +59 -0
- package/core/Page404.vue +152 -0
- package/core/PageFallback.vue +168 -0
- package/core/PageMain.vue +181 -0
- package/core/Theme.mjs +1759 -0
- package/core/VueUtils.mjs +200 -0
- package/core/WsUtils.mjs +274 -0
- package/core/img/Flag_of_the_United_States.svg +25 -0
- package/core/img/logo_v1.svg +98 -0
- package/core/img/logo_v2.svg +98 -0
- package/core/img/state-uniqueId-8k.wav +0 -0
- package/core/main-offcanvas.vue +99 -0
- package/core/nodes/_api.vue +82 -0
- package/core/nodes/node-container.vue +103 -0
- package/core/nodes/node.vue +246 -0
- package/core/nodes/place-holder.vue +47 -0
- package/core/nodes/root.vue +52 -0
- package/core/notify/NotifyUtils.mjs +150 -0
- package/core/notify/toast.vue +150 -0
- package/core/pages/About.vue +57 -0
- package/core/pages/Cache.vue +155 -0
- package/core/pages/Connection.vue +192 -0
- package/core/pages/Connections.vue +102 -0
- package/core/pages/Documentation.vue +263 -0
- package/core/pages/Notifies.vue +156 -0
- package/core/pages/Traffic.vue +152 -0
- package/core/pages/connections/connection-header-details.vue +80 -0
- package/core/pages/connections/page-connection-default.vue +92 -0
- package/core/pages/connections/page-connection.vue +176 -0
- package/core/pages/connections/ws-connection.vue +146 -0
- package/core/pages/frontend/Bootstrap.vue +1140 -0
- package/core/pages/frontend/Components.vue +56 -0
- package/core/pages/frontend/ComponentsAdv.vue +203 -0
- package/core/pages/frontend/ComponentsBasic.vue +336 -0
- package/core/pages/frontend/Theme.vue +473 -0
- package/core/pages/frontend/component-view.vue +65 -0
- package/core/pages/traffic/WsLogUtils.mjs +91 -0
- package/core/pages/traffic/log-ws-exec.vue +124 -0
- package/core/pages/traffic/log-ws-exec2.vue +129 -0
- package/core/sfc/code-item.vue +169 -0
- package/core/sfc/connection-header.vue +62 -0
- package/core/sfc/info-api.vue +158 -0
- package/core/sfc/md-toc.vue +346 -0
- package/core/sfc/scroll-to-top.vue +69 -0
- package/core/sfc/task.vue +98 -0
- package/core/sfc/text-to-md.vue +25 -0
- package/core/sfc/toc-list.vue +175 -0
- package/core/ws-client/AuthNState.mjs +84 -0
- package/core/ws-client/Connection.mjs +580 -0
- package/core/ws-client/Session.mjs +72 -0
- package/core/ws-client/WsClient.mjs +230 -0
- package/core/ws-client/WsLogUtils.mjs +91 -0
- package/core/ws-client/ws-connection.vue +144 -0
- package/css/Changa-Medium.ttf +0 -0
- package/css/Makefile +10 -0
- package/css/README.md +25 -0
- package/css/bootstrap-c0ckp1t.css +11861 -0
- package/css/bootstrap.min.css +6 -0
- package/css/fontawesome/brands.min.css +6 -0
- package/css/fontawesome/fontawesome.min.css +8 -0
- package/css/fontawesome/regular.min.css +6 -0
- package/css/fontawesome/solid.min.css +6 -0
- package/css/webfonts/fa-brands-400.woff2 +0 -0
- package/css/webfonts/fa-regular-400.woff2 +0 -0
- package/css/webfonts/fa-solid-900.woff2 +0 -0
- package/docs/Introduction.md +3 -0
- package/favicon-192x192.png +0 -0
- package/favicon-32x32.png +0 -0
- package/favicon-64x64.png +0 -0
- package/favicon.ico +0 -0
- package/index-cdn.html +66 -0
- package/js_ext/Makefile +26 -0
- package/js_ext/ace-editor/ace.js +22037 -0
- package/js_ext/ace-editor/ext-beautify.js +343 -0
- package/js_ext/ace-editor/ext-code_lens.js +204 -0
- package/js_ext/ace-editor/ext-command_bar.js +469 -0
- package/js_ext/ace-editor/ext-diff.js +4265 -0
- package/js_ext/ace-editor/ext-elastic_tabstops_lite.js +238 -0
- package/js_ext/ace-editor/ext-emmet.js +1303 -0
- package/js_ext/ace-editor/ext-error_marker.js +9 -0
- package/js_ext/ace-editor/ext-hardwrap.js +127 -0
- package/js_ext/ace-editor/ext-inline_autocomplete.js +3547 -0
- package/js_ext/ace-editor/ext-keybinding_menu.js +185 -0
- package/js_ext/ace-editor/ext-language_tools.js +2724 -0
- package/js_ext/ace-editor/ext-linking.js +66 -0
- package/js_ext/ace-editor/ext-modelist.js +276 -0
- package/js_ext/ace-editor/ext-options.js +859 -0
- package/js_ext/ace-editor/ext-prompt.js +3161 -0
- package/js_ext/ace-editor/ext-rtl.js +146 -0
- package/js_ext/ace-editor/ext-searchbox.js +385 -0
- package/js_ext/ace-editor/ext-settings_menu.js +859 -0
- package/js_ext/ace-editor/ext-simple_tokenizer.js +137 -0
- package/js_ext/ace-editor/ext-spellcheck.js +79 -0
- package/js_ext/ace-editor/ext-split.js +203 -0
- package/js_ext/ace-editor/ext-static_highlight.js +194 -0
- package/js_ext/ace-editor/ext-statusbar.js +63 -0
- package/js_ext/ace-editor/ext-textarea.js +400 -0
- package/js_ext/ace-editor/ext-themelist.js +80 -0
- package/js_ext/ace-editor/ext-whitespace.js +201 -0
- package/js_ext/ace-editor/keybinding-emacs.js +1067 -0
- package/js_ext/ace-editor/keybinding-sublime.js +409 -0
- package/js_ext/ace-editor/keybinding-vim.js +7101 -0
- package/js_ext/ace-editor/keybinding-vscode.js +255 -0
- package/js_ext/ace-editor/mode-abap.js +200 -0
- package/js_ext/ace-editor/mode-abc.js +243 -0
- package/js_ext/ace-editor/mode-actionscript.js +234 -0
- package/js_ext/ace-editor/mode-ada.js +108 -0
- package/js_ext/ace-editor/mode-alda.js +279 -0
- package/js_ext/ace-editor/mode-apache_conf.js +318 -0
- package/js_ext/ace-editor/mode-apex.js +402 -0
- package/js_ext/ace-editor/mode-applescript.js +232 -0
- package/js_ext/ace-editor/mode-aql.js +92 -0
- package/js_ext/ace-editor/mode-asciidoc.js +311 -0
- package/js_ext/ace-editor/mode-asl.js +357 -0
- package/js_ext/ace-editor/mode-assembly_arm32.js +185 -0
- package/js_ext/ace-editor/mode-assembly_x86.js +170 -0
- package/js_ext/ace-editor/mode-astro.js +2474 -0
- package/js_ext/ace-editor/mode-autohotkey.js +208 -0
- package/js_ext/ace-editor/mode-basic.js +201 -0
- package/js_ext/ace-editor/mode-batchfile.js +199 -0
- package/js_ext/ace-editor/mode-bibtex.js +318 -0
- package/js_ext/ace-editor/mode-c9search.js +250 -0
- package/js_ext/ace-editor/mode-c_cpp.js +417 -0
- package/js_ext/ace-editor/mode-cirru.js +192 -0
- package/js_ext/ace-editor/mode-clojure.js +322 -0
- package/js_ext/ace-editor/mode-clue.js +361 -0
- package/js_ext/ace-editor/mode-cobol.js +82 -0
- package/js_ext/ace-editor/mode-coffee.js +335 -0
- package/js_ext/ace-editor/mode-coldfusion.js +2409 -0
- package/js_ext/ace-editor/mode-crystal.js +586 -0
- package/js_ext/ace-editor/mode-csharp.js +413 -0
- package/js_ext/ace-editor/mode-csound_document.js +4072 -0
- package/js_ext/ace-editor/mode-csound_orchestra.js +2923 -0
- package/js_ext/ace-editor/mode-csound_score.js +409 -0
- package/js_ext/ace-editor/mode-csp.js +59 -0
- package/js_ext/ace-editor/mode-css.js +632 -0
- package/js_ext/ace-editor/mode-csv.js +97 -0
- package/js_ext/ace-editor/mode-curly.js +2381 -0
- package/js_ext/ace-editor/mode-cuttlefish.js +56 -0
- package/js_ext/ace-editor/mode-d.js +450 -0
- package/js_ext/ace-editor/mode-dart.js +618 -0
- package/js_ext/ace-editor/mode-diff.js +129 -0
- package/js_ext/ace-editor/mode-django.js +2422 -0
- package/js_ext/ace-editor/mode-dockerfile.js +427 -0
- package/js_ext/ace-editor/mode-dot.js +348 -0
- package/js_ext/ace-editor/mode-drools.js +607 -0
- package/js_ext/ace-editor/mode-edifact.js +130 -0
- package/js_ext/ace-editor/mode-eiffel.js +120 -0
- package/js_ext/ace-editor/mode-ejs.js +3277 -0
- package/js_ext/ace-editor/mode-elixir.js +443 -0
- package/js_ext/ace-editor/mode-elm.js +274 -0
- package/js_ext/ace-editor/mode-erlang.js +836 -0
- package/js_ext/ace-editor/mode-flix.js +164 -0
- package/js_ext/ace-editor/mode-forth.js +253 -0
- package/js_ext/ace-editor/mode-fortran.js +361 -0
- package/js_ext/ace-editor/mode-fsharp.js +277 -0
- package/js_ext/ace-editor/mode-fsl.js +226 -0
- package/js_ext/ace-editor/mode-ftl.js +1255 -0
- package/js_ext/ace-editor/mode-gcode.js +74 -0
- package/js_ext/ace-editor/mode-gherkin.js +154 -0
- package/js_ext/ace-editor/mode-gitignore.js +49 -0
- package/js_ext/ace-editor/mode-glsl.js +475 -0
- package/js_ext/ace-editor/mode-gobstones.js +1459 -0
- package/js_ext/ace-editor/mode-golang.js +341 -0
- package/js_ext/ace-editor/mode-graphqlschema.js +174 -0
- package/js_ext/ace-editor/mode-groovy.js +1401 -0
- package/js_ext/ace-editor/mode-haml.js +1906 -0
- package/js_ext/ace-editor/mode-handlebars.js +2438 -0
- package/js_ext/ace-editor/mode-haskell.js +324 -0
- package/js_ext/ace-editor/mode-haskell_cabal.js +135 -0
- package/js_ext/ace-editor/mode-haxe.js +313 -0
- package/js_ext/ace-editor/mode-hjson.js +318 -0
- package/js_ext/ace-editor/mode-html.js +2339 -0
- package/js_ext/ace-editor/mode-html_elixir.js +2845 -0
- package/js_ext/ace-editor/mode-html_ruby.js +3294 -0
- package/js_ext/ace-editor/mode-ini.js +138 -0
- package/js_ext/ace-editor/mode-io.js +210 -0
- package/js_ext/ace-editor/mode-ion.js +477 -0
- package/js_ext/ace-editor/mode-jack.js +293 -0
- package/js_ext/ace-editor/mode-jade.js +2017 -0
- package/js_ext/ace-editor/mode-java.js +1565 -0
- package/js_ext/ace-editor/mode-javascript.js +1191 -0
- package/js_ext/ace-editor/mode-jexl.js +270 -0
- package/js_ext/ace-editor/mode-json.js +275 -0
- package/js_ext/ace-editor/mode-json5.js +308 -0
- package/js_ext/ace-editor/mode-jsoniq.js +2577 -0
- package/js_ext/ace-editor/mode-jsp.js +1618 -0
- package/js_ext/ace-editor/mode-jssm.js +293 -0
- package/js_ext/ace-editor/mode-jsx.js +1209 -0
- package/js_ext/ace-editor/mode-julia.js +254 -0
- package/js_ext/ace-editor/mode-kotlin.js +445 -0
- package/js_ext/ace-editor/mode-latex.js +252 -0
- package/js_ext/ace-editor/mode-latte.js +2522 -0
- package/js_ext/ace-editor/mode-less.js +742 -0
- package/js_ext/ace-editor/mode-liquid.js +2741 -0
- package/js_ext/ace-editor/mode-lisp.js +104 -0
- package/js_ext/ace-editor/mode-livescript.js +272 -0
- package/js_ext/ace-editor/mode-logiql.js +272 -0
- package/js_ext/ace-editor/mode-logtalk.js +309 -0
- package/js_ext/ace-editor/mode-lsl.js +287 -0
- package/js_ext/ace-editor/mode-lua.js +393 -0
- package/js_ext/ace-editor/mode-luapage.js +2785 -0
- package/js_ext/ace-editor/mode-lucene.js +145 -0
- package/js_ext/ace-editor/mode-makefile.js +374 -0
- package/js_ext/ace-editor/mode-markdown.js +2935 -0
- package/js_ext/ace-editor/mode-mask.js +1757 -0
- package/js_ext/ace-editor/mode-matlab.js +239 -0
- package/js_ext/ace-editor/mode-maze.js +256 -0
- package/js_ext/ace-editor/mode-mediawiki.js +580 -0
- package/js_ext/ace-editor/mode-mel.js +213 -0
- package/js_ext/ace-editor/mode-mips.js +231 -0
- package/js_ext/ace-editor/mode-mixal.js +110 -0
- package/js_ext/ace-editor/mode-mushcode.js +642 -0
- package/js_ext/ace-editor/mode-mysql.js +150 -0
- package/js_ext/ace-editor/mode-nasal.js +513 -0
- package/js_ext/ace-editor/mode-nginx.js +262 -0
- package/js_ext/ace-editor/mode-nim.js +325 -0
- package/js_ext/ace-editor/mode-nix.js +555 -0
- package/js_ext/ace-editor/mode-nsis.js +279 -0
- package/js_ext/ace-editor/mode-nunjucks.js +2677 -0
- package/js_ext/ace-editor/mode-objectivec.js +626 -0
- package/js_ext/ace-editor/mode-ocaml.js +378 -0
- package/js_ext/ace-editor/mode-odin.js +449 -0
- package/js_ext/ace-editor/mode-partiql.js +750 -0
- package/js_ext/ace-editor/mode-pascal.js +204 -0
- package/js_ext/ace-editor/mode-perl.js +318 -0
- package/js_ext/ace-editor/mode-pgsql.js +1860 -0
- package/js_ext/ace-editor/mode-php.js +14072 -0
- package/js_ext/ace-editor/mode-php_laravel_blade.js +14260 -0
- package/js_ext/ace-editor/mode-pig.js +278 -0
- package/js_ext/ace-editor/mode-plain_text.js +27 -0
- package/js_ext/ace-editor/mode-plsql.js +268 -0
- package/js_ext/ace-editor/mode-powershell.js +567 -0
- package/js_ext/ace-editor/mode-praat.js +412 -0
- package/js_ext/ace-editor/mode-prisma.js +457 -0
- package/js_ext/ace-editor/mode-prolog.js +305 -0
- package/js_ext/ace-editor/mode-properties.js +69 -0
- package/js_ext/ace-editor/mode-protobuf.js +498 -0
- package/js_ext/ace-editor/mode-prql.js +323 -0
- package/js_ext/ace-editor/mode-puppet.js +316 -0
- package/js_ext/ace-editor/mode-python.js +476 -0
- package/js_ext/ace-editor/mode-qml.js +346 -0
- package/js_ext/ace-editor/mode-r.js +387 -0
- package/js_ext/ace-editor/mode-raku.js +516 -0
- package/js_ext/ace-editor/mode-razor.js +2697 -0
- package/js_ext/ace-editor/mode-rdoc.js +286 -0
- package/js_ext/ace-editor/mode-red.js +388 -0
- package/js_ext/ace-editor/mode-redshift.js +321 -0
- package/js_ext/ace-editor/mode-rhtml.js +2750 -0
- package/js_ext/ace-editor/mode-robot.js +168 -0
- package/js_ext/ace-editor/mode-rst.js +245 -0
- package/js_ext/ace-editor/mode-ruby.js +921 -0
- package/js_ext/ace-editor/mode-rust.js +393 -0
- package/js_ext/ace-editor/mode-sac.js +349 -0
- package/js_ext/ace-editor/mode-sass.js +480 -0
- package/js_ext/ace-editor/mode-scad.js +350 -0
- package/js_ext/ace-editor/mode-scala.js +1395 -0
- package/js_ext/ace-editor/mode-scheme.js +210 -0
- package/js_ext/ace-editor/mode-scrypt.js +317 -0
- package/js_ext/ace-editor/mode-scss.js +768 -0
- package/js_ext/ace-editor/mode-sh.js +387 -0
- package/js_ext/ace-editor/mode-sjs.js +1393 -0
- package/js_ext/ace-editor/mode-slim.js +4770 -0
- package/js_ext/ace-editor/mode-smarty.js +2436 -0
- package/js_ext/ace-editor/mode-smithy.js +456 -0
- package/js_ext/ace-editor/mode-snippets.js +183 -0
- package/js_ext/ace-editor/mode-soy_template.js +2611 -0
- package/js_ext/ace-editor/mode-space.js +151 -0
- package/js_ext/ace-editor/mode-sparql.js +288 -0
- package/js_ext/ace-editor/mode-sql.js +221 -0
- package/js_ext/ace-editor/mode-sqlserver.js +391 -0
- package/js_ext/ace-editor/mode-stylus.js +443 -0
- package/js_ext/ace-editor/mode-svg.js +1487 -0
- package/js_ext/ace-editor/mode-swift.js +342 -0
- package/js_ext/ace-editor/mode-tcl.js +338 -0
- package/js_ext/ace-editor/mode-terraform.js +346 -0
- package/js_ext/ace-editor/mode-tex.js +212 -0
- package/js_ext/ace-editor/mode-text.js +9 -0
- package/js_ext/ace-editor/mode-textile.js +125 -0
- package/js_ext/ace-editor/mode-toml.js +129 -0
- package/js_ext/ace-editor/mode-tsv.js +124 -0
- package/js_ext/ace-editor/mode-tsx.js +1276 -0
- package/js_ext/ace-editor/mode-turtle.js +264 -0
- package/js_ext/ace-editor/mode-twig.js +2502 -0
- package/js_ext/ace-editor/mode-typescript.js +1254 -0
- package/js_ext/ace-editor/mode-vala.js +554 -0
- package/js_ext/ace-editor/mode-vbscript.js +731 -0
- package/js_ext/ace-editor/mode-velocity.js +2580 -0
- package/js_ext/ace-editor/mode-verilog.js +98 -0
- package/js_ext/ace-editor/mode-vhdl.js +94 -0
- package/js_ext/ace-editor/mode-visualforce.js +2454 -0
- package/js_ext/ace-editor/mode-vue.js +3834 -0
- package/js_ext/ace-editor/mode-wollok.js +1329 -0
- package/js_ext/ace-editor/mode-xml.js +477 -0
- package/js_ext/ace-editor/mode-xquery.js +2589 -0
- package/js_ext/ace-editor/mode-yaml.js +395 -0
- package/js_ext/ace-editor/mode-zeek.js +502 -0
- package/js_ext/ace-editor/mode-zig.js +585 -0
- package/js_ext/ace-editor/snippets/abap.js +9 -0
- package/js_ext/ace-editor/snippets/abc.js +16 -0
- package/js_ext/ace-editor/snippets/actionscript.js +16 -0
- package/js_ext/ace-editor/snippets/ada.js +9 -0
- package/js_ext/ace-editor/snippets/alda.js +9 -0
- package/js_ext/ace-editor/snippets/apache_conf.js +9 -0
- package/js_ext/ace-editor/snippets/apex.js +9 -0
- package/js_ext/ace-editor/snippets/applescript.js +9 -0
- package/js_ext/ace-editor/snippets/aql.js +9 -0
- package/js_ext/ace-editor/snippets/asciidoc.js +9 -0
- package/js_ext/ace-editor/snippets/asl.js +9 -0
- package/js_ext/ace-editor/snippets/assembly_arm32.js +9 -0
- package/js_ext/ace-editor/snippets/assembly_x86.js +9 -0
- package/js_ext/ace-editor/snippets/astro.js +9 -0
- package/js_ext/ace-editor/snippets/autohotkey.js +9 -0
- package/js_ext/ace-editor/snippets/basic.js +9 -0
- package/js_ext/ace-editor/snippets/batchfile.js +9 -0
- package/js_ext/ace-editor/snippets/bibtex.js +9 -0
- package/js_ext/ace-editor/snippets/c9search.js +9 -0
- package/js_ext/ace-editor/snippets/c_cpp.js +16 -0
- package/js_ext/ace-editor/snippets/cirru.js +9 -0
- package/js_ext/ace-editor/snippets/clojure.js +16 -0
- package/js_ext/ace-editor/snippets/clue.js +9 -0
- package/js_ext/ace-editor/snippets/cobol.js +9 -0
- package/js_ext/ace-editor/snippets/coffee.js +16 -0
- package/js_ext/ace-editor/snippets/coldfusion.js +9 -0
- package/js_ext/ace-editor/snippets/crystal.js +9 -0
- package/js_ext/ace-editor/snippets/csharp.js +9 -0
- package/js_ext/ace-editor/snippets/csound_document.js +16 -0
- package/js_ext/ace-editor/snippets/csound_orchestra.js +16 -0
- package/js_ext/ace-editor/snippets/csound_score.js +9 -0
- package/js_ext/ace-editor/snippets/csp.js +9 -0
- package/js_ext/ace-editor/snippets/css.js +16 -0
- package/js_ext/ace-editor/snippets/csv.js +9 -0
- package/js_ext/ace-editor/snippets/curly.js +9 -0
- package/js_ext/ace-editor/snippets/cuttlefish.js +9 -0
- package/js_ext/ace-editor/snippets/d.js +9 -0
- package/js_ext/ace-editor/snippets/dart.js +16 -0
- package/js_ext/ace-editor/snippets/diff.js +16 -0
- package/js_ext/ace-editor/snippets/django.js +16 -0
- package/js_ext/ace-editor/snippets/dockerfile.js +9 -0
- package/js_ext/ace-editor/snippets/dot.js +9 -0
- package/js_ext/ace-editor/snippets/drools.js +16 -0
- package/js_ext/ace-editor/snippets/edifact.js +16 -0
- package/js_ext/ace-editor/snippets/eiffel.js +9 -0
- package/js_ext/ace-editor/snippets/ejs.js +9 -0
- package/js_ext/ace-editor/snippets/elixir.js +9 -0
- package/js_ext/ace-editor/snippets/elm.js +9 -0
- package/js_ext/ace-editor/snippets/erlang.js +16 -0
- package/js_ext/ace-editor/snippets/flix.js +9 -0
- package/js_ext/ace-editor/snippets/forth.js +9 -0
- package/js_ext/ace-editor/snippets/fortran.js +9 -0
- package/js_ext/ace-editor/snippets/fsharp.js +9 -0
- package/js_ext/ace-editor/snippets/fsl.js +16 -0
- package/js_ext/ace-editor/snippets/ftl.js +9 -0
- package/js_ext/ace-editor/snippets/gcode.js +9 -0
- package/js_ext/ace-editor/snippets/gherkin.js +9 -0
- package/js_ext/ace-editor/snippets/gitignore.js +9 -0
- package/js_ext/ace-editor/snippets/glsl.js +9 -0
- package/js_ext/ace-editor/snippets/gobstones.js +16 -0
- package/js_ext/ace-editor/snippets/golang.js +9 -0
- package/js_ext/ace-editor/snippets/graphqlschema.js +16 -0
- package/js_ext/ace-editor/snippets/groovy.js +9 -0
- package/js_ext/ace-editor/snippets/haml.js +16 -0
- package/js_ext/ace-editor/snippets/handlebars.js +9 -0
- package/js_ext/ace-editor/snippets/haskell.js +16 -0
- package/js_ext/ace-editor/snippets/haskell_cabal.js +9 -0
- package/js_ext/ace-editor/snippets/haxe.js +9 -0
- package/js_ext/ace-editor/snippets/hjson.js +9 -0
- package/js_ext/ace-editor/snippets/html.js +16 -0
- package/js_ext/ace-editor/snippets/html_elixir.js +9 -0
- package/js_ext/ace-editor/snippets/html_ruby.js +9 -0
- package/js_ext/ace-editor/snippets/ini.js +9 -0
- package/js_ext/ace-editor/snippets/io.js +74 -0
- package/js_ext/ace-editor/snippets/ion.js +9 -0
- package/js_ext/ace-editor/snippets/jack.js +9 -0
- package/js_ext/ace-editor/snippets/jade.js +9 -0
- package/js_ext/ace-editor/snippets/java.js +16 -0
- package/js_ext/ace-editor/snippets/javascript.js +16 -0
- package/js_ext/ace-editor/snippets/jexl.js +9 -0
- package/js_ext/ace-editor/snippets/json.js +9 -0
- package/js_ext/ace-editor/snippets/json5.js +9 -0
- package/js_ext/ace-editor/snippets/jsoniq.js +78 -0
- package/js_ext/ace-editor/snippets/jsp.js +16 -0
- package/js_ext/ace-editor/snippets/jssm.js +9 -0
- package/js_ext/ace-editor/snippets/jsx.js +9 -0
- package/js_ext/ace-editor/snippets/julia.js +9 -0
- package/js_ext/ace-editor/snippets/kotlin.js +9 -0
- package/js_ext/ace-editor/snippets/latex.js +9 -0
- package/js_ext/ace-editor/snippets/latte.js +9 -0
- package/js_ext/ace-editor/snippets/less.js +9 -0
- package/js_ext/ace-editor/snippets/liquid.js +16 -0
- package/js_ext/ace-editor/snippets/lisp.js +9 -0
- package/js_ext/ace-editor/snippets/livescript.js +9 -0
- package/js_ext/ace-editor/snippets/logiql.js +9 -0
- package/js_ext/ace-editor/snippets/logtalk.js +9 -0
- package/js_ext/ace-editor/snippets/lsl.js +16 -0
- package/js_ext/ace-editor/snippets/lua.js +16 -0
- package/js_ext/ace-editor/snippets/luapage.js +9 -0
- package/js_ext/ace-editor/snippets/lucene.js +9 -0
- package/js_ext/ace-editor/snippets/makefile.js +16 -0
- package/js_ext/ace-editor/snippets/markdown.js +16 -0
- package/js_ext/ace-editor/snippets/mask.js +9 -0
- package/js_ext/ace-editor/snippets/matlab.js +9 -0
- package/js_ext/ace-editor/snippets/maze.js +16 -0
- package/js_ext/ace-editor/snippets/mediawiki.js +9 -0
- package/js_ext/ace-editor/snippets/mel.js +9 -0
- package/js_ext/ace-editor/snippets/mips.js +9 -0
- package/js_ext/ace-editor/snippets/mixal.js +9 -0
- package/js_ext/ace-editor/snippets/mushcode.js +9 -0
- package/js_ext/ace-editor/snippets/mysql.js +9 -0
- package/js_ext/ace-editor/snippets/nasal.js +9 -0
- package/js_ext/ace-editor/snippets/nginx.js +9 -0
- package/js_ext/ace-editor/snippets/nim.js +9 -0
- package/js_ext/ace-editor/snippets/nix.js +9 -0
- package/js_ext/ace-editor/snippets/nsis.js +9 -0
- package/js_ext/ace-editor/snippets/nunjucks.js +9 -0
- package/js_ext/ace-editor/snippets/objectivec.js +9 -0
- package/js_ext/ace-editor/snippets/ocaml.js +9 -0
- package/js_ext/ace-editor/snippets/odin.js +9 -0
- package/js_ext/ace-editor/snippets/partiql.js +9 -0
- package/js_ext/ace-editor/snippets/pascal.js +9 -0
- package/js_ext/ace-editor/snippets/perl.js +16 -0
- package/js_ext/ace-editor/snippets/pgsql.js +9 -0
- package/js_ext/ace-editor/snippets/php.js +16 -0
- package/js_ext/ace-editor/snippets/php_laravel_blade.js +9 -0
- package/js_ext/ace-editor/snippets/pig.js +9 -0
- package/js_ext/ace-editor/snippets/plain_text.js +9 -0
- package/js_ext/ace-editor/snippets/plsql.js +9 -0
- package/js_ext/ace-editor/snippets/powershell.js +9 -0
- package/js_ext/ace-editor/snippets/praat.js +9 -0
- package/js_ext/ace-editor/snippets/prisma.js +9 -0
- package/js_ext/ace-editor/snippets/prolog.js +9 -0
- package/js_ext/ace-editor/snippets/properties.js +9 -0
- package/js_ext/ace-editor/snippets/protobuf.js +9 -0
- package/js_ext/ace-editor/snippets/prql.js +9 -0
- package/js_ext/ace-editor/snippets/puppet.js +9 -0
- package/js_ext/ace-editor/snippets/python.js +16 -0
- package/js_ext/ace-editor/snippets/qml.js +9 -0
- package/js_ext/ace-editor/snippets/r.js +16 -0
- package/js_ext/ace-editor/snippets/raku.js +9 -0
- package/js_ext/ace-editor/snippets/razor.js +16 -0
- package/js_ext/ace-editor/snippets/rdoc.js +9 -0
- package/js_ext/ace-editor/snippets/red.js +9 -0
- package/js_ext/ace-editor/snippets/redshift.js +9 -0
- package/js_ext/ace-editor/snippets/rhtml.js +9 -0
- package/js_ext/ace-editor/snippets/robot.js +16 -0
- package/js_ext/ace-editor/snippets/rst.js +16 -0
- package/js_ext/ace-editor/snippets/ruby.js +16 -0
- package/js_ext/ace-editor/snippets/rust.js +9 -0
- package/js_ext/ace-editor/snippets/sac.js +9 -0
- package/js_ext/ace-editor/snippets/sass.js +9 -0
- package/js_ext/ace-editor/snippets/scad.js +9 -0
- package/js_ext/ace-editor/snippets/scala.js +9 -0
- package/js_ext/ace-editor/snippets/scheme.js +9 -0
- package/js_ext/ace-editor/snippets/scrypt.js +9 -0
- package/js_ext/ace-editor/snippets/scss.js +9 -0
- package/js_ext/ace-editor/snippets/sh.js +16 -0
- package/js_ext/ace-editor/snippets/sjs.js +9 -0
- package/js_ext/ace-editor/snippets/slim.js +9 -0
- package/js_ext/ace-editor/snippets/smarty.js +9 -0
- package/js_ext/ace-editor/snippets/smithy.js +9 -0
- package/js_ext/ace-editor/snippets/snippets.js +16 -0
- package/js_ext/ace-editor/snippets/soy_template.js +9 -0
- package/js_ext/ace-editor/snippets/space.js +9 -0
- package/js_ext/ace-editor/snippets/sparql.js +9 -0
- package/js_ext/ace-editor/snippets/sql.js +16 -0
- package/js_ext/ace-editor/snippets/sqlserver.js +16 -0
- package/js_ext/ace-editor/snippets/stylus.js +9 -0
- package/js_ext/ace-editor/snippets/svg.js +9 -0
- package/js_ext/ace-editor/snippets/swift.js +9 -0
- package/js_ext/ace-editor/snippets/tcl.js +16 -0
- package/js_ext/ace-editor/snippets/terraform.js +9 -0
- package/js_ext/ace-editor/snippets/tex.js +16 -0
- package/js_ext/ace-editor/snippets/text.js +9 -0
- package/js_ext/ace-editor/snippets/textile.js +16 -0
- package/js_ext/ace-editor/snippets/toml.js +9 -0
- package/js_ext/ace-editor/snippets/tsv.js +9 -0
- package/js_ext/ace-editor/snippets/tsx.js +9 -0
- package/js_ext/ace-editor/snippets/turtle.js +9 -0
- package/js_ext/ace-editor/snippets/twig.js +9 -0
- package/js_ext/ace-editor/snippets/typescript.js +9 -0
- package/js_ext/ace-editor/snippets/vala.js +199 -0
- package/js_ext/ace-editor/snippets/vbscript.js +9 -0
- package/js_ext/ace-editor/snippets/velocity.js +17 -0
- package/js_ext/ace-editor/snippets/verilog.js +9 -0
- package/js_ext/ace-editor/snippets/vhdl.js +9 -0
- package/js_ext/ace-editor/snippets/visualforce.js +9 -0
- package/js_ext/ace-editor/snippets/vue.js +9 -0
- package/js_ext/ace-editor/snippets/wollok.js +16 -0
- package/js_ext/ace-editor/snippets/xml.js +9 -0
- package/js_ext/ace-editor/snippets/xquery.js +78 -0
- package/js_ext/ace-editor/snippets/yaml.js +9 -0
- package/js_ext/ace-editor/snippets/zeek.js +9 -0
- package/js_ext/ace-editor/snippets/zig.js +9 -0
- package/js_ext/ace-editor/theme-ambiance.js +18 -0
- package/js_ext/ace-editor/theme-chaos.js +18 -0
- package/js_ext/ace-editor/theme-chrome.js +18 -0
- package/js_ext/ace-editor/theme-cloud9_day.js +19 -0
- package/js_ext/ace-editor/theme-cloud9_night.js +18 -0
- package/js_ext/ace-editor/theme-cloud9_night_low_color.js +18 -0
- package/js_ext/ace-editor/theme-cloud_editor.js +19 -0
- package/js_ext/ace-editor/theme-cloud_editor_dark.js +19 -0
- package/js_ext/ace-editor/theme-clouds.js +18 -0
- package/js_ext/ace-editor/theme-clouds_midnight.js +18 -0
- package/js_ext/ace-editor/theme-cobalt.js +18 -0
- package/js_ext/ace-editor/theme-crimson_editor.js +18 -0
- package/js_ext/ace-editor/theme-dawn.js +18 -0
- package/js_ext/ace-editor/theme-dracula.js +19 -0
- package/js_ext/ace-editor/theme-dreamweaver.js +18 -0
- package/js_ext/ace-editor/theme-eclipse.js +19 -0
- package/js_ext/ace-editor/theme-github.js +18 -0
- package/js_ext/ace-editor/theme-github_dark.js +18 -0
- package/js_ext/ace-editor/theme-github_light_default.js +18 -0
- package/js_ext/ace-editor/theme-gob.js +18 -0
- package/js_ext/ace-editor/theme-gruvbox.js +18 -0
- package/js_ext/ace-editor/theme-gruvbox_dark_hard.js +18 -0
- package/js_ext/ace-editor/theme-gruvbox_light_hard.js +18 -0
- package/js_ext/ace-editor/theme-idle_fingers.js +18 -0
- package/js_ext/ace-editor/theme-iplastic.js +18 -0
- package/js_ext/ace-editor/theme-katzenmilch.js +18 -0
- package/js_ext/ace-editor/theme-kr_theme.js +18 -0
- package/js_ext/ace-editor/theme-kuroir.js +18 -0
- package/js_ext/ace-editor/theme-merbivore.js +18 -0
- package/js_ext/ace-editor/theme-merbivore_soft.js +18 -0
- package/js_ext/ace-editor/theme-mono_industrial.js +18 -0
- package/js_ext/ace-editor/theme-monokai.js +18 -0
- package/js_ext/ace-editor/theme-nord_dark.js +19 -0
- package/js_ext/ace-editor/theme-one_dark.js +18 -0
- package/js_ext/ace-editor/theme-pastel_on_dark.js +18 -0
- package/js_ext/ace-editor/theme-solarized_dark.js +18 -0
- package/js_ext/ace-editor/theme-solarized_light.js +18 -0
- package/js_ext/ace-editor/theme-sqlserver.js +18 -0
- package/js_ext/ace-editor/theme-terminal.js +18 -0
- package/js_ext/ace-editor/theme-textmate.js +16 -0
- package/js_ext/ace-editor/theme-tomorrow.js +18 -0
- package/js_ext/ace-editor/theme-tomorrow_night.js +18 -0
- package/js_ext/ace-editor/theme-tomorrow_night_blue.js +18 -0
- package/js_ext/ace-editor/theme-tomorrow_night_bright.js +18 -0
- package/js_ext/ace-editor/theme-tomorrow_night_eighties.js +18 -0
- package/js_ext/ace-editor/theme-twilight.js +18 -0
- package/js_ext/ace-editor/theme-vibrant_ink.js +18 -0
- package/js_ext/ace-editor/theme-xcode.js +18 -0
- package/js_ext/ace-editor/worker-base.js +1332 -0
- package/js_ext/ace-editor/worker-coffee.js +1381 -0
- package/js_ext/ace-editor/worker-css.js +8913 -0
- package/js_ext/ace-editor/worker-html.js +10843 -0
- package/js_ext/ace-editor/worker-javascript.js +15353 -0
- package/js_ext/ace-editor/worker-json.js +1626 -0
- package/js_ext/ace-editor/worker-lua.js +3519 -0
- package/js_ext/ace-editor/worker-php.js +3788 -0
- package/js_ext/ace-editor/worker-xml.js +3122 -0
- package/js_ext/ace-editor/worker-xquery.js +57579 -0
- package/js_ext/ace-editor/worker-yaml.js +5819 -0
- package/js_ext/bootstrap.bundle.min.js +7 -0
- package/js_ext/highlight/default.min.css +9 -0
- package/js_ext/highlight/go.min.js +14 -0
- package/js_ext/highlight/highlight.min.js +1207 -0
- package/js_ext/highlight/stackoverflow-dark.min.css +13 -0
- package/js_ext/idb-keyval-6.2.2.mjs +7 -0
- package/js_ext/json-viewer.bundle.js +52 -0
- package/js_ext/loglevel-plugin-prefix.min.js +1 -0
- package/js_ext/loglevel.min.js +2 -0
- package/js_ext/markdown/auto-render.min.js +1 -0
- package/js_ext/markdown/auto-render.mjs +245 -0
- package/js_ext/markdown/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/js_ext/markdown/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/js_ext/markdown/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Main-Bold.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Main-Italic.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Main-Regular.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Math-Italic.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/js_ext/markdown/fonts/KaTeX_Script-Regular.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/js_ext/markdown/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/js_ext/markdown/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/js_ext/markdown/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/js_ext/markdown/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/js_ext/markdown/katex.min.css +1 -0
- package/js_ext/markdown/katex.min.js +1 -0
- package/js_ext/markdown/katex.mjs +18416 -0
- package/js_ext/markdown/markdown-it.min.js +3 -0
- package/js_ext/markdown/markdownItAnchor.umd.js +2 -0
- package/js_ext/mitt.mjs +2 -0
- package/js_ext/moment.min.js +1 -0
- package/js_ext/msgpack.mjs +1612 -0
- package/js_ext/rxjs.umd.min.js +195 -0
- package/js_ext/rxjs.umd.min.js.map +1 -0
- package/js_ext/vue-router.esm-browser.prod.js +6 -0
- package/js_ext/vue.esm-browser.min.js +18 -0
- package/js_ext/vue.esm-browser.prod.min.js +3 -0
- package/js_ext/vue3-sfc-loader.esm.js +1840 -0
- package/js_ext/vue3-sfc-loader.esm.js.map +4 -0
- package/js_ext/vue3-sfc-loader.js +1839 -0
- package/js_ext/wavesurfer.esm.mjs +1 -0
- package/js_ext/xstate.web.mjs +15 -0
- package/package.json +50 -0
- package/style.css +31 -0
package/core/Theme.mjs
ADDED
|
@@ -0,0 +1,1759 @@
|
|
|
1
|
+
import {markRaw, reactive, watch, defineAsyncComponent, createApp} from 'vue'
|
|
2
|
+
import Constants from 'Constants'
|
|
3
|
+
import {getLogger} from 'Logging';
|
|
4
|
+
|
|
5
|
+
// ________________________________________________________________________________
|
|
6
|
+
// LOGGING
|
|
7
|
+
// ________________________________________________________________________________
|
|
8
|
+
const LOG_HEADER = 'Theme.mjs'
|
|
9
|
+
const logger = getLogger(LOG_HEADER)
|
|
10
|
+
logger.info("[INIT]")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// ________________________________________________________________________________
|
|
14
|
+
// CONSTANTS
|
|
15
|
+
// ________________________________________________________________________________
|
|
16
|
+
// Style element ID for dynamic theme injection
|
|
17
|
+
const THEME_STYLE_ID = 'c0ckp1t-dynamic-theme'
|
|
18
|
+
const BOOTSWATCH_LINK_ID = 'c0ckp1t-bootswatch-theme'
|
|
19
|
+
const THEME_VARS_LINK_ID = 'bootstrap-theme-vars' // ID from index.html
|
|
20
|
+
const BOOTSTRAP_MAIN_ID = 'bootstrap-main' // ID from index.html
|
|
21
|
+
|
|
22
|
+
// Static fallback colors (Bootstrap 5 defaults)
|
|
23
|
+
const fallbackColors = {
|
|
24
|
+
primary: '#0d6efd',
|
|
25
|
+
secondary: '#6c757d',
|
|
26
|
+
success: '#198754',
|
|
27
|
+
danger: '#dc3545',
|
|
28
|
+
warning: '#ffc107',
|
|
29
|
+
info: '#0dcaf0',
|
|
30
|
+
light: '#f8f9fa',
|
|
31
|
+
dark: '#212529'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Semantic colors (buttons, badges, alerts, etc.)
|
|
35
|
+
// Use static fallback initially - actual CSS values are read during initializeDefaultColors()
|
|
36
|
+
const defaultColors = {...fallbackColors}
|
|
37
|
+
|
|
38
|
+
// Static fallback for light mode backgrounds (Bootstrap 5 defaults)
|
|
39
|
+
const fallbackLightBg = {
|
|
40
|
+
bodyBg: '#ffffff',
|
|
41
|
+
bodyColor: '#212529',
|
|
42
|
+
secondaryBg: '#e9ecef',
|
|
43
|
+
tertiaryBg: '#f8f9fa',
|
|
44
|
+
borderColor: '#dee2e6',
|
|
45
|
+
emphasisColor: '#000000'
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Static fallback for dark mode backgrounds (Bootstrap 5 defaults)
|
|
49
|
+
const fallbackDarkBg = {
|
|
50
|
+
bodyBg: '#212529',
|
|
51
|
+
bodyColor: '#dee2e6',
|
|
52
|
+
secondaryBg: '#343a40',
|
|
53
|
+
tertiaryBg: '#2b3035',
|
|
54
|
+
borderColor: '#495057',
|
|
55
|
+
emphasisColor: '#ffffff'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Background colors for light mode - initialized with fallbacks, updated from CSS later
|
|
59
|
+
const defaultLightBg = {...fallbackLightBg}
|
|
60
|
+
|
|
61
|
+
// Background colors for dark mode - initialized with fallbacks, updated from CSS later
|
|
62
|
+
const defaultDarkBg = {...fallbackDarkBg}
|
|
63
|
+
|
|
64
|
+
// Cache for background colors read from CSS
|
|
65
|
+
let cachedLightBg = null
|
|
66
|
+
let cachedDarkBg = null
|
|
67
|
+
|
|
68
|
+
// ________________________________________________________________________________
|
|
69
|
+
// STORE
|
|
70
|
+
// ________________________________________________________________________________
|
|
71
|
+
export const store = reactive({
|
|
72
|
+
// ________________________________________________________________________________
|
|
73
|
+
// Theme Colors (for theme editor persistence across navigation)
|
|
74
|
+
// ________________________________________________________________________________
|
|
75
|
+
theme: "dark",
|
|
76
|
+
themeColors: {
|
|
77
|
+
colors: { ...defaultColors },
|
|
78
|
+
lightBg: { ...defaultLightBg },
|
|
79
|
+
darkBg: { ...defaultDarkBg },
|
|
80
|
+
currentBootswatchTheme: null, // null = custom editor mode, string = Bootswatch CSS active
|
|
81
|
+
isBootswatchMode: false, // true when using Bootswatch CSS swap
|
|
82
|
+
generatedCSS: '', // Generated CSS string for display/download
|
|
83
|
+
isInitialized: false, // true after theme editor has been visited and CSS applied
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
// ________________________________________________________________________________
|
|
90
|
+
// API
|
|
91
|
+
// ________________________________________________________________________________
|
|
92
|
+
export const api = {
|
|
93
|
+
// ________________________________________________________________________________
|
|
94
|
+
// THEME
|
|
95
|
+
// ________________________________________________________________________________
|
|
96
|
+
toggleTheme() {
|
|
97
|
+
store.theme = store.theme === 'dark' ? 'light' : 'dark'
|
|
98
|
+
logger.info(`[toggleTheme] - Theme changed to: ${store.theme}`)
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
setTheme(theme) {
|
|
102
|
+
if (theme === 'dark' || theme === 'light') {
|
|
103
|
+
store.theme = theme
|
|
104
|
+
logger.info(`[setTheme] - Theme set to: ${store.theme}`)
|
|
105
|
+
} else {
|
|
106
|
+
logger.warn(`[setTheme] - Invalid theme: ${theme}. Use 'dark' or 'light'.`)
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
// ________________________________________________________________________________
|
|
111
|
+
// THEME COLORS (for theme editor)
|
|
112
|
+
// ________________________________________________________________________________
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Apply the current theme colors to the DOM
|
|
116
|
+
* @returns {string} - Generated CSS string
|
|
117
|
+
*/
|
|
118
|
+
applyThemeColors() {
|
|
119
|
+
const css = Theme.applyThemeToDOM(
|
|
120
|
+
store.themeColors.colors,
|
|
121
|
+
store.themeColors.lightBg,
|
|
122
|
+
store.themeColors.darkBg
|
|
123
|
+
)
|
|
124
|
+
store.themeColors.generatedCSS = css
|
|
125
|
+
logger.info('[applyThemeColors] - Theme applied to DOM')
|
|
126
|
+
return css
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Load a preset theme by name
|
|
131
|
+
* @param {string} presetName - Name of the preset (from Theme.presets)
|
|
132
|
+
*/
|
|
133
|
+
loadThemePreset(presetName) {
|
|
134
|
+
logger.info(`[loadThemePreset] - Loading preset: ${presetName}`)
|
|
135
|
+
const preset = Theme.presets[presetName]
|
|
136
|
+
if (preset) {
|
|
137
|
+
store.themeColors.colors = { ...preset.colors }
|
|
138
|
+
store.themeColors.lightBg = { ...preset.lightBg }
|
|
139
|
+
store.themeColors.darkBg = { ...preset.darkBg }
|
|
140
|
+
api.applyThemeColors()
|
|
141
|
+
} else {
|
|
142
|
+
logger.error(`[loadThemePreset] - Preset ${presetName} not found`)
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Load a Bootswatch color preset (uses CSS variable system)
|
|
148
|
+
* @param {string} themeName - Name of the Bootswatch theme
|
|
149
|
+
*/
|
|
150
|
+
loadBootswatchPreset(themeName) {
|
|
151
|
+
logger.info(`[loadBootswatchPreset] - Loading Bootswatch preset: ${themeName}`)
|
|
152
|
+
|
|
153
|
+
// If currently in Bootswatch CSS mode, restore custom editor first
|
|
154
|
+
if (store.themeColors.isBootswatchMode) {
|
|
155
|
+
api.restoreCustomEditor()
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const preset = Theme.bootswatchPresets[themeName]
|
|
159
|
+
if (preset) {
|
|
160
|
+
store.themeColors.colors = { ...preset.colors }
|
|
161
|
+
store.themeColors.lightBg = { ...preset.lightBg }
|
|
162
|
+
store.themeColors.darkBg = { ...preset.darkBg }
|
|
163
|
+
api.applyThemeColors()
|
|
164
|
+
} else {
|
|
165
|
+
logger.error(`[loadBootswatchPreset] - Bootswatch preset ${themeName} not found`)
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Load a Bootswatch theme via CSS swap (complete Bootstrap CSS replacement)
|
|
171
|
+
* @param {string} themeName - Name of the Bootswatch theme
|
|
172
|
+
*/
|
|
173
|
+
loadBootswatchTheme(themeName) {
|
|
174
|
+
logger.info(`[loadBootswatchTheme] - Loading Bootswatch theme: ${themeName}`)
|
|
175
|
+
if(Theme.darkByDefaultThemes.includes(themeName)) {
|
|
176
|
+
api.setTheme('dark')
|
|
177
|
+
} else {
|
|
178
|
+
api.setTheme('light')
|
|
179
|
+
}
|
|
180
|
+
Theme.loadBootswatchTheme(themeName, null)
|
|
181
|
+
store.themeColors.currentBootswatchTheme = themeName
|
|
182
|
+
store.themeColors.isBootswatchMode = true
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Restore custom editor mode from Bootswatch CSS swap
|
|
187
|
+
*/
|
|
188
|
+
restoreCustomEditor() {
|
|
189
|
+
logger.info('[restoreCustomEditor] - Restoring custom editor mode')
|
|
190
|
+
const css = Theme.restoreCustomEditor(
|
|
191
|
+
store.themeColors.colors,
|
|
192
|
+
store.themeColors.lightBg,
|
|
193
|
+
store.themeColors.darkBg
|
|
194
|
+
)
|
|
195
|
+
store.themeColors.generatedCSS = css
|
|
196
|
+
store.themeColors.currentBootswatchTheme = null
|
|
197
|
+
store.themeColors.isBootswatchMode = false
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Reset theme colors to defaults
|
|
202
|
+
* Only applies CSS if theme has been initialized (editor has been visited)
|
|
203
|
+
*/
|
|
204
|
+
resetThemeColors() {
|
|
205
|
+
store.themeColors.colors = { ...Theme.defaultColors }
|
|
206
|
+
store.themeColors.lightBg = { ...Theme.defaultLightBg }
|
|
207
|
+
store.themeColors.darkBg = { ...Theme.defaultDarkBg }
|
|
208
|
+
logger.info('[resetThemeColors] - Reset to default theme')
|
|
209
|
+
// Only apply CSS if theme has been initialized
|
|
210
|
+
if (store.themeColors.isInitialized) {
|
|
211
|
+
api.applyThemeColors()
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Initialize the theme editor - reads actual CSS values and applies theme CSS
|
|
217
|
+
* Should be called once when the theme editor page is first visited
|
|
218
|
+
*/
|
|
219
|
+
initializeThemeEditor() {
|
|
220
|
+
if (store.themeColors.isInitialized) {
|
|
221
|
+
logger.debug('[initializeThemeEditor] - Already initialized, skipping')
|
|
222
|
+
return
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
logger.info('[initializeThemeEditor] - Initializing theme editor')
|
|
226
|
+
|
|
227
|
+
// Read actual CSS values from the DOM (now that DOM is ready)
|
|
228
|
+
// This returns { colors, lightBg, darkBg } with values read from CSS
|
|
229
|
+
const { colors, lightBg, darkBg } = Theme.initializeDefaultColors()
|
|
230
|
+
|
|
231
|
+
// Update store with actual default values read from CSS
|
|
232
|
+
store.themeColors.colors = { ...colors }
|
|
233
|
+
store.themeColors.lightBg = { ...lightBg }
|
|
234
|
+
store.themeColors.darkBg = { ...darkBg }
|
|
235
|
+
|
|
236
|
+
// Apply theme CSS to DOM
|
|
237
|
+
api.applyThemeColors()
|
|
238
|
+
|
|
239
|
+
// Mark as initialized
|
|
240
|
+
store.themeColors.isInitialized = true
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Update a specific semantic color
|
|
245
|
+
* @param {string} colorName - Name of the color (primary, secondary, etc.)
|
|
246
|
+
* @param {string} value - Hex color value
|
|
247
|
+
*/
|
|
248
|
+
setThemeColor(colorName, value) {
|
|
249
|
+
if (store.themeColors.colors.hasOwnProperty(colorName)) {
|
|
250
|
+
store.themeColors.colors[colorName] = value
|
|
251
|
+
api.applyThemeColors()
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Update a light mode background color
|
|
257
|
+
* @param {string} bgName - Name of the background (bodyBg, bodyColor, etc.)
|
|
258
|
+
* @param {string} value - Hex color value
|
|
259
|
+
*/
|
|
260
|
+
setLightBg(bgName, value) {
|
|
261
|
+
if (store.themeColors.lightBg.hasOwnProperty(bgName)) {
|
|
262
|
+
store.themeColors.lightBg[bgName] = value
|
|
263
|
+
api.applyThemeColors()
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Update a dark mode background color
|
|
269
|
+
* @param {string} bgName - Name of the background (bodyBg, bodyColor, etc.)
|
|
270
|
+
* @param {string} value - Hex color value
|
|
271
|
+
*/
|
|
272
|
+
setDarkBg(bgName, value) {
|
|
273
|
+
if (store.themeColors.darkBg.hasOwnProperty(bgName)) {
|
|
274
|
+
store.themeColors.darkBg[bgName] = value
|
|
275
|
+
api.applyThemeColors()
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
// Cache for initial colors read from CSS
|
|
284
|
+
let cachedDefaultColors = null
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Read a CSS variable value from :root and convert to hex if needed
|
|
288
|
+
* @param {CSSStyleDeclaration} styles - Computed styles from :root
|
|
289
|
+
* @param {string} varName - CSS variable name (without --)
|
|
290
|
+
* @param {string} fallback - Fallback hex value
|
|
291
|
+
* @returns {string} - Hex color value
|
|
292
|
+
*/
|
|
293
|
+
function readCssColor(styles, varName, fallback) {
|
|
294
|
+
const value = styles.getPropertyValue(`--bs-${varName}`).trim()
|
|
295
|
+
if (!value) return fallback
|
|
296
|
+
|
|
297
|
+
// If already hex, return as-is
|
|
298
|
+
if (value.startsWith('#')) return value
|
|
299
|
+
|
|
300
|
+
// If rgb/rgba format, convert to hex
|
|
301
|
+
const rgbMatch = value.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/)
|
|
302
|
+
if (rgbMatch) {
|
|
303
|
+
const r = parseInt(rgbMatch[1], 10)
|
|
304
|
+
const g = parseInt(rgbMatch[2], 10)
|
|
305
|
+
const b = parseInt(rgbMatch[3], 10)
|
|
306
|
+
return `#${[r, g, b].map(x => x.toString(16).padStart(2, '0')).join('')}`
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return fallback
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Get default colors - reads from CSS variables on first call, then returns cached values
|
|
314
|
+
* @returns {Object} - Default color values
|
|
315
|
+
*/
|
|
316
|
+
function getDefaultColors() {
|
|
317
|
+
// Return cached values if already read
|
|
318
|
+
if (cachedDefaultColors) return cachedDefaultColors
|
|
319
|
+
|
|
320
|
+
// Check if we're in a browser environment with DOM access
|
|
321
|
+
if (typeof document === 'undefined' || !document.documentElement) {
|
|
322
|
+
return {...fallbackColors}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const styles = getComputedStyle(document.documentElement)
|
|
326
|
+
|
|
327
|
+
cachedDefaultColors = {
|
|
328
|
+
primary: readCssColor(styles, 'primary', fallbackColors.primary),
|
|
329
|
+
secondary: readCssColor(styles, 'secondary', fallbackColors.secondary),
|
|
330
|
+
success: readCssColor(styles, 'success', fallbackColors.success),
|
|
331
|
+
danger: readCssColor(styles, 'danger', fallbackColors.danger),
|
|
332
|
+
warning: readCssColor(styles, 'warning', fallbackColors.warning),
|
|
333
|
+
info: readCssColor(styles, 'info', fallbackColors.info),
|
|
334
|
+
light: readCssColor(styles, 'light', fallbackColors.light),
|
|
335
|
+
dark: readCssColor(styles, 'dark', fallbackColors.dark)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return cachedDefaultColors
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Get light mode background colors - reads from CSS variables on first call
|
|
345
|
+
* @returns {Object} - Light mode background color values
|
|
346
|
+
*/
|
|
347
|
+
function getLightBgColors() {
|
|
348
|
+
if (cachedLightBg) return cachedLightBg
|
|
349
|
+
|
|
350
|
+
if (typeof document === 'undefined' || !document.documentElement) {
|
|
351
|
+
return {...fallbackLightBg}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Temporarily switch to light mode to read light mode CSS variables
|
|
355
|
+
const currentTheme = document.documentElement.getAttribute('data-bs-theme')
|
|
356
|
+
document.documentElement.setAttribute('data-bs-theme', 'light')
|
|
357
|
+
|
|
358
|
+
// Force a reflow to ensure computed styles are updated
|
|
359
|
+
void document.documentElement.offsetHeight
|
|
360
|
+
|
|
361
|
+
const styles = getComputedStyle(document.documentElement)
|
|
362
|
+
|
|
363
|
+
cachedLightBg = {
|
|
364
|
+
bodyBg: readCssColor(styles, 'body-bg', fallbackLightBg.bodyBg),
|
|
365
|
+
bodyColor: readCssColor(styles, 'body-color', fallbackLightBg.bodyColor),
|
|
366
|
+
secondaryBg: readCssColor(styles, 'secondary-bg', fallbackLightBg.secondaryBg),
|
|
367
|
+
tertiaryBg: readCssColor(styles, 'tertiary-bg', fallbackLightBg.tertiaryBg),
|
|
368
|
+
borderColor: readCssColor(styles, 'border-color', fallbackLightBg.borderColor),
|
|
369
|
+
emphasisColor: readCssColor(styles, 'emphasis-color', fallbackLightBg.emphasisColor)
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// Restore original theme
|
|
373
|
+
if (currentTheme) {
|
|
374
|
+
document.documentElement.setAttribute('data-bs-theme', currentTheme)
|
|
375
|
+
} else {
|
|
376
|
+
document.documentElement.removeAttribute('data-bs-theme')
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return cachedLightBg
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Get dark mode background colors - reads from CSS variables on first call
|
|
384
|
+
* @returns {Object} - Dark mode background color values
|
|
385
|
+
*/
|
|
386
|
+
function getDarkBgColors() {
|
|
387
|
+
if (cachedDarkBg) return cachedDarkBg
|
|
388
|
+
|
|
389
|
+
if (typeof document === 'undefined' || !document.documentElement) {
|
|
390
|
+
return {...fallbackDarkBg}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// Temporarily switch to dark mode to read dark mode CSS variables
|
|
394
|
+
const currentTheme = document.documentElement.getAttribute('data-bs-theme')
|
|
395
|
+
document.documentElement.setAttribute('data-bs-theme', 'dark')
|
|
396
|
+
|
|
397
|
+
// Force a reflow to ensure computed styles are updated
|
|
398
|
+
void document.documentElement.offsetHeight
|
|
399
|
+
|
|
400
|
+
// Get a fresh computed style object after the reflow
|
|
401
|
+
const styles = window.getComputedStyle(document.documentElement)
|
|
402
|
+
|
|
403
|
+
cachedDarkBg = {
|
|
404
|
+
bodyBg: readCssColor(styles, 'body-bg', fallbackDarkBg.bodyBg),
|
|
405
|
+
bodyColor: readCssColor(styles, 'body-color', fallbackDarkBg.bodyColor),
|
|
406
|
+
secondaryBg: readCssColor(styles, 'secondary-bg', fallbackDarkBg.secondaryBg),
|
|
407
|
+
tertiaryBg: readCssColor(styles, 'tertiary-bg', fallbackDarkBg.tertiaryBg),
|
|
408
|
+
borderColor: readCssColor(styles, 'border-color', fallbackDarkBg.borderColor),
|
|
409
|
+
emphasisColor: readCssColor(styles, 'emphasis-color', fallbackDarkBg.emphasisColor)
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// Restore original theme
|
|
413
|
+
if (currentTheme) {
|
|
414
|
+
document.documentElement.setAttribute('data-bs-theme', currentTheme)
|
|
415
|
+
} else {
|
|
416
|
+
document.documentElement.removeAttribute('data-bs-theme')
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
return cachedDarkBg
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// List of available Bootswatch themes (for CSS swap)
|
|
423
|
+
const bootswatchThemes = [
|
|
424
|
+
'brite', 'cerulean', 'cosmo', 'cyborg', 'darkly', 'flatly', 'journal',
|
|
425
|
+
'litera', 'lumen', 'lux', 'materia', 'minty', 'morph', 'pulse', 'quartz',
|
|
426
|
+
'sandstone', 'simplex', 'sketchy', 'slate', 'solar', 'spacelab',
|
|
427
|
+
'superhero', 'united', 'vapor', 'versa', 'yeti', 'zephyr'
|
|
428
|
+
]
|
|
429
|
+
|
|
430
|
+
// Bootswatch themes that are dark by default (use light mode to see standard appearance)
|
|
431
|
+
const darkByDefaultThemes = [
|
|
432
|
+
'cyborg', 'darkly', 'slate', 'solar', 'superhero', 'vapor', 'quartz'
|
|
433
|
+
]
|
|
434
|
+
|
|
435
|
+
// ________________________________________________________________________________
|
|
436
|
+
// HELPER FUNCTIONS
|
|
437
|
+
// ________________________________________________________________________________
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Convert hex color to RGB object
|
|
441
|
+
*/
|
|
442
|
+
function hexToRgb(hex) {
|
|
443
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
|
|
444
|
+
return result ? {
|
|
445
|
+
r: parseInt(result[1], 16),
|
|
446
|
+
g: parseInt(result[2], 16),
|
|
447
|
+
b: parseInt(result[3], 16)
|
|
448
|
+
} : null
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Darken a hex color by percentage
|
|
453
|
+
*/
|
|
454
|
+
function darken(hex, percent) {
|
|
455
|
+
const rgb = hexToRgb(hex)
|
|
456
|
+
if (!rgb) return hex
|
|
457
|
+
const factor = 1 - percent / 100
|
|
458
|
+
const r = Math.max(0, Math.round(rgb.r * factor))
|
|
459
|
+
const g = Math.max(0, Math.round(rgb.g * factor))
|
|
460
|
+
const b = Math.max(0, Math.round(rgb.b * factor))
|
|
461
|
+
return `#${[r, g, b].map(x => x.toString(16).padStart(2, '0')).join('')}`
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Lighten a hex color by percentage
|
|
466
|
+
*/
|
|
467
|
+
function lighten(hex, percent) {
|
|
468
|
+
const rgb = hexToRgb(hex)
|
|
469
|
+
if (!rgb) return hex
|
|
470
|
+
const factor = percent / 100
|
|
471
|
+
const r = Math.min(255, Math.round(rgb.r + (255 - rgb.r) * factor))
|
|
472
|
+
const g = Math.min(255, Math.round(rgb.g + (255 - rgb.g) * factor))
|
|
473
|
+
const b = Math.min(255, Math.round(rgb.b + (255 - rgb.b) * factor))
|
|
474
|
+
return `#${[r, g, b].map(x => x.toString(16).padStart(2, '0')).join('')}`
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Determine if color is light (for text contrast)
|
|
479
|
+
*/
|
|
480
|
+
function isLightColor(hex) {
|
|
481
|
+
const rgb = hexToRgb(hex)
|
|
482
|
+
if (!rgb) return false
|
|
483
|
+
const luminance = (0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b) / 255
|
|
484
|
+
return luminance > 0.5
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Auto-adjust semantic colors for dark mode
|
|
489
|
+
* Lightens colors for better visibility on dark backgrounds
|
|
490
|
+
*/
|
|
491
|
+
function adjustForDarkMode(hex) {
|
|
492
|
+
const rgb = hexToRgb(hex)
|
|
493
|
+
if (!rgb) return hex
|
|
494
|
+
// If already light, return as-is
|
|
495
|
+
if (isLightColor(hex)) return hex
|
|
496
|
+
// Lighten dark colors by 25% for dark mode visibility
|
|
497
|
+
return lighten(hex, 25)
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Generate dark mode semantic colors from light mode colors
|
|
502
|
+
* Note: 'light' and 'dark' semantic colors are kept as-is to maintain
|
|
503
|
+
* their purpose (light for light text/backgrounds, dark for dark text/backgrounds)
|
|
504
|
+
*/
|
|
505
|
+
function generateDarkModeColors(colors) {
|
|
506
|
+
const darkColors = {}
|
|
507
|
+
for (const [name, hex] of Object.entries(colors)) {
|
|
508
|
+
// 'light' and 'dark' semantic colors should remain as-is
|
|
509
|
+
// so that text-light remains light (readable on dark backgrounds)
|
|
510
|
+
// and text-dark remains dark (readable on light backgrounds)
|
|
511
|
+
if (name === 'light' || name === 'dark') {
|
|
512
|
+
darkColors[name] = hex
|
|
513
|
+
} else {
|
|
514
|
+
darkColors[name] = adjustForDarkMode(hex)
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
return darkColors
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Generate complete Bootstrap CSS overrides compatible with bootstrap-theme-vars.css
|
|
522
|
+
* Supports both light and dark themes via [data-bs-theme] attribute.
|
|
523
|
+
*/
|
|
524
|
+
function generateBootstrapCSS(colors, lightBg, darkBg) {
|
|
525
|
+
let css = `/**
|
|
526
|
+
* Bootstrap 5.3 Theme Variable Overrides
|
|
527
|
+
*
|
|
528
|
+
* This file forces Bootstrap components to use CSS custom properties (CSS variables)
|
|
529
|
+
* instead of hardcoded color values. This enables runtime theme changes by updating
|
|
530
|
+
* the --bs-* CSS variables on :root.
|
|
531
|
+
*
|
|
532
|
+
* Supports both light and dark themes via [data-bs-theme] attribute.
|
|
533
|
+
* Generated by: C0ckp1t Theme Editor
|
|
534
|
+
*/\n\n`
|
|
535
|
+
|
|
536
|
+
// Generate dark mode colors automatically
|
|
537
|
+
const darkColors = generateDarkModeColors(colors)
|
|
538
|
+
|
|
539
|
+
// ========== LIGHT THEME (Default) ==========
|
|
540
|
+
css += `/* ========== LIGHT THEME (Default) ========== */\n`
|
|
541
|
+
css += `:root,\n[data-bs-theme="light"] {\n`
|
|
542
|
+
|
|
543
|
+
// Semantic colors for light mode
|
|
544
|
+
css += ` /* Bootstrap semantic colors */\n`
|
|
545
|
+
for (const [name, hex] of Object.entries(colors)) {
|
|
546
|
+
const rgb = hexToRgb(hex)
|
|
547
|
+
if (rgb) {
|
|
548
|
+
css += ` --bs-${name}: ${hex};\n`
|
|
549
|
+
css += ` --bs-${name}-rgb: ${rgb.r}, ${rgb.g}, ${rgb.b};\n`
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// Body colors for light mode
|
|
554
|
+
css += `\n /* Body colors */\n`
|
|
555
|
+
css += ` --bs-body-bg: ${lightBg.bodyBg};\n`
|
|
556
|
+
const lightBodyBgRgb = hexToRgb(lightBg.bodyBg)
|
|
557
|
+
css += ` --bs-body-bg-rgb: ${lightBodyBgRgb ? `${lightBodyBgRgb.r}, ${lightBodyBgRgb.g}, ${lightBodyBgRgb.b}` : '255, 255, 255'};\n`
|
|
558
|
+
css += ` --bs-body-color: ${lightBg.bodyColor};\n`
|
|
559
|
+
const lightBodyColorRgb = hexToRgb(lightBg.bodyColor)
|
|
560
|
+
css += ` --bs-body-color-rgb: ${lightBodyColorRgb ? `${lightBodyColorRgb.r}, ${lightBodyColorRgb.g}, ${lightBodyColorRgb.b}` : '33, 37, 41'};\n`
|
|
561
|
+
|
|
562
|
+
// Semantic background colors for light mode
|
|
563
|
+
css += `\n /* Semantic background colors (for bg-body-secondary, bg-body-tertiary) */\n`
|
|
564
|
+
css += ` --bs-secondary-bg: ${lightBg.secondaryBg};\n`
|
|
565
|
+
const lightSecondaryBgRgb = hexToRgb(lightBg.secondaryBg)
|
|
566
|
+
css += ` --bs-secondary-bg-rgb: ${lightSecondaryBgRgb ? `${lightSecondaryBgRgb.r}, ${lightSecondaryBgRgb.g}, ${lightSecondaryBgRgb.b}` : '233, 236, 239'};\n`
|
|
567
|
+
css += ` --bs-tertiary-bg: ${lightBg.tertiaryBg};\n`
|
|
568
|
+
const lightTertiaryBgRgb = hexToRgb(lightBg.tertiaryBg)
|
|
569
|
+
css += ` --bs-tertiary-bg-rgb: ${lightTertiaryBgRgb ? `${lightTertiaryBgRgb.r}, ${lightTertiaryBgRgb.g}, ${lightTertiaryBgRgb.b}` : '248, 249, 250'};\n`
|
|
570
|
+
|
|
571
|
+
// Border colors for light mode
|
|
572
|
+
css += `\n /* Border colors */\n`
|
|
573
|
+
css += ` --bs-border-color: ${lightBg.borderColor};\n`
|
|
574
|
+
const lightBorderRgb = hexToRgb(lightBg.borderColor)
|
|
575
|
+
css += ` --bs-border-color-translucent: rgba(${lightBorderRgb ? `${lightBorderRgb.r}, ${lightBorderRgb.g}, ${lightBorderRgb.b}` : '0, 0, 0'}, 0.175);\n`
|
|
576
|
+
|
|
577
|
+
// Emphasis colors for light mode
|
|
578
|
+
css += `\n /* Emphasis colors */\n`
|
|
579
|
+
css += ` --bs-emphasis-color: ${lightBg.emphasisColor};\n`
|
|
580
|
+
const lightEmphasisRgb = hexToRgb(lightBg.emphasisColor)
|
|
581
|
+
css += ` --bs-emphasis-color-rgb: ${lightEmphasisRgb ? `${lightEmphasisRgb.r}, ${lightEmphasisRgb.g}, ${lightEmphasisRgb.b}` : '0, 0, 0'};\n`
|
|
582
|
+
css += `}\n\n`
|
|
583
|
+
|
|
584
|
+
// ========== DARK THEME ==========
|
|
585
|
+
css += `/* ========== DARK THEME ========== */\n`
|
|
586
|
+
css += `[data-bs-theme="dark"] {\n`
|
|
587
|
+
|
|
588
|
+
// Semantic colors for dark mode (auto-adjusted)
|
|
589
|
+
css += ` /* Bootstrap semantic colors - adjusted for dark theme */\n`
|
|
590
|
+
for (const [name, hex] of Object.entries(darkColors)) {
|
|
591
|
+
const rgb = hexToRgb(hex)
|
|
592
|
+
if (rgb) {
|
|
593
|
+
css += ` --bs-${name}: ${hex};\n`
|
|
594
|
+
css += ` --bs-${name}-rgb: ${rgb.r}, ${rgb.g}, ${rgb.b};\n`
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// Body colors for dark mode
|
|
599
|
+
css += `\n /* Body colors */\n`
|
|
600
|
+
css += ` --bs-body-bg: ${darkBg.bodyBg};\n`
|
|
601
|
+
const darkBodyBgRgb = hexToRgb(darkBg.bodyBg)
|
|
602
|
+
css += ` --bs-body-bg-rgb: ${darkBodyBgRgb ? `${darkBodyBgRgb.r}, ${darkBodyBgRgb.g}, ${darkBodyBgRgb.b}` : '30, 30, 30'};\n`
|
|
603
|
+
css += ` --bs-body-color: ${darkBg.bodyColor};\n`
|
|
604
|
+
const darkBodyColorRgb = hexToRgb(darkBg.bodyColor)
|
|
605
|
+
css += ` --bs-body-color-rgb: ${darkBodyColorRgb ? `${darkBodyColorRgb.r}, ${darkBodyColorRgb.g}, ${darkBodyColorRgb.b}` : '212, 212, 212'};\n`
|
|
606
|
+
|
|
607
|
+
// Semantic background colors for dark mode
|
|
608
|
+
css += `\n /* Semantic background colors */\n`
|
|
609
|
+
css += ` --bs-secondary-bg: ${darkBg.secondaryBg};\n`
|
|
610
|
+
const darkSecondaryBgRgb = hexToRgb(darkBg.secondaryBg)
|
|
611
|
+
css += ` --bs-secondary-bg-rgb: ${darkSecondaryBgRgb ? `${darkSecondaryBgRgb.r}, ${darkSecondaryBgRgb.g}, ${darkSecondaryBgRgb.b}` : '45, 45, 45'};\n`
|
|
612
|
+
css += ` --bs-tertiary-bg: ${darkBg.tertiaryBg};\n`
|
|
613
|
+
const darkTertiaryBgRgb = hexToRgb(darkBg.tertiaryBg)
|
|
614
|
+
css += ` --bs-tertiary-bg-rgb: ${darkTertiaryBgRgb ? `${darkTertiaryBgRgb.r}, ${darkTertiaryBgRgb.g}, ${darkTertiaryBgRgb.b}` : '58, 58, 58'};\n`
|
|
615
|
+
|
|
616
|
+
// Border colors for dark mode
|
|
617
|
+
css += `\n /* Border colors */\n`
|
|
618
|
+
css += ` --bs-border-color: ${darkBg.borderColor};\n`
|
|
619
|
+
const darkBorderRgb = hexToRgb(darkBg.borderColor)
|
|
620
|
+
css += ` --bs-border-color-translucent: rgba(${darkBorderRgb ? `${darkBorderRgb.r}, ${darkBorderRgb.g}, ${darkBorderRgb.b}` : '255, 255, 255'}, 0.15);\n`
|
|
621
|
+
|
|
622
|
+
// Emphasis colors for dark mode
|
|
623
|
+
css += `\n /* Emphasis colors */\n`
|
|
624
|
+
css += ` --bs-emphasis-color: ${darkBg.emphasisColor};\n`
|
|
625
|
+
const darkEmphasisRgb = hexToRgb(darkBg.emphasisColor)
|
|
626
|
+
css += ` --bs-emphasis-color-rgb: ${darkEmphasisRgb ? `${darkEmphasisRgb.r}, ${darkEmphasisRgb.g}, ${darkEmphasisRgb.b}` : '255, 255, 255'};\n`
|
|
627
|
+
css += `}\n\n`
|
|
628
|
+
|
|
629
|
+
// ========== SEMANTIC BACKGROUND UTILITIES ==========
|
|
630
|
+
css += `/* ========== SEMANTIC BACKGROUND UTILITIES ========== */\n`
|
|
631
|
+
css += `.bg-body {\n background-color: var(--bs-body-bg) !important;\n}\n\n`
|
|
632
|
+
css += `.bg-body-secondary {\n background-color: var(--bs-secondary-bg) !important;\n}\n\n`
|
|
633
|
+
css += `.bg-body-tertiary {\n background-color: var(--bs-tertiary-bg) !important;\n}\n\n`
|
|
634
|
+
|
|
635
|
+
// ========== BUTTONS - SOLID ==========
|
|
636
|
+
css += `/* ========== BUTTONS - SOLID ========== */\n`
|
|
637
|
+
for (const name of Object.keys(colors)) {
|
|
638
|
+
css += `.btn-${name} {\n`
|
|
639
|
+
css += ` --bs-btn-bg: var(--bs-${name});\n`
|
|
640
|
+
css += ` --bs-btn-border-color: var(--bs-${name});\n`
|
|
641
|
+
css += `}\n\n`
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// ========== BUTTONS - OUTLINE ==========
|
|
645
|
+
css += `/* ========== BUTTONS - OUTLINE ========== */\n`
|
|
646
|
+
for (const name of Object.keys(colors)) {
|
|
647
|
+
css += `.btn-outline-${name} {\n`
|
|
648
|
+
css += ` --bs-btn-color: var(--bs-${name});\n`
|
|
649
|
+
css += ` --bs-btn-border-color: var(--bs-${name});\n`
|
|
650
|
+
css += ` --bs-btn-hover-bg: var(--bs-${name});\n`
|
|
651
|
+
css += ` --bs-btn-hover-border-color: var(--bs-${name});\n`
|
|
652
|
+
css += ` --bs-btn-active-bg: var(--bs-${name});\n`
|
|
653
|
+
css += ` --bs-btn-active-border-color: var(--bs-${name});\n`
|
|
654
|
+
css += `}\n\n`
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// ========== BACKGROUNDS ==========
|
|
658
|
+
css += `/* ========== BACKGROUNDS ========== */\n`
|
|
659
|
+
for (const name of Object.keys(colors)) {
|
|
660
|
+
css += `.bg-${name} {\n background-color: var(--bs-${name}) !important;\n}\n\n`
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// ========== TEXT COLORS ==========
|
|
664
|
+
css += `/* ========== TEXT COLORS ========== */\n`
|
|
665
|
+
for (const name of Object.keys(colors)) {
|
|
666
|
+
css += `.text-${name} {\n color: var(--bs-${name}) !important;\n}\n\n`
|
|
667
|
+
}
|
|
668
|
+
css += `.text-body {\n color: var(--bs-body-color) !important;\n}\n\n`
|
|
669
|
+
css += `.text-body-secondary {\n color: var(--bs-secondary-color, rgba(var(--bs-body-color-rgb), 0.75)) !important;\n}\n\n`
|
|
670
|
+
css += `.text-body-tertiary {\n color: var(--bs-tertiary-color, rgba(var(--bs-body-color-rgb), 0.5)) !important;\n}\n\n`
|
|
671
|
+
|
|
672
|
+
// ========== BORDERS ==========
|
|
673
|
+
css += `/* ========== BORDERS ========== */\n`
|
|
674
|
+
css += `.border {\n border-color: var(--bs-border-color) !important;\n}\n\n`
|
|
675
|
+
for (const name of Object.keys(colors)) {
|
|
676
|
+
css += `.border-${name} {\n border-color: var(--bs-${name}) !important;\n}\n\n`
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// ========== ALERTS ==========
|
|
680
|
+
css += `/* ========== ALERTS ========== */\n`
|
|
681
|
+
for (const name of Object.keys(colors)) {
|
|
682
|
+
css += `.alert-${name} {\n`
|
|
683
|
+
css += ` --bs-alert-bg: rgba(var(--bs-${name}-rgb), 0.1);\n`
|
|
684
|
+
css += ` --bs-alert-border-color: rgba(var(--bs-${name}-rgb), 0.25);\n`
|
|
685
|
+
css += ` --bs-alert-color: var(--bs-${name});\n`
|
|
686
|
+
css += `}\n\n`
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// ========== BADGES ==========
|
|
690
|
+
css += `/* ========== BADGES ========== */\n`
|
|
691
|
+
for (const name of Object.keys(colors)) {
|
|
692
|
+
css += `.badge.bg-${name} {\n background-color: var(--bs-${name}) !important;\n}\n\n`
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// ========== NAVIGATION ==========
|
|
696
|
+
css += `/* ========== NAVIGATION ========== */\n`
|
|
697
|
+
css += `.nav-pills .nav-link.active {\n background-color: var(--bs-primary);\n}\n\n`
|
|
698
|
+
css += `.navbar-dark {\n`
|
|
699
|
+
css += ` --bs-navbar-brand-color: rgba(255, 255, 255, 1);\n`
|
|
700
|
+
css += ` --bs-navbar-brand-hover-color: rgba(255, 255, 255, 1);\n`
|
|
701
|
+
css += `}\n\n`
|
|
702
|
+
|
|
703
|
+
// ========== PROGRESS BARS ==========
|
|
704
|
+
css += `/* ========== PROGRESS BARS ========== */\n`
|
|
705
|
+
css += `.progress-bar {\n background-color: var(--bs-primary);\n}\n\n`
|
|
706
|
+
for (const name of ['success', 'info', 'warning', 'danger']) {
|
|
707
|
+
css += `.progress-bar.bg-${name} {\n background-color: var(--bs-${name}) !important;\n}\n\n`
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
// ========== FORMS ==========
|
|
711
|
+
css += `/* ========== FORMS ========== */\n`
|
|
712
|
+
css += `.form-control:focus,\n.form-select:focus {\n`
|
|
713
|
+
css += ` border-color: var(--bs-primary);\n`
|
|
714
|
+
css += ` box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);\n`
|
|
715
|
+
css += `}\n\n`
|
|
716
|
+
css += `.form-check-input:checked {\n`
|
|
717
|
+
css += ` background-color: var(--bs-primary);\n`
|
|
718
|
+
css += ` border-color: var(--bs-primary);\n`
|
|
719
|
+
css += `}\n\n`
|
|
720
|
+
css += `.form-switch .form-check-input:checked {\n`
|
|
721
|
+
css += ` background-color: var(--bs-primary);\n`
|
|
722
|
+
css += ` border-color: var(--bs-primary);\n`
|
|
723
|
+
css += `}\n\n`
|
|
724
|
+
|
|
725
|
+
// ========== LINKS ==========
|
|
726
|
+
css += `/* ========== LINKS ========== */\n`
|
|
727
|
+
css += `a {\n color: var(--bs-primary);\n}\n\n`
|
|
728
|
+
css += `a:hover {\n color: var(--bs-primary);\n opacity: 0.85;\n}\n\n`
|
|
729
|
+
|
|
730
|
+
// ========== LIST GROUP ==========
|
|
731
|
+
css += `/* ========== LIST GROUP ========== */\n`
|
|
732
|
+
css += `.list-group-item.active {\n`
|
|
733
|
+
css += ` background-color: var(--bs-primary);\n`
|
|
734
|
+
css += ` border-color: var(--bs-primary);\n`
|
|
735
|
+
css += `}\n\n`
|
|
736
|
+
|
|
737
|
+
// ========== PAGINATION ==========
|
|
738
|
+
css += `/* ========== PAGINATION ========== */\n`
|
|
739
|
+
css += `.page-link {\n color: var(--bs-primary);\n}\n\n`
|
|
740
|
+
css += `.page-link:hover {\n color: var(--bs-primary);\n}\n\n`
|
|
741
|
+
css += `.page-item.active .page-link {\n`
|
|
742
|
+
css += ` background-color: var(--bs-primary);\n`
|
|
743
|
+
css += ` border-color: var(--bs-primary);\n`
|
|
744
|
+
css += `}\n\n`
|
|
745
|
+
|
|
746
|
+
// ========== SPINNERS ==========
|
|
747
|
+
css += `/* ========== SPINNERS ========== */\n`
|
|
748
|
+
for (const name of Object.keys(colors)) {
|
|
749
|
+
css += `.spinner-border.text-${name},\n.spinner-grow.text-${name} {\n`
|
|
750
|
+
css += ` color: var(--bs-${name}) !important;\n`
|
|
751
|
+
css += `}\n\n`
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// ========== ACCORDION ==========
|
|
755
|
+
css += `/* ========== ACCORDION ========== */\n`
|
|
756
|
+
css += `.accordion-button:not(.collapsed) {\n`
|
|
757
|
+
css += ` background-color: rgba(var(--bs-primary-rgb), 0.1);\n`
|
|
758
|
+
css += ` color: var(--bs-primary);\n`
|
|
759
|
+
css += `}\n\n`
|
|
760
|
+
css += `.accordion-button:focus {\n`
|
|
761
|
+
css += ` border-color: var(--bs-primary);\n`
|
|
762
|
+
css += ` box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);\n`
|
|
763
|
+
css += `}\n\n`
|
|
764
|
+
|
|
765
|
+
// ========== BREADCRUMB ==========
|
|
766
|
+
css += `/* ========== BREADCRUMB ========== */\n`
|
|
767
|
+
css += `.breadcrumb-item.active {\n color: var(--bs-primary);\n}\n\n`
|
|
768
|
+
|
|
769
|
+
// ========== CARDS ==========
|
|
770
|
+
css += `/* ========== CARDS ========== */\n`
|
|
771
|
+
css += `.card {\n`
|
|
772
|
+
css += ` --bs-card-bg: var(--bs-body-bg);\n`
|
|
773
|
+
css += ` --bs-card-border-color: var(--bs-border-color);\n`
|
|
774
|
+
css += `}\n\n`
|
|
775
|
+
|
|
776
|
+
// ========== TABLES ==========
|
|
777
|
+
css += `/* ========== TABLES ========== */\n`
|
|
778
|
+
css += `.table {\n`
|
|
779
|
+
css += ` --bs-table-bg: transparent;\n`
|
|
780
|
+
css += ` --bs-table-color: var(--bs-body-color);\n`
|
|
781
|
+
css += ` --bs-table-border-color: var(--bs-border-color);\n`
|
|
782
|
+
css += `}\n\n`
|
|
783
|
+
|
|
784
|
+
// ========== MODALS ==========
|
|
785
|
+
css += `/* ========== MODALS ========== */\n`
|
|
786
|
+
css += `.modal-content {\n`
|
|
787
|
+
css += ` --bs-modal-bg: var(--bs-body-bg);\n`
|
|
788
|
+
css += ` --bs-modal-border-color: var(--bs-border-color);\n`
|
|
789
|
+
css += `}\n\n`
|
|
790
|
+
|
|
791
|
+
// ========== DROPDOWNS ==========
|
|
792
|
+
css += `/* ========== DROPDOWNS ========== */\n`
|
|
793
|
+
css += `.dropdown-menu {\n`
|
|
794
|
+
css += ` --bs-dropdown-bg: var(--bs-body-bg);\n`
|
|
795
|
+
css += ` --bs-dropdown-border-color: var(--bs-border-color);\n`
|
|
796
|
+
css += ` --bs-dropdown-link-color: var(--bs-body-color);\n`
|
|
797
|
+
css += `}\n`
|
|
798
|
+
|
|
799
|
+
return css
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Apply theme to DOM by injecting CSS
|
|
804
|
+
* @param {Object} colors - Semantic colors object
|
|
805
|
+
* @param {Object} lightBg - Light mode background colors
|
|
806
|
+
* @param {Object} darkBg - Dark mode background colors
|
|
807
|
+
* @returns {string} - Generated CSS string
|
|
808
|
+
*/
|
|
809
|
+
function applyThemeToDOM(colors, lightBg, darkBg) {
|
|
810
|
+
const css = generateBootstrapCSS(colors, lightBg, darkBg)
|
|
811
|
+
|
|
812
|
+
// Inject/update dynamic style element
|
|
813
|
+
let styleEl = document.getElementById(THEME_STYLE_ID)
|
|
814
|
+
if (!styleEl) {
|
|
815
|
+
styleEl = document.createElement('style')
|
|
816
|
+
styleEl.id = THEME_STYLE_ID
|
|
817
|
+
document.head.appendChild(styleEl)
|
|
818
|
+
}
|
|
819
|
+
styleEl.textContent = css
|
|
820
|
+
|
|
821
|
+
return css
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Load a Bootswatch theme via CSS swap (complete Bootstrap CSS replacement)
|
|
826
|
+
* This gives 100% accurate Bootswatch rendering
|
|
827
|
+
* @param {string} themeName - Name of the Bootswatch theme
|
|
828
|
+
* @param {Function} setThemeMode - Callback to set theme mode (light/dark)
|
|
829
|
+
*/
|
|
830
|
+
function loadBootswatchTheme(themeName, setThemeMode) {
|
|
831
|
+
// Remove dynamic theme style element (CSS variable overrides)
|
|
832
|
+
const dynamicStyle = document.getElementById(THEME_STYLE_ID)
|
|
833
|
+
if (dynamicStyle) {
|
|
834
|
+
dynamicStyle.remove()
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
// Disable bootstrap-theme-vars.css (it uses !important)
|
|
838
|
+
const themeVarsLink = document.getElementById(THEME_VARS_LINK_ID)
|
|
839
|
+
if (themeVarsLink) {
|
|
840
|
+
themeVarsLink.disabled = true
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// Disable the original Bootstrap CSS - Bootswatch CSS is a complete replacement
|
|
844
|
+
const bootstrapMainLink = document.getElementById(BOOTSTRAP_MAIN_ID)
|
|
845
|
+
if (bootstrapMainLink) {
|
|
846
|
+
bootstrapMainLink.disabled = true
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
// Find or create the Bootswatch link element
|
|
850
|
+
let bootswatchLink = document.getElementById(BOOTSWATCH_LINK_ID)
|
|
851
|
+
if (!bootswatchLink) {
|
|
852
|
+
bootswatchLink = document.createElement('link')
|
|
853
|
+
bootswatchLink.id = BOOTSWATCH_LINK_ID
|
|
854
|
+
bootswatchLink.rel = 'stylesheet'
|
|
855
|
+
// Insert after the main bootstrap.min.css (even though it's disabled)
|
|
856
|
+
if (bootstrapMainLink) {
|
|
857
|
+
bootstrapMainLink.parentNode.insertBefore(bootswatchLink, bootstrapMainLink.nextSibling)
|
|
858
|
+
} else {
|
|
859
|
+
document.head.appendChild(bootswatchLink)
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
// Set the href to load the Bootswatch CSS
|
|
864
|
+
bootswatchLink.href = `/css/bootwatch/${themeName}/bootstrap.min.css`
|
|
865
|
+
bootswatchLink.disabled = false
|
|
866
|
+
|
|
867
|
+
// Set to light mode by default for consistent viewing
|
|
868
|
+
if (setThemeMode) {
|
|
869
|
+
setThemeMode('light')
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Restore custom editor mode (CSS variable overrides)
|
|
875
|
+
* Reverses the CSS swap and re-enables the theme editor
|
|
876
|
+
* @param {Object} colors - Semantic colors object
|
|
877
|
+
* @param {Object} lightBg - Light mode background colors
|
|
878
|
+
* @param {Object} darkBg - Dark mode background colors
|
|
879
|
+
* @returns {string} - Generated CSS string
|
|
880
|
+
*/
|
|
881
|
+
function restoreCustomEditor(colors, lightBg, darkBg) {
|
|
882
|
+
// Remove/disable Bootswatch CSS link
|
|
883
|
+
const bootswatchLink = document.getElementById(BOOTSWATCH_LINK_ID)
|
|
884
|
+
if (bootswatchLink) {
|
|
885
|
+
bootswatchLink.disabled = true
|
|
886
|
+
bootswatchLink.href = ''
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
// Re-enable the original Bootstrap CSS
|
|
890
|
+
const bootstrapMainLink = document.getElementById(BOOTSTRAP_MAIN_ID)
|
|
891
|
+
if (bootstrapMainLink) {
|
|
892
|
+
bootstrapMainLink.disabled = false
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// Re-enable bootstrap-theme-vars.css
|
|
896
|
+
const themeVarsLink = document.getElementById(THEME_VARS_LINK_ID)
|
|
897
|
+
if (themeVarsLink) {
|
|
898
|
+
themeVarsLink.disabled = false
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
// Re-apply dynamic theme
|
|
902
|
+
return applyThemeToDOM(colors, lightBg, darkBg)
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
// Bootswatch color presets extracted from _variables.scss files
|
|
906
|
+
// These work with the CSS variable override system
|
|
907
|
+
const bootswatchPresets = {
|
|
908
|
+
brite: {
|
|
909
|
+
colors: {
|
|
910
|
+
primary: '#a2e436',
|
|
911
|
+
secondary: '#ffffff',
|
|
912
|
+
success: '#68d391',
|
|
913
|
+
danger: '#f56565',
|
|
914
|
+
warning: '#ffc700',
|
|
915
|
+
info: '#22d2ed',
|
|
916
|
+
light: '#e9ecef',
|
|
917
|
+
dark: '#000000'
|
|
918
|
+
},
|
|
919
|
+
lightBg: {
|
|
920
|
+
bodyBg: '#ffffff',
|
|
921
|
+
bodyColor: '#212529',
|
|
922
|
+
secondaryBg: '#e9ecef',
|
|
923
|
+
tertiaryBg: '#f8f9fa',
|
|
924
|
+
borderColor: '#000000',
|
|
925
|
+
emphasisColor: '#000000'
|
|
926
|
+
},
|
|
927
|
+
darkBg: {...defaultDarkBg}
|
|
928
|
+
},
|
|
929
|
+
cerulean: {
|
|
930
|
+
colors: {
|
|
931
|
+
primary: '#2fa4e7',
|
|
932
|
+
secondary: '#e9ecef',
|
|
933
|
+
success: '#73a839',
|
|
934
|
+
danger: '#c71c22',
|
|
935
|
+
warning: '#dd5600',
|
|
936
|
+
info: '#033c73',
|
|
937
|
+
light: '#f8f9fa',
|
|
938
|
+
dark: '#343a40'
|
|
939
|
+
},
|
|
940
|
+
lightBg: {
|
|
941
|
+
bodyBg: '#ffffff',
|
|
942
|
+
bodyColor: '#495057',
|
|
943
|
+
secondaryBg: '#e9ecef',
|
|
944
|
+
tertiaryBg: '#f8f9fa',
|
|
945
|
+
borderColor: '#dee2e6',
|
|
946
|
+
emphasisColor: '#000000'
|
|
947
|
+
},
|
|
948
|
+
darkBg: {...defaultDarkBg}
|
|
949
|
+
},
|
|
950
|
+
cosmo: {
|
|
951
|
+
colors: {
|
|
952
|
+
primary: '#2780e3',
|
|
953
|
+
secondary: '#373a3c',
|
|
954
|
+
success: '#3fb618',
|
|
955
|
+
danger: '#ff0039',
|
|
956
|
+
warning: '#ff7518',
|
|
957
|
+
info: '#9954bb',
|
|
958
|
+
light: '#f8f9fa',
|
|
959
|
+
dark: '#373a3c'
|
|
960
|
+
},
|
|
961
|
+
lightBg: {
|
|
962
|
+
bodyBg: '#ffffff',
|
|
963
|
+
bodyColor: '#373a3c',
|
|
964
|
+
secondaryBg: '#e9ecef',
|
|
965
|
+
tertiaryBg: '#f8f9fa',
|
|
966
|
+
borderColor: '#dee2e6',
|
|
967
|
+
emphasisColor: '#000000'
|
|
968
|
+
},
|
|
969
|
+
darkBg: {...defaultDarkBg}
|
|
970
|
+
},
|
|
971
|
+
cyborg: {
|
|
972
|
+
colors: {
|
|
973
|
+
primary: '#2a9fd6',
|
|
974
|
+
secondary: '#555555',
|
|
975
|
+
success: '#77b300',
|
|
976
|
+
danger: '#cc0000',
|
|
977
|
+
warning: '#ff8800',
|
|
978
|
+
info: '#9933cc',
|
|
979
|
+
light: '#222222',
|
|
980
|
+
dark: '#adafae'
|
|
981
|
+
},
|
|
982
|
+
lightBg: {
|
|
983
|
+
bodyBg: '#060606',
|
|
984
|
+
bodyColor: '#adafae',
|
|
985
|
+
secondaryBg: '#222222',
|
|
986
|
+
tertiaryBg: '#282828',
|
|
987
|
+
borderColor: '#282828',
|
|
988
|
+
emphasisColor: '#ffffff'
|
|
989
|
+
},
|
|
990
|
+
darkBg: {
|
|
991
|
+
bodyBg: '#060606',
|
|
992
|
+
bodyColor: '#adafae',
|
|
993
|
+
secondaryBg: '#222222',
|
|
994
|
+
tertiaryBg: '#282828',
|
|
995
|
+
borderColor: '#282828',
|
|
996
|
+
emphasisColor: '#ffffff'
|
|
997
|
+
}
|
|
998
|
+
},
|
|
999
|
+
darkly: {
|
|
1000
|
+
colors: {
|
|
1001
|
+
primary: '#375a7f',
|
|
1002
|
+
secondary: '#444444',
|
|
1003
|
+
success: '#00bc8c',
|
|
1004
|
+
danger: '#e74c3c',
|
|
1005
|
+
warning: '#f39c12',
|
|
1006
|
+
info: '#3498db',
|
|
1007
|
+
light: '#adb5bd',
|
|
1008
|
+
dark: '#303030'
|
|
1009
|
+
},
|
|
1010
|
+
lightBg: {
|
|
1011
|
+
bodyBg: '#222222',
|
|
1012
|
+
bodyColor: '#ffffff',
|
|
1013
|
+
secondaryBg: '#303030',
|
|
1014
|
+
tertiaryBg: '#444444',
|
|
1015
|
+
borderColor: '#444444',
|
|
1016
|
+
emphasisColor: '#ffffff'
|
|
1017
|
+
},
|
|
1018
|
+
darkBg: {
|
|
1019
|
+
bodyBg: '#222222',
|
|
1020
|
+
bodyColor: '#ffffff',
|
|
1021
|
+
secondaryBg: '#303030',
|
|
1022
|
+
tertiaryBg: '#444444',
|
|
1023
|
+
borderColor: '#444444',
|
|
1024
|
+
emphasisColor: '#ffffff'
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
flatly: {
|
|
1028
|
+
colors: {
|
|
1029
|
+
primary: '#2c3e50',
|
|
1030
|
+
secondary: '#95a5a6',
|
|
1031
|
+
success: '#18bc9c',
|
|
1032
|
+
danger: '#e74c3c',
|
|
1033
|
+
warning: '#f39c12',
|
|
1034
|
+
info: '#3498db',
|
|
1035
|
+
light: '#ecf0f1',
|
|
1036
|
+
dark: '#7b8a8b'
|
|
1037
|
+
},
|
|
1038
|
+
lightBg: {
|
|
1039
|
+
bodyBg: '#ffffff',
|
|
1040
|
+
bodyColor: '#212529',
|
|
1041
|
+
secondaryBg: '#ecf0f1',
|
|
1042
|
+
tertiaryBg: '#f8f9fa',
|
|
1043
|
+
borderColor: '#dee2e6',
|
|
1044
|
+
emphasisColor: '#000000'
|
|
1045
|
+
},
|
|
1046
|
+
darkBg: {...defaultDarkBg}
|
|
1047
|
+
},
|
|
1048
|
+
journal: {
|
|
1049
|
+
colors: {
|
|
1050
|
+
primary: '#eb6864',
|
|
1051
|
+
secondary: '#aaaaaa',
|
|
1052
|
+
success: '#22b24c',
|
|
1053
|
+
danger: '#f57a00',
|
|
1054
|
+
warning: '#f5e625',
|
|
1055
|
+
info: '#336699',
|
|
1056
|
+
light: '#f8f9fa',
|
|
1057
|
+
dark: '#222222'
|
|
1058
|
+
},
|
|
1059
|
+
lightBg: {
|
|
1060
|
+
bodyBg: '#ffffff',
|
|
1061
|
+
bodyColor: '#212529',
|
|
1062
|
+
secondaryBg: '#eeeeee',
|
|
1063
|
+
tertiaryBg: '#f8f9fa',
|
|
1064
|
+
borderColor: '#dee2e6',
|
|
1065
|
+
emphasisColor: '#000000'
|
|
1066
|
+
},
|
|
1067
|
+
darkBg: {...defaultDarkBg}
|
|
1068
|
+
},
|
|
1069
|
+
litera: {
|
|
1070
|
+
colors: {
|
|
1071
|
+
primary: '#4582ec',
|
|
1072
|
+
secondary: '#adb5bd',
|
|
1073
|
+
success: '#02b875',
|
|
1074
|
+
danger: '#d9534f',
|
|
1075
|
+
warning: '#f0ad4e',
|
|
1076
|
+
info: '#17a2b8',
|
|
1077
|
+
light: '#f8f9fa',
|
|
1078
|
+
dark: '#343a40'
|
|
1079
|
+
},
|
|
1080
|
+
lightBg: {
|
|
1081
|
+
bodyBg: '#ffffff',
|
|
1082
|
+
bodyColor: '#343a40',
|
|
1083
|
+
secondaryBg: '#e9ecef',
|
|
1084
|
+
tertiaryBg: '#f8f9fa',
|
|
1085
|
+
borderColor: '#dddddd',
|
|
1086
|
+
emphasisColor: '#000000'
|
|
1087
|
+
},
|
|
1088
|
+
darkBg: {...defaultDarkBg}
|
|
1089
|
+
},
|
|
1090
|
+
lumen: {
|
|
1091
|
+
colors: {
|
|
1092
|
+
primary: '#158cba',
|
|
1093
|
+
secondary: '#f0f0f0',
|
|
1094
|
+
success: '#28b62c',
|
|
1095
|
+
danger: '#ff4136',
|
|
1096
|
+
warning: '#ff851b',
|
|
1097
|
+
info: '#75caeb',
|
|
1098
|
+
light: '#f6f6f6',
|
|
1099
|
+
dark: '#555555'
|
|
1100
|
+
},
|
|
1101
|
+
lightBg: {
|
|
1102
|
+
bodyBg: '#ffffff',
|
|
1103
|
+
bodyColor: '#212529',
|
|
1104
|
+
secondaryBg: '#f0f0f0',
|
|
1105
|
+
tertiaryBg: '#f6f6f6',
|
|
1106
|
+
borderColor: '#dee2e6',
|
|
1107
|
+
emphasisColor: '#000000'
|
|
1108
|
+
},
|
|
1109
|
+
darkBg: {...defaultDarkBg}
|
|
1110
|
+
},
|
|
1111
|
+
lux: {
|
|
1112
|
+
colors: {
|
|
1113
|
+
primary: '#1a1a1a',
|
|
1114
|
+
secondary: '#ffffff',
|
|
1115
|
+
success: '#4bbf73',
|
|
1116
|
+
danger: '#d9534f',
|
|
1117
|
+
warning: '#f0ad4e',
|
|
1118
|
+
info: '#1f9bcf',
|
|
1119
|
+
light: '#f0f1f2',
|
|
1120
|
+
dark: '#343a40'
|
|
1121
|
+
},
|
|
1122
|
+
lightBg: {
|
|
1123
|
+
bodyBg: '#ffffff',
|
|
1124
|
+
bodyColor: '#55595c',
|
|
1125
|
+
secondaryBg: '#f0f1f2',
|
|
1126
|
+
tertiaryBg: '#f8f9fa',
|
|
1127
|
+
borderColor: '#e0e1e2',
|
|
1128
|
+
emphasisColor: '#000000'
|
|
1129
|
+
},
|
|
1130
|
+
darkBg: {...defaultDarkBg}
|
|
1131
|
+
},
|
|
1132
|
+
materia: {
|
|
1133
|
+
colors: {
|
|
1134
|
+
primary: '#2196f3',
|
|
1135
|
+
secondary: '#ffffff',
|
|
1136
|
+
success: '#4caf50',
|
|
1137
|
+
danger: '#e51c23',
|
|
1138
|
+
warning: '#ff9800',
|
|
1139
|
+
info: '#9c27b0',
|
|
1140
|
+
light: '#f8f9fa',
|
|
1141
|
+
dark: '#222222'
|
|
1142
|
+
},
|
|
1143
|
+
lightBg: {
|
|
1144
|
+
bodyBg: '#ffffff',
|
|
1145
|
+
bodyColor: '#444444',
|
|
1146
|
+
secondaryBg: '#eeeeee',
|
|
1147
|
+
tertiaryBg: '#f8f9fa',
|
|
1148
|
+
borderColor: '#dee2e6',
|
|
1149
|
+
emphasisColor: '#000000'
|
|
1150
|
+
},
|
|
1151
|
+
darkBg: {...defaultDarkBg}
|
|
1152
|
+
},
|
|
1153
|
+
minty: {
|
|
1154
|
+
colors: {
|
|
1155
|
+
primary: '#78c2ad',
|
|
1156
|
+
secondary: '#f3969a',
|
|
1157
|
+
success: '#56cc9d',
|
|
1158
|
+
danger: '#ff7851',
|
|
1159
|
+
warning: '#ffce67',
|
|
1160
|
+
info: '#6cc3d5',
|
|
1161
|
+
light: '#f8f9fa',
|
|
1162
|
+
dark: '#343a40'
|
|
1163
|
+
},
|
|
1164
|
+
lightBg: {
|
|
1165
|
+
bodyBg: '#ffffff',
|
|
1166
|
+
bodyColor: '#888888',
|
|
1167
|
+
secondaryBg: '#f7f7f9',
|
|
1168
|
+
tertiaryBg: '#f8f9fa',
|
|
1169
|
+
borderColor: '#eceeef',
|
|
1170
|
+
emphasisColor: '#000000'
|
|
1171
|
+
},
|
|
1172
|
+
darkBg: {...defaultDarkBg}
|
|
1173
|
+
},
|
|
1174
|
+
morph: {
|
|
1175
|
+
colors: {
|
|
1176
|
+
primary: '#378dfc',
|
|
1177
|
+
secondary: '#d9e3f1',
|
|
1178
|
+
success: '#43cc29',
|
|
1179
|
+
danger: '#e52527',
|
|
1180
|
+
warning: '#ffc107',
|
|
1181
|
+
info: '#5b62f4',
|
|
1182
|
+
light: '#f0f5fa',
|
|
1183
|
+
dark: '#212529'
|
|
1184
|
+
},
|
|
1185
|
+
lightBg: {
|
|
1186
|
+
bodyBg: '#d9e3f1',
|
|
1187
|
+
bodyColor: '#7b8ab8',
|
|
1188
|
+
secondaryBg: '#e9ecef',
|
|
1189
|
+
tertiaryBg: '#f0f5fa',
|
|
1190
|
+
borderColor: '#bed1e6',
|
|
1191
|
+
emphasisColor: '#000000'
|
|
1192
|
+
},
|
|
1193
|
+
darkBg: {...defaultDarkBg}
|
|
1194
|
+
},
|
|
1195
|
+
pulse: {
|
|
1196
|
+
colors: {
|
|
1197
|
+
primary: '#593196',
|
|
1198
|
+
secondary: '#a991d4',
|
|
1199
|
+
success: '#13b955',
|
|
1200
|
+
danger: '#fc3939',
|
|
1201
|
+
warning: '#efa31d',
|
|
1202
|
+
info: '#009cdc',
|
|
1203
|
+
light: '#f9f8fc',
|
|
1204
|
+
dark: '#17141f'
|
|
1205
|
+
},
|
|
1206
|
+
lightBg: {
|
|
1207
|
+
bodyBg: '#ffffff',
|
|
1208
|
+
bodyColor: '#444444',
|
|
1209
|
+
secondaryBg: '#f9f8fc',
|
|
1210
|
+
tertiaryBg: '#fafafa',
|
|
1211
|
+
borderColor: '#ededed',
|
|
1212
|
+
emphasisColor: '#000000'
|
|
1213
|
+
},
|
|
1214
|
+
darkBg: {...defaultDarkBg}
|
|
1215
|
+
},
|
|
1216
|
+
quartz: {
|
|
1217
|
+
colors: {
|
|
1218
|
+
primary: '#e83283',
|
|
1219
|
+
secondary: '#ffffff66',
|
|
1220
|
+
success: '#41d7a7',
|
|
1221
|
+
danger: '#fd7e14',
|
|
1222
|
+
warning: '#ffc107',
|
|
1223
|
+
info: '#39cbfb',
|
|
1224
|
+
light: '#e9e9e8',
|
|
1225
|
+
dark: '#212529'
|
|
1226
|
+
},
|
|
1227
|
+
lightBg: {
|
|
1228
|
+
bodyBg: '#686dc3',
|
|
1229
|
+
bodyColor: '#ffffff',
|
|
1230
|
+
secondaryBg: '#5b62f4',
|
|
1231
|
+
tertiaryBg: '#7a7fd1',
|
|
1232
|
+
borderColor: '#ffffff33',
|
|
1233
|
+
emphasisColor: '#ffffff'
|
|
1234
|
+
},
|
|
1235
|
+
darkBg: {
|
|
1236
|
+
bodyBg: '#686dc3',
|
|
1237
|
+
bodyColor: '#ffffff',
|
|
1238
|
+
secondaryBg: '#5b62f4',
|
|
1239
|
+
tertiaryBg: '#7a7fd1',
|
|
1240
|
+
borderColor: '#ffffff33',
|
|
1241
|
+
emphasisColor: '#ffffff'
|
|
1242
|
+
}
|
|
1243
|
+
},
|
|
1244
|
+
sandstone: {
|
|
1245
|
+
colors: {
|
|
1246
|
+
primary: '#325d88',
|
|
1247
|
+
secondary: '#8e8c84',
|
|
1248
|
+
success: '#93c54b',
|
|
1249
|
+
danger: '#d9534f',
|
|
1250
|
+
warning: '#f47c3c',
|
|
1251
|
+
info: '#29abe0',
|
|
1252
|
+
light: '#f8f5f0',
|
|
1253
|
+
dark: '#3e3f3a'
|
|
1254
|
+
},
|
|
1255
|
+
lightBg: {
|
|
1256
|
+
bodyBg: '#ffffff',
|
|
1257
|
+
bodyColor: '#3e3f3a',
|
|
1258
|
+
secondaryBg: '#f8f5f0',
|
|
1259
|
+
tertiaryBg: '#f8f9fa',
|
|
1260
|
+
borderColor: '#dfd7ca',
|
|
1261
|
+
emphasisColor: '#000000'
|
|
1262
|
+
},
|
|
1263
|
+
darkBg: {...defaultDarkBg}
|
|
1264
|
+
},
|
|
1265
|
+
simplex: {
|
|
1266
|
+
colors: {
|
|
1267
|
+
primary: '#d9230f',
|
|
1268
|
+
secondary: '#ffffff',
|
|
1269
|
+
success: '#469408',
|
|
1270
|
+
danger: '#9b479f',
|
|
1271
|
+
warning: '#d9831f',
|
|
1272
|
+
info: '#029acf',
|
|
1273
|
+
light: '#ffffff',
|
|
1274
|
+
dark: '#373a3c'
|
|
1275
|
+
},
|
|
1276
|
+
lightBg: {
|
|
1277
|
+
bodyBg: '#fcfcfc',
|
|
1278
|
+
bodyColor: '#212529',
|
|
1279
|
+
secondaryBg: '#dddddd',
|
|
1280
|
+
tertiaryBg: '#f8f9fa',
|
|
1281
|
+
borderColor: '#cccccc',
|
|
1282
|
+
emphasisColor: '#000000'
|
|
1283
|
+
},
|
|
1284
|
+
darkBg: {...defaultDarkBg}
|
|
1285
|
+
},
|
|
1286
|
+
sketchy: {
|
|
1287
|
+
colors: {
|
|
1288
|
+
primary: '#333333',
|
|
1289
|
+
secondary: '#555555',
|
|
1290
|
+
success: '#28a745',
|
|
1291
|
+
danger: '#dc3545',
|
|
1292
|
+
warning: '#ffc107',
|
|
1293
|
+
info: '#17a2b8',
|
|
1294
|
+
light: '#ffffff',
|
|
1295
|
+
dark: '#555555'
|
|
1296
|
+
},
|
|
1297
|
+
lightBg: {
|
|
1298
|
+
bodyBg: '#ffffff',
|
|
1299
|
+
bodyColor: '#212529',
|
|
1300
|
+
secondaryBg: '#f7f7f9',
|
|
1301
|
+
tertiaryBg: '#f8f9fa',
|
|
1302
|
+
borderColor: '#333333',
|
|
1303
|
+
emphasisColor: '#000000'
|
|
1304
|
+
},
|
|
1305
|
+
darkBg: {...defaultDarkBg}
|
|
1306
|
+
},
|
|
1307
|
+
slate: {
|
|
1308
|
+
colors: {
|
|
1309
|
+
primary: '#3a3f44',
|
|
1310
|
+
secondary: '#7a8288',
|
|
1311
|
+
success: '#62c462',
|
|
1312
|
+
danger: '#ee5f5b',
|
|
1313
|
+
warning: '#f89406',
|
|
1314
|
+
info: '#5bc0de',
|
|
1315
|
+
light: '#e9ecef',
|
|
1316
|
+
dark: '#272b30'
|
|
1317
|
+
},
|
|
1318
|
+
lightBg: {
|
|
1319
|
+
bodyBg: '#272b30',
|
|
1320
|
+
bodyColor: '#aaaaaa',
|
|
1321
|
+
secondaryBg: '#3a3f44',
|
|
1322
|
+
tertiaryBg: '#52575c',
|
|
1323
|
+
borderColor: '#1a1a1a',
|
|
1324
|
+
emphasisColor: '#ffffff'
|
|
1325
|
+
},
|
|
1326
|
+
darkBg: {
|
|
1327
|
+
bodyBg: '#272b30',
|
|
1328
|
+
bodyColor: '#aaaaaa',
|
|
1329
|
+
secondaryBg: '#3a3f44',
|
|
1330
|
+
tertiaryBg: '#52575c',
|
|
1331
|
+
borderColor: '#1a1a1a',
|
|
1332
|
+
emphasisColor: '#ffffff'
|
|
1333
|
+
}
|
|
1334
|
+
},
|
|
1335
|
+
solar: {
|
|
1336
|
+
colors: {
|
|
1337
|
+
primary: '#b58900',
|
|
1338
|
+
secondary: '#839496',
|
|
1339
|
+
success: '#2aa198',
|
|
1340
|
+
danger: '#d33682',
|
|
1341
|
+
warning: '#cb4b16',
|
|
1342
|
+
info: '#268bd2',
|
|
1343
|
+
light: '#fdf6e3',
|
|
1344
|
+
dark: '#073642'
|
|
1345
|
+
},
|
|
1346
|
+
lightBg: {
|
|
1347
|
+
bodyBg: '#002b36',
|
|
1348
|
+
bodyColor: '#839496',
|
|
1349
|
+
secondaryBg: '#073642',
|
|
1350
|
+
tertiaryBg: '#094050',
|
|
1351
|
+
borderColor: '#073642',
|
|
1352
|
+
emphasisColor: '#fdf6e3'
|
|
1353
|
+
},
|
|
1354
|
+
darkBg: {
|
|
1355
|
+
bodyBg: '#002b36',
|
|
1356
|
+
bodyColor: '#839496',
|
|
1357
|
+
secondaryBg: '#073642',
|
|
1358
|
+
tertiaryBg: '#094050',
|
|
1359
|
+
borderColor: '#073642',
|
|
1360
|
+
emphasisColor: '#fdf6e3'
|
|
1361
|
+
}
|
|
1362
|
+
},
|
|
1363
|
+
spacelab: {
|
|
1364
|
+
colors: {
|
|
1365
|
+
primary: '#446e9b',
|
|
1366
|
+
secondary: '#999999',
|
|
1367
|
+
success: '#3cb521',
|
|
1368
|
+
danger: '#cd0200',
|
|
1369
|
+
warning: '#d47500',
|
|
1370
|
+
info: '#3399f3',
|
|
1371
|
+
light: '#eeeeee',
|
|
1372
|
+
dark: '#333333'
|
|
1373
|
+
},
|
|
1374
|
+
lightBg: {
|
|
1375
|
+
bodyBg: '#ffffff',
|
|
1376
|
+
bodyColor: '#777777',
|
|
1377
|
+
secondaryBg: '#eeeeee',
|
|
1378
|
+
tertiaryBg: '#f8f9fa',
|
|
1379
|
+
borderColor: '#dee2e6',
|
|
1380
|
+
emphasisColor: '#2d2d2d'
|
|
1381
|
+
},
|
|
1382
|
+
darkBg: {...defaultDarkBg}
|
|
1383
|
+
},
|
|
1384
|
+
superhero: {
|
|
1385
|
+
colors: {
|
|
1386
|
+
primary: '#df6919',
|
|
1387
|
+
secondary: '#4e5d6c',
|
|
1388
|
+
success: '#5cb85c',
|
|
1389
|
+
danger: '#d9534f',
|
|
1390
|
+
warning: '#ffc107',
|
|
1391
|
+
info: '#5bc0de',
|
|
1392
|
+
light: '#abb6c2',
|
|
1393
|
+
dark: '#20374c'
|
|
1394
|
+
},
|
|
1395
|
+
lightBg: {
|
|
1396
|
+
bodyBg: '#0f2537',
|
|
1397
|
+
bodyColor: '#ebebeb',
|
|
1398
|
+
secondaryBg: '#20374c',
|
|
1399
|
+
tertiaryBg: '#4e5d6c',
|
|
1400
|
+
borderColor: '#4e5d6c',
|
|
1401
|
+
emphasisColor: '#ffffff'
|
|
1402
|
+
},
|
|
1403
|
+
darkBg: {
|
|
1404
|
+
bodyBg: '#0f2537',
|
|
1405
|
+
bodyColor: '#ebebeb',
|
|
1406
|
+
secondaryBg: '#20374c',
|
|
1407
|
+
tertiaryBg: '#4e5d6c',
|
|
1408
|
+
borderColor: '#4e5d6c',
|
|
1409
|
+
emphasisColor: '#ffffff'
|
|
1410
|
+
}
|
|
1411
|
+
},
|
|
1412
|
+
united: {
|
|
1413
|
+
colors: {
|
|
1414
|
+
primary: '#e95420',
|
|
1415
|
+
secondary: '#aea79f',
|
|
1416
|
+
success: '#38b44a',
|
|
1417
|
+
danger: '#df382c',
|
|
1418
|
+
warning: '#efb73e',
|
|
1419
|
+
info: '#17a2b8',
|
|
1420
|
+
light: '#e9ecef',
|
|
1421
|
+
dark: '#772953'
|
|
1422
|
+
},
|
|
1423
|
+
lightBg: {
|
|
1424
|
+
bodyBg: '#ffffff',
|
|
1425
|
+
bodyColor: '#333333',
|
|
1426
|
+
secondaryBg: '#e9ecef',
|
|
1427
|
+
tertiaryBg: '#f8f9fa',
|
|
1428
|
+
borderColor: '#dee2e6',
|
|
1429
|
+
emphasisColor: '#000000'
|
|
1430
|
+
},
|
|
1431
|
+
darkBg: {...defaultDarkBg}
|
|
1432
|
+
},
|
|
1433
|
+
vapor: {
|
|
1434
|
+
colors: {
|
|
1435
|
+
primary: '#6f42c1',
|
|
1436
|
+
secondary: '#ea39b8',
|
|
1437
|
+
success: '#3cf281',
|
|
1438
|
+
danger: '#e44c55',
|
|
1439
|
+
warning: '#ffc107',
|
|
1440
|
+
info: '#1ba2f6',
|
|
1441
|
+
light: '#44d9e8',
|
|
1442
|
+
dark: '#170229'
|
|
1443
|
+
},
|
|
1444
|
+
lightBg: {
|
|
1445
|
+
bodyBg: '#1a0933',
|
|
1446
|
+
bodyColor: '#32fbe2',
|
|
1447
|
+
secondaryBg: '#2a1045',
|
|
1448
|
+
tertiaryBg: '#3d1560',
|
|
1449
|
+
borderColor: '#6f42c1',
|
|
1450
|
+
emphasisColor: '#ffffff'
|
|
1451
|
+
},
|
|
1452
|
+
darkBg: {
|
|
1453
|
+
bodyBg: '#1a0933',
|
|
1454
|
+
bodyColor: '#32fbe2',
|
|
1455
|
+
secondaryBg: '#2a1045',
|
|
1456
|
+
tertiaryBg: '#3d1560',
|
|
1457
|
+
borderColor: '#6f42c1',
|
|
1458
|
+
emphasisColor: '#ffffff'
|
|
1459
|
+
}
|
|
1460
|
+
},
|
|
1461
|
+
versa: {
|
|
1462
|
+
colors: {
|
|
1463
|
+
primary: '#161616',
|
|
1464
|
+
secondary: '#ffffff',
|
|
1465
|
+
success: '#04c951',
|
|
1466
|
+
danger: '#e7020b',
|
|
1467
|
+
warning: '#efb100',
|
|
1468
|
+
info: '#2b80ff',
|
|
1469
|
+
light: '#f5f5f5',
|
|
1470
|
+
dark: '#2e2e2e'
|
|
1471
|
+
},
|
|
1472
|
+
lightBg: {
|
|
1473
|
+
bodyBg: '#ffffff',
|
|
1474
|
+
bodyColor: '#0a0a0a',
|
|
1475
|
+
secondaryBg: '#f5f5f5',
|
|
1476
|
+
tertiaryBg: '#f8f9fa',
|
|
1477
|
+
borderColor: '#e5e5e5',
|
|
1478
|
+
emphasisColor: '#000000'
|
|
1479
|
+
},
|
|
1480
|
+
darkBg: {...defaultDarkBg}
|
|
1481
|
+
},
|
|
1482
|
+
yeti: {
|
|
1483
|
+
colors: {
|
|
1484
|
+
primary: '#008cba',
|
|
1485
|
+
secondary: '#eeeeee',
|
|
1486
|
+
success: '#43ac6a',
|
|
1487
|
+
danger: '#f04124',
|
|
1488
|
+
warning: '#e99002',
|
|
1489
|
+
info: '#5bc0de',
|
|
1490
|
+
light: '#eeeeee',
|
|
1491
|
+
dark: '#333333'
|
|
1492
|
+
},
|
|
1493
|
+
lightBg: {
|
|
1494
|
+
bodyBg: '#ffffff',
|
|
1495
|
+
bodyColor: '#212529',
|
|
1496
|
+
secondaryBg: '#eeeeee',
|
|
1497
|
+
tertiaryBg: '#f8f9fa',
|
|
1498
|
+
borderColor: '#cccccc',
|
|
1499
|
+
emphasisColor: '#000000'
|
|
1500
|
+
},
|
|
1501
|
+
darkBg: {...defaultDarkBg}
|
|
1502
|
+
},
|
|
1503
|
+
zephyr: {
|
|
1504
|
+
colors: {
|
|
1505
|
+
primary: '#3459e6',
|
|
1506
|
+
secondary: '#ffffff',
|
|
1507
|
+
success: '#2fb380',
|
|
1508
|
+
danger: '#da292e',
|
|
1509
|
+
warning: '#f4bd61',
|
|
1510
|
+
info: '#287bb5',
|
|
1511
|
+
light: '#f8f9fa',
|
|
1512
|
+
dark: '#212529'
|
|
1513
|
+
},
|
|
1514
|
+
lightBg: {
|
|
1515
|
+
bodyBg: '#ffffff',
|
|
1516
|
+
bodyColor: '#495057',
|
|
1517
|
+
secondaryBg: '#e9ecef',
|
|
1518
|
+
tertiaryBg: '#f8f9fa',
|
|
1519
|
+
borderColor: '#dee2e6',
|
|
1520
|
+
emphasisColor: '#000000'
|
|
1521
|
+
},
|
|
1522
|
+
darkBg: {...defaultDarkBg}
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* Initialize default colors by reading actual CSS values from the DOM.
|
|
1528
|
+
* Should be called when the DOM is ready (e.g., in Vue's onMounted).
|
|
1529
|
+
* Updates the defaultColors, defaultLightBg, and defaultDarkBg objects in place.
|
|
1530
|
+
* @returns {Object} - Object containing { colors, lightBg, darkBg }
|
|
1531
|
+
*/
|
|
1532
|
+
function initializeDefaultColors() {
|
|
1533
|
+
// Clear caches to force re-read from current CSS
|
|
1534
|
+
cachedDefaultColors = null
|
|
1535
|
+
cachedLightBg = null
|
|
1536
|
+
cachedDarkBg = null
|
|
1537
|
+
|
|
1538
|
+
// Read semantic colors
|
|
1539
|
+
const colors = getDefaultColors()
|
|
1540
|
+
Object.assign(defaultColors, colors)
|
|
1541
|
+
|
|
1542
|
+
// Read light mode background colors
|
|
1543
|
+
const lightBg = getLightBgColors()
|
|
1544
|
+
Object.assign(defaultLightBg, lightBg)
|
|
1545
|
+
|
|
1546
|
+
// Read dark mode background colors
|
|
1547
|
+
const darkBg = getDarkBgColors()
|
|
1548
|
+
Object.assign(defaultDarkBg, darkBg)
|
|
1549
|
+
|
|
1550
|
+
return { colors, lightBg, darkBg }
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
export const Theme = {
|
|
1554
|
+
// Constants
|
|
1555
|
+
defaultColors,
|
|
1556
|
+
defaultLightBg,
|
|
1557
|
+
defaultDarkBg,
|
|
1558
|
+
bootswatchThemes,
|
|
1559
|
+
bootswatchPresets,
|
|
1560
|
+
darkByDefaultThemes,
|
|
1561
|
+
|
|
1562
|
+
// DOM IDs
|
|
1563
|
+
THEME_STYLE_ID,
|
|
1564
|
+
BOOTSWATCH_LINK_ID,
|
|
1565
|
+
THEME_VARS_LINK_ID,
|
|
1566
|
+
BOOTSTRAP_MAIN_ID,
|
|
1567
|
+
|
|
1568
|
+
// Helper functions
|
|
1569
|
+
hexToRgb,
|
|
1570
|
+
darken,
|
|
1571
|
+
lighten,
|
|
1572
|
+
isLightColor,
|
|
1573
|
+
adjustForDarkMode,
|
|
1574
|
+
generateDarkModeColors,
|
|
1575
|
+
generateBootstrapCSS,
|
|
1576
|
+
applyThemeToDOM,
|
|
1577
|
+
loadBootswatchTheme,
|
|
1578
|
+
restoreCustomEditor,
|
|
1579
|
+
initializeDefaultColors,
|
|
1580
|
+
|
|
1581
|
+
// Labels for UI
|
|
1582
|
+
|
|
1583
|
+
colorLabels: {
|
|
1584
|
+
primary: 'Primary',
|
|
1585
|
+
secondary: 'Secondary',
|
|
1586
|
+
success: 'Success',
|
|
1587
|
+
danger: 'Danger',
|
|
1588
|
+
warning: 'Warning',
|
|
1589
|
+
info: 'Info',
|
|
1590
|
+
light: 'Light',
|
|
1591
|
+
dark: 'Dark'
|
|
1592
|
+
},
|
|
1593
|
+
|
|
1594
|
+
lightBgLabels: {
|
|
1595
|
+
bodyBg: 'Body Background',
|
|
1596
|
+
bodyColor: 'Body Text',
|
|
1597
|
+
secondaryBg: 'Secondary Background',
|
|
1598
|
+
tertiaryBg: 'Tertiary Background',
|
|
1599
|
+
borderColor: 'Border Color',
|
|
1600
|
+
emphasisColor: 'Emphasis Color'
|
|
1601
|
+
},
|
|
1602
|
+
|
|
1603
|
+
darkBgLabels: {
|
|
1604
|
+
bodyBg: 'Body Background',
|
|
1605
|
+
bodyColor: 'Body Text',
|
|
1606
|
+
secondaryBg: 'Secondary Background',
|
|
1607
|
+
tertiaryBg: 'Tertiary Background',
|
|
1608
|
+
borderColor: 'Border Color',
|
|
1609
|
+
emphasisColor: 'Emphasis Color'
|
|
1610
|
+
},
|
|
1611
|
+
|
|
1612
|
+
presets: {
|
|
1613
|
+
default: {
|
|
1614
|
+
colors: {...defaultColors},
|
|
1615
|
+
lightBg: {...defaultLightBg},
|
|
1616
|
+
darkBg: {...defaultDarkBg}
|
|
1617
|
+
},
|
|
1618
|
+
ocean: {
|
|
1619
|
+
colors: {
|
|
1620
|
+
primary: '#0077b6',
|
|
1621
|
+
secondary: '#90e0ef',
|
|
1622
|
+
success: '#2d6a4f',
|
|
1623
|
+
danger: '#d62828',
|
|
1624
|
+
warning: '#ffba08',
|
|
1625
|
+
info: '#48cae4',
|
|
1626
|
+
light: '#caf0f8',
|
|
1627
|
+
dark: '#023e8a'
|
|
1628
|
+
},
|
|
1629
|
+
lightBg: {
|
|
1630
|
+
bodyBg: '#ffffff',
|
|
1631
|
+
bodyColor: '#023e8a',
|
|
1632
|
+
secondaryBg: '#caf0f8',
|
|
1633
|
+
tertiaryBg: '#e0f7fa',
|
|
1634
|
+
borderColor: '#90e0ef',
|
|
1635
|
+
emphasisColor: '#000000'
|
|
1636
|
+
},
|
|
1637
|
+
darkBg: {
|
|
1638
|
+
bodyBg: '#03045e',
|
|
1639
|
+
bodyColor: '#caf0f8',
|
|
1640
|
+
secondaryBg: '#023e8a',
|
|
1641
|
+
tertiaryBg: '#0077b6',
|
|
1642
|
+
borderColor: '#0096c7',
|
|
1643
|
+
emphasisColor: '#ffffff'
|
|
1644
|
+
}
|
|
1645
|
+
},
|
|
1646
|
+
forest: {
|
|
1647
|
+
colors: {
|
|
1648
|
+
primary: '#2d6a4f',
|
|
1649
|
+
secondary: '#74c69d',
|
|
1650
|
+
success: '#40916c',
|
|
1651
|
+
danger: '#ae2012',
|
|
1652
|
+
warning: '#ee9b00',
|
|
1653
|
+
info: '#52b788',
|
|
1654
|
+
light: '#d8f3dc',
|
|
1655
|
+
dark: '#1b4332'
|
|
1656
|
+
},
|
|
1657
|
+
lightBg: {
|
|
1658
|
+
bodyBg: '#ffffff',
|
|
1659
|
+
bodyColor: '#1b4332',
|
|
1660
|
+
secondaryBg: '#d8f3dc',
|
|
1661
|
+
tertiaryBg: '#b7e4c7',
|
|
1662
|
+
borderColor: '#74c69d',
|
|
1663
|
+
emphasisColor: '#000000'
|
|
1664
|
+
},
|
|
1665
|
+
darkBg: {
|
|
1666
|
+
bodyBg: '#081c15',
|
|
1667
|
+
bodyColor: '#d8f3dc',
|
|
1668
|
+
secondaryBg: '#1b4332',
|
|
1669
|
+
tertiaryBg: '#2d6a4f',
|
|
1670
|
+
borderColor: '#40916c',
|
|
1671
|
+
emphasisColor: '#ffffff'
|
|
1672
|
+
}
|
|
1673
|
+
},
|
|
1674
|
+
sunset: {
|
|
1675
|
+
colors: {
|
|
1676
|
+
primary: '#e63946',
|
|
1677
|
+
secondary: '#f4a261',
|
|
1678
|
+
success: '#2a9d8f',
|
|
1679
|
+
danger: '#9b2226',
|
|
1680
|
+
warning: '#e9c46a',
|
|
1681
|
+
info: '#264653',
|
|
1682
|
+
light: '#f1faee',
|
|
1683
|
+
dark: '#1d3557'
|
|
1684
|
+
},
|
|
1685
|
+
lightBg: {
|
|
1686
|
+
bodyBg: '#f1faee',
|
|
1687
|
+
bodyColor: '#1d3557',
|
|
1688
|
+
secondaryBg: '#a8dadc',
|
|
1689
|
+
tertiaryBg: '#e9ecef',
|
|
1690
|
+
borderColor: '#457b9d',
|
|
1691
|
+
emphasisColor: '#000000'
|
|
1692
|
+
},
|
|
1693
|
+
darkBg: {
|
|
1694
|
+
bodyBg: '#1d3557',
|
|
1695
|
+
bodyColor: '#f1faee',
|
|
1696
|
+
secondaryBg: '#264653',
|
|
1697
|
+
tertiaryBg: '#2a3f5f',
|
|
1698
|
+
borderColor: '#457b9d',
|
|
1699
|
+
emphasisColor: '#ffffff'
|
|
1700
|
+
}
|
|
1701
|
+
},
|
|
1702
|
+
purple: {
|
|
1703
|
+
colors: {
|
|
1704
|
+
primary: '#7b2cbf',
|
|
1705
|
+
secondary: '#c77dff',
|
|
1706
|
+
success: '#38b000',
|
|
1707
|
+
danger: '#d00000',
|
|
1708
|
+
warning: '#ffaa00',
|
|
1709
|
+
info: '#9d4edd',
|
|
1710
|
+
light: '#e0aaff',
|
|
1711
|
+
dark: '#3c096c'
|
|
1712
|
+
},
|
|
1713
|
+
lightBg: {
|
|
1714
|
+
bodyBg: '#ffffff',
|
|
1715
|
+
bodyColor: '#3c096c',
|
|
1716
|
+
secondaryBg: '#e0aaff',
|
|
1717
|
+
tertiaryBg: '#f3d5ff',
|
|
1718
|
+
borderColor: '#c77dff',
|
|
1719
|
+
emphasisColor: '#000000'
|
|
1720
|
+
},
|
|
1721
|
+
darkBg: {
|
|
1722
|
+
bodyBg: '#10002b',
|
|
1723
|
+
bodyColor: '#e0aaff',
|
|
1724
|
+
secondaryBg: '#240046',
|
|
1725
|
+
tertiaryBg: '#3c096c',
|
|
1726
|
+
borderColor: '#5a189a',
|
|
1727
|
+
emphasisColor: '#ffffff'
|
|
1728
|
+
}
|
|
1729
|
+
},
|
|
1730
|
+
monochrome: {
|
|
1731
|
+
colors: {
|
|
1732
|
+
primary: '#495057',
|
|
1733
|
+
secondary: '#6c757d',
|
|
1734
|
+
success: '#495057',
|
|
1735
|
+
danger: '#343a40',
|
|
1736
|
+
warning: '#adb5bd',
|
|
1737
|
+
info: '#868e96',
|
|
1738
|
+
light: '#f8f9fa',
|
|
1739
|
+
dark: '#212529'
|
|
1740
|
+
},
|
|
1741
|
+
lightBg: {
|
|
1742
|
+
bodyBg: '#ffffff',
|
|
1743
|
+
bodyColor: '#212529',
|
|
1744
|
+
secondaryBg: '#e9ecef',
|
|
1745
|
+
tertiaryBg: '#f8f9fa',
|
|
1746
|
+
borderColor: '#dee2e6',
|
|
1747
|
+
emphasisColor: '#000000'
|
|
1748
|
+
},
|
|
1749
|
+
darkBg: {
|
|
1750
|
+
bodyBg: '#121212',
|
|
1751
|
+
bodyColor: '#e9ecef',
|
|
1752
|
+
secondaryBg: '#1e1e1e',
|
|
1753
|
+
tertiaryBg: '#2d2d2d',
|
|
1754
|
+
borderColor: '#444444',
|
|
1755
|
+
emphasisColor: '#ffffff'
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
}
|