-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
312edff
commit 10d81dd
Showing
1 changed file
with
46 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,7 +150,31 @@ | |
"outputs": [], | ||
"source": [ | ||
"#| export\n", | ||
"def _headers_theme(color, mode='auto'):\n", | ||
"class ThemeRadii(VEnum):\n", | ||
" none = 'uk-radii-none'\n", | ||
" sm = 'uk-radii-sm'\n", | ||
" md = 'uk-radii-md'\n", | ||
" lg = 'uk-radii-lg'\n", | ||
"\n", | ||
"class ThemeShadows:\n", | ||
" none = 'uk-shadows-none'\n", | ||
" sm = 'uk-shadows-sm'\n", | ||
" md = 'uk-shadows-md'\n", | ||
" lg = 'uk-shadows-lg'\n", | ||
"\n", | ||
"class ThemeFont:\n", | ||
" sm = 'uk-font-sm'\n", | ||
" default = 'uk-font-base'" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#| export\n", | ||
"def _headers_theme(color, mode='auto', radii='md', shadows='sm', font='sm'):\n", | ||
" mode_script = {\n", | ||
" 'auto': '''\n", | ||
" const __FRANKEN__ = JSON.parse(localStorage.getItem(\"__FRANKEN__\") || \"{}\");\n", | ||
|
@@ -175,10 +199,16 @@ | |
" {mode_script[mode]}\n", | ||
" htmlElement.classList.add(\"uk-theme-{color}\");\n", | ||
" htmlElement.classList.add(__FRANKEN__.theme || \"uk-theme-{color}\");\n", | ||
<<<<<<< Updated upstream | ||
" htmlElement.classList.add(__FRANKEN__.radii || \"uk-radii-md\");\n", | ||
" htmlElement.classList.add(__FRANKEN__.shadows || \"uk-shadows-sm\");\n", | ||
" htmlElement.classList.add(__FRANKEN__.font || \"uk-font-sm\");\n", | ||
"\n", | ||
======= | ||
" htmlElement.classList.add(__FRANKEN__.radii || \"uk-radii-{radii}\");\n", | ||
" htmlElement.classList.add(__FRANKEN__.shadows || \"uk-shadows-{shadows}\");\n", | ||
" htmlElement.classList.add(__FRANKEN__.font || \"uk-font-{font}\");\n", | ||
>>>>>>> Stashed changes | ||
" ''')" | ||
] | ||
}, | ||
|
@@ -217,11 +247,17 @@ | |
"source": [ | ||
"#| export\n", | ||
"HEADER_URLS = {\n", | ||
<<<<<<< Updated upstream | ||
" 'franken_css': \"https://unpkg.com/[email protected]/dist/css/core.min.css\",\n", | ||
"# 'franken_tw_utils': \"https://unpkg.com/[email protected]/dist/css/utilities.min.css\",\n", | ||
" 'franken_js_core': \"https://unpkg.com/[email protected]/dist/js/core.iife.js\",\n", | ||
" 'franken_icons': \"https://unpkg.com/[email protected]/dist/js/icon.iife.js\",\n", | ||
"# 'icon_js': \"https://cdn.jsdelivr.net/gh/answerdotai/monsterui@main/monsterui/icon.iife.js\",\n", | ||
======= | ||
" 'franken_css': \"https://unpkg.com/[email protected]/dist/css/core.min.css\",\n", | ||
" 'franken_js_core': \"https://unpkg.com/[email protected]/dist/js/core.iife.js\",\n", | ||
" 'franken_icons': \"https://unpkg.com/[email protected]/dist/js/icon.iife.js\",\n", | ||
>>>>>>> Stashed changes | ||
" 'tailwind': \"https://cdn.tailwindcss.com\",\n", | ||
" 'daisyui': \"https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css\",\n", | ||
" 'highlight_js': \"https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js\",\n", | ||
|
@@ -323,20 +359,23 @@ | |
" violet = auto()\n", | ||
" zinc = auto()\n", | ||
"\n", | ||
" def _create_headers(self, urls, mode='auto', daisy=True, highlightjs=False, katex=True):\n", | ||
" def _create_headers(self, urls, mode='auto', daisy=True, highlightjs=False, katex=True, radii='md', shadows='sm', font='sm'):\n", | ||
" \"Create header elements with given URLs\"\n", | ||
" hdrs = [\n", | ||
" fh.Link(rel=\"stylesheet\", href=urls['franken_css']),\n", | ||
"# fh.Link(rel=\"stylesheet\", href=urls['franken_utils']),\n", | ||
" fh.Script(type=\"module\", src=urls['franken_js_core']),\n", | ||
" fh.Script(type=\"module\", src=urls['franken_icons']),\n", | ||
" fh.Script(src=urls['tailwind']),\n", | ||
<<<<<<< Updated upstream | ||
" fh.Script(\"\"\"\n", | ||
" tailwind.config = {\n", | ||
" darkMode: 'selector',\n", | ||
" }\n", | ||
" \"\"\"),\n", | ||
" _headers_theme(self.value, mode=mode),\n", | ||
======= | ||
" _headers_theme(self.value, mode=mode, radii=radii, shadows=shadows, font=font),\n", | ||
>>>>>>> Stashed changes | ||
" scrollspy_style]\n", | ||
"\n", | ||
" if daisy:\n", | ||
|
@@ -392,18 +431,17 @@ | |
" });\n", | ||
" \"\"\",type=\"module\"),\n", | ||
" ]\n", | ||
"\n", | ||
" return hdrs\n", | ||
"\n", | ||
" def headers(self, mode='auto', daisy=True, highlightjs=False, katex=True):\n", | ||
" def headers(self, mode='auto', daisy=True, highlightjs=False, katex=True, radii='md', shadows='sm', font='sm' ):\n", | ||
" \"Create frankenui and tailwind cdns\"\n", | ||
" return self._create_headers(HEADER_URLS, mode=mode, daisy=daisy, highlightjs=highlightjs, katex=katex) \n", | ||
" return self._create_headers(HEADER_URLS, mode=mode, daisy=daisy, highlightjs=highlightjs, katex=katex, radii=radii, shadows=shadows, font=font) \n", | ||
" \n", | ||
" def local_headers(self, mode='auto', static_dir='static', daisy=True, highlightjs=False, katex=True):\n", | ||
" def local_headers(self, mode='auto', static_dir='static', daisy=True, highlightjs=False, katex=True, radii='md', shadows='sm', font='sm'):\n", | ||
" \"Create headers using local files downloaded from CDNs\"\n", | ||
" Path(static_dir).mkdir(exist_ok=True)\n", | ||
" local_urls = dict([_download_resource(url, static_dir) for url in HEADER_URLS.items()])\n", | ||
" return self._create_headers(local_urls, mode=mode, daisy=daisy, highlightjs=highlightjs, katex=katex)" | ||
" return self._create_headers(local_urls, mode=mode, daisy=daisy, highlightjs=highlightjs, katex=katex, radii=radii, shadows=shadows, font=font)" | ||
] | ||
}, | ||
{ | ||
|
@@ -442,27 +480,6 @@ | |
"Show = partial(HTMX, app=app)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
|