Compare commits
62 Commits
Author | SHA1 | Date | |
---|---|---|---|
e0d62ccc4f | |||
2941a5903f | |||
857680c3b1 | |||
b44b17d830 | |||
8fe6e39440 | |||
5f050066e9 | |||
0b5e54faa6 | |||
6d8b9d0e47 | |||
9db11f3f97 | |||
df95905fe0 | |||
89870edaaf | |||
ca3f9970a9 | |||
d5cbcb5807 | |||
a204f7fc98 | |||
c6e7b616f1 | |||
2a060106bc | |||
e2c05ac338 | |||
93800c2706 | |||
67c857bbed | |||
516b0fe4df | |||
b5e0061247 | |||
a8cd90c349 | |||
be90329514 | |||
d64bb5e7a2 | |||
f842822915 | |||
c0aa93a3c1 | |||
7dcc72d5a0 | |||
f70d94ea67 | |||
339e177ac4 | |||
197e6f2f33 | |||
bcbe51e9a7 | |||
559552f218 | |||
2cd25ad7bd | |||
f358266533 | |||
b5ab99da8d | |||
5fa631a903 | |||
c201ff8f63 | |||
2c117442af | |||
b60c118e41 | |||
acdb794971 | |||
140b239cfc | |||
a60f831900 | |||
ea92f5e7ac | |||
3292729d53 | |||
77a13bbd46 | |||
bdb7f0e0aa | |||
0b82aa4be6 | |||
fd53ee174a | |||
c94d5e565f | |||
552a204edd | |||
e7d4e2ab48 | |||
fa165d530f | |||
74fc7a4c11 | |||
9cba20c39c | |||
3c261881e9 | |||
c0ea225d03 | |||
ce98e0c488 | |||
fa708175b7 | |||
0036bcf0fd | |||
0708328647 | |||
74abc40dc4 | |||
4c394e5215 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
ds2 core.sublime-workspace
|
85
Readme.md
85
Readme.md
@ -1,4 +1,14 @@
|
|||||||
# DS2 Core
|
# DS2-core
|
||||||
|
DS2-core is a lightweight PugJS-based framework for building design systems.
|
||||||
|
|
||||||
|
The design system compiles to mostly pure HTML, SCSS and JavaScript. There are a few enhanced parts that use PHP in order to handle non-critical tasks Zip files on the fly to collect component JavaScript and SCSS. PugJS is used because it can handle some of the automation such as creating includes making components extremely modular.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
The requirements for ds2-core are pretty light. You'll want to be able to process [PugJS](https://pugjs.org/api/getting-started.html) (formerly Jade) and [SCSS](https://sass-lang.com/documentation/) -- and that's about it.
|
||||||
|
|
||||||
|
For our own design system, we use ds2-core with [Prepros](https://prepros.io) (which you can use the Free Unlimited Trial for, but why not splurge and spend the $30USD to support the developer and skip the nags). On MacOS, you could also use [CodeKit](https://codekitapp.com/).
|
||||||
|
|
||||||
|
Alternatively, if you have pre-processor pipelines for Pug and SCSS, which you can install using npm, or any other language you decide to pull in, you can use those to compile if that ends up being easier for you. The framework isn't too picky, so long as things go into the right place.
|
||||||
|
|
||||||
## "Installation"
|
## "Installation"
|
||||||
|
|
||||||
@ -11,20 +21,23 @@ src/pg/core/download.php.pug | public
|
|||||||
|
|
||||||
All other pug files should compile to from src/pg/ to a relative path of public/*
|
All other pug files should compile to from src/pg/ to a relative path of public/*
|
||||||
|
|
||||||
|
|
||||||
## Running the core
|
## Running the core
|
||||||
|
|
||||||
functions
|
### Callback functions
|
||||||
|
Callback functions can be used in
|
||||||
|
|
||||||
beforeArticleLoad - called before any patterns are started to load
|
- beforeArticleLoad - called before any patterns have started to load
|
||||||
success - called when loading a pattern is successful if the result is an HTTP 200
|
- success - called when loading a pattern is successful if the result is an HTTP 200
|
||||||
afterArticleLoad - called after any patterns are started to load
|
- afterArticleLoad - called after any patterns have started to load
|
||||||
done - called when the ajax for any pattern is done, whether successful or not. This is a useful place to load any javascript initializations that pattern.
|
- done - called when the ajax for any pattern is done, whether successful or not. This is a useful place to load any javascript initializations that pattern.
|
||||||
|
|
||||||
|
|
||||||
## About the content variable
|
## Creating an item
|
||||||
|
|
||||||
The content variable in \_config.pug defines your array of patterns. It is made up of the following attributes:
|
|
||||||
|
## The content object
|
||||||
|
|
||||||
|
The content variable in \/src\/pg\/_config.pug defines your array of patterns. It is made up of the following attributes:
|
||||||
- name - the hypenated name of the pattern
|
- name - the hypenated name of the pattern
|
||||||
- status - this should be one of the statuses from your status array
|
- status - this should be one of the statuses from your status array
|
||||||
- display - (optional) if present this will be displayed, as is, instead of the name
|
- display - (optional) if present this will be displayed, as is, instead of the name
|
||||||
@ -34,3 +47,57 @@ The content variable in \_config.pug defines your array of patterns. It is made
|
|||||||
|
|
||||||
By changing and resaving the \_config.pug file, (our change is often adding or removing a random space) all of the pug patterns will recompile. Note that md templates will not recompile automatically when config is saved and updated as markdown files don't have an include.
|
By changing and resaving the \_config.pug file, (our change is often adding or removing a random space) all of the pug patterns will recompile. Note that md templates will not recompile automatically when config is saved and updated as markdown files don't have an include.
|
||||||
|
|
||||||
|
## Including PugJS in Pug files without compiling
|
||||||
|
If you wish to include Pug output as code in your instance, you can do this without manually creating a second 'dot container' version of the file. Including files with 'unrecognised' extensions does not compile them.
|
||||||
|
|
||||||
|
1. In your project config, create a Custom Tool called Pug pattern to pug file
|
||||||
|
1. Check Process automatically and set the command to 'cp {{input}} {{output}}' on Mac/Linux and 'copy {{input}} {{output}}' on Windows. (This is just your operating system's command line file copy executable.)
|
||||||
|
1. Set the Output to Relative to input
|
||||||
|
1. Set the Output Extension to .pug
|
||||||
|
|
||||||
|
In your design system implementation,
|
||||||
|
1. Create the files that you edit as _[pattern].pp files, and set them to auto compile. (You may wish to let your text editor know what they are, so the syntax highlighting works.
|
||||||
|
1. Save the file, ensure that it is set to in prepros it is set to process automatically.
|
||||||
|
1. Include the .pp file as your pug pattern with .language-pug and include the .pug file as your html output.
|
||||||
|
|
||||||
|
This will ensure that the .pug file will get processed and the .pp file will be handled as text will get compiled, but they should display correctly and remain in sync while maintaining the minimum number of files.
|
||||||
|
|
||||||
|
## Using core code with your own pattern documentation.
|
||||||
|
Using
|
||||||
|
|
||||||
|
---
|
||||||
|
Creating a new pattern
|
||||||
|
Begin by creating a folder within your strucutre to hold the pattern. Add the folder to your config file.
|
||||||
|
|
||||||
|
|
||||||
|
Generating css
|
||||||
|
You've likely created your component's css as an include file beginning with an underscore. create a second file named the same that includes any dependencies (such as breakpoints) that are required to generate your valid css.
|
||||||
|
|
||||||
|
You can now include the css in your pattern's index file.
|
||||||
|
|
||||||
|
Generating pug
|
||||||
|
Create a custom tool in prepros, give it a name such as "PP to Pug" set the input extension to .pp and the output extension to .pug and check Process Automatically . The command should be
|
||||||
|
Mac / Linux
|
||||||
|
cp {{input}} {{output}}
|
||||||
|
|
||||||
|
Windows
|
||||||
|
copy {{input}} {{output}}
|
||||||
|
|
||||||
|
Once you've added the tool, set the output to "relative path" and set the output extension to pug. For each .pp file you may have to check process automatically as it doesn't always identify the new extension.
|
||||||
|
|
||||||
|
You will now be able to include the .pp file in your pattern's index file while including the .pug file which will give a compiled version of your component's html.
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
This framework includes [PrismJS](https://prismjs.com/) for code syntax highlighting. PrismJS is released under the [MIT license](https://opensource.org/licenses/MIT).
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
"folders":
|
"folders":
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"path": "."
|
"path": ".",
|
||||||
|
"folder_exclude_patterns": ["src/pg/patterns"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "./src/pg/patterns"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
@ -1,606 +0,0 @@
|
|||||||
{
|
|
||||||
"auto_complete":
|
|
||||||
{
|
|
||||||
"selected_items":
|
|
||||||
[
|
|
||||||
[
|
|
||||||
"Quer",
|
|
||||||
"querySelectorAll"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"get",
|
|
||||||
"getAttribute"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"query",
|
|
||||||
"querySelectorAll"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"to",
|
|
||||||
"toContent"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"tos",
|
|
||||||
"toSentenceCase"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"sticky",
|
|
||||||
"sticky-note"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"back",
|
|
||||||
"background-color"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"setAttr",
|
|
||||||
"setAttributes"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"post",
|
|
||||||
"positionSticky"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"grid-",
|
|
||||||
"grid-column"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"of",
|
|
||||||
"offsetWidth"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"fun",
|
|
||||||
"function"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"grid-template",
|
|
||||||
"grid-template-columns"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"text",
|
|
||||||
"text-decoration"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"text-",
|
|
||||||
"text-decoration"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"grid-template-",
|
|
||||||
"grid-template-columns"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"bakc",
|
|
||||||
"background-color"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"copyco",
|
|
||||||
"copycolour"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"ar",
|
|
||||||
"article"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"toS",
|
|
||||||
"toSentenceCase"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"bacg",
|
|
||||||
"background-color"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"acc",
|
|
||||||
"accent-grey"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"_",
|
|
||||||
"_POST"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"json",
|
|
||||||
"json_encode"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"font",
|
|
||||||
"font-heading"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"border",
|
|
||||||
"border-radius"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"background-o",
|
|
||||||
"background-position"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"lang",
|
|
||||||
"language\tAttr"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Emai",
|
|
||||||
"EMAIL_FOLDER"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"tem",
|
|
||||||
"template"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"G",
|
|
||||||
"GetParentFolderName"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"out",
|
|
||||||
"outFile"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"with",
|
|
||||||
"With"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Write",
|
|
||||||
"WriteFile"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"File",
|
|
||||||
"FileExists"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"font-",
|
|
||||||
"font-weight"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"list-st",
|
|
||||||
"list-style-type"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"html",
|
|
||||||
"html5\tSimple HTML5 Boilerplate"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"backgroun",
|
|
||||||
"background-color"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"background-",
|
|
||||||
"background-color"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"place",
|
|
||||||
"place_content"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"string",
|
|
||||||
"stringify"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"cor",
|
|
||||||
"corpbiege"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"inner",
|
|
||||||
"innerWidth"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"program",
|
|
||||||
"programcontent"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"corp",
|
|
||||||
"corpgreen"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"buffers":
|
|
||||||
[
|
|
||||||
],
|
|
||||||
"build_system": "",
|
|
||||||
"build_system_choices":
|
|
||||||
[
|
|
||||||
],
|
|
||||||
"build_varint": "",
|
|
||||||
"command_palette":
|
|
||||||
{
|
|
||||||
"height": 89.0,
|
|
||||||
"last_filter": "",
|
|
||||||
"selected_items":
|
|
||||||
[
|
|
||||||
[
|
|
||||||
"key",
|
|
||||||
"Preferences: Key Bindings"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"live",
|
|
||||||
"MarkdownLivePreview: Open Preview"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"markdown",
|
|
||||||
"MarkdownLivePreview: Open Settings"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"install",
|
|
||||||
"Package Control: Install Package"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"packages",
|
|
||||||
"Package Control: Discover Packages"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Package Control: ",
|
|
||||||
"Package Control: Discover Packages"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"insta",
|
|
||||||
"Package Control: Install Package"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Package Control: install",
|
|
||||||
"Package Control: Install Package"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"package",
|
|
||||||
"Package Control: Install Package"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"compare",
|
|
||||||
"Compare with..."
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"install\t",
|
|
||||||
"Package Control: Install Package"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"list",
|
|
||||||
"Package Control: List Packages"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"jav",
|
|
||||||
"Set Syntax: JavaScript"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"diff",
|
|
||||||
"Set Syntax: Diff"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"width": 444.0
|
|
||||||
},
|
|
||||||
"console":
|
|
||||||
{
|
|
||||||
"height": 0.0,
|
|
||||||
"history":
|
|
||||||
[
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"distraction_free":
|
|
||||||
{
|
|
||||||
"menu_visible": true,
|
|
||||||
"show_minimap": false,
|
|
||||||
"show_open_files": false,
|
|
||||||
"show_tabs": false,
|
|
||||||
"side_bar_visible": false,
|
|
||||||
"status_bar_visible": false
|
|
||||||
},
|
|
||||||
"expanded_folders":
|
|
||||||
[
|
|
||||||
"/Users/am/Desktop/ds2-core",
|
|
||||||
"/Users/am/Desktop/ds2-core/src",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/sticky-note",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/switch",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/tooltip"
|
|
||||||
],
|
|
||||||
"file_history":
|
|
||||||
[
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/switch/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/sticky-note/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/layouts/breakpoints/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/layouts/header/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/layouts/tabs/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/tooltip/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/status/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/colours/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/core/_master-index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/_config.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/components/sticky-note-core/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/components/switch-core/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/components/tooltip-core/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/layouts/breakpoints-core/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/layouts/header-core/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/layouts/tabs-core/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/status-core/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2-core/src/pg/patterns/colours-core/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/components/sticky-note-core/_sticky-note.js",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/layouts/tabs-core/_tabs.js",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/_master-index.pug",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/_config.pug",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/scss/scaffolding.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/js/scaffolding.js",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/js/_core.js",
|
|
||||||
"/Users/am/Desktop/ds2 core/public/assets/scaffolding-min.js",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/layouts/header-core/_header.pug",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/layouts/header-core/_header.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/layouts/header-core/header.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/components/tooltip-core/_tooltip.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/components/tooltip-core/tooltip.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/components/switch-core/_switch.js",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/components/sticky-note-core/sticky-note.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/components/sticky-note-core/_sticky-note.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/colours-core/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/_color-samples.pug",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/layouts/tabs-core/tabs.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/layouts/breakpoints-core/_breakpoints.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/layouts/tabs-core/_tabs-jquery.js",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/layouts/tabs-core/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/layouts/tabs-core/_tabs.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/layouts/tabs-core/_tabs.pug",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/scss/_color-samples.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/js/_color-samples.js",
|
|
||||||
"/Users/am/Desktop/ds2 core/public/assets/scaffolding.css",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/status-core/_status.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/status-core/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/patterns/layouts/header-core/index.pug",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/js/_geturlvars.js",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/js/_core-cookies.js",
|
|
||||||
"/Users/am/Desktop/My DS2/src/js/scaffolding.js",
|
|
||||||
"/Users/am/Desktop/ds2 core/Readme.md",
|
|
||||||
"/Users/am/Desktop/My DS2/src/scss/_color-samples.scss",
|
|
||||||
"/Users/am/Desktop/My DS2/src/scss/scaffolding.scss",
|
|
||||||
"/Users/am/Desktop/My DS2/public/assets/scaffolding.css",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/_config.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/scss/_core.scss",
|
|
||||||
"/Users/am/Desktop/ds2 core/src/pg/_core.scss.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/_master-pattern.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/_color-samples.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/other-docs/status/index.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/_core.scss.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/_master-index.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/visual-design/spacing/index.pug",
|
|
||||||
"/Users/am/Desktop/statuses.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/index.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/components/sticky-note/_sticky-note.scss",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/components/sticky-note/_sticky-note.js",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/components/sticky-note/index.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/layouts/tabs/index.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/js/_oneClickSelect.js",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/layouts/tabs/_tabs.js",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/layouts/tabs/_tabs-module.js",
|
|
||||||
"/Users/am/Desktop/tabs-module-old.js",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/layouts/tabs/esc6 tabs.js",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/layouts/tabs/tabs-module.js",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/layouts/tabs/_tabs.scss",
|
|
||||||
"/Users/am/Desktop/My DS2/public/assets/scaffolding-min.js",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/layouts/tabs/tabs.scss",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/components/sticky-note/sticky-note.scss",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/components/form-fields/text/index.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/other-docs/flex-box/_flex-box.scss",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/other-docs/grid/_grid.scss",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/_config.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/form-fields/button/_button.scss",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/form-fields/text/_text.scss",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/form-fields/text/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/form-fields/_form-fields.scss",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/form-fields/textarea/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/form-fields/textarea/_textarea.scss",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/form-fields/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/form-fields/button/button.css",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/form-fields/form-fields.scss",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/components/form-fields/button/button.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/form-fields/button/index.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/components/form-fields/text/text.pug",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/components/form-fields/text/text.scss",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/components/form-fields/form-fields.scss",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/progress-bar/_progress-bar.scss",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/components/form-fields/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/scss/scaffolding.scss",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/sticky-note/_sticky-note.scss",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/sticky-note/_sticky-note.js",
|
|
||||||
"/Users/am/Desktop/my DS2/src/js/scaffolding.js",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/layouts/main-navigation/_main-navigation.js",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/_core.scss.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/public/assets/scaffolding.css",
|
|
||||||
"/Users/am/Desktop/My DS2/src/pg/patterns/layouts/tabs/_tabs.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/_color-samples.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/layouts/tabs/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/spacing/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/spacing/_spacing.scss",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/typography/_content.scss",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/spacing/spacing.scss",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/typography/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/site-identifiers/favicon-and-browser-tab/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/site-identifiers/monogram/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/switch/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/tooltip/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/link/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/components/progress-bar/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/layouts/main-navigation/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/layouts/breakpoints/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/notifications/index.pug",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/spacing/spacing.css",
|
|
||||||
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/colours/index.pug"
|
|
||||||
],
|
|
||||||
"find":
|
|
||||||
{
|
|
||||||
"height": 26.0
|
|
||||||
},
|
|
||||||
"find_in_files":
|
|
||||||
{
|
|
||||||
"height": 179.0,
|
|
||||||
"where_history":
|
|
||||||
[
|
|
||||||
"<open files>"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"find_state":
|
|
||||||
{
|
|
||||||
"case_sensitive": false,
|
|
||||||
"find_history":
|
|
||||||
[
|
|
||||||
"../core/_master-pattern.pug",
|
|
||||||
"../core",
|
|
||||||
"hide-deprecated",
|
|
||||||
"deprecated",
|
|
||||||
"ajx",
|
|
||||||
"console.log",
|
|
||||||
"setupStickies",
|
|
||||||
"document.querySelector",
|
|
||||||
"renderPatterns",
|
|
||||||
"xhr",
|
|
||||||
"xhttp",
|
|
||||||
"document.querySelector",
|
|
||||||
"classList",
|
|
||||||
"core.",
|
|
||||||
"innerHTML",
|
|
||||||
"core.",
|
|
||||||
"generateSCSS",
|
|
||||||
"showMessage(",
|
|
||||||
"core.showMessage",
|
|
||||||
"core.colours",
|
|
||||||
"core.colors",
|
|
||||||
"status-",
|
|
||||||
"header",
|
|
||||||
"status:",
|
|
||||||
"status",
|
|
||||||
"core: \"true\",",
|
|
||||||
"1rem",
|
|
||||||
"main-grid-4col",
|
|
||||||
"@include main-grid-4col;",
|
|
||||||
"components",
|
|
||||||
"layouts",
|
|
||||||
"alert",
|
|
||||||
"colour",
|
|
||||||
"main-grid",
|
|
||||||
"{\n\t\t\t\t\tname: \"header\",\n\t\t\t\t\tstatus: \"complete\",\n\t\t\t\t\tcore: true,\n\t\t\t\t}, ",
|
|
||||||
"colours",
|
|
||||||
"get.vars.",
|
|
||||||
"get.",
|
|
||||||
"colours.",
|
|
||||||
"cookie.get",
|
|
||||||
"cookie.set",
|
|
||||||
"cookie",
|
|
||||||
"function"
|
|
||||||
],
|
|
||||||
"highlight": false,
|
|
||||||
"in_selection": false,
|
|
||||||
"preserve_case": false,
|
|
||||||
"regex": false,
|
|
||||||
"replace_history":
|
|
||||||
[
|
|
||||||
"../../core/_master-pattern.pug",
|
|
||||||
"colors",
|
|
||||||
"core.cookie.get",
|
|
||||||
"core.cookie.set"
|
|
||||||
],
|
|
||||||
"reverse": false,
|
|
||||||
"scrollbar_highlights": true,
|
|
||||||
"show_context": true,
|
|
||||||
"use_buffer2": true,
|
|
||||||
"use_gitignore": true,
|
|
||||||
"whole_word": false,
|
|
||||||
"wrap": false
|
|
||||||
},
|
|
||||||
"groups":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"sheets":
|
|
||||||
[
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"incremental_find":
|
|
||||||
{
|
|
||||||
"height": 26.0
|
|
||||||
},
|
|
||||||
"input":
|
|
||||||
{
|
|
||||||
"height": 209.0
|
|
||||||
},
|
|
||||||
"layout":
|
|
||||||
{
|
|
||||||
"cells":
|
|
||||||
[
|
|
||||||
[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"cols":
|
|
||||||
[
|
|
||||||
0.0,
|
|
||||||
1.0
|
|
||||||
],
|
|
||||||
"rows":
|
|
||||||
[
|
|
||||||
0.0,
|
|
||||||
1.0
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"menu_visible": true,
|
|
||||||
"output.diff_views":
|
|
||||||
{
|
|
||||||
"height": 339.0
|
|
||||||
},
|
|
||||||
"output.exec":
|
|
||||||
{
|
|
||||||
"height": 147.0
|
|
||||||
},
|
|
||||||
"output.find_results":
|
|
||||||
{
|
|
||||||
"height": 0.0
|
|
||||||
},
|
|
||||||
"pinned_build_system": "",
|
|
||||||
"project": "ds2 core.sublime-project",
|
|
||||||
"replace":
|
|
||||||
{
|
|
||||||
"height": 68.0
|
|
||||||
},
|
|
||||||
"save_all_on_build": false,
|
|
||||||
"select_file":
|
|
||||||
{
|
|
||||||
"height": 0.0,
|
|
||||||
"last_filter": "",
|
|
||||||
"selected_items":
|
|
||||||
[
|
|
||||||
],
|
|
||||||
"width": 0.0
|
|
||||||
},
|
|
||||||
"select_project":
|
|
||||||
{
|
|
||||||
"height": 500.0,
|
|
||||||
"last_filter": "",
|
|
||||||
"selected_items":
|
|
||||||
[
|
|
||||||
[
|
|
||||||
"",
|
|
||||||
"D:\\Projects\\apps\\Apps Website.sublime-project"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"width": 380.0
|
|
||||||
},
|
|
||||||
"select_symbol":
|
|
||||||
{
|
|
||||||
"height": 274.0,
|
|
||||||
"last_filter": "",
|
|
||||||
"selected_items":
|
|
||||||
[
|
|
||||||
],
|
|
||||||
"width": 592.0
|
|
||||||
},
|
|
||||||
"selected_group": 0,
|
|
||||||
"settings":
|
|
||||||
{
|
|
||||||
},
|
|
||||||
"show_minimap": false,
|
|
||||||
"show_open_files": true,
|
|
||||||
"show_tabs": true,
|
|
||||||
"side_bar_visible": true,
|
|
||||||
"side_bar_width": 254.0,
|
|
||||||
"status_bar_visible": true,
|
|
||||||
"template_settings":
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -492,6 +492,9 @@
|
|||||||
"resolveJsonModule": false,
|
"resolveJsonModule": false,
|
||||||
"esModuleInterop": false,
|
"esModuleInterop": false,
|
||||||
"useDefineForClassFields": false
|
"useDefineForClassFields": false
|
||||||
|
},
|
||||||
|
"custom-gzg6caunrh": {
|
||||||
|
"command": "cp {{input}} {{output}}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fileTypes": {
|
"fileTypes": {
|
||||||
@ -955,6 +958,26 @@
|
|||||||
"type": "SOURCE_RELATIVE",
|
"type": "SOURCE_RELATIVE",
|
||||||
"relativePath": ""
|
"relativePath": ""
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"custom-sm9kzo2npr": {
|
||||||
|
"autoCompile": true,
|
||||||
|
"label": "Pug pattern to pug file",
|
||||||
|
"extensions": [
|
||||||
|
".pp"
|
||||||
|
],
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"task": "custom-gzg6caunrh",
|
||||||
|
"enable": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"output": {
|
||||||
|
"extension": ".pug",
|
||||||
|
"type": "SOURCE_RELATIVE",
|
||||||
|
"relativePath": "",
|
||||||
|
"suffix": "-dist",
|
||||||
|
"alwaysSuffix": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
@ -1184,6 +1207,9 @@
|
|||||||
"concat-js": {
|
"concat-js": {
|
||||||
"enable": false
|
"enable": false
|
||||||
},
|
},
|
||||||
|
"babel": {
|
||||||
|
"enable": true
|
||||||
|
},
|
||||||
"bundle-js": {
|
"bundle-js": {
|
||||||
"enable": true,
|
"enable": true,
|
||||||
"options": {
|
"options": {
|
||||||
@ -1346,6 +1372,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"file": "src/pg/patterns/core/sticky-note/_sticky-note.pp",
|
||||||
|
"config": {
|
||||||
|
"autoCompile": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "src/pg/patterns/core/switch/_switch.pp",
|
||||||
|
"config": {
|
||||||
|
"autoCompile": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "src/pg/patterns/core/tabs/_tabs.pp",
|
||||||
|
"config": {
|
||||||
|
"autoCompile": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "src/pg/patterns/core/tooltip/_tooltip.pp",
|
||||||
|
"config": {
|
||||||
|
"autoCompile": true
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"file": "src/pg/patterns/layouts/header-core/header.scss",
|
"file": "src/pg/patterns/layouts/header-core/header.scss",
|
||||||
"config": {
|
"config": {
|
||||||
|
722
public/assets/scaffolding-min.js
vendored
722
public/assets/scaffolding-min.js
vendored
@ -4,31 +4,34 @@
|
|||||||
/* 1 */
|
/* 1 */
|
||||||
/***/ (function(module) {
|
/***/ (function(module) {
|
||||||
|
|
||||||
const getDate = function(){
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||||
|
var getDate = function getDate() {
|
||||||
var d = new Date();
|
var d = new Date();
|
||||||
return d.toLocaleDateString(lang, {day: "numeric", month: "long", year: "numeric"});
|
return d.toLocaleDateString(lang, {
|
||||||
}
|
day: "numeric",
|
||||||
String.prototype.toTitleCase = function() {
|
month: "long",
|
||||||
return this.replace(/\w\S*/g, function(txt) {
|
year: "numeric"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
String.prototype.toTitleCase = function () {
|
||||||
|
return this.replace(/\w\S*/g, function (txt) {
|
||||||
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
String.prototype.toSentenceCase = function() {
|
String.prototype.toSentenceCase = function () {
|
||||||
return this.charAt(0).toUpperCase() + this.substr(1).toLowerCase();
|
return this.charAt(0).toUpperCase() + this.substr(1).toLowerCase();
|
||||||
}
|
};
|
||||||
String.prototype.toContent = function() {
|
String.prototype.toContent = function () {
|
||||||
return this.replace(/-/g, " ");
|
return this.replace(/-/g, " ");
|
||||||
}
|
};
|
||||||
String.prototype.toPath = function() {
|
String.prototype.toPath = function () {
|
||||||
return this.trim().replace(/ /g, "_").replace(/-/g, "_").replace(/[\/\W]/g, "").replace(/_/g, "-");
|
return this.trim().replace(/ /g, "_").replace(/-/g, "_").replace(/[\/\W]/g, "").replace(/_/g, "-");
|
||||||
}
|
};
|
||||||
|
var font = {
|
||||||
const font = {
|
|
||||||
size: 0
|
size: 0
|
||||||
}
|
};
|
||||||
|
var copyFallback = function copyFallback(copyInfo, attr) {
|
||||||
const copyColourFallback = (copyInfo, attr) => {
|
console.log("fallback");
|
||||||
console.log("fallback")
|
|
||||||
var textArea = document.createElement('textarea');
|
var textArea = document.createElement('textarea');
|
||||||
textArea.value = copyInfo;
|
textArea.value = copyInfo;
|
||||||
|
|
||||||
@ -36,48 +39,101 @@ const copyColourFallback = (copyInfo, attr) => {
|
|||||||
textArea.style.top = '0';
|
textArea.style.top = '0';
|
||||||
textArea.style.left = '0';
|
textArea.style.left = '0';
|
||||||
textArea.style.position = 'fixed';
|
textArea.style.position = 'fixed';
|
||||||
|
|
||||||
document.body.appendChild(textArea);
|
document.body.appendChild(textArea);
|
||||||
textArea.focus();
|
textArea.focus();
|
||||||
textArea.select();
|
textArea.select();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var successful = document.execCommand('copy');
|
var successful = document.execCommand('copy');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (successful) {
|
if (successful) {
|
||||||
//copyInfo.success();
|
//copyInfo.success();
|
||||||
showMessage(`Copied ${attr}.`)
|
showMessage("Copied ".concat(attr, "."));
|
||||||
} else {
|
} else {
|
||||||
//copyInfo.error();
|
//copyInfo.error();
|
||||||
showMessage(`Copy failed (${attr}).`, false)
|
showMessage("Copy failed (".concat(attr, ")."), false);
|
||||||
}
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
showMessage(`Copy failed (${attr}). ${err.Message}`, false);
|
showMessage("Copy failed (".concat(attr, "). ").concat(err.Message), false);
|
||||||
|
|
||||||
//copyInfo.error(err);
|
//copyInfo.error(err);
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
document.body.removeChild(textArea);
|
document.body.removeChild(textArea);
|
||||||
}
|
};
|
||||||
|
var showMessage = function showMessage(m, s) {
|
||||||
const showMessage = (m, s) => {
|
|
||||||
s = s == undefined ? true : s;
|
s = s == undefined ? true : s;
|
||||||
console.log("Copy success (navigator.clipboard)");
|
console.log("Copy success (navigator.clipboard)");
|
||||||
let status = document.createElement("div");
|
var status = document.createElement("div");
|
||||||
status.setAttribute("id", "copystatus");
|
status.setAttribute("id", "copystatus");
|
||||||
// status.style.display = "none";
|
// status.style.display = "none";
|
||||||
status.innerHTML = "<div class='"+(s ? "succeeded" : "failed")+"'>" + m + "</div>";
|
status.innerHTML = "<div class='" + (s ? "succeeded" : "failed") + "'>" + m + "</div>";
|
||||||
document.querySelector("body").prepend(status)
|
document.querySelector("body").prepend(status);
|
||||||
|
status.querySelector("div").style.top = window.scrollY + 100 + "px";
|
||||||
status.querySelector("div").style.top = (window.scrollY + 100)+ "px";
|
setTimeout(function () {
|
||||||
setTimeout( () => {
|
|
||||||
status.remove();
|
status.remove();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
};
|
||||||
|
var getURLVars = function getURLVars() {
|
||||||
const oneClickSelect = (e, t = e.currentTarget) => {
|
var oResult = {};
|
||||||
|
if (location.search.length > 0) {
|
||||||
|
var aQueryString = location.search.substr(1).split("&");
|
||||||
|
for (var i = 0; i < aQueryString.length; i++) {
|
||||||
|
var aTemp = aQueryString[i].split("=");
|
||||||
|
if (aTemp[1].length > 0) {
|
||||||
|
oResult[aTemp[0]] = decodeURIComponent(aTemp[1].replace(/\+/g, '%20'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return oResult;
|
||||||
|
};
|
||||||
|
module.exports = {
|
||||||
|
url: function () {
|
||||||
|
var v = {};
|
||||||
|
if (location.search.length > 0) {
|
||||||
|
var qs = location.search.substr(1).split("&");
|
||||||
|
for (var i = 0; i < qs.length; i++) {
|
||||||
|
var t = qs[i].split("=");
|
||||||
|
if (t[1].length > 0) {
|
||||||
|
v[t[0]] = decodeURIComponent(t[1].replace(/\+/g, '%20'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}(),
|
||||||
|
cookie: {
|
||||||
|
set: function set(name, value, expires, path, domain, secure) {
|
||||||
|
switch (_typeof(expires)) {
|
||||||
|
case "number":
|
||||||
|
var d = new Date();
|
||||||
|
expires = d.setTime(d + expires * 24 * 60 * 60 * 1000);
|
||||||
|
break;
|
||||||
|
case "object":
|
||||||
|
expires = expires.toGMTString();
|
||||||
|
}
|
||||||
|
document.cookie = name + "=" + escape(value) + (expires ? "; expires=" + expires : "") + "; path=/" + (domain ? "; domain=" + domain : "") + (secure ? "; secure" : "");
|
||||||
|
},
|
||||||
|
get: function get(cname) {
|
||||||
|
var name = cname + "=";
|
||||||
|
var ca = document.cookie.split(";");
|
||||||
|
for (var i = 0; i < ca.length; i++) {
|
||||||
|
var c = ca[i];
|
||||||
|
while (c.charAt(0) === " ") {
|
||||||
|
c = c.substring(1);
|
||||||
|
}
|
||||||
|
if (c.indexOf(name) === 0) {
|
||||||
|
return c.substring(name.length, c.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
remove: function remove(cname) {
|
||||||
|
module.exports.cookie.set(cname, null, new Date(null));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
oneClickSelect: function oneClickSelect(e) {
|
||||||
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : e.currentTarget;
|
||||||
// In here, "this" is the element
|
// In here, "this" is the element
|
||||||
var range, selection;
|
var range, selection;
|
||||||
if (window.getSelection) {
|
if (window.getSelection) {
|
||||||
@ -91,192 +147,163 @@ const oneClickSelect = (e, t = e.currentTarget) => {
|
|||||||
range.moveToElementText(t);
|
range.moveToElementText(t);
|
||||||
range.select();
|
range.select();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const getURLVars = () => {
|
|
||||||
var oResult = {};
|
|
||||||
if (location.search.length > 0) {
|
|
||||||
var aQueryString = (location.search.substr(1)).split("&");
|
|
||||||
for (var i = 0; i < aQueryString.length; i++) {
|
|
||||||
var aTemp = aQueryString[i].split("=");
|
|
||||||
if (aTemp[1].length > 0) {
|
|
||||||
oResult[aTemp[0]] = decodeURIComponent(aTemp[1].replace(/\+/g, '%20'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return oResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
url: getURLVars(),
|
|
||||||
cookie: {
|
|
||||||
set: (name, value, expires, path, domain, secure) => {
|
|
||||||
switch(typeof expires) {
|
|
||||||
case "number" :
|
|
||||||
var d = new Date()
|
|
||||||
expires = d.setTime(d + (expires*24*60*60*1000));
|
|
||||||
break;
|
|
||||||
case "object" :
|
|
||||||
expires = expires.toGMTString();
|
|
||||||
}
|
|
||||||
document.cookie= name + "=" + escape(value) +
|
|
||||||
((expires) ? "; expires=" + expires : "") +
|
|
||||||
("; path=/") +
|
|
||||||
((domain) ? "; domain=" + domain : "") +
|
|
||||||
((secure) ? "; secure" : "");
|
|
||||||
},
|
|
||||||
get: (cname) => {
|
|
||||||
var name = cname + "=";
|
|
||||||
var ca = document.cookie.split(";");
|
|
||||||
for(var i = 0; i <ca.length; i++) {
|
|
||||||
var c = ca[i];
|
|
||||||
while (c.charAt(0)===" ") {
|
|
||||||
c = c.substring(1);
|
|
||||||
}
|
|
||||||
if (c.indexOf(name) === 0) {
|
|
||||||
return c.substring(name.length,c.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
},
|
|
||||||
remove: (cnane) => {
|
|
||||||
setCookie(cname, "", -1);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
colour: {
|
colour: {
|
||||||
|
copy: function copy(w, t) {
|
||||||
copy: (w, t) => {
|
var c = t.parentNode.getAttribute("data-" + (w == "var" ? "token" : w));
|
||||||
let c = t.parentNode.getAttribute("data-" + (w=="var" ? "token" : w));
|
c = w == "var" ? "var(".concat(c, ")") : c;
|
||||||
c = w == "var" ? `var(${c})` : c;
|
|
||||||
|
|
||||||
if (navigator.clipboard) {
|
if (navigator.clipboard) {
|
||||||
navigator.clipboard.writeText(c).then(function() {
|
navigator.clipboard.writeText(c).then(function () {
|
||||||
showMessage(`Copied ${w}.`);
|
showMessage("Copied ".concat(w, "."));
|
||||||
}, function(e) {
|
}, function (e) {
|
||||||
copyColourFallback(c,w);
|
copyFallback(c, w);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
copyColourFallback(c, w);
|
copyFallback(c, w);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
positionTooltip: function positionTooltip() {
|
||||||
positionTooltip: () => {
|
document.querySelectorAll("color-pill > span").forEach(function (ps) {
|
||||||
document.querySelectorAll("color-pill > span").forEach((ps) => {
|
ps.querySelectorAll("div.tooltip-tc").forEach(function (tip) {
|
||||||
ps.querySelectorAll("div.tooltip-tc").forEach((tip) => {
|
if (font.size * 10 > ps.offsetLeft) {
|
||||||
if ( (font.size * 10) > ps.offsetLeft ) {
|
|
||||||
tip.setAttribute("tip-position", "right");
|
tip.setAttribute("tip-position", "right");
|
||||||
} else {
|
} else {
|
||||||
tip.setAttribute("tip-position", "bottom");
|
tip.setAttribute("tip-position", "bottom");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
init: (args = {}) => {
|
getCSS: function getCSS(el, prop) {
|
||||||
const url = getURLVars();
|
var b = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||||
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px",""));
|
return window.getComputedStyle(el, null).getPropertyValue(prop);
|
||||||
|
},
|
||||||
|
getTabPath: function getTabPath(t) {
|
||||||
|
var url = window.location.toString();
|
||||||
|
url = url.indexOf("?") > 0 ? url.substring(0, url.indexOf("?")) : url;
|
||||||
|
url = "".concat(url, "?p=").concat(t.closest("article").getAttribute("data-path"), "#").concat(t.getAttribute("id"));
|
||||||
|
var type = "URL";
|
||||||
|
if (navigator.clipboard) {
|
||||||
|
navigator.clipboard.writeText(url).then(function () {
|
||||||
|
showMessage("Copied ".concat(type, "."));
|
||||||
|
}, function (e) {
|
||||||
|
copyFallback(url, type);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
copyFallback(url, type);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
init: function init() {
|
||||||
|
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||||
|
var url = getURLVars();
|
||||||
|
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px", ""));
|
||||||
if (url.p !== undefined) {
|
if (url.p !== undefined) {
|
||||||
document.querySelectorAll("main article:not([data-path^='" + url.p + "'])").forEach((a) => {
|
document.querySelectorAll("main article:not([data-path^='" + url.p + "'])").forEach(function (a) {
|
||||||
a.remove();
|
a.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (url.p == -1) {
|
if (url.p == -1) {
|
||||||
document.querySelector("title").innerHTML = `${url.p.toContent().toTitleCase()} | ${ document.querySelector("title").getAttribute("data-site") }`;
|
document.querySelector("title").innerHTML = "".concat(url.p.toContent().toTitleCase(), " | ").concat(document.querySelector("title").getAttribute("data-site"));
|
||||||
} else {
|
} else {
|
||||||
document.querySelector("title").innerHTML = `${url.p.substring(url.p.lastIndexOf("/")+1).toContent().toTitleCase()} | ${ document.querySelector("title").getAttribute("data-site") }`
|
var theTitle = document.querySelectorAll("article");
|
||||||
|
if (theTitle.length > 0) {
|
||||||
|
theTitle = theTitle[0].getAttribute("data-name").toContent().toTitleCase();
|
||||||
|
if (document.querySelector("article").getAttribute("data-display") !== null) {
|
||||||
|
theTitle = document.querySelector("article").getAttribute("data-display");
|
||||||
|
}
|
||||||
|
document.querySelector("title").innerHTML = "".concat(theTitle, " | ").concat(document.querySelector("title").getAttribute("data-site"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (typeof args.beforeArticleLoad == "function") args.beforeArticleLoad(a);
|
if (typeof args.beforeArticleLoad == "function") args.beforeArticleLoad();
|
||||||
|
document.querySelectorAll("article").forEach(function (a) {
|
||||||
document.querySelectorAll("article").forEach((a) => {
|
if (a.getAttribute("data-template") != "none") {
|
||||||
if ( a.getAttribute("data-template") != "none" ) {
|
var observer = new IntersectionObserver(function (articles) {
|
||||||
let path = a.getAttribute("data-path");
|
articles.forEach(function (article) {
|
||||||
path = "patterns/" +
|
var a = article.target;
|
||||||
(a.getAttribute("data-core") == "true" ?
|
if (article.isIntersecting == true) {
|
||||||
"core/" + path.substring(path.lastIndexOf("/") + 1) :
|
var path = a.getAttribute("data-path");
|
||||||
a.getAttribute("data-path"))
|
path = "patterns/" + (a.getAttribute("data-core") == "true" ? "core/" + path.substring(path.lastIndexOf("/") + 1) : a.getAttribute("data-path")) + "/index.html";
|
||||||
+ "/index.html";
|
var ASYNC = true;
|
||||||
const ASYNC = true;
|
var ajx = new XMLHttpRequest();
|
||||||
let ajx = new XMLHttpRequest();
|
ajx.onreadystatechange = function () {
|
||||||
ajx.onreadystatechange = () => {
|
|
||||||
if (ajx.readyState == 4) {
|
if (ajx.readyState == 4) {
|
||||||
|
observer.unobserve(article.target);
|
||||||
switch (ajx.status) {
|
switch (ajx.status) {
|
||||||
case 200:
|
case 200:
|
||||||
a.innerHTML = a.innerHTML + ajx.responseText;
|
a.innerHTML = a.innerHTML + ajx.responseText;
|
||||||
|
a.style.height = "auto";
|
||||||
switch (a.getAttribute("data-template")) {
|
switch (a.getAttribute("data-template")) {
|
||||||
case "pug":
|
case "pug":
|
||||||
a.querySelectorAll("pre").forEach((aa) => {
|
a.querySelectorAll("pre").forEach(function (aa) {
|
||||||
aa.innerHTML = `<code class="${aa.getAttribute("class")}">${aa.innerHTML}</code>`;
|
aa.innerHTML = "<code class=\"".concat(aa.getAttribute("class"), "\">").concat(aa.innerHTML, "</code>");
|
||||||
})
|
});
|
||||||
break;
|
break;
|
||||||
case "md":
|
case "md":
|
||||||
a.querySelectorAll("code").forEach((aa) => {
|
a.querySelectorAll("code").forEach(function (aa) {
|
||||||
aa.classList.add("language-html");
|
aa.classList.add("language-html");
|
||||||
})
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
a.querySelectorAll("code").forEach(function (c) {
|
||||||
a.querySelectorAll("code").forEach((c)=> {
|
|
||||||
c.classList.add("line-numbers");
|
c.classList.add("line-numbers");
|
||||||
c.innerHTML = c.innerHTML.replace(/</g, "<");
|
c.innerHTML = c.innerHTML.replace(/</g, "<");
|
||||||
c.classList.add("copy-to-clipboard-button");
|
c.classList.add("copy-to-clipboard-button");
|
||||||
})
|
});
|
||||||
if (typeof args.success == "function") args.success(a);
|
if (typeof args.success == "function") args.success(a);
|
||||||
|
|
||||||
Prism.highlightAll();
|
Prism.highlightAll();
|
||||||
|
a.querySelectorAll("code").forEach(function (c) {
|
||||||
a.querySelectorAll("code").forEach((c)=> {
|
c.onclick = function (e) {
|
||||||
c.onclick = (e) => {
|
module.exports.oneClickSelect(e);
|
||||||
oneClickSelect(e);
|
};
|
||||||
}
|
});
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
module.exports.colour.positionTooltip();
|
module.exports.colour.positionTooltip();
|
||||||
window.onresize = () => {
|
window.onresize = function () {
|
||||||
module.exports.colour.positionTooltip();
|
module.exports.colour.positionTooltip();
|
||||||
}
|
};
|
||||||
|
a.querySelectorAll("name > span, color-pill > span").forEach(function (pill) {
|
||||||
a.querySelectorAll("name > span, color-pill > span").forEach((pill) => {
|
pill.onclick = function (e) {
|
||||||
pill.onclick = (e) => {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let w = "";
|
var w = "";
|
||||||
if (e.metaKey || e.ctrlKey || e.keyCode == 91 || e.keyCode == 224) {
|
if (e.metaKey || e.ctrlKey || e.keyCode == 91 || e.keyCode == 224) {
|
||||||
w = "var";
|
w = "var";
|
||||||
} else if (e.altKey) {
|
} else if (e.altKey) {
|
||||||
w = "token"
|
w = "token";
|
||||||
} else if (e.shiftKey) {
|
} else if (e.shiftKey) {
|
||||||
w = "rgb";
|
w = "rgb";
|
||||||
} else {
|
} else {
|
||||||
w = "hex";
|
w = "hex";
|
||||||
}
|
}
|
||||||
module.exports.colour.copy(w, pill);
|
module.exports.colour.copy(w, pill);
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 404:
|
case 404:
|
||||||
|
|
||||||
if (typeof args.notFound == "function") args.notFound(a, path);
|
if (typeof args.notFound == "function") args.notFound(a, path);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.log("uncaught http error", { status: ajx.status, path: a.getAttribute("data-path") });
|
console.log("uncaught http error", {
|
||||||
|
status: ajx.status,
|
||||||
|
path: a.getAttribute("data-path")
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
a.style.height = "auto";
|
||||||
if (typeof args.done == "function") args.done(a);
|
if (typeof args.done == "function") args.done(a);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ajx.open("GET", path, ASYNC);
|
ajx.open("GET", path, ASYNC);
|
||||||
ajx.send();
|
ajx.send();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
}, {
|
||||||
if (typeof args.afterArticleLoad == "function") args.afterArticleLoad(a);
|
threshold: 0,
|
||||||
|
rootMargin: "100%"
|
||||||
|
});
|
||||||
|
observer.observe(a);
|
||||||
|
} else {
|
||||||
|
a.style.height = "auto";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (typeof args.afterArticleLoad == "function") args.afterArticleLoad();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2987,52 +3014,49 @@ Prism.languages.webmanifest = Prism.languages.json;
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 8 */
|
/* 8 */
|
||||||
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
/***/ (function(module) {
|
||||||
|
|
||||||
"use strict";
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
||||||
__webpack_require__.r(__webpack_exports__);
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||||
/* harmony export */ init: function() { return /* binding */ init; }
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||||
/* harmony export */ });
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||||
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
||||||
//- DS2 core (c) 2024 Alexander McIlwraith
|
//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
const font = {
|
var font = {
|
||||||
size: 0
|
size: 0
|
||||||
}
|
};
|
||||||
|
var pos = {
|
||||||
const pos = {
|
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0
|
y: 0
|
||||||
}
|
};
|
||||||
|
|
||||||
function drag(sticky) {
|
function drag(sticky) {
|
||||||
sticky.onmousedown = event => {
|
sticky.onmousedown = function (event) {
|
||||||
// get the position within the sticky
|
// get the position within the sticky
|
||||||
pos.x = (event.clientX - sticky.offsetLeft);
|
pos.x = event.clientX - sticky.offsetLeft;
|
||||||
pos.y = (event.clientY - sticky.offsetTop);
|
pos.y = event.clientY - sticky.offsetTop;
|
||||||
|
|
||||||
// on mouse move, move the sticky to the position, minus the offset, of the mouse
|
// on mouse move, move the sticky to the position, minus the offset, of the mouse
|
||||||
document.onmousemove = documentEvent => {
|
document.onmousemove = function (documentEvent) {
|
||||||
sticky.style.top = (documentEvent.clientY - pos.y) + 'px';
|
sticky.style.top = documentEvent.clientY - pos.y + 'px';
|
||||||
sticky.style.left = (documentEvent.clientX - pos.x) + 'px';
|
sticky.style.left = documentEvent.clientX - pos.x + 'px';
|
||||||
sticky.setAttribute("moved", "true");
|
sticky.setAttribute("moved", "true");
|
||||||
}
|
};
|
||||||
// when done, remove mouse move and mouse up handlers.
|
// when done, remove mouse move and mouse up handlers.
|
||||||
document.onmouseup = () => {
|
document.onmouseup = function () {
|
||||||
document.onmouseup = null;
|
document.onmouseup = null;
|
||||||
document.onmousemove = null;
|
document.onmousemove = null;
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function waitForElement(selector) {
|
function waitForElement(selector) {
|
||||||
return new Promise(resolve => {
|
return new Promise(function (resolve) {
|
||||||
if (document.querySelector(selector)) {
|
if (document.querySelector(selector)) {
|
||||||
return resolve(document.querySelector(selector));
|
return resolve(document.querySelector(selector));
|
||||||
}
|
}
|
||||||
|
var observer = new MutationObserver(function (mutations) {
|
||||||
const observer = new MutationObserver(mutations => {
|
|
||||||
if (document.querySelector(selector)) {
|
if (document.querySelector(selector)) {
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
resolve(document.querySelector(selector));
|
resolve(document.querySelector(selector));
|
||||||
@ -3046,85 +3070,84 @@ function waitForElement(selector) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
var checkBottom = function checkBottom(attach) {
|
||||||
const checkBottom = (attach) => {
|
|
||||||
// check if top or bottom
|
// check if top or bottom
|
||||||
if (attach.y < 0) {
|
if (attach.y < 0) {
|
||||||
attach.ys = "bottom";
|
attach.ys = "bottom";
|
||||||
attach.y = attach.y * -1;
|
attach.y = attach.y * -1;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
var setStickyPostions = function setStickyPostions(s, attach) {
|
||||||
const setStickyPostions = (s, attach) => {
|
|
||||||
// set
|
// set
|
||||||
s.style[attach.ys] = `${attach.y}px`;
|
s.style[attach.ys] = "".concat(attach.y, "px");
|
||||||
s.style[attach.xs] = `${attach.x}px`;
|
s.style[attach.xs] = "".concat(attach.x, "px");
|
||||||
s.style.display = "grid";
|
s.style.display = "grid";
|
||||||
}
|
};
|
||||||
|
var css = function css(el, attr) {
|
||||||
const css = (el, attr) => {
|
var st = "";
|
||||||
let st = ""
|
Object.entries(attr).forEach(function (val) {
|
||||||
Object.entries(attr).forEach(val => {
|
var _val = _slicedToArray(val, 2),
|
||||||
const [key, value] = val;
|
key = _val[0],
|
||||||
st += `${key}: ${value}; `;
|
value = _val[1];
|
||||||
})
|
st += "".concat(key, ": ").concat(value, "; ");
|
||||||
el.setAttribute("style",st.trim());
|
});
|
||||||
}
|
el.setAttribute("style", st.trim());
|
||||||
|
};
|
||||||
|
var calculateStickyPosition = function calculateStickyPosition(s) {
|
||||||
const calculateStickyPosition = (s) => {
|
var float = s.getAttribute("float");
|
||||||
let float = s.getAttribute("float");
|
var p = s.parentNode.getBoundingClientRect();
|
||||||
let p = s.parentNode.getBoundingClientRect()
|
|
||||||
switch (float) {
|
switch (float) {
|
||||||
case "left":
|
case "left":
|
||||||
css(s, {left: (p.left * -1) + "px"})
|
css(s, {
|
||||||
|
left: p.left * -1 + "px"
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "right":
|
case "right":
|
||||||
css(s, { left: (Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) - p.left - s.offsetWidth - (font.size * 2)) + "px" });
|
css(s, {
|
||||||
|
left: Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) - p.left - s.offsetWidth - font.size * 2 + "px"
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
var offset = s.getAttribute("offset");
|
||||||
let offset = s.getAttribute("offset");
|
|
||||||
if (offset !== null) {
|
if (offset !== null) {
|
||||||
offset = offset.trim().split(" ");
|
offset = offset.trim().split(" ");
|
||||||
css(s, {top: offset[0], left: offset[1] })
|
css(s, {
|
||||||
|
top: offset[0],
|
||||||
|
left: offset[1]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
module.exports = {
|
||||||
function init(p = document){
|
init: function init() {
|
||||||
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px",""));
|
var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
||||||
|
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px", ""));
|
||||||
p.querySelectorAll("sticky-note").forEach((s) => {
|
p.querySelectorAll("sticky-note").forEach(function (s) {
|
||||||
if (s.querySelectorAll("svg").length == 0) {
|
if (s.querySelectorAll("svg").length == 0) {
|
||||||
|
var wrapper = document.createElement("sticky-note-wrapper");
|
||||||
let wrapper = document.createElement("sticky-note-wrapper");
|
|
||||||
|
|
||||||
s.parentNode.insertBefore(wrapper, s);
|
s.parentNode.insertBefore(wrapper, s);
|
||||||
wrapper.appendChild(s);
|
wrapper.appendChild(s);
|
||||||
|
|
||||||
s.setAttribute("content", s.innerHTML.replace(/"/g, "\""));
|
s.setAttribute("content", s.innerHTML.replace(/"/g, "\""));
|
||||||
s.innerHTML = `<div><svg width='0' height='0'><defs><clipPath id='stickyClip' clipPathUnits='objectBoundingBox'><path d='M 0 0 Q 0 0.69, 0.03 0.96 0.03 0.96, 1 0.96 Q 0.96 0.69, 0.96 0 0.96 0, 0 0' stroke-linejoin='round' stroke-linecap='square' /></clipPath></defs></svg></div><div><div>${s.innerHTML}</div></div>`;
|
s.innerHTML = "<div><svg width='0' height='0'><defs><clipPath id='stickyClip' clipPathUnits='objectBoundingBox'><path d='M 0 0 Q 0 0.69, 0.03 0.96 0.03 0.96, 1 0.96 Q 0.96 0.69, 0.96 0 0.96 0, 0 0' stroke-linejoin='round' stroke-linecap='square' /></clipPath></defs></svg></div><div><div>".concat(s.innerHTML, "</div></div>");
|
||||||
}
|
}
|
||||||
calculateStickyPosition(s);
|
calculateStickyPosition(s);
|
||||||
drag(s);
|
drag(s);
|
||||||
s.ondblclick = (e) => {
|
s.ondblclick = function (e) {
|
||||||
if (e.ctrlKey) {
|
if (e.ctrlKey) {
|
||||||
calculateStickyPosition(s);
|
calculateStickyPosition(s);
|
||||||
} else {
|
} else {
|
||||||
// add one click select
|
// add one click select
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
|
window.onresize = function () {
|
||||||
|
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px", ""));
|
||||||
window.onresize = () => {
|
var stickies = p.querySelectorAll("sticky-note");
|
||||||
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px",""));
|
stickies.forEach(function (s) {
|
||||||
let stickies = p.querySelectorAll("sticky-note");
|
|
||||||
stickies.forEach((s) => {
|
|
||||||
calculateStickyPosition(s);
|
calculateStickyPosition(s);
|
||||||
});
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 9 */
|
/* 9 */
|
||||||
@ -3134,8 +3157,8 @@ function init(p = document){
|
|||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
function flip(e) {
|
function flip(e) {
|
||||||
let sw = e.currentTarget;
|
var sw = e.currentTarget;
|
||||||
switch(sw.getAttribute("aria-checked")) {
|
switch (sw.getAttribute("aria-checked")) {
|
||||||
case "true":
|
case "true":
|
||||||
sw.setAttribute("aria-checked", "false");
|
sw.setAttribute("aria-checked", "false");
|
||||||
break;
|
break;
|
||||||
@ -3143,84 +3166,166 @@ function flip(e) {
|
|||||||
sw.setAttribute("aria-checked", "true");
|
sw.setAttribute("aria-checked", "true");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
;
|
||||||
module.exports = {
|
module.exports = {
|
||||||
init: (p = document) => {
|
init: function init() {
|
||||||
p.querySelectorAll("[role='switch']").forEach((sw) => {
|
var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
||||||
|
try {
|
||||||
|
p.querySelectorAll("[role='switch']").forEach(function (sw) {
|
||||||
sw.innerHTML = "<span></span>";
|
sw.innerHTML = "<span></span>";
|
||||||
sw.setAttribute("aria-checked", "false");
|
sw.setAttribute("aria-checked", "false");
|
||||||
sw.setAttribute("tabindex", "0");
|
sw.setAttribute("tabindex", "0");
|
||||||
sw.addEventListener("click", flip, false);
|
sw.addEventListener("click", flip, false);
|
||||||
sw.addEventListener("keypress", flip, false);
|
sw.addEventListener("keypress", flip, false);
|
||||||
})
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("Cannot initialise switches.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 10 */
|
/* 10 */
|
||||||
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
/***/ (function(module) {
|
||||||
|
|
||||||
"use strict";
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
|
||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
||||||
/* harmony export */ init: function() { return /* binding */ init; }
|
|
||||||
/* harmony export */ });
|
|
||||||
/* DS2 core (c) 2024 Alexander McIlwraith
|
/* DS2 core (c) 2024 Alexander McIlwraith
|
||||||
import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js";
|
Released under Creative Commons Attribution-ShareAlike 4.0 International
|
||||||
tabs.init();
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function init(p = document) {
|
// create a pure JS mouse click event
|
||||||
p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
var click = new MouseEvent('click', {
|
||||||
|
view: window,
|
||||||
|
bubbles: false,
|
||||||
|
cancelable: true
|
||||||
|
});
|
||||||
|
var waitForElement = function waitForElement(selector) {
|
||||||
|
return new Promise(function (resolve) {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
return resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
var observer = new MutationObserver(function (mutations) {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
observer.disconnect();
|
||||||
|
resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
|
||||||
|
observer.observe(document.body, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var chooseTab = function chooseTab(tab) {
|
||||||
|
var siblings = Array.from(tab.parentNode.children);
|
||||||
|
siblings.forEach(function (sibling) {
|
||||||
|
return sibling.classList.remove("selected");
|
||||||
|
});
|
||||||
|
tab.classList.add("selected");
|
||||||
|
var tabPanels = Array.from(tab.parentNode.parentNode.children);
|
||||||
|
tabPanels.forEach(function (panel) {
|
||||||
|
return panel.classList.remove("open");
|
||||||
|
});
|
||||||
|
var tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||||
|
document.getElementById(tabPanelId).classList.add("open");
|
||||||
|
};
|
||||||
|
var pushState = 0;
|
||||||
|
var tabsetCount = 0;
|
||||||
|
module.exports = {
|
||||||
|
"init": function init() {
|
||||||
|
var container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
||||||
|
var spacer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||||
|
var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||||
|
container.querySelectorAll(".tab-group, tabset").forEach(function (tabGroup) {
|
||||||
if (tabGroup.querySelector("[role=tablist]") === null) {
|
if (tabGroup.querySelector("[role=tablist]") === null) {
|
||||||
const tabgroup = tabGroup.getAttribute("id");
|
if (tabGroup.getAttribute("id") == null) {
|
||||||
let tablist = "";
|
tabGroup.setAttribute("id", "tab-group-" + tabsetCount);
|
||||||
|
tabsetCount++;
|
||||||
|
}
|
||||||
|
var tabgroup = tabGroup.getAttribute("id");
|
||||||
|
var tablist = "";
|
||||||
|
Array.from(tabGroup.children).forEach(function (child) {
|
||||||
|
// is details?
|
||||||
|
var dtls = child.nodeName == "DETAILS" ? true : false;
|
||||||
|
|
||||||
Array.from(tabGroup.children).forEach(child => {
|
// get the tab text
|
||||||
const tab = child.getAttribute("tab") || child.getAttribute("data-tab");
|
var tab = dtls ? child.querySelector("summary").innerHTML : child.getAttribute("tab") || child.getAttribute("data-tab");
|
||||||
|
|
||||||
|
// if the tab text is not blank
|
||||||
if (tab !== null) {
|
if (tab !== null) {
|
||||||
const tabID = tab.replace(/\W+/g, "-").toLowerCase();
|
var tabID = tab.replace(/\W+/g, "-").toLowerCase();
|
||||||
const tabPanel = document.createElement('div');
|
|
||||||
tabPanel.id = `tab-panel-${tabgroup}-${tabID}`;
|
// define the tab panel content
|
||||||
|
var tabPanel = null;
|
||||||
|
if (dtls) {
|
||||||
|
tabPanel = child;
|
||||||
|
tabPanel.setAttribute("open", "");
|
||||||
|
} else {
|
||||||
|
tabPanel = document.createElement('div');
|
||||||
|
tabPanel.appendChild(child.cloneNode(true));
|
||||||
|
}
|
||||||
|
tabPanel.id = "tab-panel-".concat(tabgroup, "-").concat(tabID);
|
||||||
tabPanel.className = tablist === "" ? "open" : "";
|
tabPanel.className = tablist === "" ? "open" : "";
|
||||||
tabPanel.setAttribute("role", "tabpanel");
|
tabPanel.setAttribute("role", "tabpanel");
|
||||||
tabPanel.setAttribute("tabindex", "0");
|
tabPanel.setAttribute("tabindex", "0");
|
||||||
tabPanel.setAttribute("aria-labelledby", `tab-${tabgroup}-${tabID}`);
|
tabPanel.setAttribute("aria-labelledby", "tab-".concat(tabgroup, "-").concat(tabID));
|
||||||
tabPanel.appendChild(child.cloneNode(true));
|
|
||||||
child.parentNode.replaceChild(tabPanel, child);
|
child.parentNode.replaceChild(tabPanel, child);
|
||||||
tablist += `<li tabindex="0" role="tab" ${tablist === "" ? "class='selected'" : ""} id="tab-${tabgroup}-${tabID}"><span>${tab}</span></li>`;
|
var cls = tablist === "" ? "class='selected'" : "";
|
||||||
|
tablist += "<li tabindex=\"0\" role=\"tab\" ".concat(cls, " id=\"tab-").concat(tabgroup, "-").concat(tabID, "\"><span>").concat(tab, "</span></li>");
|
||||||
} else {
|
} else {
|
||||||
child.classList.add("tab-hidden");
|
child.classList.add("tab-hidden");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
var ul = document.createElement('ul');
|
||||||
const ul = document.createElement('ul');
|
|
||||||
ul.setAttribute("role", "tablist");
|
ul.setAttribute("role", "tablist");
|
||||||
ul.innerHTML = `${tablist}<li role="separator" class="separator"></li>`;
|
ul.innerHTML = spacer != true ? "".concat(tablist) : "".concat(tablist, "<li role=\"separator\" class=\"separator\"></li>");
|
||||||
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
||||||
|
tabGroup.querySelectorAll('[role="tab"]').forEach(function (tab) {
|
||||||
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
tab.addEventListener("click", function (evt) {
|
||||||
tab.addEventListener("click", () => {
|
if (pushState == 0) {
|
||||||
const siblings = Array.from(tab.parentNode.children);
|
window.history.pushState({
|
||||||
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
rand: Math.random(),
|
||||||
tab.classList.add("selected");
|
pushState: pushState,
|
||||||
|
tab: tab.parentNode.firstChild.getAttribute("id")
|
||||||
const tabPanels = Array.from(tab.parentNode.parentNode.children)
|
}, "", "#".concat(tab.parentNode.firstChild.getAttribute("id")));
|
||||||
.filter(child => child.getAttribute("role") === "tabpanel");
|
pushState++;
|
||||||
tabPanels.forEach(panel => panel.classList.remove("open"));
|
}
|
||||||
|
chooseTab(evt.currentTarget);
|
||||||
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
window.history.pushState({
|
||||||
document.getElementById(tabPanelId).classList.add("open");
|
rand: Math.random(),
|
||||||
|
pushState: pushState,
|
||||||
|
tab: tab.getAttribute("id")
|
||||||
|
}, "", "#".concat(tab.getAttribute("id")));
|
||||||
|
pushState++;
|
||||||
});
|
});
|
||||||
});
|
tab.addEventListener("keypress", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
if (e.which == 32 || e.which == 13) {
|
||||||
|
e.currentTarget.dispatchEvent(click);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
if (document.location.hash != "" && document.location.hash.substring(0, 5) == "#tab-") {
|
||||||
|
waitForElement(document.location.hash).then(function (el) {
|
||||||
|
el.scrollIntoView();
|
||||||
|
el.focus();
|
||||||
|
el.dispatchEvent(click);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
window.addEventListener("popstate", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
if (e.state != null) {
|
||||||
|
chooseTab(document.querySelector("#".concat(e.state.tab)));
|
||||||
|
} else {
|
||||||
|
history.go(-1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
/******/ ]);
|
/******/ ]);
|
||||||
@ -3323,9 +3428,11 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony import */ var _node_modules_prismjs_components_prism_sass__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7);
|
/* harmony import */ var _node_modules_prismjs_components_prism_sass__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7);
|
||||||
/* harmony import */ var _node_modules_prismjs_components_prism_sass__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_node_modules_prismjs_components_prism_sass__WEBPACK_IMPORTED_MODULE_6__);
|
/* harmony import */ var _node_modules_prismjs_components_prism_sass__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_node_modules_prismjs_components_prism_sass__WEBPACK_IMPORTED_MODULE_6__);
|
||||||
/* harmony import */ var _pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(8);
|
/* harmony import */ var _pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(8);
|
||||||
|
/* harmony import */ var _pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7__);
|
||||||
/* harmony import */ var _pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9);
|
/* harmony import */ var _pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9);
|
||||||
/* harmony import */ var _pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__);
|
/* harmony import */ var _pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__);
|
||||||
/* harmony import */ var _pg_patterns_core_tabs_tabs_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(10);
|
/* harmony import */ var _pg_patterns_core_tabs_tabs_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(10);
|
||||||
|
/* harmony import */ var _pg_patterns_core_tabs_tabs_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_pg_patterns_core_tabs_tabs_js__WEBPACK_IMPORTED_MODULE_9__);
|
||||||
// core and prism
|
// core and prism
|
||||||
|
|
||||||
|
|
||||||
@ -3340,49 +3447,64 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// init core
|
// init c
|
||||||
_core_core_js__WEBPACK_IMPORTED_MODULE_0__.init({
|
_core_core_js__WEBPACK_IMPORTED_MODULE_0__.init({
|
||||||
success: (a) => {
|
success: function success(a) {
|
||||||
_pg_patterns_core_tabs_tabs_js__WEBPACK_IMPORTED_MODULE_9__.init(a);
|
_pg_patterns_core_tabs_tabs_js__WEBPACK_IMPORTED_MODULE_9__.init(a, true, {
|
||||||
|
shiftModifier: _core_core_js__WEBPACK_IMPORTED_MODULE_0__.getTabPath
|
||||||
|
});
|
||||||
_pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__.init(a);
|
_pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__.init(a);
|
||||||
_pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7__.init(a);
|
_pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7__.init(a);
|
||||||
},
|
},
|
||||||
notFound: (a, path) => {
|
notFound: function notFound(a, path) {
|
||||||
a.innerHTML = `${a.innerHTML}<div class='notification-box error'><p>This pattern appears to be missing.<br><small>(${path} returned http status 404)</small></p></div>`;
|
a.innerHTML = "".concat(a.innerHTML, "<div class='notification-box error'><p>This pattern appears to be missing.<br><small>(").concat(path, " returned http status 404)</small></p></div>");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// deprecated switch handler
|
// deprecated switch handler
|
||||||
const flipDeprecated = (e, s = e.currentTarget) => {
|
var flipInfoSwitch = function flipInfoSwitch(e) {
|
||||||
|
var s = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : e.currentTarget;
|
||||||
|
switch (s.getAttribute("id")) {
|
||||||
|
case "deprecated":
|
||||||
_core_core_js__WEBPACK_IMPORTED_MODULE_0__.cookie.set("show-deprecated", s.getAttribute("aria-checked"), 30, "/");
|
_core_core_js__WEBPACK_IMPORTED_MODULE_0__.cookie.set("show-deprecated", s.getAttribute("aria-checked"), 30, "/");
|
||||||
document.querySelector("main").querySelectorAll("article[data-status=deprecated]").forEach((a) => {
|
document.querySelector("main").querySelectorAll("article[data-status=deprecated]").forEach(function (a) {
|
||||||
a.classList[( s.getAttribute("aria-checked") == "true" ? "add" : "remove" )]("show-deprecated")
|
a.classList[s.getAttribute("aria-checked") == "true" ? "add" : "remove"]("show-deprecated");
|
||||||
});
|
});
|
||||||
}
|
break;
|
||||||
|
case "breakpoints":
|
||||||
|
_core_core_js__WEBPACK_IMPORTED_MODULE_0__.cookie.set("show-breakpoints", s.getAttribute("aria-checked"), 30, "/");
|
||||||
|
document.querySelector("html").classList[s.getAttribute("aria-checked") == "true" ? "add" : "remove"]("show-breakpoints");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// create a pure JS mouse click event
|
// create a pure JS mouse click event
|
||||||
const click = new MouseEvent('click', {
|
var click = new MouseEvent('click', {
|
||||||
view: window,
|
view: window,
|
||||||
bubbles: false,
|
bubbles: false,
|
||||||
cancelable: true
|
cancelable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// get the switch, initialize it and add the handler
|
// get the switch, initialize it and add the handler
|
||||||
let deprecated = document.querySelector("#deprecated");
|
var switches = document.querySelector(".info-switches");
|
||||||
_pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__.init(deprecated.parentNode)
|
_pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__.init(switches);
|
||||||
deprecated.onclick = flipDeprecated;
|
var deprecated = document.querySelector("#deprecated");
|
||||||
deprecated.keypress = flipDeprecated;
|
var breakpoints = document.querySelector("#breakpoints");
|
||||||
|
deprecated.onclick = flipInfoSwitch;
|
||||||
|
deprecated.keypress = flipInfoSwitch;
|
||||||
|
breakpoints.onclick = flipInfoSwitch;
|
||||||
|
breakpoints.keypress = flipInfoSwitch;
|
||||||
|
|
||||||
// check a cookie to get the switch's state
|
// check a cookie to get the switch's state
|
||||||
if (_core_core_js__WEBPACK_IMPORTED_MODULE_0__.cookie.get("show-deprecated") == "true") {
|
if (_core_core_js__WEBPACK_IMPORTED_MODULE_0__.cookie.get("show-deprecated") == "true") {
|
||||||
deprecated.dispatchEvent(click);
|
deprecated.dispatchEvent(click);
|
||||||
}
|
}
|
||||||
|
if (_core_core_js__WEBPACK_IMPORTED_MODULE_0__.cookie.get("show-breakpoints") == "true") {
|
||||||
|
breakpoints.dispatchEvent(click);
|
||||||
|
}
|
||||||
|
|
||||||
// just for fun... We'll show deprecated if they match the path
|
// just for fun... We'll show deprecated if they match the path
|
||||||
// document.querySelector(`#${core.url.p.replace(/\//g, "-")}`).classList.add("show-deprecated");
|
// document.querySelector(`#${core.url.p.replace(/\//g, "-")}`).classList.add("show-deprecated");
|
||||||
|
|
||||||
}();
|
}();
|
||||||
/******/ })()
|
/******/ })()
|
||||||
;
|
;
|
File diff suppressed because one or more lines are too long
@ -24,7 +24,7 @@
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$allowed_types = ["scss", "js"];
|
$allowed_types = ['js','pug','scss'];
|
||||||
$patterns = dirname(dirname(__file__)) . "/src/pg/patterns";
|
$patterns = dirname(dirname(__file__)) . "/src/pg/patterns";
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,52 +38,53 @@
|
|||||||
<li><a href="./?p=status">Status</a></li>
|
<li><a href="./?p=status">Status</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<p class="deprecated-switch"><span></span><span id="deprecated" role="switch"></span>
|
<p class="info-switches"><span></span><span id="deprecated" role="switch"></span>
|
||||||
<label for="deprecated">Show deprecated patterns</label>
|
<label for="deprecated">Show deprecated patterns</label><span></span><span id="breakpoints" role="switch"></span>
|
||||||
|
<label for="breakpoints">Show breakpoint information</label>
|
||||||
</p>
|
</p>
|
||||||
<main id="main">
|
<main id="main">
|
||||||
<h1>DS2 core</h1>
|
<h1>DS2 core</h1>
|
||||||
<article id="this-pattern-doesnt-exist" data-name="this pattern doesn't exist" data-status="deprecated" data-template="pug" data-core="false" data-path="this-pattern-doesnt-exist">
|
<article id="this-pattern-doesnt-exist" data-name="this pattern doesn't exist" data-status="deprecated" data-template="pug" data-core="false" data-path="this-pattern-doesnt-exist" style="height: 100vh">
|
||||||
<h1 class="status-deprecated"><span>This pattern doesn't exist
|
<h1 class="status-deprecated"><span>This pattern doesn't exist
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">Deprecated</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Deprecated</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
<article id="colours" data-name="colours" data-status="complete" data-template="pug" data-core="true" data-path="colours">
|
<article id="colours" data-name="colours" data-status="complete" data-template="pug" data-core="true" data-path="colours" style="height: 100vh">
|
||||||
<h1 class="status-complete"><span>Colours
|
<h1 class="status-complete"><span>Colours
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
<article id="components" data-name="components" data-status="complete" data-template="none" data-core="false" data-path="components">
|
<article id="components" data-name="components" data-status="complete" data-template="none" data-core="false" data-path="components" style="height: 100vh">
|
||||||
<h1 class="status-complete"><span>Components
|
<h1 class="status-complete"><span>Components
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
<article id="components-sticky-note" data-name="sticky-note" data-status="complete" data-template="pug" data-core="true" data-path="components/sticky-note">
|
<article id="components-sticky-note" data-name="sticky-note" data-status="complete" data-template="pug" data-core="true" data-path="components/sticky-note" style="height: 100vh">
|
||||||
<h1 class="status-complete"><span>Sticky note
|
<h1 class="status-complete"><span>Sticky note
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
<article id="components-switch" data-name="switch" data-status="in-progress" data-template="pug" data-core="true" data-path="components/switch">
|
<article id="components-switch" data-name="switch" data-status="complete" data-template="pug" data-core="true" data-path="components/switch" style="height: 100vh">
|
||||||
<h1 class="status-in-progress"><span>Switch
|
<h1 class="status-complete"><span>Switch
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">In progress</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
<article id="components-tooltip" data-name="tooltip" data-status="in-progress" data-template="pug" data-core="true" data-path="components/tooltip">
|
<article id="components-tooltip" data-name="tooltip" data-status="complete" data-template="pug" data-core="true" data-path="components/tooltip" style="height: 100vh">
|
||||||
<h1 class="status-in-progress"><span>Tooltip
|
<h1 class="status-complete"><span>Tooltip
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">In progress</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
<article id="layouts" data-name="layouts" data-status="complete" data-template="none" data-core="true" data-path="layouts">
|
<article id="layouts" data-name="layouts" data-status="complete" data-template="none" data-core="true" data-path="layouts" style="height: 100vh">
|
||||||
<h1 class="status-complete"><span>Layouts
|
<h1 class="status-complete"><span>Layouts
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
<article id="layouts-header" data-name="header" data-status="in-progress" data-template="pug" data-core="true" data-path="layouts/header">
|
<article id="layouts-header" data-name="header" data-status="complete" data-template="pug" data-core="true" data-path="layouts/header" style="height: 100vh">
|
||||||
<h1 class="status-in-progress"><span>Header
|
<h1 class="status-complete"><span>Header
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">In progress</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
<article id="layouts-breakpoints" data-name="breakpoints" data-status="in-progress" data-template="pug" data-core="true" data-path="layouts/breakpoints">
|
<article id="layouts-breakpoint" data-name="breakpoint" data-status="complete" data-template="pug" data-core="true" data-path="layouts/breakpoint" style="height: 100vh">
|
||||||
<h1 class="status-in-progress"><span>Breakpoints
|
<h1 class="status-complete"><span>Breakpoint
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">In progress</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
<article id="layouts-tabs" data-name="tabs" data-status="in-progress" data-template="pug" data-core="true" data-path="layouts/tabs">
|
<article id="layouts-tabs" data-name="tabs" data-status="complete" data-template="pug" data-core="true" data-path="layouts/tabs" style="height: 100vh">
|
||||||
<h1 class="status-in-progress"><span>Tabs
|
<h1 class="status-complete"><span>Tabs
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">In progress</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
<article id="status" data-name="status" data-status="complete" data-template="pug" data-core="true" data-path="status">
|
<article id="status" data-name="status" data-status="complete" data-template="pug" data-core="true" data-path="status" style="height: 100vh">
|
||||||
<h1 class="status-complete"><span>Status
|
<h1 class="status-complete"><span>Status
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
|
@ -2,24 +2,42 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
|
<p>Breakpoints enable responsive mobile design.</p>
|
||||||
<h2>When to use it</h2>
|
<h2>When to use it</h2>
|
||||||
|
<p>Use breakpoints when designing for different screen sizes. </p>
|
||||||
|
<p>The breakpoints SCSS mixin included implements media queries to allow for the change of the layout and design based on pre-defined screen sizes. </p>
|
||||||
<h2>How to use it</h2>
|
<h2>How to use it</h2>
|
||||||
|
<p>This pattern is only available for SCSS breakpoints. The mixin is avai</p>
|
||||||
<p>When using this, use the default break points as they are set to the same as the Bootstrap framework. The grid for the design system at large break point has been widened to accompdate 3 colour cards across. </p>
|
<p>When using this, use the default break points as they are set to the same as the Bootstrap framework. The grid for the design system at large break point has been widened to accompdate 3 colour cards across. </p>
|
||||||
<div class="tab-group" id="breakpoints">
|
<tabset id="breakpoints">
|
||||||
<pre class="language-css" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith
|
<div tab="scss">
|
||||||
|
<pre class="language-sass">@use "scss/core/breakpoint/breakpoint";
|
||||||
|
@include breapoint.break([breakpoint]) {
|
||||||
|
// css here
|
||||||
|
}</pre>
|
||||||
|
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px ) !default;
|
// default breakpoints match bootstrap 5 breakpoints.
|
||||||
|
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px ) !default;
|
||||||
|
|
||||||
@mixin breakpoint-debug {
|
@mixin debug {
|
||||||
body::before, body::after {
|
body::before, body::after {
|
||||||
background-color: #555;
|
background-color: #555;
|
||||||
color: white;
|
color: white;
|
||||||
content: "bigger than extra large";
|
content: "bigger than extra large";
|
||||||
display: grid;
|
display: grid;
|
||||||
|
font-family: sans-serif;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
grid-template-columns: auto;
|
grid-template-columns: auto;
|
||||||
padding: 25px;
|
padding: 25px;
|
||||||
@ -96,5 +114,6 @@ $grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px ) !defau
|
|||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
</div>
|
</div>
|
||||||
|
</tabset>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -2,6 +2,13 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
@ -287,23 +294,23 @@
|
|||||||
<div class="tab-group" id="colors">
|
<div class="tab-group" id="colors">
|
||||||
<div data-tab="css">
|
<div data-tab="css">
|
||||||
<pre class="language-css">:root {
|
<pre class="language-css">:root {
|
||||||
--colour-blue: #2e51a1,
|
--colour-blue: #2e51a1;
|
||||||
--colour-blue-l: #5c7abf,
|
--colour-blue-l: #5c7abf;
|
||||||
--colour-blue-xl: #b2c3ec,
|
--colour-blue-xl: #b2c3ec;
|
||||||
--colour-blue-d: #133176,
|
--colour-blue-d: #133176;
|
||||||
--colour-blue-xd: #031235,
|
--colour-blue-xd: #031235;
|
||||||
|
|
||||||
--colour-grey: #7f7f7f,
|
--colour-grey: #7f7f7f;
|
||||||
--colour-grey-l: #b2b2b2,
|
--colour-grey-l: #b2b2b2;
|
||||||
--colour-grey-xl: #d8d8d8,
|
--colour-grey-xl: #d8d8d8;
|
||||||
--colour-grey-xxl: #f0f0f0,
|
--colour-grey-xxl: #f0f0f0;
|
||||||
--colour-white: #fff,
|
--colour-white: #fff;
|
||||||
--colour-page: #fff,
|
--colour-page: #fff;
|
||||||
--colour-light: #fff,
|
--colour-light: #fff;
|
||||||
--colour-grey-d: #4c4c4c,
|
--colour-grey-d: #4c4c4c;
|
||||||
--colour-grey-xd: #4c4c4c,
|
--colour-grey-xd: #4c4c4c;
|
||||||
--colour-black: #000,
|
--colour-black: #000;
|
||||||
--colour-dark: #000,
|
--colour-dark: #000;
|
||||||
}</pre>
|
}</pre>
|
||||||
</div>
|
</div>
|
||||||
<div data-tab="scss">
|
<div data-tab="scss">
|
||||||
|
@ -2,13 +2,23 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
|
<p>A header is layout pattern that helps the user identify the site. </p>
|
||||||
<h2>When to use it</h2>
|
<h2>When to use it</h2>
|
||||||
|
<p>Use a header at the top of every page. The 'front page' of a site may have a different header than the rest of the pages. </p>
|
||||||
<h2>How to use it</h2>
|
<h2>How to use it</h2>
|
||||||
<div class="tab-group" id="header">
|
<p>Place the header at the top of the page after the skip to main content link. You will likely want to replace core header should be replaced with your own site's header. To do this, remove the <code class="inline language-js">core: true </code> and create your own pattern in the location you wish it in your design system. </p>
|
||||||
<pre class="language-html" data-tab="html">
|
<tabset id="header">
|
||||||
|
<pre class="language-html" tab="html">
|
||||||
<!-- create temp variables and store the design system values-->
|
<!-- create temp variables and store the design system values-->
|
||||||
<header>
|
<header>
|
||||||
<!-- The headline banner area -->
|
<!-- The headline banner area -->
|
||||||
@ -22,7 +32,28 @@
|
|||||||
<!-- Other sections can go here, such as search and directory-->
|
<!-- Other sections can go here, such as search and directory-->
|
||||||
</div>
|
</div>
|
||||||
</header></pre>
|
</header></pre>
|
||||||
<pre class="language-sass" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith
|
<pre class="language-pug" tab="pug">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
|
//- required variables
|
||||||
|
//- site - the site name that goes in the site title
|
||||||
|
//- root - the path to the root of the site
|
||||||
|
|
||||||
|
header
|
||||||
|
// The headline banner area
|
||||||
|
svg(height='5.5rem' width='100%' xmlns='http://www.w3.org/2000/svg' aria-hidden='true')
|
||||||
|
text= site
|
||||||
|
div
|
||||||
|
div.header-title
|
||||||
|
h1
|
||||||
|
a(href="./")= site
|
||||||
|
// Other sections can go here, such as search and directory
|
||||||
|
</pre>
|
||||||
|
<pre class="language-css" tab="css">header{display:-ms-grid;display:grid;-ms-grid-rows:1.75rem 3.5rem;grid-template-rows:1.75rem 3.5rem;-ms-grid-column:2;-ms-grid-column-span:2;grid-column:2/4;overflow:hidden}header svg{grid-column:1/-1;grid-row:1/-1;-ms-grid-row-align:stretch;-ms-grid-column-align:stretch;place-self:stretch}header svg text{-webkit-transform:translate(-1rem,7.25rem);-ms-transform:translate(-1rem,7.25rem);transform:translate(-1rem,7.25rem);font-size:10rem;font-weight:1000;font-family:sans-serif;fill:var(--colour-grey-xxl)}header>div{-ms-grid-row:2;grid-row:2;grid-column:1/-1;display:-ms-grid;display:grid;grid-column-gap:1rem;-ms-grid-columns:auto -webkit-max-content -webkit-max-content;-ms-grid-columns:auto max-content max-content;grid-template-columns:auto -webkit-max-content -webkit-max-content;grid-template-columns:auto max-content max-content}header>div .header-title h1{margin:0;padding:0 1rem}header>div .header-title h1 a,header>div .header-title h1 a:visited{border-bottom:none;color:var(--colour-black);font-family:sans-serif;font-size:2.5rem;font-size:32px;font-weight:700;margin:0;padding:0;text-decoration:none}</pre>
|
||||||
|
<div class="language-sass" tab="scss">
|
||||||
|
<pre class="language-sass">@use "scss/core/header/header;
|
||||||
|
</pre>
|
||||||
|
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
$header-bg-color: var(--colour-grey-xxl) !default;
|
$header-bg-color: var(--colour-grey-xxl) !default;
|
||||||
@ -75,60 +106,8 @@ $font-weight: 700 !default;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}</pre>
|
|
||||||
<pre class="language-css" data-tab="css">header {
|
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
-ms-grid-rows: 1.75rem 3.5rem;
|
|
||||||
grid-template-rows: 1.75rem 3.5rem;
|
|
||||||
-ms-grid-column: 2;
|
|
||||||
-ms-grid-column-span: 2;
|
|
||||||
grid-column: 2/4;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
header svg {
|
|
||||||
grid-column: 1/-1;
|
|
||||||
grid-row: 1/-1;
|
|
||||||
-ms-grid-row-align: stretch;
|
|
||||||
-ms-grid-column-align: stretch;
|
|
||||||
place-self: stretch;
|
|
||||||
}
|
|
||||||
header svg text {
|
|
||||||
-webkit-transform: translate(-1rem, 7.25rem);
|
|
||||||
-ms-transform: translate(-1rem, 7.25rem);
|
|
||||||
transform: translate(-1rem, 7.25rem);
|
|
||||||
font-size: 10rem;
|
|
||||||
font-weight: 1000;
|
|
||||||
font-family: sans-serif;
|
|
||||||
fill: var(--colour-grey-xxl);
|
|
||||||
}
|
|
||||||
header > div {
|
|
||||||
-ms-grid-row: 2;
|
|
||||||
grid-row: 2;
|
|
||||||
grid-column: 1/-1;
|
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
grid-column-gap: 1rem;
|
|
||||||
-ms-grid-columns: auto -webkit-max-content -webkit-max-content;
|
|
||||||
-ms-grid-columns: auto max-content max-content;
|
|
||||||
grid-template-columns: auto -webkit-max-content -webkit-max-content;
|
|
||||||
grid-template-columns: auto max-content max-content;
|
|
||||||
}
|
|
||||||
header > div .header-title h1 {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0 1rem;
|
|
||||||
}
|
|
||||||
header > div .header-title h1 a, header > div .header-title h1 a:visited {
|
|
||||||
border-bottom: none;
|
|
||||||
color: var(--colour-black);
|
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: 2.5rem;
|
|
||||||
font-size: 32px;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
text-decoration: none;
|
|
||||||
}</pre>
|
}</pre>
|
||||||
</div>
|
</div>
|
||||||
|
</tabset>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -2,6 +2,13 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<div class="tab-group" id="status-report">
|
<div class="tab-group" id="status-report">
|
||||||
@ -34,11 +41,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=components/switch"> Switch</a></td>
|
<td><a href="./?p=components/switch"> Switch</a></td>
|
||||||
<td><span class="status-in-progress">In progress</span></td>
|
<td><span class="status-complete">Complete</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=components/tooltip"> Tooltip</a></td>
|
<td><a href="./?p=components/tooltip"> Tooltip</a></td>
|
||||||
<td><span class="status-in-progress">In progress</span></td>
|
<td><span class="status-complete">Complete</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -49,15 +56,15 @@
|
|||||||
<td><span class="status-complete">Complete</span></td>
|
<td><span class="status-complete">Complete</span></td>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=layouts/header"> Header</a></td>
|
<td><a href="./?p=layouts/header"> Header</a></td>
|
||||||
<td><span class="status-in-progress">In progress</span></td>
|
<td><span class="status-complete">Complete</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=layouts/breakpoints"> Breakpoints</a></td>
|
<td><a href="./?p=layouts/breakpoint"> Breakpoint</a></td>
|
||||||
<td><span class="status-in-progress">In progress</span></td>
|
<td><span class="status-complete">Complete</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=layouts/tabs"> Tabs</a></td>
|
<td><a href="./?p=layouts/tabs"> Tabs</a></td>
|
||||||
<td><span class="status-in-progress">In progress</span></td>
|
<td><span class="status-complete">Complete</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -77,31 +84,15 @@
|
|||||||
<td colspan="2"><span class="status-not-started">Not started (0)</span></td>
|
<td colspan="2"><span class="status-not-started">Not started (0)</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><span class="status-in-progress">In progress (5)</span></td>
|
<td colspan="2"><span class="status-in-progress">In progress (0)</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts/breakpoints">Breakpoints</a></td>
|
<td colspan="2"><span class="status-complete">Complete (10)</span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> <a href="./?p=layouts/breakpoint">Breakpoint</a></td>
|
||||||
<td>Layouts</td>
|
<td>Layouts</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td> <a href="./?p=layouts/header">Header</a></td>
|
|
||||||
<td>Layouts</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td> <a href="./?p=components/switch">Switch</a></td>
|
|
||||||
<td>Components</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td> <a href="./?p=layouts/tabs">Tabs</a></td>
|
|
||||||
<td>Layouts</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td> <a href="./?p=components/tooltip">Tooltip</a></td>
|
|
||||||
<td>Components</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2"><span class="status-complete">Complete (5)</span></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=colours">Colours</a></td>
|
<td> <a href="./?p=colours">Colours</a></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -110,6 +101,10 @@
|
|||||||
<td> <a href="./?p=components">Components</a></td>
|
<td> <a href="./?p=components">Components</a></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> <a href="./?p=layouts/header">Header</a></td>
|
||||||
|
<td>Layouts</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts">Layouts</a></td>
|
<td> <a href="./?p=layouts">Layouts</a></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -122,6 +117,18 @@
|
|||||||
<td> <a href="./?p=components/sticky-note">Sticky note</a></td>
|
<td> <a href="./?p=components/sticky-note">Sticky note</a></td>
|
||||||
<td>Components</td>
|
<td>Components</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> <a href="./?p=components/switch">Switch</a></td>
|
||||||
|
<td>Components</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> <a href="./?p=layouts/tabs">Tabs</a></td>
|
||||||
|
<td>Layouts</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> <a href="./?p=components/tooltip">Tooltip</a></td>
|
||||||
|
<td>Components</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><span class="status-deprecated">Deprecated (1)</span></td>
|
<td colspan="2"><span class="status-deprecated">Deprecated (1)</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -136,8 +143,8 @@
|
|||||||
<table role="presentation">
|
<table role="presentation">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts/breakpoints">Breakpoints</a></td>
|
<td> <a href="./?p=layouts/breakpoint">Breakpoint</a></td>
|
||||||
<td><span><span class="status-in-progress">In Progress</span></span></td>
|
<td><span><span class="status-complete">Complete</span></span></td>
|
||||||
<td>Layouts</td>
|
<td>Layouts</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -152,7 +159,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts/header">Header</a></td>
|
<td> <a href="./?p=layouts/header">Header</a></td>
|
||||||
<td><span><span class="status-in-progress">In Progress</span></span></td>
|
<td><span><span class="status-complete">Complete</span></span></td>
|
||||||
<td>Layouts</td>
|
<td>Layouts</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -172,12 +179,12 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=components/switch">Switch</a></td>
|
<td> <a href="./?p=components/switch">Switch</a></td>
|
||||||
<td><span><span class="status-in-progress">In Progress</span></span></td>
|
<td><span><span class="status-complete">Complete</span></span></td>
|
||||||
<td>Components</td>
|
<td>Components</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts/tabs">Tabs</a></td>
|
<td> <a href="./?p=layouts/tabs">Tabs</a></td>
|
||||||
<td><span><span class="status-in-progress">In Progress</span></span></td>
|
<td><span><span class="status-complete">Complete</span></span></td>
|
||||||
<td>Layouts</td>
|
<td>Layouts</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -187,7 +194,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=components/tooltip">Tooltip</a></td>
|
<td> <a href="./?p=components/tooltip">Tooltip</a></td>
|
||||||
<td><span><span class="status-in-progress">In Progress</span></span></td>
|
<td><span><span class="status-complete">Complete</span></span></td>
|
||||||
<td>Components</td>
|
<td>Components</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -2,6 +2,13 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
@ -9,143 +16,23 @@
|
|||||||
<h2>When to use it</h2>
|
<h2>When to use it</h2>
|
||||||
<p>Use a sticky when you want to make a note without adding it to the content. </p>
|
<p>Use a sticky when you want to make a note without adding it to the content. </p>
|
||||||
<h2>How to use it</h2>
|
<h2>How to use it</h2>
|
||||||
<p>Uses absolute positioning.
|
<p>Uses absolute positioning. Passing an optional element to the init function will initialise tabs within that element. You can move the position using either <code class="language-html inline">float="[ right | left ]"</code> or <code class="language-html inline">offset="[ top | left ]"</code>. Offset will take negative values in any web measurement unit.
|
||||||
<sticky-note class="blue" float="right">This <strong>is</strong> a sample sticky. You can drag it out of the way if you need to see the content under it.</sticky-note>
|
<sticky-note class="blue" offset="-10rem 1rem">This <strong>is</strong> a sample sticky. You can drag it out of the way if you need to see the content under it.</sticky-note>
|
||||||
|
<sticky-note float="right">You will notice when you hover over the sticky, it shows a dot in the colour of the sticky in the position where the sticky note refers to (assuming you haven't dragged it and scrolled that location off the screen).</sticky-note>
|
||||||
</p>
|
</p>
|
||||||
<p>If you wish to create a custom element, that extends another HTML element, the native element has to be extended in customElements.define(). Custom elements that inherit native elements are also known as "type extension custom elements". </p>
|
<p>If you wish to create a custom element, that extends another HTML element, the native element has to be extended in customElements.define(). Custom elements that inherit native elements are also known as "type extension custom elements". </p>
|
||||||
<sticky-note>You will notice when you hover over the sticky, it shows a dot in the colour of the sticky in the position where the sticky note refers to (assuming you haven't dragged it and scrolled that location off the screen).</sticky-note>
|
|
||||||
<tabset id="sticky-note">
|
<tabset id="sticky-note">
|
||||||
<pre class="language-html" tab="html">
|
<pre class="language-html" tab="html">
|
||||||
<sticky-note class="blue" float="right">This <strong>is</strong> a sample sticky. You can drag it out of the way if you need to see the content under it.</sticky-note></pre>
|
<sticky-note class="blue" float="right">This <strong>is</strong> a sample sticky. You can drag it out of the way if you need to see the content under it.</sticky-note></pre>
|
||||||
<pre class="language-pug" tab="pug">sticky-note(float="right").blue This <strong>is</strong> a sample sticky.
|
<pre class="language-pug" tab="pug">sticky-note(float="right").blue This #[strong is] a sample sticky.
|
||||||
| You can drag it out of the way if you need to see the content under it.</pre>
|
| You can drag it out of the way if you need to see the content under it.</pre>
|
||||||
<pre class="language-css" data-tab="css"> @import url("https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap");
|
<pre class="language-css" data-tab="css"> @import url("https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap");sticky-note-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid transparent;border-radius:50%;display:inline-block;height:0.5rem;position:relative;width:0.5rem}sticky-note-wrapper *{-webkit-box-sizing:border-box;box-sizing:border-box}sticky-note-wrapper sticky-note{cursor:-webkit-grab;cursor:grab;display:-ms-grid;display:grid;float:left;font-size:1rem;height:13rem;left:0;place-items:stretch;position:absolute;top:0;width:13rem;z-index:100}sticky-note-wrapper sticky-note:active{cursor:-webkit-grabbing;cursor:grabbing;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}sticky-note-wrapper sticky-note.right{float:right}sticky-note-wrapper sticky-note>div{-ms-grid-row:1;grid-row:1;-ms-grid-column:1;grid-column:1}sticky-note-wrapper sticky-note>div:first-child{background-color:rgba(0,0,0,0.25);-webkit-box-shadow:-2px 2px 15px 0 rgba(0,0,0,0.5);box-shadow:-2px 2px 15px 0 rgba(0,0,0,0.5);display:-ms-grid;display:grid;margin:2rem 1rem 0.25rem 0.36rem;width:calc(100% - 1rem)}sticky-note-wrapper sticky-note>div:nth-child(2){clip-path:url(#stickyClip);display:-ms-grid;display:grid;font-family:"Kalam",cursive;font-style:1rem;font-weight:300;line-height:1.25rem;padding:1rem;place-items:center;text-align:center}sticky-note-wrapper sticky-note>div:nth-child(2)>*{font-family:"Kalam",cursive!important;font-style:normal!important;font-weight:300!important}@media screen and (max-width:1024px){sticky-note-wrapper sticky-note>div:nth-child(2){max-width:13rem;min-width:13rem;width:1rem}}@media screen and (max-width:768px){sticky-note-wrapper sticky-note>div:nth-child(2){font-size:1.75rem;max-width:21rem;min-height:21rem}}@media screen and (max-width:640px){sticky-note-wrapper sticky-note>div:nth-child(2){font-size:2.5rem;max-width:26rem;min-height:26rem}}sticky-note-wrapper sticky-note>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#ffffdd),color-stop(2%,#ffffd3),color-stop(12%,#ffffd3),color-stop(75%,#ffffc9),to(#ffffba));background:linear-gradient(180deg,#ffffdd 0%,#ffffd3 2%,#ffffd3 12%,#ffffc9 75%,#ffffba 100%)}sticky-note-wrapper sticky-note.blue>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#9dddec),color-stop(2%,#94daea),color-stop(12%,#94daea),color-stop(75%,#8bd7e8),to(#7fd3e6));background:linear-gradient(180deg,#9dddec 0%,#94daea 2%,#94daea 12%,#8bd7e8 75%,#7fd3e6 100%)}sticky-note-wrapper sticky-note.pink>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#fa7c93),color-stop(2%,#fa728b),color-stop(12%,#fa728b),color-stop(75%,#fa6883),to(#f95977));background:linear-gradient(180deg,#fa7c93 0%,#fa728b 2%,#fa728b 12%,#fa6883 75%,#f95977 100%)}sticky-note-wrapper sticky-note.green>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#c5fcc9),color-stop(2%,#bbfbc0),color-stop(12%,#bbfbc0),color-stop(75%,#b1fab7),to(#a3faaa));background:linear-gradient(180deg,#c5fcc9 0%,#bbfbc0 2%,#bbfbc0 12%,#b1fab7 75%,#a3faaa 100%)}sticky-note-wrapper:has(sticky-note:hover){background-color:#ffffd3;border:1px solid black}sticky-note-wrapper:has(sticky-note.yellow:hover){background-color:#ffffd3}sticky-note-wrapper:has(sticky-note.blue:hover){background-color:#94daea}sticky-note-wrapper:has(sticky-note.pink:hover){background-color:#fa728b}sticky-note-wrapper:has(sticky-note.green:hover){background-color:#bbfbc0}</pre>
|
||||||
sticky-note-wrapper {
|
<div tab="scss">
|
||||||
-webkit-box-sizing: border-box;
|
<pre class="language-sass">$sticky-colors: ( [sass map with your own defined colours] );
|
||||||
box-sizing: border-box;
|
@use "scss/core/switch/_sticky-note";
|
||||||
border: 1px solid transparent;
|
@include sticky-note;
|
||||||
border-radius: 50%;
|
</pre>
|
||||||
display: inline-block;
|
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
height: 0.5rem;
|
|
||||||
position: relative;
|
|
||||||
width: 0.5rem;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper * {
|
|
||||||
-webkit-box-sizing: border-box;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note {
|
|
||||||
cursor: -webkit-grab;
|
|
||||||
cursor: grab;
|
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
float: left;
|
|
||||||
font-size: 1rem;
|
|
||||||
height: 13rem;
|
|
||||||
left: 0;
|
|
||||||
place-items: stretch;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
width: 13rem;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note:active {
|
|
||||||
cursor: -webkit-grabbing;
|
|
||||||
cursor: grabbing;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
-ms-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note.right {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note > div {
|
|
||||||
-ms-grid-row: 1;
|
|
||||||
grid-row: 1;
|
|
||||||
-ms-grid-column: 1;
|
|
||||||
grid-column: 1;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(1) {
|
|
||||||
background-color: rgba(0, 0, 0, 0.25);
|
|
||||||
-webkit-box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
|
|
||||||
box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
|
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
margin: 2rem 1rem 0.25rem 0.36rem;
|
|
||||||
width: calc(100% - 1rem);
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
|
||||||
clip-path: url(#stickyClip);
|
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
font-family: "Kalam", cursive;
|
|
||||||
font-style: 1rem;
|
|
||||||
font-weight: 300;
|
|
||||||
line-height: 1.25rem;
|
|
||||||
padding: 1rem;
|
|
||||||
place-items: center;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(2) > * {
|
|
||||||
font-family: "Kalam", cursive !important;
|
|
||||||
font-style: normal !important;
|
|
||||||
font-weight: 300 !important;
|
|
||||||
}
|
|
||||||
@media screen and (max-width: 1024px) {
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
|
||||||
max-width: 13rem;
|
|
||||||
min-width: 13rem;
|
|
||||||
width: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@media screen and (max-width: 768px) {
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
|
||||||
font-size: 1.75rem;
|
|
||||||
max-width: 21rem;
|
|
||||||
min-height: 21rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@media screen and (max-width: 640px) {
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
|
||||||
font-size: 2.5rem;
|
|
||||||
max-width: 26rem;
|
|
||||||
min-height: 26rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#ffffdd), color-stop(2%, #ffffd3), color-stop(12%, #ffffd3), color-stop(75%, #ffffc9), to(#ffffba));
|
|
||||||
background: linear-gradient(180deg, #ffffdd 0%, #ffffd3 2%, #ffffd3 12%, #ffffc9 75%, #ffffba 100%);
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note.blue > div:nth-child(2) {
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#9dddec), color-stop(2%, #94daea), color-stop(12%, #94daea), color-stop(75%, #8bd7e8), to(#7fd3e6));
|
|
||||||
background: linear-gradient(180deg, #9dddec 0%, #94daea 2%, #94daea 12%, #8bd7e8 75%, #7fd3e6 100%);
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note.pink > div:nth-child(2) {
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#fa7c93), color-stop(2%, #fa728b), color-stop(12%, #fa728b), color-stop(75%, #fa6883), to(#f95977));
|
|
||||||
background: linear-gradient(180deg, #fa7c93 0%, #fa728b 2%, #fa728b 12%, #fa6883 75%, #f95977 100%);
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note.green > div:nth-child(2) {
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#c5fcc9), color-stop(2%, #bbfbc0), color-stop(12%, #bbfbc0), color-stop(75%, #b1fab7), to(#a3faaa));
|
|
||||||
background: linear-gradient(180deg, #c5fcc9 0%, #bbfbc0 2%, #bbfbc0 12%, #b1fab7 75%, #a3faaa 100%);
|
|
||||||
}
|
|
||||||
sticky-note-wrapper:has(sticky-note:hover) {
|
|
||||||
background-color: #ffffd3;
|
|
||||||
border: 1px solid black;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper:has(sticky-note.yellow:hover) {
|
|
||||||
background-color: #ffffd3;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper:has(sticky-note.blue:hover) {
|
|
||||||
background-color: #94daea;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper:has(sticky-note.pink:hover) {
|
|
||||||
background-color: #fa728b;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper:has(sticky-note.green:hover) {
|
|
||||||
background-color: #bbfbc0;
|
|
||||||
}</pre>
|
|
||||||
<pre class="language-css" data-tab="scss"> //- DS2 core (c) 2024 Alexander McIlwraith
|
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
@use 'sass:color';
|
@use 'sass:color';
|
||||||
@ -297,7 +184,12 @@ $sticky-colors: (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
<pre class="language-js" data-tab="js"> //- DS2 core (c) 2024 Alexander McIlwraith
|
</div>
|
||||||
|
<div tab="js">
|
||||||
|
<pre class="language-js">import * as stickynote from ""./js/core/sticky-note/_sticky-note.js";
|
||||||
|
stickynote.init()
|
||||||
|
</pre>
|
||||||
|
<pre class="language-js">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
const font = {
|
const font = {
|
||||||
@ -394,7 +286,8 @@ const calculateStickyPosition = (s) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function init(p = document){
|
module.exports = {
|
||||||
|
init: (p = document) => {
|
||||||
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px",""));
|
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px",""));
|
||||||
|
|
||||||
p.querySelectorAll("sticky-note").forEach((s) => {
|
p.querySelectorAll("sticky-note").forEach((s) => {
|
||||||
@ -427,7 +320,9 @@ export function init(p = document){
|
|||||||
calculateStickyPosition(s);
|
calculateStickyPosition(s);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
|
</div>
|
||||||
</tabset>
|
</tabset>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -2,53 +2,42 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
<p>Switches are used to toggle application state between two mutually exlusive values. </p>
|
<p>Switches are used to toggle application state between two mutually exclusive values. </p>
|
||||||
<h2>When to use it</h2>
|
<h2>When to use it</h2>
|
||||||
|
<p>Use a switch when the user will see an immediate visible state change. Do not use a switch when the state change will affect future results. The user should not have to perform another action (search, save, etc) for the result to take affect. If the change in state does not take effect immediately, consider a checkbox. </p>
|
||||||
<h2>How to use it</h2>
|
<h2>How to use it</h2>
|
||||||
|
<p>The switch label should describe what will happen when the switch is turned to the on state. Frontload labels with keywords. </p>
|
||||||
|
<p>Include the CSS and JavaScript. An additional handler will need to be created for the actual state change. The CSS implements the visual design of the switch, which is based on the accessibility properties, which are implemented by the JavaScript.</p>
|
||||||
<h2>Example</h2>
|
<h2>Example</h2>
|
||||||
<p class="switch">
|
<p class="switch">
|
||||||
<label for="example-switch">Switch label</label><span id="example-switch" role="switch"></span>
|
<label for="example-switch">Switch label (states the on state)</label><span id="example-switch" role="switch"></span>
|
||||||
</p>
|
</p>
|
||||||
<div class="tab-group" id="switches">
|
<div class="tab-group" id="switches">
|
||||||
<pre class="language-html" data-tab="html"><span id="example-id" role="switch"></span></pre>
|
<pre class="language-html" tab="html"><span id="example-id" role="switch"></span></pre>
|
||||||
<pre class="language-pug" data-tab="pug">span#example-id(role="switch")</pre>
|
<pre class="language-pug" tab="pug">span#example-id(role="switch")</pre>
|
||||||
<pre class="language-css" data-tab="css">[role=switch] {
|
<pre class="language-css" tab="css">[role=switch]{display:-ms-inline-grid;display:inline-grid;border:1px solid #2e51a1;background-color:#d8d8d8;border-radius:0.75rem;height:1.5rem;width:3rem;-webkit-transition:all 500ms;transition:all 500ms}[role=switch]>span{display:inline-block;background-color:white;border-radius:50%;margin:2%;width:calc(1.5rem - 2%);-webkit-transition:all 500ms;transition:all 500ms}[role=switch][aria-checked=true]{background-color:#2e51a1}[role=switch][aria-checked=true]>span{margin-left:calc(1.5rem - 5%)}</pre>
|
||||||
display: -ms-inline-grid;
|
<div tab="scss">
|
||||||
display: inline-grid;
|
<pre class="language-sass">@use "scss/core/switch/_switch";
|
||||||
border: 1px solid var(--colour-blue);
|
@include switch;
|
||||||
background-color: var(--colour-grey-xl);
|
</pre>
|
||||||
border-radius: 0.75rem;
|
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
height: 1.5rem;
|
|
||||||
width: 3rem;
|
|
||||||
-webkit-transition: all 500ms;
|
|
||||||
transition: all 500ms;
|
|
||||||
}
|
|
||||||
[role=switch] > span {
|
|
||||||
display: inline-block;
|
|
||||||
background-color: white;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin: 2%;
|
|
||||||
width: calc(1.5rem - 2%);
|
|
||||||
-webkit-transition: all 500ms;
|
|
||||||
transition: all 500ms;
|
|
||||||
}
|
|
||||||
[role=switch][aria-checked=true] {
|
|
||||||
background-color: var(--colour-blue);
|
|
||||||
}
|
|
||||||
[role=switch][aria-checked=true] > span {
|
|
||||||
margin-left: calc(1.5rem - 5%);
|
|
||||||
}</pre>
|
|
||||||
<pre class="language-css" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith
|
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
@use "sass:math";
|
@use "sass:math";
|
||||||
|
|
||||||
$switch-accent: var(--colour-blue) !default; // switch background when switched right (on/ true)
|
$switch-accent: #2e51a1 !default; // switch background when switched right (on/ true)
|
||||||
$switch-background: var(--colour-grey-xl) !default; // switch background when switched left (off / false)
|
$switch-background: #d8d8d8 !default; // switch background when switched left (off / false)
|
||||||
$switch-color: var(--colour-white) !default; // the colour of the switch
|
$switch-color: white !default; // the colour of the switch
|
||||||
$switch-height: 1.5rem !default;
|
$switch-height: 1.5rem !default;
|
||||||
|
|
||||||
@mixin switch {
|
@mixin switch {
|
||||||
@ -77,7 +66,13 @@ $switch-height: 1.5rem !default;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
<pre class="language-js" data-tab="js">//- DS2 core (c) 2024 Alexander McIlwraith
|
</div>
|
||||||
|
<div tab="js">
|
||||||
|
<pre class="language-js">// Note that switch is a reserved word.
|
||||||
|
import * as swtch from "./js/core/switch/_switch.js";
|
||||||
|
swtch.init();
|
||||||
|
</pre>
|
||||||
|
<pre class="language-js">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
function flip(e) {
|
function flip(e) {
|
||||||
@ -94,6 +89,7 @@ function flip(e) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
init: (p = document) => {
|
init: (p = document) => {
|
||||||
|
try {
|
||||||
p.querySelectorAll("[role='switch']").forEach((sw) => {
|
p.querySelectorAll("[role='switch']").forEach((sw) => {
|
||||||
sw.innerHTML = "<span></span>";
|
sw.innerHTML = "<span></span>";
|
||||||
sw.setAttribute("aria-checked", "false");
|
sw.setAttribute("aria-checked", "false");
|
||||||
@ -101,9 +97,13 @@ module.exports = {
|
|||||||
sw.addEventListener("click", flip, false);
|
sw.addEventListener("click", flip, false);
|
||||||
sw.addEventListener("keypress", flip, false);
|
sw.addEventListener("keypress", flip, false);
|
||||||
})
|
})
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("Cannot initialise switches.", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -2,11 +2,18 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
|
<p>A tabs component that provides different sections of content that are displayed one at a time when the user selects that information. </p>
|
||||||
<h2>When to use it</h2>
|
<h2>When to use it</h2>
|
||||||
<h2>How to use it</h2>
|
|
||||||
<p>The tabbed user interface enables users to jump to their target section quickly. Tabs present like logically group information on the same page. Information should </p>
|
<p>The tabbed user interface enables users to jump to their target section quickly. Tabs present like logically group information on the same page. Information should </p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>be logically chunked and ordered</li>
|
<li>be logically chunked and ordered</li>
|
||||||
@ -15,80 +22,53 @@
|
|||||||
<li>obvious where they begin and end </li>
|
<li>obvious where they begin and end </li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>Users should not need to see content of multiple tabs simultaneously and the user should be able to easily recognise where they are within the content. </p>
|
<p>Users should not need to see content of multiple tabs simultaneously and the user should be able to easily recognise where they are within the content. </p>
|
||||||
<p>The tab module can be initialised by importing a file with the javascript module using import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js"; contains a modularized version of the jQuery code, so that it can be called on demand. It is what is used in the design system so that the JavaScript can be called at run time (after loading content).</p>
|
<h2>How to use it</h2>
|
||||||
|
<p>The structure of the tab set is defined in html. There are two forms supported. Adding a class of <code class="inline">.tab-group</code> to the container element will work in place of the <code class="inline">tabset</code> tag, and the tab panels can be defined using either <code class="inline">tab=""</code> or <code class="inline">data-tab=""</code>. Passing an optional element to the init function will initialise tabs within that element. </p>
|
||||||
|
<p>The tab initalize function now takes a new function parameter in the form of an third argument is an object that can take the following callbacks: </p>
|
||||||
|
<ul>
|
||||||
|
<li>altModifer (When the altKey is used)</li>
|
||||||
|
<li>shiftModifier (When the shift key is used)</li>
|
||||||
|
<li>metaModifier (When the Windows key or Apple key is used)</li>
|
||||||
|
</ul>
|
||||||
|
<p>You can use these callbacks to create a custom event to get the tab information. </p>
|
||||||
|
<p>Note: There is a new core function (core.getTabPath) that will generate the query string and url hash for use in DS2 Core. You may wish to update your scaffolding.js file to make use of this functionality. </p>
|
||||||
<tabset id="tabs">
|
<tabset id="tabs">
|
||||||
<pre class="language-html" tab="html">
|
<pre class="language-html" tab="html">
|
||||||
<div class="tab-group" id="uniqueID">
|
<tabset id="uniqueID">
|
||||||
<div data-tab="[tab title]"></div>
|
<div tab="[tab title]"></div>
|
||||||
<div data-tab="[tab title]"></div>
|
<div tab="[tab title]"></div>
|
||||||
</div></pre>
|
</tabset></pre>
|
||||||
<pre class="language-css" tab="css">tabset, .tab-group {
|
<pre class="language-pug" tab="pug">tabset#uniqueID
|
||||||
margin: 2rem 0 1rem 0;
|
div(tab="[tab title]")
|
||||||
}
|
div(tab="[tab title]")
|
||||||
tabset > ul, .tab-group > ul {
|
</pre>
|
||||||
display: -webkit-box;
|
<pre class="language-css" tab="css">@media (min-width:450px){.tab-group,tabset{margin:2rem 0 1rem 0}}.tab-group>ul,tabset>ul{display:-webkit-box;display:-ms-flexbox;display:flex;margin:0;padding:0}.tab-group>ul li.separator,tabset>ul li.separator{border-bottom:1px solid #7f7f7f;border-left:1px solid #7f7f7f;display:inline-block;margin:0.45rem 0 0 0;width:100%}.tab-group .tab-hidden,tabset .tab-hidden{display:none}.tab-group [role=tab],tabset [role=tab]{background-color:#FFF;border-left:1px solid #7f7f7f;border-top:1px solid #7f7f7f;border-radius:0.5rem 0.5rem 0 0;cursor:pointer;margin:0;display:inline;padding:1rem 1.5rem 0.14rem 1.5rem;z-index:2}.tab-group [role=tab]:last-of-type,tabset [role=tab]:last-of-type{border-right:1px solid #7f7f7f}.tab-group [role=tab]:not(.selected),tabset [role=tab]:not(.selected){background-color:#f0f0f0;border-bottom:1px solid #7f7f7f}.tab-group [role=tab] span,tabset [role=tab] span{display:block;margin:0 0 0.5rem 0}.tab-group [role=tabpanel],tabset [role=tabpanel]{background-color:#FFF;border:1px solid #7f7f7f;border-top:none;padding:1rem;z-index:1}@media (min-width:450px){.tab-group [role=tabpanel][open] summary,tabset [role=tabpanel][open] summary{display:none}}@media (min-width:450px){.tab-group [role=tabpanel]:not(.open),tabset [role=tabpanel]:not(.open){display:none}}@media (max-width:450px){.tab-group:has(details) [role=tablist],tabset:has(details) [role=tablist]{display:none}.tab-group:has(details) [role=tabpanel],tabset:has(details) [role=tabpanel]{border:none}}</pre>
|
||||||
display: -ms-flexbox;
|
<div tab="scss">
|
||||||
display: flex;
|
<pre class="language-sass">@use "scss/core/tabs/_tabs";
|
||||||
margin: 0;
|
@include tabs{
|
||||||
padding: 0;
|
// optional content block
|
||||||
}
|
};
|
||||||
tabset > ul li.separator, .tab-group > ul li.separator {
|
</pre>
|
||||||
border-bottom: 1px solid var(--colour-grey);
|
<pre class="language-sass">// DS2 core (c) 2024 Alexander McIlwraith
|
||||||
border-left: 1px solid var(--colour-grey);
|
|
||||||
display: inline-block;
|
|
||||||
margin: 0.45rem 0 0 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
tabset .tab-hidden, .tab-group .tab-hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
tabset [role=tab], .tab-group [role=tab] {
|
|
||||||
background-color: var(--colour-white);
|
|
||||||
border-left: 1px solid var(--colour-grey);
|
|
||||||
border-top: 1px solid var(--colour-grey);
|
|
||||||
border-radius: 0.5rem 0.5rem 0 0;
|
|
||||||
cursor: pointer;
|
|
||||||
margin: 0;
|
|
||||||
display: inline;
|
|
||||||
padding: 1rem 1.5rem 0.14rem 1.5rem;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
tabset [role=tab]:last-of-type, .tab-group [role=tab]:last-of-type {
|
|
||||||
border-right: 1px solid var(--colour-grey);
|
|
||||||
}
|
|
||||||
tabset [role=tab]:not(.selected), .tab-group [role=tab]:not(.selected) {
|
|
||||||
background-color: var(--colour-grey-xxl);
|
|
||||||
border-bottom: 1px solid var(--colour-grey);
|
|
||||||
}
|
|
||||||
tabset [role=tab] span, .tab-group [role=tab] span {
|
|
||||||
display: block;
|
|
||||||
margin: 0 0 0.5rem 0;
|
|
||||||
}
|
|
||||||
tabset [role=tabpanel], .tab-group [role=tabpanel] {
|
|
||||||
background-color: var(--colour-white);
|
|
||||||
border: 1px solid var(--colour-grey);
|
|
||||||
border-top: none;
|
|
||||||
padding: 1rem;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
tabset [role=tabpanel]:not(.open), .tab-group [role=tabpanel]:not(.open) {
|
|
||||||
display: none;
|
|
||||||
}</pre>
|
|
||||||
<pre class="language-css" tab="scss">// DS2 core (c) 2024 Alexander McIlwraith
|
|
||||||
// Licensed under CC BY-SA 4.0
|
// Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
$tab-border: var(--colour-grey) !default;
|
|
||||||
$tab-selected: var(--colour-white) !default;
|
$tab-border: #7f7f7f !default;
|
||||||
$tab-notselected: var(--colour-grey-xxl) !default;
|
$tab-selected: #FFF !default;
|
||||||
|
$tab-notselected: #f0f0f0 !default;
|
||||||
|
$tab-break: 450px !default;
|
||||||
|
|
||||||
@mixin tabs {
|
@mixin tabs {
|
||||||
tabset, .tab-group {
|
tabset, .tab-group {
|
||||||
|
@media (min-width: $tab-break) {
|
||||||
margin: 2rem 0 1rem 0;
|
margin: 2rem 0 1rem 0;
|
||||||
|
}
|
||||||
> ul {
|
> ul {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
|
|
||||||
li.separator {
|
li.separator {
|
||||||
border-bottom: 1px solid $tab-border;
|
border-bottom: 1px solid $tab-border;
|
||||||
border-left: 1px solid $tab-border;
|
border-left: 1px solid $tab-border;
|
||||||
@ -98,6 +78,8 @@ $tab-notselected: var(--colour-grey-xxl) !default;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.tab-hidden {
|
.tab-hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@ -135,39 +117,130 @@ $tab-notselected: var(--colour-grey-xxl) !default;
|
|||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
||||||
|
@media (min-width: $tab-break) {
|
||||||
|
&[open] summary {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: $tab-break) {
|
||||||
&:not(.open) {
|
&:not(.open) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@content;
|
@content;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: $tab-break) {
|
||||||
|
&:has(details) {
|
||||||
|
[role="tablist"] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
[role="tabpanel"] {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
<pre class="language-css" tab="js">/* DS2 core (c) 2024 Alexander McIlwraith
|
</div>
|
||||||
import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js";
|
<div tab="js">
|
||||||
tabs.init();
|
<pre class="language-js">import * as tabs from "./js/core/tabs/_tabs.js";
|
||||||
|
tabs.init();</pre>
|
||||||
|
<pre class="language-js">/* DS2 core (c) 2024 Alexander McIlwraith
|
||||||
|
Released under Creative Commons Attribution-ShareAlike 4.0 International
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function init(p = document) {
|
// create a pure JS mouse click event
|
||||||
p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
const click = new MouseEvent('click', {
|
||||||
|
view: window,
|
||||||
|
bubbles: false,
|
||||||
|
cancelable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
const waitForElement = (selector) => {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
return resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
|
||||||
|
const observer = new MutationObserver(mutations => {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
observer.disconnect();
|
||||||
|
resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
|
||||||
|
observer.observe(document.body, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const chooseTab = (tab) => {
|
||||||
|
const siblings = Array.from(tab.parentNode.children);
|
||||||
|
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
||||||
|
tab.classList.add("selected");
|
||||||
|
|
||||||
|
const tabPanels = Array.from(tab.parentNode.parentNode.children)
|
||||||
|
tabPanels.forEach(panel => panel.classList.remove("open"));
|
||||||
|
|
||||||
|
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||||
|
document.getElementById(tabPanelId).classList.add("open");
|
||||||
|
}
|
||||||
|
|
||||||
|
let pushState = 0;
|
||||||
|
let tabsetCount = 0;
|
||||||
|
module.exports = {
|
||||||
|
"init": (container = document, spacer = true, args = {}) => {
|
||||||
|
container.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
||||||
if (tabGroup.querySelector("[role=tablist]") === null) {
|
if (tabGroup.querySelector("[role=tablist]") === null) {
|
||||||
|
if (tabGroup.getAttribute("id") == null) {
|
||||||
|
tabGroup.setAttribute("id", "tab-group-" + tabsetCount);
|
||||||
|
tabsetCount++;
|
||||||
|
}
|
||||||
|
|
||||||
const tabgroup = tabGroup.getAttribute("id");
|
const tabgroup = tabGroup.getAttribute("id");
|
||||||
let tablist = "";
|
let tablist = "";
|
||||||
|
|
||||||
Array.from(tabGroup.children).forEach(child => {
|
Array.from(tabGroup.children).forEach(child => {
|
||||||
const tab = child.getAttribute("tab") || child.getAttribute("data-tab");
|
|
||||||
|
// is details?
|
||||||
|
let dtls = child.nodeName == "DETAILS" ? true : false;
|
||||||
|
|
||||||
|
// get the tab text
|
||||||
|
let tab = dtls ? child.querySelector("summary").innerHTML : child.getAttribute("tab") || child.getAttribute("data-tab");
|
||||||
|
|
||||||
|
// if the tab text is not blank
|
||||||
if (tab !== null) {
|
if (tab !== null) {
|
||||||
const tabID = tab.replace(/\W+/g, "-").toLowerCase();
|
const tabID = tab.replace(/\W+/g, "-").toLowerCase();
|
||||||
const tabPanel = document.createElement('div');
|
|
||||||
|
|
||||||
|
// define the tab panel content
|
||||||
|
let tabPanel = null;
|
||||||
|
if (dtls) {
|
||||||
|
tabPanel = child;
|
||||||
|
tabPanel.setAttribute("open", "");
|
||||||
|
} else {
|
||||||
|
tabPanel = document.createElement('div');
|
||||||
|
tabPanel.appendChild(child.cloneNode(true));
|
||||||
|
}
|
||||||
|
|
||||||
tabPanel.id = `tab-panel-${tabgroup}-${tabID}`;
|
tabPanel.id = `tab-panel-${tabgroup}-${tabID}`;
|
||||||
tabPanel.className = tablist === "" ? "open" : "";
|
tabPanel.className = tablist === "" ? "open" : "";
|
||||||
tabPanel.setAttribute("role", "tabpanel");
|
tabPanel.setAttribute("role", "tabpanel");
|
||||||
tabPanel.setAttribute("tabindex", "0");
|
tabPanel.setAttribute("tabindex", "0");
|
||||||
tabPanel.setAttribute("aria-labelledby", `tab-${tabgroup}-${tabID}`);
|
tabPanel.setAttribute("aria-labelledby", `tab-${tabgroup}-${tabID}`);
|
||||||
tabPanel.appendChild(child.cloneNode(true));
|
|
||||||
child.parentNode.replaceChild(tabPanel, child);
|
child.parentNode.replaceChild(tabPanel, child);
|
||||||
tablist += `<li tabindex="0" role="tab" ${tablist === "" ? "class='selected'" : ""} id="tab-${tabgroup}-${tabID}"><span>${tab}</span></li>`;
|
let cls = tablist === "" ? "class='selected'" : "";
|
||||||
|
tablist += `<li tabindex="0" role="tab" ${cls} id="tab-${tabgroup}-${tabID}"><span>${tab}</span></li>`;
|
||||||
} else {
|
} else {
|
||||||
child.classList.add("tab-hidden");
|
child.classList.add("tab-hidden");
|
||||||
}
|
}
|
||||||
@ -175,28 +248,53 @@ export function init(p = document) {
|
|||||||
|
|
||||||
const ul = document.createElement('ul');
|
const ul = document.createElement('ul');
|
||||||
ul.setAttribute("role", "tablist");
|
ul.setAttribute("role", "tablist");
|
||||||
ul.innerHTML = `${tablist}<li role="separator" class="separator"></li>`;
|
ul.innerHTML = spacer != true ? `${tablist}` : `${tablist}<li role="separator" class="separator"></li>`;
|
||||||
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
||||||
|
|
||||||
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
||||||
tab.addEventListener("click", () => {
|
tab.addEventListener("click", (evt) => {
|
||||||
const siblings = Array.from(tab.parentNode.children);
|
if (pushState == 0) {
|
||||||
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
window.history.pushState({rand: Math.random(), pushState: pushState, tab: tab.parentNode.firstChild.getAttribute("id")}, "", `#${tab.parentNode.firstChild.getAttribute("id")}`);
|
||||||
tab.classList.add("selected");
|
pushState++;
|
||||||
|
}
|
||||||
|
|
||||||
const tabPanels = Array.from(tab.parentNode.parentNode.children)
|
chooseTab(evt.currentTarget);
|
||||||
.filter(child => child.getAttribute("role") === "tabpanel");
|
window.history.pushState({rand: Math.random(), pushState: pushState, tab: tab.getAttribute("id")}, "", `#${tab.getAttribute("id")}`);
|
||||||
tabPanels.forEach(panel => panel.classList.remove("open"));
|
pushState++;
|
||||||
|
|
||||||
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
|
||||||
document.getElementById(tabPanelId).classList.add("open");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tab.addEventListener("keypress", (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if( e.which == 32 || e.which == 13 ) {
|
||||||
|
e.currentTarget.dispatchEvent(click);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.location.hash != "" && document.location.hash.substring(0,5) == "#tab-") {
|
||||||
|
waitForElement(document.location.hash).then((el) => {
|
||||||
|
el.scrollIntoView();
|
||||||
|
el.focus();
|
||||||
|
el.dispatchEvent(click);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("popstate", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
if (e.state != null) {
|
||||||
|
chooseTab(document.querySelector(`#${e.state.tab}`));
|
||||||
|
} else {
|
||||||
|
history.go(-1);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
|
</div>
|
||||||
</tabset>
|
</tabset>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -2,12 +2,25 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
|
<p>Tooltips provide brief information messaging through a mouse or keyboard hover. </p>
|
||||||
<h2>When to use it</h2>
|
<h2>When to use it</h2>
|
||||||
|
<p>Use tool tips to provide additional information. Don't use tooltips for that is required to complete an interaction as the information disappears when it loses the hover state. </p>
|
||||||
|
<p>Use tooltips to help differentiate between multiple, close, similar options. </p>
|
||||||
<h2>How to use it</h2>
|
<h2>How to use it</h2>
|
||||||
<p>Either form works. Place this inside another element for the tooltip to be "linked to that element."</p>
|
<p class="notification-box info">Currently, there is no easy way to activate a hover without with pure CSS without using a keyboard or mouse. Level4 media queries aim to solve that.</p>
|
||||||
|
<p>Either form works.
|
||||||
|
<sticky-note class="blue">"Either form works": What are the two forms.</sticky-note>Place the <code class="language-html inline">tooltip</code> inside another element for the tooltip to be 'linked to that element.' A container element may need to be added for a single tag element, such as a input field.
|
||||||
|
</p>
|
||||||
<p>Tool tip positions are: </p>
|
<p>Tool tip positions are: </p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>top / block-start</li>
|
<li>top / block-start</li>
|
||||||
@ -15,16 +28,12 @@
|
|||||||
<li>bottom / block-end</li>
|
<li>bottom / block-end</li>
|
||||||
<li>left / inline-start</li>
|
<li>left / inline-start</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-group" id="tooltip">
|
<p><a href="#">Link with a tool tip<span role="tooltip" inert="inert" tip-position="right">Tool tip content</span></a></p>
|
||||||
<pre class="language-html" data-tab="html"><a href="#">Link with a tool tip
|
<tabset id="tooltip">
|
||||||
<div role="tooltip" inert="inert" tip-position="bottom">Tool tip content</div></a><a href="#">Link with a tool tip
|
<pre class="language-html" tab="html"><a href="#">Link with a tool tip<span role="tooltip" inert="inert" tip-position="right">Tool tip content</span></a></pre>
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="bottom">Tool tip content</tool-tip></a></pre>
|
<pre class="language-pug" tab="pug">a(href="#") Link with a tool tip
|
||||||
<pre class="language-pug" data-tab="pug">a(href="#") Link with a tool tip
|
span(role="tooltip" inert tip-position="right") Tool tip content</pre>
|
||||||
div(role="tooltip" inert tip-position="bottom") Tool tip content
|
<pre class="language-css" tab="css">/* Position Options
|
||||||
|
|
||||||
a(href="#") Link with a tool tip
|
|
||||||
tool-tip(role="tooltip" inert tip-position="bottom") Tool tip content</pre>
|
|
||||||
<pre class="language-css" data-tab="css">/* Position Options
|
|
||||||
- top / block-start
|
- top / block-start
|
||||||
- right / inline-end
|
- right / inline-end
|
||||||
- bottom / block-end
|
- bottom / block-end
|
||||||
@ -179,9 +188,13 @@ a(href="#") Link with a tool tip
|
|||||||
--tooltip-x: calc(-1 * 3px * -1);
|
--tooltip-x: calc(-1 * 3px * -1);
|
||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
<pre class="language-css" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith
|
<div tab="scss">
|
||||||
|
<pre class="language-sass">@use "scss/core/tooltip/_tooltip";
|
||||||
|
@include tooltip;</pre>
|
||||||
|
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
|
$font-body: sans-serif !default;
|
||||||
$tooltip-border-radius: .5rem !default;
|
$tooltip-border-radius: .5rem !default;
|
||||||
$tooltip-dark-allow: true !default;
|
$tooltip-dark-allow: true !default;
|
||||||
$tooltip-dark-background: #1f2127 !default;
|
$tooltip-dark-background: #1f2127 !default;
|
||||||
@ -210,6 +223,7 @@ $tooltip-pointer-top: conic-gradient(from 150deg at top, rgba(0, 0, 0, 0), #000
|
|||||||
border-radius: $tooltip-border-radius;
|
border-radius: $tooltip-border-radius;
|
||||||
color: $tooltip-light-foreground;
|
color: $tooltip-light-foreground;
|
||||||
filter: $tooltip-light-drop-shadow;
|
filter: $tooltip-light-drop-shadow;
|
||||||
|
$font-family: $font-body;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
inline-size: max-content;
|
inline-size: max-content;
|
||||||
@ -357,5 +371,6 @@ $tooltip-pointer-top: conic-gradient(from 150deg at top, rgba(0, 0, 0, 0), #000
|
|||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
</div>
|
</div>
|
||||||
|
</tabset>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -21,7 +21,7 @@ const font = {
|
|||||||
size: 0
|
size: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const copyColourFallback = (copyInfo, attr) => {
|
const copyFallback = (copyInfo, attr) => {
|
||||||
console.log("fallback")
|
console.log("fallback")
|
||||||
var textArea = document.createElement('textarea');
|
var textArea = document.createElement('textarea');
|
||||||
textArea.value = copyInfo;
|
textArea.value = copyInfo;
|
||||||
@ -71,22 +71,6 @@ const showMessage = (m, s) => {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
const oneClickSelect = (e, t = e.currentTarget) => {
|
|
||||||
// In here, "this" is the element
|
|
||||||
var range, selection;
|
|
||||||
if (window.getSelection) {
|
|
||||||
selection = window.getSelection();
|
|
||||||
range = document.createRange();
|
|
||||||
range.selectNodeContents(t);
|
|
||||||
selection.removeAllRanges();
|
|
||||||
selection.addRange(range);
|
|
||||||
} else if (document.body.createTextRange) {
|
|
||||||
range = document.body.createTextRange();
|
|
||||||
range.moveToElementText(t);
|
|
||||||
range.select();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getURLVars = () => {
|
const getURLVars = () => {
|
||||||
var oResult = {};
|
var oResult = {};
|
||||||
if (location.search.length > 0) {
|
if (location.search.length > 0) {
|
||||||
@ -102,7 +86,19 @@ const getURLVars = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
url: getURLVars(),
|
url: (() => {
|
||||||
|
var v = {};
|
||||||
|
if (location.search.length > 0) {
|
||||||
|
var qs = (location.search.substr(1)).split("&");
|
||||||
|
for (var i = 0; i < qs.length; i++) {
|
||||||
|
var t = qs[i].split("=");
|
||||||
|
if (t[1].length > 0) {
|
||||||
|
v[t[0]] = decodeURIComponent(t[1].replace(/\+/g, '%20'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
})(),
|
||||||
cookie: {
|
cookie: {
|
||||||
set: (name, value, expires, path, domain, secure) => {
|
set: (name, value, expires, path, domain, secure) => {
|
||||||
switch(typeof expires) {
|
switch(typeof expires) {
|
||||||
@ -133,12 +129,26 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
remove: (cnane) => {
|
remove: (cname) => {
|
||||||
setCookie(cname, "", -1);
|
module.exports.cookie.set(cname, null, new Date(null));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
oneClickSelect: (e, t = e.currentTarget) => {
|
||||||
|
// In here, "this" is the element
|
||||||
|
var range, selection;
|
||||||
|
if (window.getSelection) {
|
||||||
|
selection = window.getSelection();
|
||||||
|
range = document.createRange();
|
||||||
|
range.selectNodeContents(t);
|
||||||
|
selection.removeAllRanges();
|
||||||
|
selection.addRange(range);
|
||||||
|
} else if (document.body.createTextRange) {
|
||||||
|
range = document.body.createTextRange();
|
||||||
|
range.moveToElementText(t);
|
||||||
|
range.select();
|
||||||
|
}
|
||||||
|
},
|
||||||
colour: {
|
colour: {
|
||||||
|
|
||||||
copy: (w, t) => {
|
copy: (w, t) => {
|
||||||
let c = t.parentNode.getAttribute("data-" + (w=="var" ? "token" : w));
|
let c = t.parentNode.getAttribute("data-" + (w=="var" ? "token" : w));
|
||||||
c = w == "var" ? `var(${c})` : c;
|
c = w == "var" ? `var(${c})` : c;
|
||||||
@ -147,10 +157,10 @@ module.exports = {
|
|||||||
navigator.clipboard.writeText(c).then(function() {
|
navigator.clipboard.writeText(c).then(function() {
|
||||||
showMessage(`Copied ${w}.`);
|
showMessage(`Copied ${w}.`);
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
copyColourFallback(c,w);
|
copyFallback(c,w);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
copyColourFallback(c, w);
|
copyFallback(c, w);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -165,6 +175,26 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
getCSS: (el, prop, b = false) => {
|
||||||
|
return window.getComputedStyle(el, null).getPropertyValue(prop);
|
||||||
|
},
|
||||||
|
getTabPath: (t) => {
|
||||||
|
let url = window.location.toString();
|
||||||
|
url = url.indexOf("?") > 0 ? url.substring(0,url.indexOf("?")) : url;
|
||||||
|
url = `${url}?p=${t.closest("article").getAttribute("data-path")}#${t.getAttribute("id")}`
|
||||||
|
let type = "URL";
|
||||||
|
if (navigator.clipboard) {
|
||||||
|
navigator.clipboard.writeText(url).then(function() {
|
||||||
|
showMessage(`Copied ${type}.`);
|
||||||
|
}, function(e) {
|
||||||
|
copyFallback(url,type);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
copyFallback(url, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
init: (args = {}) => {
|
init: (args = {}) => {
|
||||||
const url = getURLVars();
|
const url = getURLVars();
|
||||||
@ -177,7 +207,14 @@ module.exports = {
|
|||||||
if (url.p == -1) {
|
if (url.p == -1) {
|
||||||
document.querySelector("title").innerHTML = `${url.p.toContent().toTitleCase()} | ${ document.querySelector("title").getAttribute("data-site") }`;
|
document.querySelector("title").innerHTML = `${url.p.toContent().toTitleCase()} | ${ document.querySelector("title").getAttribute("data-site") }`;
|
||||||
} else {
|
} else {
|
||||||
document.querySelector("title").innerHTML = `${url.p.substring(url.p.lastIndexOf("/")+1).toContent().toTitleCase()} | ${ document.querySelector("title").getAttribute("data-site") }`
|
let theTitle = document.querySelectorAll("article");
|
||||||
|
if (theTitle.length > 0) {
|
||||||
|
theTitle = theTitle[0].getAttribute("data-name").toContent().toTitleCase();
|
||||||
|
if (document.querySelector("article").getAttribute("data-display") !== null) {
|
||||||
|
theTitle = document.querySelector("article").getAttribute("data-display")
|
||||||
|
}
|
||||||
|
document.querySelector("title").innerHTML = `${theTitle} | ${ document.querySelector("title").getAttribute("data-site") }`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,13 +222,11 @@ module.exports = {
|
|||||||
|
|
||||||
document.querySelectorAll("article").forEach((a) => {
|
document.querySelectorAll("article").forEach((a) => {
|
||||||
if ( a.getAttribute("data-template") != "none" ) {
|
if ( a.getAttribute("data-template") != "none" ) {
|
||||||
|
const observer = new IntersectionObserver(articles => {
|
||||||
const observer = new IntersectionObserver((articles, { threshold: 0, rootMargin: 50vh}) => {
|
|
||||||
articles.forEach(article => {
|
articles.forEach(article => {
|
||||||
let a = article.target;
|
let a = article.target;
|
||||||
|
|
||||||
if (article.isIntersecting) {
|
if (article.isIntersecting == true) {
|
||||||
|
|
||||||
let path = a.getAttribute("data-path");
|
let path = a.getAttribute("data-path");
|
||||||
path = "patterns/" +
|
path = "patterns/" +
|
||||||
(a.getAttribute("data-core") == "true" ?
|
(a.getAttribute("data-core") == "true" ?
|
||||||
@ -202,11 +237,11 @@ module.exports = {
|
|||||||
let ajx = new XMLHttpRequest();
|
let ajx = new XMLHttpRequest();
|
||||||
ajx.onreadystatechange = () => {
|
ajx.onreadystatechange = () => {
|
||||||
if (ajx.readyState == 4) {
|
if (ajx.readyState == 4) {
|
||||||
|
observer.unobserve(article.target);
|
||||||
switch (ajx.status) {
|
switch (ajx.status) {
|
||||||
case 200:
|
case 200:
|
||||||
a.innerHTML = a.innerHTML + ajx.responseText;
|
a.innerHTML = a.innerHTML + ajx.responseText;
|
||||||
|
a.style.height = "auto"
|
||||||
switch (a.getAttribute("data-template")) {
|
switch (a.getAttribute("data-template")) {
|
||||||
case "pug":
|
case "pug":
|
||||||
a.querySelectorAll("pre").forEach((aa) => {
|
a.querySelectorAll("pre").forEach((aa) => {
|
||||||
@ -231,7 +266,7 @@ module.exports = {
|
|||||||
|
|
||||||
a.querySelectorAll("code").forEach((c)=> {
|
a.querySelectorAll("code").forEach((c)=> {
|
||||||
c.onclick = (e) => {
|
c.onclick = (e) => {
|
||||||
oneClickSelect(e);
|
module.exports.oneClickSelect(e);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -260,7 +295,6 @@ module.exports = {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 404:
|
case 404:
|
||||||
|
|
||||||
if (typeof args.notFound == "function") args.notFound(a, path);
|
if (typeof args.notFound == "function") args.notFound(a, path);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -268,6 +302,8 @@ module.exports = {
|
|||||||
console.log("uncaught http error", { status: ajx.status, path: a.getAttribute("data-path") });
|
console.log("uncaught http error", { status: ajx.status, path: a.getAttribute("data-path") });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.style.height = "auto";
|
||||||
|
|
||||||
if (typeof args.done == "function") args.done(a);
|
if (typeof args.done == "function") args.done(a);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -277,10 +313,12 @@ module.exports = {
|
|||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
}, { threshold: 0, rootMargin: "100%" })
|
||||||
|
|
||||||
observer.observe(a);
|
observer.observe(a);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
a.style.height = "auto";
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -12,10 +12,12 @@ import * as stickynote from "../pg/patterns/core/sticky-note/_sticky-note.js";
|
|||||||
import * as swtch from "../pg/patterns/core/switch/_switch.js";
|
import * as swtch from "../pg/patterns/core/switch/_switch.js";
|
||||||
import * as tabs from "../pg/patterns/core/tabs/_tabs.js";
|
import * as tabs from "../pg/patterns/core/tabs/_tabs.js";
|
||||||
|
|
||||||
// init core
|
// init c
|
||||||
core.init({
|
core.init({
|
||||||
success: (a) => {
|
success: (a) => {
|
||||||
tabs.init(a);
|
tabs.init(a, true, {
|
||||||
|
shiftModifier: core.getTabPath,
|
||||||
|
});
|
||||||
swtch.init(a);
|
swtch.init(a);
|
||||||
stickynote.init(a);
|
stickynote.init(a);
|
||||||
},
|
},
|
||||||
@ -25,13 +27,23 @@ core.init({
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// deprecated switch handler
|
// deprecated switch handler
|
||||||
const flipDeprecated = (e, s = e.currentTarget) => {
|
const flipInfoSwitch = (e, s = e.currentTarget) => {
|
||||||
|
|
||||||
|
switch(s.getAttribute("id")) {
|
||||||
|
|
||||||
|
case "deprecated" :
|
||||||
core.cookie.set("show-deprecated", s.getAttribute("aria-checked"), 30, "/");
|
core.cookie.set("show-deprecated", s.getAttribute("aria-checked"), 30, "/");
|
||||||
document.querySelector("main").querySelectorAll("article[data-status=deprecated]").forEach((a) => {
|
document.querySelector("main").querySelectorAll("article[data-status=deprecated]").forEach((a) => {
|
||||||
a.classList[( s.getAttribute("aria-checked") == "true" ? "add" : "remove" )]("show-deprecated")
|
a.classList[( s.getAttribute("aria-checked") == "true" ? "add" : "remove" )]("show-deprecated");
|
||||||
});
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "breakpoints" :
|
||||||
|
core.cookie.set("show-breakpoints", s.getAttribute("aria-checked"), 30, "/");
|
||||||
|
document.querySelector("html").classList[( s.getAttribute("aria-checked") == "true" ? "add" : "remove" )]("show-breakpoints");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a pure JS mouse click event
|
// create a pure JS mouse click event
|
||||||
@ -42,15 +54,24 @@ const click = new MouseEvent('click', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// get the switch, initialize it and add the handler
|
// get the switch, initialize it and add the handler
|
||||||
|
let switches = document.querySelector(".info-switches");
|
||||||
|
swtch.init(switches);
|
||||||
|
|
||||||
let deprecated = document.querySelector("#deprecated");
|
let deprecated = document.querySelector("#deprecated");
|
||||||
swtch.init(deprecated.parentNode)
|
let breakpoints = document.querySelector("#breakpoints");
|
||||||
deprecated.onclick = flipDeprecated;
|
|
||||||
deprecated.keypress = flipDeprecated;
|
deprecated.onclick = flipInfoSwitch;
|
||||||
|
deprecated.keypress = flipInfoSwitch;
|
||||||
|
breakpoints.onclick = flipInfoSwitch;
|
||||||
|
breakpoints.keypress = flipInfoSwitch;
|
||||||
|
|
||||||
// check a cookie to get the switch's state
|
// check a cookie to get the switch's state
|
||||||
if (core.cookie.get("show-deprecated") == "true") {
|
if (core.cookie.get("show-deprecated") == "true") {
|
||||||
deprecated.dispatchEvent(click);
|
deprecated.dispatchEvent(click);
|
||||||
}
|
}
|
||||||
|
if (core.cookie.get("show-breakpoints") == "true") {
|
||||||
|
breakpoints.dispatchEvent(click);
|
||||||
|
}
|
||||||
|
|
||||||
// just for fun... We'll show deprecated if they match the path
|
// just for fun... We'll show deprecated if they match the path
|
||||||
// document.querySelector(`#${core.url.p.replace(/\//g, "-")}`).classList.add("show-deprecated");
|
// document.querySelector(`#${core.url.p.replace(/\//g, "-")}`).classList.add("show-deprecated");
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
- var lang = "en-uk"
|
- var lang = "en-uk"
|
||||||
- var colorpfx = "colour"
|
- var colorpfx = "colour"
|
||||||
- var headings = ["What is it", "When to use it", "How to use it"]
|
- var headings = ["What is it", "When to use it", "How to use it"]
|
||||||
|
- var downloadExtensions = ["js", "pug", "scss"]
|
||||||
- var generateColourToken = ["colours"]
|
- var generateColourToken = ["colours"]
|
||||||
|
|
||||||
-
|
-
|
||||||
@ -27,12 +28,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "switch",
|
name: "switch",
|
||||||
status: "in-progress",
|
status: "complete",
|
||||||
core: true,
|
core: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "tooltip",
|
name: "tooltip",
|
||||||
status: "in-progress",
|
status: "complete",
|
||||||
core: true,
|
core: true,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@ -45,17 +46,17 @@
|
|||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
name: "header",
|
name: "header",
|
||||||
status: "in-progress",
|
status: "complete",
|
||||||
core: true,
|
core: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "breakpoints",
|
name: "breakpoint",
|
||||||
status: "in-progress",
|
status: "complete",
|
||||||
core: true,
|
core: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "tabs",
|
name: "tabs",
|
||||||
status: "in-progress",
|
status: "complete",
|
||||||
core: true,
|
core: true,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -128,24 +128,27 @@
|
|||||||
- function generateCSS(c, p) {
|
- function generateCSS(c, p) {
|
||||||
- let o = "";
|
- let o = "";
|
||||||
- for (let i = 0; i < c.length; i++) {
|
- for (let i = 0; i < c.length; i++) {
|
||||||
- o += `\n\t--${p}-${c[i].name.toLowerCase()}: ${ color(c[i].color, "hex").toLowerCase() },\n`;
|
- o += `\n\t--${p}-${c[i].name.toLowerCase()}: ${ color(c[i].color, "hex").toLowerCase() };\n`;
|
||||||
- for (let ii = 0; ii < c[i].grad.l.length; ii++) {
|
- for (let ii = 0; ii < c[i].grad.l.length; ii++) {
|
||||||
- o += `\t--${p}-${c[i].grad.l[ii].n.toLowerCase()}: ${ color(c[i].grad.l[ii].c, "hex").toLowerCase() },\n`;
|
- o += `\t--${p}-${c[i].grad.l[ii].n.toLowerCase()}: ${ color(c[i].grad.l[ii].c, "hex").toLowerCase() };\n`;
|
||||||
- }
|
- }
|
||||||
- for (let ii = 0; ii < c[i].grad.d.length; ii++) {
|
- for (let ii = 0; ii < c[i].grad.d.length; ii++) {
|
||||||
- o += `\t--${p}-${c[i].grad.d[ii].n.toLowerCase()}: ${ color(c[i].grad.d[ii].c, "hex").toLowerCase() },\n`;
|
- o += `\t--${p}-${c[i].grad.d[ii].n.toLowerCase()}: ${ color(c[i].grad.d[ii].c, "hex").toLowerCase() };\n`;
|
||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
- return o;
|
- return o;
|
||||||
- }
|
- }
|
||||||
|
|
||||||
|
if !colortxt
|
||||||
|
- var colortxt = "color"
|
||||||
|
|
||||||
|
|
||||||
mixin accessibility-info(c)
|
mixin accessibility-info(c)
|
||||||
div.acchb
|
div.acchb
|
||||||
span color & black
|
span #{colortxt} & black
|
||||||
small= getContrastRatio(color(c, "rgb"), "rgb(0,0,0)") + ":1"
|
small= getContrastRatio(color(c, "rgb"), "rgb(0,0,0)") + ":1"
|
||||||
div.acchw
|
div.acchw
|
||||||
span color & white
|
span #{colortxt} & white
|
||||||
small= getContrastRatio(color(c, "rgb"), "rgb(255,255,255)") + ":1"
|
small= getContrastRatio(color(c, "rgb"), "rgb(255,255,255)") + ":1"
|
||||||
div.aa WCAG 2.0 AA
|
div.aa WCAG 2.0 AA
|
||||||
div.accbaa.result
|
div.accbaa.result
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
@use "../pg/patterns/core/breakpoint/breakpoint";
|
||||||
|
|
||||||
@mixin core-colour-samples {
|
@mixin core-colour-samples {
|
||||||
|
|
||||||
#copystatus {
|
#copystatus {
|
||||||
@ -36,14 +38,14 @@
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
|
||||||
@include break(-lg) {
|
@include breakpoint.break(-lg) {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include break(-sm) {
|
@include breakpoint.break(-sm) {
|
||||||
grid-template-columns: auto;
|
grid-template-columns: auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
@ -67,7 +69,7 @@
|
|||||||
width: 20rem;
|
width: 20rem;
|
||||||
max-width: 318px;
|
max-width: 318px;
|
||||||
|
|
||||||
@include break(-lg) {
|
@include breakpoint.break(-lg) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,9 @@ mixin show-content(items, path)
|
|||||||
|
|
||||||
- path = (path == "" ? "" : path + "/") + items.name.toPath()
|
- path = (path == "" ? "" : path + "/") + items.name.toPath()
|
||||||
|
|
||||||
|
if items.core == true
|
||||||
|
- items.status = "complete"
|
||||||
|
|
||||||
article(id=path.replace(/\//g, "-").toPath()
|
article(id=path.replace(/\//g, "-").toPath()
|
||||||
data-name=items.name
|
data-name=items.name
|
||||||
data-status=items.status
|
data-status=items.status
|
||||||
@ -36,8 +39,13 @@ mixin show-content(items, path)
|
|||||||
data-template=(items.template == undefined ? "pug" : items.template)
|
data-template=(items.template == undefined ? "pug" : items.template)
|
||||||
data-core= (items.core ? "true" : "false")
|
data-core= (items.core ? "true" : "false")
|
||||||
data-path=path
|
data-path=path
|
||||||
|
style="height: 100vh"
|
||||||
)
|
)
|
||||||
|
if items.display
|
||||||
|
h1(class="status-" + items.status )
|
||||||
|
span= items.display
|
||||||
|
tool-tip(role="tooltip" inert tip-position="right")= items.status.toSentenceCase().toContent()
|
||||||
|
else
|
||||||
h1(class="status-" + items.status )
|
h1(class="status-" + items.status )
|
||||||
span= items.name.toSentenceCase().toContent()
|
span= items.name.toSentenceCase().toContent()
|
||||||
tool-tip(role="tooltip" inert tip-position="right")= items.status.toSentenceCase().toContent()
|
tool-tip(role="tooltip" inert tip-position="right")= items.status.toSentenceCase().toContent()
|
||||||
@ -76,18 +84,3 @@ html(lang= lang )
|
|||||||
+show-content(category, "")
|
+show-content(category, "")
|
||||||
|
|
||||||
script(src="assets/scaffolding-min.js")
|
script(src="assets/scaffolding-min.js")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,11 @@ block config
|
|||||||
|
|
||||||
mixin h(h)
|
mixin h(h)
|
||||||
if headings[h]
|
if headings[h]
|
||||||
|
if headings[h].indexOf("|") == -1
|
||||||
h2= headings[h]
|
h2= headings[h]
|
||||||
|
else
|
||||||
|
- var cntnt = headings[h].split("|")
|
||||||
|
| <#{cntnt[0]}>#{cntnt[1]}</#{cntnt[0]}>
|
||||||
|
|
||||||
- const getDate = function(){
|
- const getDate = function(){
|
||||||
- var d = new Date();
|
- var d = new Date();
|
||||||
@ -33,6 +37,11 @@ html
|
|||||||
head
|
head
|
||||||
|
|
||||||
title Pattern
|
title Pattern
|
||||||
|
script.
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
body(data-assetpath= assetpath data-prismjs-copy-timeout="1500")
|
body(data-assetpath= assetpath data-prismjs-copy-timeout="1500")
|
||||||
|
|
||||||
|
@ -5,270 +5,18 @@
|
|||||||
This file is generates _core.scss using information in ../pg/_config.pug.
|
This file is generates _core.scss using information in ../pg/_config.pug.
|
||||||
Please make your changes in your _config.pug file so that they are not
|
Please make your changes in your _config.pug file so that they are not
|
||||||
overwritten. \n*/\n\n\n`
|
overwritten. \n*/\n\n\n`
|
||||||
|
| !{out}
|
||||||
|
|
||||||
|
|
||||||
include ../_config
|
include ../_config
|
||||||
include _colour-samples
|
include _colour-samples
|
||||||
|
include _core-colour-samples.scss
|
||||||
|
|
||||||
|
- out = `\n\n//colour tokens\n$${colorpfx}: (`
|
||||||
-
|
|
||||||
out +=`@mixin core-colour-samples {
|
|
||||||
|
|
||||||
#copystatus {
|
|
||||||
left: 50%;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 100;
|
|
||||||
div {
|
|
||||||
border-radius: 1rem;
|
|
||||||
border: 1px solid green;
|
|
||||||
left: -50%;
|
|
||||||
padding: 1rem;
|
|
||||||
position: relative;
|
|
||||||
white-space: nowrap;
|
|
||||||
&::after {
|
|
||||||
clear: both;
|
|
||||||
content: " ";
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
&.succeeded {
|
|
||||||
background-color: white;
|
|
||||||
border-color: black;
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
&.failed {
|
|
||||||
background-color: white;
|
|
||||||
border-color: #f00;
|
|
||||||
color: #f00;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
color-samples {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 1rem;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
|
|
||||||
@include break(-lg) {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(2, 1fr);
|
|
||||||
max-width: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
@include break(-sm) {
|
|
||||||
grid-template-columns: auto;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
color-sample {
|
|
||||||
align-items: center;
|
|
||||||
border-radius: .5rem;
|
|
||||||
border: 1px solid #CCC;
|
|
||||||
display: grid;
|
|
||||||
font-family: inherit;
|
|
||||||
gap: .5rem;
|
|
||||||
grid-template-areas: "name name name hex hex hex"
|
|
||||||
"name name name rgb rgb rgb"
|
|
||||||
"acc acc acc acc acc acc"
|
|
||||||
"lighter lighter lighter darker darker darker"
|
|
||||||
"notes notes notes notes notes notes";
|
|
||||||
grid-template-columns: repeat(6, 1fr);
|
|
||||||
grid-template-rows: repeat(2, 1.5rem) 10rem repeat(3, max-content); // 3rem repeat(2, 2rem) 1.5rem repeat(3, max-content);
|
|
||||||
padding: 1rem;
|
|
||||||
width: 20rem;
|
|
||||||
max-width: 318px;
|
|
||||||
|
|
||||||
@include break(-lg) {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
name {
|
|
||||||
align-self: start;
|
|
||||||
font-size: 1.25rem;
|
|
||||||
grid-area: name;
|
|
||||||
span {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rgb {
|
|
||||||
grid-area: rgb;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
hex {
|
|
||||||
grid-area: hex;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
> accessibility {
|
|
||||||
border-bottom: 1px solid #ccc;
|
|
||||||
border-top: 1px solid #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
accessibility {
|
|
||||||
grid-area: acc;
|
|
||||||
grid-row: 3;
|
|
||||||
padding: .5rem 0;
|
|
||||||
|
|
||||||
display: grid;
|
|
||||||
gap: .5rem;
|
|
||||||
grid-template-columns: repeat(3, 1fr);
|
|
||||||
grid-template-rows: 2.5rem repeat(2, max-content);
|
|
||||||
.result {
|
|
||||||
align-items: center;
|
|
||||||
border-radius: .5rem;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(2, 1fr);
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 0 1rem;
|
|
||||||
text-align: center;
|
|
||||||
&.accwaa, &.accwaaa {
|
|
||||||
background-color: white;
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
&.accbaa, &.accbaaa {
|
|
||||||
background-color: black;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
span:nth-child(2) {
|
|
||||||
font-size: 2rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.aa, .aaa {
|
|
||||||
align-self: center;
|
|
||||||
display: block;
|
|
||||||
font-size: .75rem;
|
|
||||||
}
|
|
||||||
.acchb {
|
|
||||||
grid-column: 2;
|
|
||||||
}
|
|
||||||
.acchb, .acchw {
|
|
||||||
display: grid;
|
|
||||||
grid-tempate-columns: auto;
|
|
||||||
grid-template-rows: repeat(2, max-content);
|
|
||||||
align-self: start;
|
|
||||||
text-align: center;
|
|
||||||
padding: 0;
|
|
||||||
span {
|
|
||||||
grid-row: 1;
|
|
||||||
grid-column: 1 / -1;
|
|
||||||
font-size: .9rem;
|
|
||||||
}
|
|
||||||
small {
|
|
||||||
text-align: center;
|
|
||||||
grid-row: 2;
|
|
||||||
grid-column: 1 / -1;
|
|
||||||
font-size: .75rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sample-block {
|
|
||||||
align-self: start;
|
|
||||||
grid-column: span 3;
|
|
||||||
grid-row: 4;
|
|
||||||
color-pill {
|
|
||||||
display: grid;
|
|
||||||
grid-gap: .5rem;
|
|
||||||
grid-template-columns: 20px max-content auto;
|
|
||||||
:nth-child(1) {
|
|
||||||
align-self: center;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: 1px solid #CCC;
|
|
||||||
display: inline-block;
|
|
||||||
height: 10px;
|
|
||||||
width: 20px;
|
|
||||||
}
|
|
||||||
span {
|
|
||||||
cursor: pointer;
|
|
||||||
.tooltip-tc {
|
|
||||||
padding: .5rem;
|
|
||||||
width: 20rem;
|
|
||||||
max-width: 318px;
|
|
||||||
height: 10.5rem;
|
|
||||||
|
|
||||||
display: grid;
|
|
||||||
gap: .5rem;
|
|
||||||
grid-template-columns: repeat(3, 1fr);
|
|
||||||
grid-template-rows: repeat(3, max-content);
|
|
||||||
.result {
|
|
||||||
align-items: center;
|
|
||||||
border-radius: .5rem;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(2, 1fr);
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 0 1rem;
|
|
||||||
text-align: center;
|
|
||||||
&.accwaa, &.accwaaa {
|
|
||||||
background-color: white;
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
&.accbaa, &.accbaaa {
|
|
||||||
background-color: black;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
span{ border: none;
|
|
||||||
&:nth-child(2) {
|
|
||||||
font-size: 2rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.aa, .aaa {
|
|
||||||
align-self: center;
|
|
||||||
display: block;
|
|
||||||
font-size: .75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.acchb {
|
|
||||||
grid-column: 2;
|
|
||||||
}
|
|
||||||
.acchb, .acchw {
|
|
||||||
border: none;
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
place-self: stretch;
|
|
||||||
span {
|
|
||||||
border: none;
|
|
||||||
font-size: .9rem;
|
|
||||||
width: 100%;
|
|
||||||
&::after, &::before {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
small {
|
|
||||||
font-size: .75rem;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
notes {
|
|
||||||
border-top: 1px solid #ccc;
|
|
||||||
grid-column: 1 / -1;
|
|
||||||
padding-top: .5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- out += `\n\n//colour tokens\n$${colorpfx}: (`
|
|
||||||
|
|
||||||
each val in generateColourToken
|
each val in generateColourToken
|
||||||
- out += generateSCSS(eval(val), colorpfx)
|
- out += generateSCSS(eval(val), colorpfx)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//- var scss = $colors
|
//- var scss = $colors
|
||||||
| !{generateSCSS(eval(val), colorpfx)}
|
| !{generateSCSS(eval(val), colorpfx)}
|
||||||
|
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
include ../_config.pug
|
||||||
|
|
||||||
|
if typeof downloadExtensions == "undefined"
|
||||||
|
- var extensions = `["js", "scss", "hello"]`
|
||||||
|
else
|
||||||
|
- var extensions = []
|
||||||
|
each ext in downloadExtensions
|
||||||
|
- extensions.push("'" + ext + "'")
|
||||||
|
- extensions = "[" + extensions + "]"
|
||||||
|
|
||||||
-
|
-
|
||||||
var php = `<?php
|
var php = `<?php
|
||||||
function recursor($dir, $type) {
|
function recursor($dir, $type) {
|
||||||
@ -25,7 +35,7 @@
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$allowed_types = ["scss", "js"];
|
$allowed_types = {{extensions}};
|
||||||
$patterns = dirname(dirname(__file__)) . "/src/pg/patterns";
|
$patterns = dirname(dirname(__file__)) . "/src/pg/patterns";
|
||||||
|
|
||||||
|
|
||||||
@ -50,5 +60,7 @@
|
|||||||
|
|
||||||
header('Content-type: application/zip');
|
header('Content-type: application/zip');
|
||||||
header(sprintf('Content-Disposition: attachment; filename="%s.zip"', $type));
|
header(sprintf('Content-Disposition: attachment; filename="%s.zip"', $type));
|
||||||
echo(file_get_contents($t)); ?>`
|
echo(file_get_contents($t)); ?>`.replace("{{extensions}}", extensions)
|
||||||
| !{php}
|
| !{php}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,10 @@ block header
|
|||||||
li(class= navClass)
|
li(class= navClass)
|
||||||
a(href="./?p=" + first.name.toPath() )= first.name.toContent().toSentenceCase()
|
a(href="./?p=" + first.name.toPath() )= first.name.toContent().toSentenceCase()
|
||||||
|
|
||||||
p.deprecated-switch
|
p.info-switches
|
||||||
span
|
span
|
||||||
span#deprecated(role="switch")
|
span#deprecated(role="switch")
|
||||||
label(for="deprecated") Show deprecated patterns
|
label(for="deprecated") Show deprecated patterns
|
||||||
|
span
|
||||||
|
span#breakpoints(role="switch")
|
||||||
|
label(for="breakpoints") Show breakpoint information
|
@ -1,14 +1,16 @@
|
|||||||
//- DS2 core (c) 2024 Alexander McIlwraith
|
//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px ) !default;
|
// default breakpoints match bootstrap 5 breakpoints.
|
||||||
|
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px ) !default;
|
||||||
|
|
||||||
@mixin breakpoint-debug {
|
@mixin debug {
|
||||||
body::before, body::after {
|
body::before, body::after {
|
||||||
background-color: #555;
|
background-color: #555;
|
||||||
color: white;
|
color: white;
|
||||||
content: "bigger than extra large";
|
content: "bigger than extra large";
|
||||||
display: grid;
|
display: grid;
|
||||||
|
font-family: sans-serif;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
grid-template-columns: auto;
|
grid-template-columns: auto;
|
||||||
padding: 25px;
|
padding: 25px;
|
30
src/pg/patterns/core/breakpoint/index.pug
Normal file
30
src/pg/patterns/core/breakpoint/index.pug
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
|
//- Core licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
|
extends ../../../core/_master-pattern
|
||||||
|
block content
|
||||||
|
|
||||||
|
+h(0)
|
||||||
|
p Breakpoints enable responsive mobile design.
|
||||||
|
|
||||||
|
+h(1)
|
||||||
|
p Use breakpoints when designing for different screen sizes.
|
||||||
|
|
||||||
|
p The breakpoints SCSS mixin included implements media queries to allow for the change of the layout and design based on pre-defined screen sizes.
|
||||||
|
|
||||||
|
+h(2)
|
||||||
|
p This pattern is only available for SCSS breakpoints. The mixin is avai
|
||||||
|
|
||||||
|
p When using this, use the default break points as they are set to the same as the Bootstrap framework. The grid for the design system at large break point has been widened to accompdate 3 colour cards across.
|
||||||
|
|
||||||
|
tabset#breakpoints
|
||||||
|
div(tab="scss")
|
||||||
|
+h(3)
|
||||||
|
pre.language-sass.
|
||||||
|
@use "scss/core/breakpoint/breakpoint";
|
||||||
|
@include breapoint.break([breakpoint]) {
|
||||||
|
// css here
|
||||||
|
}
|
||||||
|
+h(4)
|
||||||
|
pre.language-sass
|
||||||
|
include _breakpoint.scss
|
@ -1,15 +0,0 @@
|
|||||||
//- DS2 core (c) 2024 Alexander McIlwraith
|
|
||||||
//- Core licensed under CC BY-SA 4.0
|
|
||||||
|
|
||||||
extends ../../../core/_master-pattern
|
|
||||||
block content
|
|
||||||
|
|
||||||
+h(0)
|
|
||||||
+h(1)
|
|
||||||
+h(2)
|
|
||||||
|
|
||||||
p When using this, use the default break points as they are set to the same as the Bootstrap framework. The grid for the design system at large break point has been widened to accompdate 3 colour cards across.
|
|
||||||
|
|
||||||
div.tab-group#breakpoints
|
|
||||||
pre.language-css(data-tab="scss")
|
|
||||||
include _breakpoints.scss
|
|
16
src/pg/patterns/core/header/_header.pp
Normal file
16
src/pg/patterns/core/header/_header.pp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
|
//- required variables
|
||||||
|
//- site - the site name that goes in the site title
|
||||||
|
//- root - the path to the root of the site
|
||||||
|
|
||||||
|
header
|
||||||
|
// The headline banner area
|
||||||
|
svg(height='5.5rem' width='100%' xmlns='http://www.w3.org/2000/svg' aria-hidden='true')
|
||||||
|
text= site
|
||||||
|
div
|
||||||
|
div.header-title
|
||||||
|
h1
|
||||||
|
a(href="./")= site
|
||||||
|
// Other sections can go here, such as search and directory
|
@ -1,53 +1 @@
|
|||||||
header {
|
header{display:-ms-grid;display:grid;-ms-grid-rows:1.75rem 3.5rem;grid-template-rows:1.75rem 3.5rem;-ms-grid-column:2;-ms-grid-column-span:2;grid-column:2/4;overflow:hidden}header svg{grid-column:1/-1;grid-row:1/-1;-ms-grid-row-align:stretch;-ms-grid-column-align:stretch;place-self:stretch}header svg text{-webkit-transform:translate(-1rem,7.25rem);-ms-transform:translate(-1rem,7.25rem);transform:translate(-1rem,7.25rem);font-size:10rem;font-weight:1000;font-family:sans-serif;fill:var(--colour-grey-xxl)}header>div{-ms-grid-row:2;grid-row:2;grid-column:1/-1;display:-ms-grid;display:grid;grid-column-gap:1rem;-ms-grid-columns:auto -webkit-max-content -webkit-max-content;-ms-grid-columns:auto max-content max-content;grid-template-columns:auto -webkit-max-content -webkit-max-content;grid-template-columns:auto max-content max-content}header>div .header-title h1{margin:0;padding:0 1rem}header>div .header-title h1 a,header>div .header-title h1 a:visited{border-bottom:none;color:var(--colour-black);font-family:sans-serif;font-size:2.5rem;font-size:32px;font-weight:700;margin:0;padding:0;text-decoration:none}
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
-ms-grid-rows: 1.75rem 3.5rem;
|
|
||||||
grid-template-rows: 1.75rem 3.5rem;
|
|
||||||
-ms-grid-column: 2;
|
|
||||||
-ms-grid-column-span: 2;
|
|
||||||
grid-column: 2/4;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
header svg {
|
|
||||||
grid-column: 1/-1;
|
|
||||||
grid-row: 1/-1;
|
|
||||||
-ms-grid-row-align: stretch;
|
|
||||||
-ms-grid-column-align: stretch;
|
|
||||||
place-self: stretch;
|
|
||||||
}
|
|
||||||
header svg text {
|
|
||||||
-webkit-transform: translate(-1rem, 7.25rem);
|
|
||||||
-ms-transform: translate(-1rem, 7.25rem);
|
|
||||||
transform: translate(-1rem, 7.25rem);
|
|
||||||
font-size: 10rem;
|
|
||||||
font-weight: 1000;
|
|
||||||
font-family: sans-serif;
|
|
||||||
fill: var(--colour-grey-xxl);
|
|
||||||
}
|
|
||||||
header > div {
|
|
||||||
-ms-grid-row: 2;
|
|
||||||
grid-row: 2;
|
|
||||||
grid-column: 1/-1;
|
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
grid-column-gap: 1rem;
|
|
||||||
-ms-grid-columns: auto -webkit-max-content -webkit-max-content;
|
|
||||||
-ms-grid-columns: auto max-content max-content;
|
|
||||||
grid-template-columns: auto -webkit-max-content -webkit-max-content;
|
|
||||||
grid-template-columns: auto max-content max-content;
|
|
||||||
}
|
|
||||||
header > div .header-title h1 {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0 1rem;
|
|
||||||
}
|
|
||||||
header > div .header-title h1 a, header > div .header-title h1 a:visited {
|
|
||||||
border-bottom: none;
|
|
||||||
color: var(--colour-black);
|
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: 2.5rem;
|
|
||||||
font-size: 32px;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
@ -5,11 +5,15 @@ extends ../../../core/_master-pattern
|
|||||||
block content
|
block content
|
||||||
|
|
||||||
+h(0)
|
+h(0)
|
||||||
|
p A header is layout pattern that helps the user identify the site.
|
||||||
+h(1)
|
+h(1)
|
||||||
+h(2)
|
p Use a header at the top of every page. The 'front page' of a site may have a different header than the rest of the pages.
|
||||||
|
|
||||||
div.tab-group#header
|
+h(2)
|
||||||
pre.language-html(data-tab="html")
|
p Place the header at the top of the page after the skip to main content link. You will likely want to replace core header should be replaced with your own site's header. To do this, remove the #[code.inline.language-js core: true ] and create your own pattern in the location you wish it in your design system.
|
||||||
|
|
||||||
|
tabset#header
|
||||||
|
pre.language-html(tab="html")
|
||||||
// create temp variables and store the design system values
|
// create temp variables and store the design system values
|
||||||
- var tmpsite= site
|
- var tmpsite= site
|
||||||
- var tmproot= root
|
- var tmproot= root
|
||||||
@ -21,8 +25,14 @@ block content
|
|||||||
//- reset variables to original values
|
//- reset variables to original values
|
||||||
- site= tmpsite
|
- site= tmpsite
|
||||||
- root= tmproot
|
- root= tmproot
|
||||||
|
pre.language-pug(tab="pug")
|
||||||
pre.language-sass(data-tab="scss")
|
include _header.pp
|
||||||
include _header.scss
|
pre.language-css(tab="css")
|
||||||
pre.language-css(data-tab="css")
|
|
||||||
include header.css
|
include header.css
|
||||||
|
div.language-sass(tab="scss")
|
||||||
|
|
||||||
|
pre.language-sass.
|
||||||
|
@use "scss/core/header/header;
|
||||||
|
|
||||||
|
pre.language-sass
|
||||||
|
include _header.scss
|
@ -6,23 +6,23 @@ block content
|
|||||||
-
|
-
|
||||||
- let list = []
|
- let list = []
|
||||||
- for(let i = 0; i < content.length; i++) {
|
- for(let i = 0; i < content.length; i++) {
|
||||||
- list.push({ "name": content[i].name, "path": content[i].name, "status": content[i].status, "display": content[i].display } )
|
- list.push({ "name": content[i].name, "core": (typeof content[i].core != 'undefined' && content[i].core ? 'true' : 'false'), "path": content[i].name, "status": content[i].status, "display": (content[i].hasOwnProperty("display") && content[i].display != "" ? content[i].display : content[i].name.toSentenceCase().toContent()) } )
|
||||||
- if (content[i].files != undefined) {
|
- if (content[i].files != undefined) {
|
||||||
- for (let ii = 0; ii < content[i].files.length; ii++) {
|
- for (let ii = 0; ii < content[i].files.length; ii++) {
|
||||||
- list.push({ "name": content[i].files[ii].name, "path": content[i].name +"."+ content[i].files[ii].name, "status": content[i].files[ii].status } )
|
- list.push({ "name": content[i].files[ii].name, "core": (typeof content[i].files[ii].core != 'undefined' && content[i].files[ii].core ? 'true' : 'false'), "path": content[i].name +"."+ content[i].files[ii].name, "status": content[i].files[ii].status, "display": (content[i].files[ii].hasOwnProperty("display") && content[i].files[ii].display != "" ? content[i].files[ii].display : content[i].files[ii].name.toSentenceCase().toContent()) } )
|
||||||
- if (content[i].files[ii].files != undefined) {
|
- if (content[i].files[ii].files != undefined) {
|
||||||
- for (let iii = 0; iii < content[i].files[ii].files.length; iii++) {
|
- for (let iii = 0; iii < content[i].files[ii].files.length; iii++) {
|
||||||
- list.push({ "name": content[i].files[ii].files[iii].name, "path": content[i].name +"."+ content[i].files[ii].name + "." + content[i].files[ii].files[iii].name, "status": content[i].files[ii].files[iii].status } )
|
- list.push({ "name": content[i].files[ii].files[iii].name, "core": (typeof content[i].files[ii].files[iii].core != 'undefined' && content[i].files[ii].files[iii].core ? 'true' : 'false'), "path": content[i].name +"."+ content[i].files[ii].name + "." + content[i].files[ii].files[iii].name, "status": content[i].files[ii].files[iii].status, "display": (content[i].files[ii].files[iii].hasOwnProperty("display") && content[i].files[ii].files[iii].display != "" ? content[i].files[ii].files[iii].display : content[i].files[ii].files[iii].name.toSentenceCase().toContent()) } )
|
||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
- list.sort((a, b) => {
|
- list.sort((a, b) => {
|
||||||
- if (a.name < b.name) {
|
- if (a.display < b.display) {
|
||||||
- return -1;
|
- return -1;
|
||||||
- }
|
- }
|
||||||
- if (a.name > b.name) {
|
- if (a.display > b.display) {
|
||||||
- return 1;
|
- return 1;
|
||||||
- }
|
- }
|
||||||
- return 0;
|
- return 0;
|
||||||
@ -64,6 +64,9 @@ block content
|
|||||||
else
|
else
|
||||||
| !{category.name.toContent().toSentenceCase()}
|
| !{category.name.toContent().toSentenceCase()}
|
||||||
td
|
td
|
||||||
|
if typeof category.core && category.core
|
||||||
|
span.status-complete Complete (Core)
|
||||||
|
else
|
||||||
span(class="status-" + category.status)= category.status.toContent().toSentenceCase()
|
span(class="status-" + category.status)= category.status.toContent().toSentenceCase()
|
||||||
|
|
||||||
|
|
||||||
@ -77,6 +80,9 @@ block content
|
|||||||
else
|
else
|
||||||
| !{pattern.name.toContent().toSentenceCase()}
|
| !{pattern.name.toContent().toSentenceCase()}
|
||||||
td
|
td
|
||||||
|
if typeof pattern.core && pattern.core
|
||||||
|
span.status-complete Complete (Core)
|
||||||
|
else
|
||||||
span(class="status-" + pattern.status)= pattern.status.toContent().toSentenceCase()
|
span(class="status-" + pattern.status)= pattern.status.toContent().toSentenceCase()
|
||||||
|
|
||||||
if pattern.files
|
if pattern.files
|
||||||
@ -90,14 +96,22 @@ block content
|
|||||||
else
|
else
|
||||||
| !{sub.name.toContent().toSentenceCase()}
|
| !{sub.name.toContent().toSentenceCase()}
|
||||||
td
|
td
|
||||||
|
if typeof sub.core && sub.core
|
||||||
|
span.status-complete Complete (Core)
|
||||||
|
else
|
||||||
span(class="status-" + sub.status)= sub.status.toContent().toSentenceCase()
|
span(class="status-" + sub.status)= sub.status.toContent().toSentenceCase()
|
||||||
|
|
||||||
div.status-report.status-report-status(data-tab="by status")
|
div.status-report.status-report-status(data-tab="by status")
|
||||||
table(role="presentation")
|
table(role="presentation")
|
||||||
|
|
||||||
tbody
|
tbody
|
||||||
|
- bystatus = list;
|
||||||
|
- for(i=0; i < bystatus.length; i++) {
|
||||||
|
- if (bystatus[i].core == "true") {
|
||||||
|
- bystatus[i].status = "complete"
|
||||||
|
- }
|
||||||
|
- }
|
||||||
each status in statuses || []
|
each status in statuses || []
|
||||||
- out = list.filter(list => list.status === status.name)
|
- out = bystatus.filter(list => list.status === status.name)
|
||||||
tr
|
tr
|
||||||
td(colspan="2")
|
td(colspan="2")
|
||||||
span(class="status-" + status.name)= status.name.toContent().toSentenceCase() + " (" + out.length + ")"
|
span(class="status-" + status.name)= status.name.toContent().toSentenceCase() + " (" + out.length + ")"
|
||||||
@ -110,6 +124,9 @@ block content
|
|||||||
| !{item.display}
|
| !{item.display}
|
||||||
else
|
else
|
||||||
| !{item.name.toContent().toSentenceCase()}
|
| !{item.name.toContent().toSentenceCase()}
|
||||||
|
td
|
||||||
|
if item.core == "true"
|
||||||
|
span (core)
|
||||||
td= getCategory(item.path)
|
td= getCategory(item.path)
|
||||||
|
|
||||||
div.status-report.status-report-alpha(data-tab="alphabetical")
|
div.status-report.status-report-alpha(data-tab="alphabetical")
|
||||||
@ -125,6 +142,9 @@ block content
|
|||||||
| !{item.name.toContent().toSentenceCase()}
|
| !{item.name.toContent().toSentenceCase()}
|
||||||
td
|
td
|
||||||
span
|
span
|
||||||
|
if item.core == "true"
|
||||||
|
span.status-complete Complete (Core)
|
||||||
|
else
|
||||||
span(class="status-" + item.status)= item.status.toContent().toTitleCase()
|
span(class="status-" + item.status)= item.status.toContent().toTitleCase()
|
||||||
td= getCategory(item.path)
|
td= getCategory(item.path)
|
||||||
|
|
||||||
|
@ -95,7 +95,8 @@ const calculateStickyPosition = (s) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function init(p = document){
|
module.exports = {
|
||||||
|
init: (p = document) => {
|
||||||
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px",""));
|
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px",""));
|
||||||
|
|
||||||
p.querySelectorAll("sticky-note").forEach((s) => {
|
p.querySelectorAll("sticky-note").forEach((s) => {
|
||||||
@ -128,4 +129,5 @@ export function init(p = document){
|
|||||||
calculateStickyPosition(s);
|
calculateStickyPosition(s);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
2
src/pg/patterns/core/sticky-note/_sticky-note.pp
Normal file
2
src/pg/patterns/core/sticky-note/_sticky-note.pp
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
sticky-note(float="right").blue This #[strong is] a sample sticky.
|
||||||
|
| You can drag it out of the way if you need to see the content under it.
|
2
src/pg/patterns/core/sticky-note/_sticky-note.pug
Normal file
2
src/pg/patterns/core/sticky-note/_sticky-note.pug
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
sticky-note(float="right").blue This #[strong is] a sample sticky.
|
||||||
|
| You can drag it out of the way if you need to see the content under it.
|
@ -8,24 +8,36 @@ block content
|
|||||||
+h(1)
|
+h(1)
|
||||||
p Use a sticky when you want to make a note without adding it to the content.
|
p Use a sticky when you want to make a note without adding it to the content.
|
||||||
+h(2)
|
+h(2)
|
||||||
p Uses absolute positioning.
|
p Uses absolute positioning. Passing an optional element to the init function will initialise tabs within that element. You can move the position using either #[code.language-html.inline float="[ right | left ]"] or #[code.language-html.inline offset="[ top | left ]"]. Offset will take negative values in any web measurement unit.
|
||||||
sticky-note(float="right").blue This #[strong is] a sample sticky.
|
sticky-note.blue(offset="-10rem 1rem") This #[strong is] a sample sticky. You can drag it out of the way if you need to see the content under it.
|
||||||
| You can drag it out of the way if you need to see the content under it.
|
sticky-note(float="right") You will notice when you hover over the sticky, it shows a dot in the colour of the sticky in the position where the sticky note refers to (assuming you haven't dragged it and scrolled that location off the screen).
|
||||||
|
|
||||||
p If you wish to create a custom element, that extends another HTML element, the native element has to be extended in customElements.define(). Custom elements that inherit native elements are also known as "type extension custom elements".
|
p If you wish to create a custom element, that extends another HTML element, the native element has to be extended in customElements.define(). Custom elements that inherit native elements are also known as "type extension custom elements".
|
||||||
|
|
||||||
sticky-note You will notice when you hover over the sticky, it shows a dot in the colour of the sticky in the position where the sticky note refers to (assuming you haven't dragged it and scrolled that location off the screen).
|
|
||||||
|
|
||||||
tabset#sticky-note
|
tabset#sticky-note
|
||||||
pre.language-html(tab="html")
|
pre.language-html(tab="html")
|
||||||
sticky-note(float="right").blue This #[strong is] a sample sticky.
|
include _sticky-note.pug
|
||||||
| You can drag it out of the way if you need to see the content under it.
|
pre.language-pug(tab="pug")
|
||||||
pre.language-pug(tab="pug").
|
include _sticky-note.pp
|
||||||
sticky-note(float="right").blue This #[strong is] a sample sticky.
|
|
||||||
| You can drag it out of the way if you need to see the content under it.
|
|
||||||
pre.language-css(data-tab="css")
|
pre.language-css(data-tab="css")
|
||||||
include sticky-note.css
|
include sticky-note.css
|
||||||
pre.language-css(data-tab="scss")
|
div(tab="scss")
|
||||||
|
+h(3)
|
||||||
|
pre.language-sass.
|
||||||
|
$sticky-colors: ( [sass map with your own defined colours] );
|
||||||
|
@use "scss/core/switch/_sticky-note";
|
||||||
|
@include sticky-note;
|
||||||
|
|
||||||
|
+h(4)
|
||||||
|
pre.language-sass
|
||||||
include _sticky-note.scss
|
include _sticky-note.scss
|
||||||
pre.language-js(data-tab="js")
|
div(tab="js")
|
||||||
|
+h(3)
|
||||||
|
pre.language-js.
|
||||||
|
import * as stickynote from ""./js/core/sticky-note/_sticky-note.js";
|
||||||
|
stickynote.init()
|
||||||
|
|
||||||
|
+h(4)
|
||||||
|
pre.language-js
|
||||||
include _sticky-note.js
|
include _sticky-note.js
|
@ -1,126 +1 @@
|
|||||||
@import url("https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap");
|
@import url("https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap");sticky-note-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid transparent;border-radius:50%;display:inline-block;height:0.5rem;position:relative;width:0.5rem}sticky-note-wrapper *{-webkit-box-sizing:border-box;box-sizing:border-box}sticky-note-wrapper sticky-note{cursor:-webkit-grab;cursor:grab;display:-ms-grid;display:grid;float:left;font-size:1rem;height:13rem;left:0;place-items:stretch;position:absolute;top:0;width:13rem;z-index:100}sticky-note-wrapper sticky-note:active{cursor:-webkit-grabbing;cursor:grabbing;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}sticky-note-wrapper sticky-note.right{float:right}sticky-note-wrapper sticky-note>div{-ms-grid-row:1;grid-row:1;-ms-grid-column:1;grid-column:1}sticky-note-wrapper sticky-note>div:first-child{background-color:rgba(0,0,0,0.25);-webkit-box-shadow:-2px 2px 15px 0 rgba(0,0,0,0.5);box-shadow:-2px 2px 15px 0 rgba(0,0,0,0.5);display:-ms-grid;display:grid;margin:2rem 1rem 0.25rem 0.36rem;width:calc(100% - 1rem)}sticky-note-wrapper sticky-note>div:nth-child(2){clip-path:url(#stickyClip);display:-ms-grid;display:grid;font-family:"Kalam",cursive;font-style:1rem;font-weight:300;line-height:1.25rem;padding:1rem;place-items:center;text-align:center}sticky-note-wrapper sticky-note>div:nth-child(2)>*{font-family:"Kalam",cursive!important;font-style:normal!important;font-weight:300!important}@media screen and (max-width:1024px){sticky-note-wrapper sticky-note>div:nth-child(2){max-width:13rem;min-width:13rem;width:1rem}}@media screen and (max-width:768px){sticky-note-wrapper sticky-note>div:nth-child(2){font-size:1.75rem;max-width:21rem;min-height:21rem}}@media screen and (max-width:640px){sticky-note-wrapper sticky-note>div:nth-child(2){font-size:2.5rem;max-width:26rem;min-height:26rem}}sticky-note-wrapper sticky-note>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#ffffdd),color-stop(2%,#ffffd3),color-stop(12%,#ffffd3),color-stop(75%,#ffffc9),to(#ffffba));background:linear-gradient(180deg,#ffffdd 0%,#ffffd3 2%,#ffffd3 12%,#ffffc9 75%,#ffffba 100%)}sticky-note-wrapper sticky-note.blue>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#9dddec),color-stop(2%,#94daea),color-stop(12%,#94daea),color-stop(75%,#8bd7e8),to(#7fd3e6));background:linear-gradient(180deg,#9dddec 0%,#94daea 2%,#94daea 12%,#8bd7e8 75%,#7fd3e6 100%)}sticky-note-wrapper sticky-note.pink>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#fa7c93),color-stop(2%,#fa728b),color-stop(12%,#fa728b),color-stop(75%,#fa6883),to(#f95977));background:linear-gradient(180deg,#fa7c93 0%,#fa728b 2%,#fa728b 12%,#fa6883 75%,#f95977 100%)}sticky-note-wrapper sticky-note.green>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#c5fcc9),color-stop(2%,#bbfbc0),color-stop(12%,#bbfbc0),color-stop(75%,#b1fab7),to(#a3faaa));background:linear-gradient(180deg,#c5fcc9 0%,#bbfbc0 2%,#bbfbc0 12%,#b1fab7 75%,#a3faaa 100%)}sticky-note-wrapper:has(sticky-note:hover){background-color:#ffffd3;border:1px solid black}sticky-note-wrapper:has(sticky-note.yellow:hover){background-color:#ffffd3}sticky-note-wrapper:has(sticky-note.blue:hover){background-color:#94daea}sticky-note-wrapper:has(sticky-note.pink:hover){background-color:#fa728b}sticky-note-wrapper:has(sticky-note.green:hover){background-color:#bbfbc0}
|
||||||
sticky-note-wrapper {
|
|
||||||
-webkit-box-sizing: border-box;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
border-radius: 50%;
|
|
||||||
display: inline-block;
|
|
||||||
height: 0.5rem;
|
|
||||||
position: relative;
|
|
||||||
width: 0.5rem;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper * {
|
|
||||||
-webkit-box-sizing: border-box;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note {
|
|
||||||
cursor: -webkit-grab;
|
|
||||||
cursor: grab;
|
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
float: left;
|
|
||||||
font-size: 1rem;
|
|
||||||
height: 13rem;
|
|
||||||
left: 0;
|
|
||||||
place-items: stretch;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
width: 13rem;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note:active {
|
|
||||||
cursor: -webkit-grabbing;
|
|
||||||
cursor: grabbing;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
-ms-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note.right {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note > div {
|
|
||||||
-ms-grid-row: 1;
|
|
||||||
grid-row: 1;
|
|
||||||
-ms-grid-column: 1;
|
|
||||||
grid-column: 1;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(1) {
|
|
||||||
background-color: rgba(0, 0, 0, 0.25);
|
|
||||||
-webkit-box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
|
|
||||||
box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
|
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
margin: 2rem 1rem 0.25rem 0.36rem;
|
|
||||||
width: calc(100% - 1rem);
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
|
||||||
clip-path: url(#stickyClip);
|
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
font-family: "Kalam", cursive;
|
|
||||||
font-style: 1rem;
|
|
||||||
font-weight: 300;
|
|
||||||
line-height: 1.25rem;
|
|
||||||
padding: 1rem;
|
|
||||||
place-items: center;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(2) > * {
|
|
||||||
font-family: "Kalam", cursive !important;
|
|
||||||
font-style: normal !important;
|
|
||||||
font-weight: 300 !important;
|
|
||||||
}
|
|
||||||
@media screen and (max-width: 1024px) {
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
|
||||||
max-width: 13rem;
|
|
||||||
min-width: 13rem;
|
|
||||||
width: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@media screen and (max-width: 768px) {
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
|
||||||
font-size: 1.75rem;
|
|
||||||
max-width: 21rem;
|
|
||||||
min-height: 21rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@media screen and (max-width: 640px) {
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
|
||||||
font-size: 2.5rem;
|
|
||||||
max-width: 26rem;
|
|
||||||
min-height: 26rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#ffffdd), color-stop(2%, #ffffd3), color-stop(12%, #ffffd3), color-stop(75%, #ffffc9), to(#ffffba));
|
|
||||||
background: linear-gradient(180deg, #ffffdd 0%, #ffffd3 2%, #ffffd3 12%, #ffffc9 75%, #ffffba 100%);
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note.blue > div:nth-child(2) {
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#9dddec), color-stop(2%, #94daea), color-stop(12%, #94daea), color-stop(75%, #8bd7e8), to(#7fd3e6));
|
|
||||||
background: linear-gradient(180deg, #9dddec 0%, #94daea 2%, #94daea 12%, #8bd7e8 75%, #7fd3e6 100%);
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note.pink > div:nth-child(2) {
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#fa7c93), color-stop(2%, #fa728b), color-stop(12%, #fa728b), color-stop(75%, #fa6883), to(#f95977));
|
|
||||||
background: linear-gradient(180deg, #fa7c93 0%, #fa728b 2%, #fa728b 12%, #fa6883 75%, #f95977 100%);
|
|
||||||
}
|
|
||||||
sticky-note-wrapper sticky-note.green > div:nth-child(2) {
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#c5fcc9), color-stop(2%, #bbfbc0), color-stop(12%, #bbfbc0), color-stop(75%, #b1fab7), to(#a3faaa));
|
|
||||||
background: linear-gradient(180deg, #c5fcc9 0%, #bbfbc0 2%, #bbfbc0 12%, #b1fab7 75%, #a3faaa 100%);
|
|
||||||
}
|
|
||||||
sticky-note-wrapper:has(sticky-note:hover) {
|
|
||||||
background-color: #ffffd3;
|
|
||||||
border: 1px solid black;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper:has(sticky-note.yellow:hover) {
|
|
||||||
background-color: #ffffd3;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper:has(sticky-note.blue:hover) {
|
|
||||||
background-color: #94daea;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper:has(sticky-note.pink:hover) {
|
|
||||||
background-color: #fa728b;
|
|
||||||
}
|
|
||||||
sticky-note-wrapper:has(sticky-note.green:hover) {
|
|
||||||
background-color: #bbfbc0;
|
|
||||||
}
|
|
@ -15,6 +15,7 @@ function flip(e) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
init: (p = document) => {
|
init: (p = document) => {
|
||||||
|
try {
|
||||||
p.querySelectorAll("[role='switch']").forEach((sw) => {
|
p.querySelectorAll("[role='switch']").forEach((sw) => {
|
||||||
sw.innerHTML = "<span></span>";
|
sw.innerHTML = "<span></span>";
|
||||||
sw.setAttribute("aria-checked", "false");
|
sw.setAttribute("aria-checked", "false");
|
||||||
@ -22,5 +23,8 @@ module.exports = {
|
|||||||
sw.addEventListener("click", flip, false);
|
sw.addEventListener("click", flip, false);
|
||||||
sw.addEventListener("keypress", flip, false);
|
sw.addEventListener("keypress", flip, false);
|
||||||
})
|
})
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("Cannot initialise switches.", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
src/pg/patterns/core/switch/_switch.pp
Normal file
1
src/pg/patterns/core/switch/_switch.pp
Normal file
@ -0,0 +1 @@
|
|||||||
|
span#example-id(role="switch")
|
@ -5,23 +5,44 @@ extends ../../../core/_master-pattern
|
|||||||
block content
|
block content
|
||||||
|
|
||||||
+h(0)
|
+h(0)
|
||||||
p Switches are used to toggle application state between two mutually exlusive values.
|
p Switches are used to toggle application state between two mutually exclusive values.
|
||||||
|
|
||||||
+h(1)
|
+h(1)
|
||||||
|
p Use a switch when the user will see an immediate visible state change. Do not use a switch when the state change will affect future results. The user should not have to perform another action (search, save, etc) for the result to take affect. If the change in state does not take effect immediately, consider a checkbox.
|
||||||
|
|
||||||
+h(2)
|
+h(2)
|
||||||
|
p The switch label should describe what will happen when the switch is turned to the on state. Frontload labels with keywords.
|
||||||
|
|
||||||
|
p Include the CSS and JavaScript. An additional handler will need to be created for the actual state change. The CSS implements the visual design of the switch, which is based on the accessibility properties, which are implemented by the JavaScript.
|
||||||
|
|
||||||
h2 Example
|
h2 Example
|
||||||
p.switch
|
p.switch
|
||||||
label(for="example-switch") Switch label
|
label(for="example-switch") Switch label (states the on state)
|
||||||
span#example-switch(role="switch")
|
span#example-switch(role="switch")
|
||||||
|
|
||||||
div#switches.tab-group
|
div#switches.tab-group
|
||||||
pre.language-html(data-tab="html")
|
pre.language-html(tab="html")
|
||||||
include _switch.pug
|
include _switch.pug
|
||||||
pre.language-pug(data-tab="pug")
|
pre.language-pug(tab="pug")
|
||||||
include switch.pug
|
include _switch.pp
|
||||||
pre.language-css(data-tab="css")
|
pre.language-css(tab="css")
|
||||||
include switch.css
|
include switch.css
|
||||||
pre.language-css(data-tab="scss")
|
div(tab="scss")
|
||||||
|
+h(3)
|
||||||
|
pre.language-sass.
|
||||||
|
@use "scss/core/switch/_switch";
|
||||||
|
@include switch;
|
||||||
|
|
||||||
|
+h(4)
|
||||||
|
pre.language-sass
|
||||||
include _switch.scss
|
include _switch.scss
|
||||||
pre.language-js(data-tab="js")
|
div(tab="js")
|
||||||
|
+h(3)
|
||||||
|
pre.language-js.
|
||||||
|
// Note that switch is a reserved word.
|
||||||
|
import * as swtch from "./js/core/switch/_switch.js";
|
||||||
|
swtch.init();
|
||||||
|
|
||||||
|
+h(4)
|
||||||
|
pre.language-js
|
||||||
include _switch.js
|
include _switch.js
|
||||||
|
@ -1,26 +1 @@
|
|||||||
[role=switch] {
|
[role=switch]{display:-ms-inline-grid;display:inline-grid;border:1px solid #2e51a1;background-color:#d8d8d8;border-radius:0.75rem;height:1.5rem;width:3rem;-webkit-transition:all 500ms;transition:all 500ms}[role=switch]>span{display:inline-block;background-color:white;border-radius:50%;margin:2%;width:calc(1.5rem - 2%);-webkit-transition:all 500ms;transition:all 500ms}[role=switch][aria-checked=true]{background-color:#2e51a1}[role=switch][aria-checked=true]>span{margin-left:calc(1.5rem - 5%)}
|
||||||
display: -ms-inline-grid;
|
|
||||||
display: inline-grid;
|
|
||||||
border: 1px solid var(--colour-blue);
|
|
||||||
background-color: var(--colour-grey-xl);
|
|
||||||
border-radius: 0.75rem;
|
|
||||||
height: 1.5rem;
|
|
||||||
width: 3rem;
|
|
||||||
-webkit-transition: all 500ms;
|
|
||||||
transition: all 500ms;
|
|
||||||
}
|
|
||||||
[role=switch] > span {
|
|
||||||
display: inline-block;
|
|
||||||
background-color: white;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin: 2%;
|
|
||||||
width: calc(1.5rem - 2%);
|
|
||||||
-webkit-transition: all 500ms;
|
|
||||||
transition: all 500ms;
|
|
||||||
}
|
|
||||||
[role=switch][aria-checked=true] {
|
|
||||||
background-color: var(--colour-blue);
|
|
||||||
}
|
|
||||||
[role=switch][aria-checked=true] > span {
|
|
||||||
margin-left: calc(1.5rem - 5%);
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
.
|
|
||||||
span#example-id(role="switch")
|
|
@ -1,28 +1,92 @@
|
|||||||
/* DS2 core (c) 2024 Alexander McIlwraith
|
/* DS2 core (c) 2024 Alexander McIlwraith
|
||||||
import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js";
|
Released under Creative Commons Attribution-ShareAlike 4.0 International
|
||||||
tabs.init();
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function init(p = document) {
|
// create a pure JS mouse click event
|
||||||
p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
const click = new MouseEvent('click', {
|
||||||
|
view: window,
|
||||||
|
bubbles: false,
|
||||||
|
cancelable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
const waitForElement = (selector) => {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
return resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
|
||||||
|
const observer = new MutationObserver(mutations => {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
observer.disconnect();
|
||||||
|
resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
|
||||||
|
observer.observe(document.body, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const chooseTab = (tab) => {
|
||||||
|
const siblings = Array.from(tab.parentNode.children);
|
||||||
|
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
||||||
|
tab.classList.add("selected");
|
||||||
|
|
||||||
|
const tabPanels = Array.from(tab.parentNode.parentNode.children)
|
||||||
|
tabPanels.forEach(panel => panel.classList.remove("open"));
|
||||||
|
|
||||||
|
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||||
|
document.getElementById(tabPanelId).classList.add("open");
|
||||||
|
}
|
||||||
|
|
||||||
|
let pushState = 0;
|
||||||
|
let tabsetCount = 0;
|
||||||
|
module.exports = {
|
||||||
|
"init": (container = document, spacer = true, args = {}) => {
|
||||||
|
container.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
||||||
if (tabGroup.querySelector("[role=tablist]") === null) {
|
if (tabGroup.querySelector("[role=tablist]") === null) {
|
||||||
|
if (tabGroup.getAttribute("id") == null) {
|
||||||
|
tabGroup.setAttribute("id", "tab-group-" + tabsetCount);
|
||||||
|
tabsetCount++;
|
||||||
|
}
|
||||||
|
|
||||||
const tabgroup = tabGroup.getAttribute("id");
|
const tabgroup = tabGroup.getAttribute("id");
|
||||||
let tablist = "";
|
let tablist = "";
|
||||||
|
|
||||||
Array.from(tabGroup.children).forEach(child => {
|
Array.from(tabGroup.children).forEach(child => {
|
||||||
const tab = child.getAttribute("tab") || child.getAttribute("data-tab");
|
|
||||||
|
// is details?
|
||||||
|
let dtls = child.nodeName == "DETAILS" ? true : false;
|
||||||
|
|
||||||
|
// get the tab text
|
||||||
|
let tab = dtls ? child.querySelector("summary").innerHTML : child.getAttribute("tab") || child.getAttribute("data-tab");
|
||||||
|
|
||||||
|
// if the tab text is not blank
|
||||||
if (tab !== null) {
|
if (tab !== null) {
|
||||||
const tabID = tab.replace(/\W+/g, "-").toLowerCase();
|
const tabID = tab.replace(/\W+/g, "-").toLowerCase();
|
||||||
const tabPanel = document.createElement('div');
|
|
||||||
|
|
||||||
|
// define the tab panel content
|
||||||
|
let tabPanel = null;
|
||||||
|
if (dtls) {
|
||||||
|
tabPanel = child;
|
||||||
|
tabPanel.setAttribute("open", "");
|
||||||
|
} else {
|
||||||
|
tabPanel = document.createElement('div');
|
||||||
|
tabPanel.appendChild(child.cloneNode(true));
|
||||||
|
}
|
||||||
|
|
||||||
tabPanel.id = `tab-panel-${tabgroup}-${tabID}`;
|
tabPanel.id = `tab-panel-${tabgroup}-${tabID}`;
|
||||||
tabPanel.className = tablist === "" ? "open" : "";
|
tabPanel.className = tablist === "" ? "open" : "";
|
||||||
tabPanel.setAttribute("role", "tabpanel");
|
tabPanel.setAttribute("role", "tabpanel");
|
||||||
tabPanel.setAttribute("tabindex", "0");
|
tabPanel.setAttribute("tabindex", "0");
|
||||||
tabPanel.setAttribute("aria-labelledby", `tab-${tabgroup}-${tabID}`);
|
tabPanel.setAttribute("aria-labelledby", `tab-${tabgroup}-${tabID}`);
|
||||||
tabPanel.appendChild(child.cloneNode(true));
|
|
||||||
child.parentNode.replaceChild(tabPanel, child);
|
child.parentNode.replaceChild(tabPanel, child);
|
||||||
tablist += `<li tabindex="0" role="tab" ${tablist === "" ? "class='selected'" : ""} id="tab-${tabgroup}-${tabID}"><span>${tab}</span></li>`;
|
let cls = tablist === "" ? "class='selected'" : "";
|
||||||
|
tablist += `<li tabindex="0" role="tab" ${cls} id="tab-${tabgroup}-${tabID}"><span>${tab}</span></li>`;
|
||||||
} else {
|
} else {
|
||||||
child.classList.add("tab-hidden");
|
child.classList.add("tab-hidden");
|
||||||
}
|
}
|
||||||
@ -30,24 +94,48 @@ export function init(p = document) {
|
|||||||
|
|
||||||
const ul = document.createElement('ul');
|
const ul = document.createElement('ul');
|
||||||
ul.setAttribute("role", "tablist");
|
ul.setAttribute("role", "tablist");
|
||||||
ul.innerHTML = `${tablist}<li role="separator" class="separator"></li>`;
|
ul.innerHTML = spacer != true ? `${tablist}` : `${tablist}<li role="separator" class="separator"></li>`;
|
||||||
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
||||||
|
|
||||||
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
||||||
tab.addEventListener("click", () => {
|
tab.addEventListener("click", (evt) => {
|
||||||
const siblings = Array.from(tab.parentNode.children);
|
if (pushState == 0) {
|
||||||
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
window.history.pushState({rand: Math.random(), pushState: pushState, tab: tab.parentNode.firstChild.getAttribute("id")}, "", `#${tab.parentNode.firstChild.getAttribute("id")}`);
|
||||||
tab.classList.add("selected");
|
pushState++;
|
||||||
|
}
|
||||||
|
|
||||||
const tabPanels = Array.from(tab.parentNode.parentNode.children)
|
chooseTab(evt.currentTarget);
|
||||||
.filter(child => child.getAttribute("role") === "tabpanel");
|
window.history.pushState({rand: Math.random(), pushState: pushState, tab: tab.getAttribute("id")}, "", `#${tab.getAttribute("id")}`);
|
||||||
tabPanels.forEach(panel => panel.classList.remove("open"));
|
pushState++;
|
||||||
|
|
||||||
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
|
||||||
document.getElementById(tabPanelId).classList.add("open");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tab.addEventListener("keypress", (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if( e.which == 32 || e.which == 13 ) {
|
||||||
|
e.currentTarget.dispatchEvent(click);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.location.hash != "" && document.location.hash.substring(0,5) == "#tab-") {
|
||||||
|
waitForElement(document.location.hash).then((el) => {
|
||||||
|
el.scrollIntoView();
|
||||||
|
el.focus();
|
||||||
|
el.dispatchEvent(click);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("popstate", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
if (e.state != null) {
|
||||||
|
chooseTab(document.querySelector(`#${e.state.tab}`));
|
||||||
|
} else {
|
||||||
|
history.go(-1);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
src/pg/patterns/core/tabs/_tabs.pp
Normal file
4
src/pg/patterns/core/tabs/_tabs.pp
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
tabset#uniqueID
|
||||||
|
div(tab="[tab title]")
|
||||||
|
div(tab="[tab title]")
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
div#uniqueID.tab-group
|
tabset#uniqueID
|
||||||
div(data-tab="[tab title]")
|
div(tab="[tab title]")
|
||||||
div(data-tab="[tab title]")
|
div(tab="[tab title]")
|
||||||
|
|
@ -1,18 +1,23 @@
|
|||||||
// DS2 core (c) 2024 Alexander McIlwraith
|
// DS2 core (c) 2024 Alexander McIlwraith
|
||||||
// Licensed under CC BY-SA 4.0
|
// Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
|
|
||||||
$tab-border: #7f7f7f !default;
|
$tab-border: #7f7f7f !default;
|
||||||
$tab-selected: #FFF !default;
|
$tab-selected: #FFF !default;
|
||||||
$tab-notselected: #f0f0f0 !default;
|
$tab-notselected: #f0f0f0 !default;
|
||||||
|
$tab-break: 450px !default;
|
||||||
|
|
||||||
@mixin tabs {
|
@mixin tabs {
|
||||||
tabset, .tab-group {
|
tabset, .tab-group {
|
||||||
|
@media (min-width: $tab-break) {
|
||||||
margin: 2rem 0 1rem 0;
|
margin: 2rem 0 1rem 0;
|
||||||
|
}
|
||||||
> ul {
|
> ul {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
|
|
||||||
li.separator {
|
li.separator {
|
||||||
border-bottom: 1px solid $tab-border;
|
border-bottom: 1px solid $tab-border;
|
||||||
border-left: 1px solid $tab-border;
|
border-left: 1px solid $tab-border;
|
||||||
@ -22,6 +27,8 @@ $tab-notselected: #f0f0f0 !default;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.tab-hidden {
|
.tab-hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@ -59,11 +66,34 @@ $tab-notselected: #f0f0f0 !default;
|
|||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
||||||
|
@media (min-width: $tab-break) {
|
||||||
|
&[open] summary {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: $tab-break) {
|
||||||
&:not(.open) {
|
&:not(.open) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@content;
|
@content;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: $tab-break) {
|
||||||
|
&:has(details) {
|
||||||
|
[role="tablist"] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
[role="tabpanel"] {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,9 +5,9 @@ extends ../../../core/_master-pattern
|
|||||||
block content
|
block content
|
||||||
|
|
||||||
+h(0)
|
+h(0)
|
||||||
+h(1)
|
p A tabs component that provides different sections of content that are displayed one at a time when the user selects that information.
|
||||||
+h(2)
|
|
||||||
|
|
||||||
|
+h(1)
|
||||||
p The tabbed user interface enables users to jump to their target section quickly. Tabs present like logically group information on the same page. Information should
|
p The tabbed user interface enables users to jump to their target section quickly. Tabs present like logically group information on the same page. Information should
|
||||||
|
|
||||||
ul
|
ul
|
||||||
@ -19,24 +19,43 @@ block content
|
|||||||
p Users should not need to see content of multiple tabs simultaneously and the user should be able to easily recognise where they are within the content.
|
p Users should not need to see content of multiple tabs simultaneously and the user should be able to easily recognise where they are within the content.
|
||||||
|
|
||||||
|
|
||||||
p The tab module can be initialised by importing a file with the javascript module using import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js"; contains a modularized version of the jQuery code, so that it can be called on demand. It is what is used in the design system so that the JavaScript can be called at run time (after loading content).
|
+h(2)
|
||||||
|
p The structure of the tab set is defined in html. There are two forms supported. Adding a class of #[code.inline .tab-group] to the container element will work in place of the #[code.inline tabset] tag, and the tab panels can be defined using either #[code.inline tab=""] or #[code.inline data-tab=""]. Passing an optional element to the init function will initialise tabs within that element.
|
||||||
|
|
||||||
|
p The tab initalize function now takes a new function parameter in the form of an third argument is an object that can take the following callbacks:
|
||||||
|
ul
|
||||||
|
li altModifer (When the altKey is used)
|
||||||
|
li shiftModifier (When the shift key is used)
|
||||||
|
li metaModifier (When the Windows key or Apple key is used)
|
||||||
|
p You can use these callbacks to create a custom event to get the tab information.
|
||||||
|
|
||||||
|
p Note: There is a new core function (core.getTabPath) that will generate the query string and url hash for use in DS2 Core. You may wish to update your scaffolding.js file to make use of this functionality.
|
||||||
|
|
||||||
|
|
||||||
tabset#tabs
|
tabset#tabs
|
||||||
pre.language-html(tab="html")
|
pre.language-html(tab="html")
|
||||||
include _tabs.pug
|
include _tabs.pug
|
||||||
|
pre.language-pug(tab="pug")
|
||||||
//- pre.language-pug(tab="pug").
|
include _tabs.pp
|
||||||
include _tabs.pug
|
|
||||||
|
|
||||||
pre.language-css(tab="css")
|
pre.language-css(tab="css")
|
||||||
include tabs.css
|
include tabs.css
|
||||||
|
div(tab="scss")
|
||||||
|
+h(3)
|
||||||
|
pre.language-sass.
|
||||||
|
@use "scss/core/tabs/_tabs";
|
||||||
|
@include tabs{
|
||||||
|
// optional content block
|
||||||
|
};
|
||||||
|
|
||||||
pre.language-css(tab="scss")
|
+h(4)
|
||||||
|
pre.language-sass
|
||||||
include _tabs.scss
|
include _tabs.scss
|
||||||
|
div(tab="js")
|
||||||
pre.language-css(tab="js")
|
+h(3)
|
||||||
|
pre.language-js.
|
||||||
|
import * as tabs from "./js/core/tabs/_tabs.js";
|
||||||
|
tabs.init();
|
||||||
|
+h(4)
|
||||||
|
pre.language-js
|
||||||
include _tabs.js
|
include _tabs.js
|
||||||
|
|
||||||
|
@ -1,52 +1 @@
|
|||||||
tabset, .tab-group {
|
@media (min-width:450px){.tab-group,tabset{margin:2rem 0 1rem 0}}.tab-group>ul,tabset>ul{display:-webkit-box;display:-ms-flexbox;display:flex;margin:0;padding:0}.tab-group>ul li.separator,tabset>ul li.separator{border-bottom:1px solid #7f7f7f;border-left:1px solid #7f7f7f;display:inline-block;margin:0.45rem 0 0 0;width:100%}.tab-group .tab-hidden,tabset .tab-hidden{display:none}.tab-group [role=tab],tabset [role=tab]{background-color:#FFF;border-left:1px solid #7f7f7f;border-top:1px solid #7f7f7f;border-radius:0.5rem 0.5rem 0 0;cursor:pointer;margin:0;display:inline;padding:1rem 1.5rem 0.14rem 1.5rem;z-index:2}.tab-group [role=tab]:last-of-type,tabset [role=tab]:last-of-type{border-right:1px solid #7f7f7f}.tab-group [role=tab]:not(.selected),tabset [role=tab]:not(.selected){background-color:#f0f0f0;border-bottom:1px solid #7f7f7f}.tab-group [role=tab] span,tabset [role=tab] span{display:block;margin:0 0 0.5rem 0}.tab-group [role=tabpanel],tabset [role=tabpanel]{background-color:#FFF;border:1px solid #7f7f7f;border-top:none;padding:1rem;z-index:1}@media (min-width:450px){.tab-group [role=tabpanel][open] summary,tabset [role=tabpanel][open] summary{display:none}}@media (min-width:450px){.tab-group [role=tabpanel]:not(.open),tabset [role=tabpanel]:not(.open){display:none}}@media (max-width:450px){.tab-group:has(details) [role=tablist],tabset:has(details) [role=tablist]{display:none}.tab-group:has(details) [role=tabpanel],tabset:has(details) [role=tabpanel]{border:none}}
|
||||||
margin: 2rem 0 1rem 0;
|
|
||||||
}
|
|
||||||
tabset > ul, .tab-group > ul {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
tabset > ul li.separator, .tab-group > ul li.separator {
|
|
||||||
border-bottom: 1px solid var(--colour-grey);
|
|
||||||
border-left: 1px solid var(--colour-grey);
|
|
||||||
display: inline-block;
|
|
||||||
margin: 0.45rem 0 0 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
tabset .tab-hidden, .tab-group .tab-hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
tabset [role=tab], .tab-group [role=tab] {
|
|
||||||
background-color: var(--colour-white);
|
|
||||||
border-left: 1px solid var(--colour-grey);
|
|
||||||
border-top: 1px solid var(--colour-grey);
|
|
||||||
border-radius: 0.5rem 0.5rem 0 0;
|
|
||||||
cursor: pointer;
|
|
||||||
margin: 0;
|
|
||||||
display: inline;
|
|
||||||
padding: 1rem 1.5rem 0.14rem 1.5rem;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
tabset [role=tab]:last-of-type, .tab-group [role=tab]:last-of-type {
|
|
||||||
border-right: 1px solid var(--colour-grey);
|
|
||||||
}
|
|
||||||
tabset [role=tab]:not(.selected), .tab-group [role=tab]:not(.selected) {
|
|
||||||
background-color: var(--colour-grey-xxl);
|
|
||||||
border-bottom: 1px solid var(--colour-grey);
|
|
||||||
}
|
|
||||||
tabset [role=tab] span, .tab-group [role=tab] span {
|
|
||||||
display: block;
|
|
||||||
margin: 0 0 0.5rem 0;
|
|
||||||
}
|
|
||||||
tabset [role=tabpanel], .tab-group [role=tabpanel] {
|
|
||||||
background-color: var(--colour-white);
|
|
||||||
border: 1px solid var(--colour-grey);
|
|
||||||
border-top: none;
|
|
||||||
padding: 1rem;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
tabset [role=tabpanel]:not(.open), .tab-group [role=tabpanel]:not(.open) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
2
src/pg/patterns/core/tooltip/_tooltip.pp
Normal file
2
src/pg/patterns/core/tooltip/_tooltip.pp
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
a(href="#") Link with a tool tip
|
||||||
|
span(role="tooltip" inert tip-position="right") Tool tip content
|
@ -1,5 +1,2 @@
|
|||||||
a(href="#") Link with a tool tip
|
a(href="#") Link with a tool tip
|
||||||
div(role="tooltip" inert tip-position="bottom") Tool tip content
|
span(role="tooltip" inert tip-position="right") Tool tip content
|
||||||
|
|
||||||
a(href="#") Link with a tool tip
|
|
||||||
tool-tip(role="tooltip" inert tip-position="bottom") Tool tip content
|
|
@ -1,6 +1,7 @@
|
|||||||
//- DS2 core (c) 2024 Alexander McIlwraith
|
//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
|
$font-body: sans-serif !default;
|
||||||
$tooltip-border-radius: .5rem !default;
|
$tooltip-border-radius: .5rem !default;
|
||||||
$tooltip-dark-allow: true !default;
|
$tooltip-dark-allow: true !default;
|
||||||
$tooltip-dark-background: #1f2127 !default;
|
$tooltip-dark-background: #1f2127 !default;
|
||||||
@ -29,6 +30,7 @@ $tooltip-pointer-top: conic-gradient(from 150deg at top, rgba(0, 0, 0, 0), #000
|
|||||||
border-radius: $tooltip-border-radius;
|
border-radius: $tooltip-border-radius;
|
||||||
color: $tooltip-light-foreground;
|
color: $tooltip-light-foreground;
|
||||||
filter: $tooltip-light-drop-shadow;
|
filter: $tooltip-light-drop-shadow;
|
||||||
|
$font-family: $font-body;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
inline-size: max-content;
|
inline-size: max-content;
|
||||||
|
@ -5,13 +5,22 @@ extends ../../../core/_master-pattern
|
|||||||
block content
|
block content
|
||||||
|
|
||||||
+h(0)
|
+h(0)
|
||||||
|
p Tooltips provide brief information messaging through a mouse or keyboard hover.
|
||||||
|
|
||||||
+h(1)
|
+h(1)
|
||||||
|
p Use tool tips to provide additional information. Don't use tooltips for that is required to complete an interaction as the information disappears when it loses the hover state.
|
||||||
|
|
||||||
|
p Use tooltips to help differentiate between multiple, close, similar options.
|
||||||
|
|
||||||
+h(2)
|
+h(2)
|
||||||
|
|
||||||
p Either form works. Place this inside another element for the tooltip to be "linked to that element."
|
p.notification-box.info Currently, there is no easy way to activate a hover without with pure CSS without using a keyboard or mouse. Level4 media queries aim to solve that.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
p Either form works.
|
||||||
|
sticky-note.blue "Either form works": What are the two forms.
|
||||||
|
| Place the #[code.language-html.inline tooltip] inside another element for the tooltip to be 'linked to that element.' A container element may need to be added for a single tag element, such as a input field.
|
||||||
|
|
||||||
p Tool tip positions are:
|
p Tool tip positions are:
|
||||||
ul
|
ul
|
||||||
@ -20,14 +29,23 @@ block content
|
|||||||
li bottom / block-end
|
li bottom / block-end
|
||||||
li left / inline-start
|
li left / inline-start
|
||||||
|
|
||||||
|
p
|
||||||
div#tooltip.tab-group
|
|
||||||
pre.language-html(data-tab="html")
|
|
||||||
include _tooltip.pug
|
include _tooltip.pug
|
||||||
pre.language-pug(data-tab="pug")
|
|
||||||
include tooltip.pug
|
|
||||||
pre.language-css(data-tab="css")
|
tabset#tooltip
|
||||||
|
pre.language-html(tab="html")
|
||||||
|
include _tooltip.pug
|
||||||
|
pre.language-pug(tab="pug")
|
||||||
|
include _tooltip.pp
|
||||||
|
pre.language-css(tab="css")
|
||||||
include tooltip.css
|
include tooltip.css
|
||||||
pre.language-css(data-tab="scss")
|
div(tab="scss")
|
||||||
|
+h(3)
|
||||||
|
pre.language-sass.
|
||||||
|
@use "scss/core/tooltip/_tooltip";
|
||||||
|
@include tooltip;
|
||||||
|
+h(4)
|
||||||
|
pre.language-sass
|
||||||
include _tooltip.scss
|
include _tooltip.scss
|
||||||
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
.
|
|
||||||
a(href="#") Link with a tool tip
|
|
||||||
div(role="tooltip" inert tip-position="bottom") Tool tip content
|
|
||||||
|
|
||||||
a(href="#") Link with a tool tip
|
|
||||||
tool-tip(role="tooltip" inert tip-position="bottom") Tool tip content
|
|
@ -10,6 +10,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@use "../pg/patterns/core/breakpoint/breakpoint";
|
||||||
|
|
||||||
@mixin core-colour-samples {
|
@mixin core-colour-samples {
|
||||||
|
|
||||||
#copystatus {
|
#copystatus {
|
||||||
@ -48,14 +50,14 @@
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
|
||||||
@include break(-lg) {
|
@include breakpoint.break(-lg) {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include break(-sm) {
|
@include breakpoint.break(-sm) {
|
||||||
grid-template-columns: auto;
|
grid-template-columns: auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
@ -79,7 +81,7 @@
|
|||||||
width: 20rem;
|
width: 20rem;
|
||||||
max-width: 318px;
|
max-width: 318px;
|
||||||
|
|
||||||
@include break(-lg) {
|
@include breakpoint.break(-lg) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/* ----------------------------------------------------------
|
||||||
* Variables
|
* Variables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -15,15 +15,26 @@ $tooltip-dark-allow: false;
|
|||||||
// We recommend explicitly using the underscore when referring to pattern scss
|
// We recommend explicitly using the underscore when referring to pattern scss
|
||||||
// as you may have also created a version that compiles to css to display in
|
// as you may have also created a version that compiles to css to display in
|
||||||
// your pattern.
|
// your pattern.
|
||||||
@import "core";
|
@use "core";
|
||||||
|
@use "../../node_modules/prismjs/themes/prism";
|
||||||
|
@use "../../node_modules/prismjs/plugins/toolbar/prism-toolbar";
|
||||||
|
@use "../../node_modules/prismjs/plugins/line-numbers/prism-line-numbers";
|
||||||
|
|
||||||
|
@use "../pg/patterns/core/sticky-note/_sticky-note";
|
||||||
|
@use "../pg/patterns/core/switch/_switch";
|
||||||
|
@use "../pg/patterns/core/tooltip/_tooltip";
|
||||||
|
@use "../pg/patterns/core/breakpoint/_breakpoint";
|
||||||
|
@use "../pg/patterns/core/header/_header";
|
||||||
|
@use "../pg/patterns/core/tabs/_tabs";
|
||||||
|
@use "../pg/patterns/core/status/_status";
|
||||||
|
|
||||||
|
|
||||||
|
@include core.core-colour-samples;
|
||||||
|
@include tooltip.tooltip;
|
||||||
|
@include sticky-note.sticky-note;
|
||||||
|
@include status.status;
|
||||||
|
|
||||||
|
|
||||||
@import "../pg/patterns/core/sticky-note/_sticky-note";
|
|
||||||
@import "../pg/patterns/core/switch/_switch";
|
|
||||||
@import "../pg/patterns/core/tooltip/_tooltip";
|
|
||||||
@import "../pg/patterns/core/breakpoints/_breakpoints";
|
|
||||||
@import "../pg/patterns/core/header/_header";
|
|
||||||
@import "../pg/patterns/core/tabs/_tabs";
|
|
||||||
@import "../pg/patterns/core/status/_status";
|
|
||||||
|
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -32,16 +43,15 @@ $tooltip-dark-allow: false;
|
|||||||
html {
|
html {
|
||||||
font-family: $font-body;
|
font-family: $font-body;
|
||||||
font-size: $font-size;
|
font-size: $font-size;
|
||||||
@include break(-md) {
|
@include breakpoint.break(-md) {
|
||||||
font-size: calc($font-size + 2pt);
|
font-size: calc($font-size + 2pt);
|
||||||
}
|
}
|
||||||
|
&.show-breakpoints {
|
||||||
|
@include breakpoint.debug;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@include core-colour-samples;
|
|
||||||
|
|
||||||
@include tooltip;
|
|
||||||
@include sticky-note;
|
|
||||||
@include status;
|
|
||||||
|
|
||||||
article[data-status=deprecated]:not(.show-deprecated) {
|
article[data-status=deprecated]:not(.show-deprecated) {
|
||||||
display: none;
|
display: none;
|
||||||
@ -62,7 +72,7 @@ body {
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
|
|
||||||
@include header;
|
@include header.header;
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
background-color: var(--colour-blue);
|
background-color: var(--colour-blue);
|
||||||
@ -81,17 +91,24 @@ body {
|
|||||||
color: var(--colour-white);
|
color: var(--colour-white);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
@include break(md-) {
|
@include breakpoint.break(md-) {
|
||||||
display: initial;
|
display: initial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
p.deprecated-switch {
|
p.info-switches {
|
||||||
|
align-items: center;
|
||||||
|
display: grid;
|
||||||
|
gap: .25rem;
|
||||||
grid-column: 2 / 4;
|
grid-column: 2 / 4;
|
||||||
grid-row: 3;
|
grid-row: 3;
|
||||||
|
grid-template-columns: auto repeat(2, max-content);
|
||||||
text-align: right;
|
text-align: right;
|
||||||
@include switch;
|
@include switch.switch;
|
||||||
|
label {
|
||||||
|
text-align: left;;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
main {
|
main {
|
||||||
@ -99,7 +116,7 @@ body {
|
|||||||
grid-column: 1 / -1;
|
grid-column: 1 / -1;
|
||||||
grid-row: 4;
|
grid-row: 4;
|
||||||
|
|
||||||
@include break(-md) {
|
@include breakpoint.break(-md) {
|
||||||
grid-row: 3;
|
grid-row: 3;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
@ -107,7 +124,7 @@ body {
|
|||||||
@supports(grid-area: auto) {
|
@supports(grid-area: auto) {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1rem repeat(2, auto) 1rem;
|
grid-template-columns: 1rem repeat(2, auto) 1rem;
|
||||||
@include break(md-) {
|
@include breakpoint.break(md-) {
|
||||||
grid-template-columns: auto repeat(2, 22rem) auto;
|
grid-template-columns: auto repeat(2, 22rem) auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,7 +142,7 @@ body {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include tabs {
|
@include tabs.tabs {
|
||||||
pre {
|
pre {
|
||||||
background-color: var(--colour-black-5);
|
background-color: var(--colour-black-5);
|
||||||
font-size: .8rem;
|
font-size: .8rem;
|
||||||
@ -140,15 +157,12 @@ body {
|
|||||||
display: grid;
|
display: grid;
|
||||||
grid-gap: .5rem;
|
grid-gap: .5rem;
|
||||||
grid-template-columns: max-content auto;
|
grid-template-columns: max-content auto;
|
||||||
@include switch;
|
@include switch.switch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep your prism modules
|
|
||||||
@import "../../node_modules/prismjs/themes/prism";
|
|
||||||
@import "../../node_modules/prismjs/plugins/toolbar/prism-toolbar";
|
|
||||||
@import "../../node_modules/prismjs/plugins/line-numbers/prism-line-numbers";
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user