swatchkit 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/build.js +8 -4
- package/package.json +1 -1
- package/src/layout.html +1 -1
package/README.md
CHANGED
|
@@ -221,15 +221,15 @@ Compiles your documentation site into `dist/swatchkit/`.
|
|
|
221
221
|
|
|
222
222
|
1. **Reads JSON Tokens**: Scans `tokens/*.json` and calculates fluid typography/spacing.
|
|
223
223
|
2. **Generates CSS**: Creates `css/tokens.css`. **Do not edit this file**; it is overwritten every build.
|
|
224
|
-
3. **Copies Assets**: Copies your `css/` folder (including your manually edited `global
|
|
224
|
+
3. **Copies Assets**: Copies your `css/` folder (including your manually edited `main.css`, `global/variables.css`, and `global/elements.css`) to the output folder.
|
|
225
225
|
4. **Scans Patterns**: Finds all HTML files in `swatchkit/` and stitches them into the documentation site.
|
|
226
226
|
5. **Bundles JavaScript**: Collects any `.js` files from swatch folders (e.g., `swatchkit/carousel/script.js`) and section directories into a single `js/swatches.js` bundle. The default token display script (`swatchkit/tokens/script.js`) is included here — it shows computed CSS values alongside token documentation.
|
|
227
227
|
|
|
228
228
|
### Global Styles & Variables
|
|
229
|
-
SwatchKit includes sensible defaults in `css/variables.css` and `css/global
|
|
230
|
-
* These are **static files** copied to your project during `init
|
|
231
|
-
*
|
|
232
|
-
*
|
|
229
|
+
SwatchKit includes sensible defaults in `css/global/variables.css` and `css/global/elements.css`.
|
|
230
|
+
* These are **static files** copied to your project during `init` and **enabled by default**.
|
|
231
|
+
* Variable references use the default token names from `tokens/*.json`. If you rename any tokens, update the `var()` references in these files to match.
|
|
232
|
+
* Both files are yours to edit — add your own variables and element styles freely.
|
|
233
233
|
|
|
234
234
|
### What is Safe to Edit?
|
|
235
235
|
|
|
@@ -237,7 +237,8 @@ SwatchKit includes sensible defaults in `css/variables.css` and `css/global-styl
|
|
|
237
237
|
| :--- | :--- | :--- |
|
|
238
238
|
| `tokens/*.json` | ✅ **YES** | Your source of truth. Safe. |
|
|
239
239
|
| `css/main.css` | ✅ **YES** | Your entry point. Safe. |
|
|
240
|
-
| `css/global
|
|
240
|
+
| `css/global/variables.css` | ✅ **YES** | You own this. Update var() references if you rename tokens. |
|
|
241
|
+
| `css/global/elements.css` | ✅ **YES** | You own this. Update var() references if you rename tokens. |
|
|
241
242
|
| `css/tokens.css` | 🚫 **NO** | Overwritten by **every** `swatchkit build` and `swatchkit init`. |
|
|
242
243
|
| `swatchkit/_layout.html`| ✅ **YES** | Safe during normal use. `init --force` overwrites all init-managed files, including this one. |
|
|
243
244
|
| `swatchkit/_preview.html`| ✅ **YES** | Same as `_layout.html` — safe unless you run `init --force`. |
|
package/build.js
CHANGED
|
@@ -698,13 +698,17 @@ function build(settings) {
|
|
|
698
698
|
const previewPath = p.sectionSlug
|
|
699
699
|
? `preview/${p.sectionSlug}/${p.id}.html`
|
|
700
700
|
: `preview/${p.id}.html`;
|
|
701
|
+
const previewLink = previewPath.replace(/\.html$/, '');
|
|
701
702
|
|
|
702
703
|
return `
|
|
703
|
-
<section id="${p.id}" class="flow">
|
|
704
|
+
<section id="${p.id}" class="region flow">
|
|
704
705
|
<h2>${p.name} <small style="font-weight: normal; opacity: 0.6; font-size: 0.7em">(${section})</small></h2>
|
|
705
|
-
<
|
|
706
|
-
<div class="swatchkit-preview-link"><a href="${
|
|
707
|
-
<
|
|
706
|
+
<iframe src="${previewPath}" style="width: 100%; border: var(--stroke); min-height: 25rem; resize: vertical; overflow: auto;"></iframe>
|
|
707
|
+
<div class="swatchkit-preview-link"><a href="${previewLink}">View full screen</a></div>
|
|
708
|
+
<details>
|
|
709
|
+
<summary>View source</summary>
|
|
710
|
+
<pre><code>${escapedContent}</code></pre>
|
|
711
|
+
</details>
|
|
708
712
|
</section>
|
|
709
713
|
`;
|
|
710
714
|
})
|
package/package.json
CHANGED