@pure-ds/storybook 0.1.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/.storybook/addons/description/preview.js +15 -0
- package/.storybook/addons/description/register.js +60 -0
- package/.storybook/addons/html-preview/Panel.jsx +327 -0
- package/.storybook/addons/html-preview/constants.js +6 -0
- package/.storybook/addons/html-preview/preview.js +178 -0
- package/.storybook/addons/html-preview/register.js +16 -0
- package/.storybook/addons/pds-configurator/SearchTool.js +44 -0
- package/.storybook/addons/pds-configurator/Tool.js +30 -0
- package/.storybook/addons/pds-configurator/constants.js +9 -0
- package/.storybook/addons/pds-configurator/preview.js +159 -0
- package/.storybook/addons/pds-configurator/register.js +24 -0
- package/.storybook/docs.css +35 -0
- package/.storybook/htmlPreview.css +103 -0
- package/.storybook/htmlPreview.js +271 -0
- package/.storybook/main.js +160 -0
- package/.storybook/preview-body.html +48 -0
- package/.storybook/preview-head.html +11 -0
- package/.storybook/preview.js +1563 -0
- package/README.md +266 -0
- package/bin/index.js +40 -0
- package/dist/pds-reference.json +2101 -0
- package/package.json +45 -0
- package/pds.config.js +6 -0
- package/public/assets/css/app.css +1216 -0
- package/public/assets/data/auto-design-advanced.json +704 -0
- package/public/assets/data/auto-design-simple.json +123 -0
- package/public/assets/img/icon-512x512.png +0 -0
- package/public/assets/img/logo-trans.png +0 -0
- package/public/assets/img/logo.png +0 -0
- package/public/assets/js/app.js +15088 -0
- package/public/assets/js/app.js.map +7 -0
- package/public/assets/js/lit.js +1176 -0
- package/public/assets/js/lit.js.map +7 -0
- package/public/assets/js/pds.js +9801 -0
- package/public/assets/js/pds.js.map +7 -0
- package/public/assets/pds/components/pds-calendar.js +837 -0
- package/public/assets/pds/components/pds-drawer.js +857 -0
- package/public/assets/pds/components/pds-icon.js +338 -0
- package/public/assets/pds/components/pds-jsonform.js +1775 -0
- package/public/assets/pds/components/pds-richtext.js +1035 -0
- package/public/assets/pds/components/pds-scrollrow.js +331 -0
- package/public/assets/pds/components/pds-splitpanel.js +401 -0
- package/public/assets/pds/components/pds-tabstrip.js +251 -0
- package/public/assets/pds/components/pds-toaster.js +446 -0
- package/public/assets/pds/components/pds-upload.js +657 -0
- package/public/assets/pds/custom-elements.json +2003 -0
- package/public/assets/pds/icons/pds-icons.svg +498 -0
- package/public/assets/pds/pds-css-complete.json +1861 -0
- package/public/assets/pds/pds-runtime-config.json +11 -0
- package/public/assets/pds/pds.css-data.json +2152 -0
- package/public/assets/pds/styles/pds-components.css +1944 -0
- package/public/assets/pds/styles/pds-components.css.js +3895 -0
- package/public/assets/pds/styles/pds-primitives.css +352 -0
- package/public/assets/pds/styles/pds-primitives.css.js +711 -0
- package/public/assets/pds/styles/pds-styles.css +3761 -0
- package/public/assets/pds/styles/pds-styles.css.js +7529 -0
- package/public/assets/pds/styles/pds-tokens.css +699 -0
- package/public/assets/pds/styles/pds-tokens.css.js +1405 -0
- package/public/assets/pds/styles/pds-utilities.css +763 -0
- package/public/assets/pds/styles/pds-utilities.css.js +1533 -0
- package/public/assets/pds/vscode-custom-data.json +824 -0
- package/scripts/build-pds-reference.mjs +807 -0
- package/scripts/generate-stories.js +542 -0
- package/scripts/package-build.js +86 -0
- package/src/js/app.js +17 -0
- package/src/js/common/ask.js +208 -0
- package/src/js/common/common.js +20 -0
- package/src/js/common/font-loader.js +200 -0
- package/src/js/common/msg.js +90 -0
- package/src/js/lit.js +40 -0
- package/src/js/pds-core/pds-config.js +1162 -0
- package/src/js/pds-core/pds-enhancer-metadata.js +75 -0
- package/src/js/pds-core/pds-enhancers.js +357 -0
- package/src/js/pds-core/pds-enums.js +86 -0
- package/src/js/pds-core/pds-generator.js +5317 -0
- package/src/js/pds-core/pds-ontology.js +256 -0
- package/src/js/pds-core/pds-paths.js +109 -0
- package/src/js/pds-core/pds-query.js +571 -0
- package/src/js/pds-core/pds-registry.js +129 -0
- package/src/js/pds-core/pds.d.ts +129 -0
- package/src/js/pds.d.ts +408 -0
- package/src/js/pds.js +1579 -0
- package/src/pds-core/pds-api.js +105 -0
- package/stories/GettingStarted.md +96 -0
- package/stories/GettingStarted.stories.js +144 -0
- package/stories/WhatIsPDS.md +194 -0
- package/stories/WhatIsPDS.stories.js +144 -0
- package/stories/components/PdsCalendar.stories.js +263 -0
- package/stories/components/PdsDrawer.stories.js +623 -0
- package/stories/components/PdsIcon.stories.js +78 -0
- package/stories/components/PdsJsonform.stories.js +1444 -0
- package/stories/components/PdsRichtext.stories.js +367 -0
- package/stories/components/PdsScrollrow.stories.js +140 -0
- package/stories/components/PdsSplitpanel.stories.js +502 -0
- package/stories/components/PdsTabstrip.stories.js +442 -0
- package/stories/components/PdsToaster.stories.js +186 -0
- package/stories/components/PdsUpload.stories.js +66 -0
- package/stories/enhancements/Dropdowns.stories.js +185 -0
- package/stories/enhancements/InteractiveStates.stories.js +625 -0
- package/stories/enhancements/MeshGradients.stories.js +320 -0
- package/stories/enhancements/OpenGroups.stories.js +227 -0
- package/stories/enhancements/RangeSliders.stories.js +232 -0
- package/stories/enhancements/RequiredFields.stories.js +189 -0
- package/stories/enhancements/Toggles.stories.js +167 -0
- package/stories/foundations/Colors.stories.js +283 -0
- package/stories/foundations/Icons.stories.js +305 -0
- package/stories/foundations/SmartSurfaces.stories.js +367 -0
- package/stories/foundations/Spacing.stories.js +175 -0
- package/stories/foundations/Typography.stories.js +960 -0
- package/stories/foundations/ZIndex.stories.js +325 -0
- package/stories/patterns/BorderEffects.stories.js +72 -0
- package/stories/patterns/Layout.stories.js +99 -0
- package/stories/patterns/Utilities.stories.js +107 -0
- package/stories/primitives/Accordion.stories.js +359 -0
- package/stories/primitives/Alerts.stories.js +64 -0
- package/stories/primitives/Badges.stories.js +183 -0
- package/stories/primitives/Buttons.stories.js +229 -0
- package/stories/primitives/Cards.stories.js +353 -0
- package/stories/primitives/FormGroups.stories.js +569 -0
- package/stories/primitives/Forms.stories.js +131 -0
- package/stories/primitives/Media.stories.js +203 -0
- package/stories/primitives/Tables.stories.js +232 -0
- package/stories/reference/ReferenceCatalog.stories.js +28 -0
- package/stories/reference/reference-catalog.js +413 -0
- package/stories/reference/reference-docs.js +302 -0
- package/stories/reference/reference-helpers.js +310 -0
- package/stories/utilities/GridSystem.stories.js +208 -0
- package/stories/utils/PdsAsk.stories.js +420 -0
- package/stories/utils/toast-utils.js +148 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import crypto from 'crypto';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { Generator } from '../js/pds-core/pds-generator.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generate modules map and metadata from a config object.
|
|
8
|
+
* @param {object} config
|
|
9
|
+
* @param {object} [opts]
|
|
10
|
+
* @returns {Promise<{modules: Record<string,string>, meta: object}>}
|
|
11
|
+
*/
|
|
12
|
+
export async function generate(config, opts = {}) {
|
|
13
|
+
const gen = new Generator(config || {});
|
|
14
|
+
|
|
15
|
+
// generator produces tokens and css during construction in this repo
|
|
16
|
+
const tokens = gen.tokens || {};
|
|
17
|
+
const css = gen.layeredCSS || '';
|
|
18
|
+
|
|
19
|
+
const modules = {};
|
|
20
|
+
|
|
21
|
+
// Raw CSS outputs
|
|
22
|
+
modules['pds-tokens.css'] = Object.keys(tokens).length ? toTokensCSS(tokens) : '';
|
|
23
|
+
modules['pds-styles.css'] = css;
|
|
24
|
+
|
|
25
|
+
// JS modules that export the CSS as default string (consumable by import)
|
|
26
|
+
modules['pds-tokens.css.js'] = `export default ${JSON.stringify(modules['pds-tokens.css'])};`;
|
|
27
|
+
modules['pds-styles.css.js'] = `export default ${JSON.stringify(css)};`;
|
|
28
|
+
|
|
29
|
+
// A minimal story module placeholder (consumers/Storybook adapter can replace)
|
|
30
|
+
modules['pds-stories.js'] = `// PDS generated stories placeholder\nexport const meta = { generatedAt: ${JSON.stringify(new Date().toISOString())} };`;
|
|
31
|
+
|
|
32
|
+
const rawConfig = typeof config === 'string' ? config : JSON.stringify(config);
|
|
33
|
+
const hash = crypto.createHash('sha1').update(rawConfig).digest('hex');
|
|
34
|
+
|
|
35
|
+
const meta = {
|
|
36
|
+
generatedAt: new Date().toISOString(),
|
|
37
|
+
configHash: hash,
|
|
38
|
+
files: Object.keys(modules),
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return { modules, meta };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function toTokensCSS(tokens) {
|
|
45
|
+
// Very small helper: flatten top-level token groups into :root custom properties
|
|
46
|
+
const parts = [':root {'];
|
|
47
|
+
for (const [group, obj] of Object.entries(tokens)) {
|
|
48
|
+
if (typeof obj === 'object') {
|
|
49
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
50
|
+
const name = `--pds-${group}-${k}`.replace(/[^a-z0-9-_]/gi, '-').toLowerCase();
|
|
51
|
+
parts.push(` ${name}: ${v};`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
parts.push('}');
|
|
56
|
+
return parts.join('\n');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Read config from file and generate modules.
|
|
61
|
+
* @param {string} configPath
|
|
62
|
+
* @param {object} [opts]
|
|
63
|
+
*/
|
|
64
|
+
export async function generateFromFile(configPath, opts = {}) {
|
|
65
|
+
const txt = await fs.readFile(configPath, 'utf8');
|
|
66
|
+
let cfg;
|
|
67
|
+
try {
|
|
68
|
+
cfg = JSON.parse(txt);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
throw new Error(`Failed to parse config JSON: ${e.message}`);
|
|
71
|
+
}
|
|
72
|
+
return generate(cfg, opts);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Watch a config file and call the writer on changes.
|
|
77
|
+
* @param {string} configPath
|
|
78
|
+
* @param {string} outDir
|
|
79
|
+
* @param {{onWrite?:Function}} opts
|
|
80
|
+
*/
|
|
81
|
+
export function watch(configPath, outDir, opts = {}) {
|
|
82
|
+
let timeout = null;
|
|
83
|
+
const onChange = async () => {
|
|
84
|
+
try {
|
|
85
|
+
const result = await generateFromFile(configPath);
|
|
86
|
+
if (opts.onWrite) await opts.onWrite(result.modules, outDir, result.meta);
|
|
87
|
+
} catch (err) {
|
|
88
|
+
console.error('pds watch: generation error', err);
|
|
89
|
+
if (opts.onError) opts.onError(err);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const watcher = fs.watch(configPath, { persistent: true }, () => {
|
|
94
|
+
if (timeout) clearTimeout(timeout);
|
|
95
|
+
// debounce
|
|
96
|
+
timeout = setTimeout(onChange, 150);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// initial run
|
|
100
|
+
(async () => { await onChange(); })();
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
close() { watcher.close(); }
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Getting Started with PDS Storybook
|
|
2
|
+
|
|
3
|
+
Welcome to the **Pure Design System** Storybook! This is a comprehensive showcase of the configuration-driven design system that generates complete design systems from JavaScript configuration.
|
|
4
|
+
|
|
5
|
+
## 🎨 What You're Looking At
|
|
6
|
+
|
|
7
|
+
This Storybook instance demonstrates:
|
|
8
|
+
|
|
9
|
+
- **Live Configuration** - Use the PDS Configurator button in the toolbar to change the design in real-time
|
|
10
|
+
- **Multiple Presets** - Switch between design presets using the toolbar
|
|
11
|
+
- **Theme Switching** - Toggle between light and dark themes
|
|
12
|
+
- **Quick Search** - Use the search icon to query tokens and components
|
|
13
|
+
|
|
14
|
+
## 🚀 Quick Start
|
|
15
|
+
|
|
16
|
+
### 1. Try the Configurator
|
|
17
|
+
|
|
18
|
+
Click the **PDS Configurator** button in the toolbar (circle icon) to open the configuration panel at the bottom of the screen. From there you can:
|
|
19
|
+
|
|
20
|
+
- Change colors, typography, spacing
|
|
21
|
+
- Toggle effects like liquid glass
|
|
22
|
+
- Export your configuration
|
|
23
|
+
- See changes applied instantly across all stories
|
|
24
|
+
|
|
25
|
+
### 2. Browse Stories
|
|
26
|
+
|
|
27
|
+
Stories are organized by best practices:
|
|
28
|
+
|
|
29
|
+
- **Foundations** - Design tokens (colors, typography, spacing, icons)
|
|
30
|
+
- **Primitives** - Basic UI elements (buttons, forms, cards, badges)
|
|
31
|
+
- **Components** - Web Components (pds-icon, pds-drawer, pds-tabstrip, etc.)
|
|
32
|
+
- **Patterns** - Layout patterns and utilities
|
|
33
|
+
- **Enhancements** - Progressive enhancements for semantic HTML
|
|
34
|
+
|
|
35
|
+
### 3. Use Quick Search
|
|
36
|
+
|
|
37
|
+
Click the search icon in the toolbar to query the design system:
|
|
38
|
+
|
|
39
|
+
- "what is the focus border color on inputs?"
|
|
40
|
+
- "button hover color"
|
|
41
|
+
- "how do I create a card?"
|
|
42
|
+
|
|
43
|
+
## 📚 Story Features
|
|
44
|
+
|
|
45
|
+
Each story includes:
|
|
46
|
+
|
|
47
|
+
- **Interactive controls** - Use the Controls panel to customize
|
|
48
|
+
- **Preset selection** - Try different design presets
|
|
49
|
+
- **Color overrides** - Override primary/secondary colors per story
|
|
50
|
+
- **Live updates** - Changes apply immediately
|
|
51
|
+
|
|
52
|
+
## 🎯 Key Features
|
|
53
|
+
|
|
54
|
+
### Configuration-Driven
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
await PDS.start({
|
|
58
|
+
design: {
|
|
59
|
+
colors: { primary: '#007acc', secondary: '#5c2d91' },
|
|
60
|
+
typography: { baseFontSize: 16, fontScale: 1.25 },
|
|
61
|
+
spatialRhythm: { baseUnit: 8, scaleRatio: 1.5 }
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Live Mode
|
|
67
|
+
|
|
68
|
+
This Storybook runs PDS in **live mode**, meaning:
|
|
69
|
+
- Styles are generated at runtime
|
|
70
|
+
- Configuration changes apply instantly
|
|
71
|
+
- Full access to `PDS.compiled` object model
|
|
72
|
+
- Automatic font loading from Google Fonts
|
|
73
|
+
|
|
74
|
+
### Framework Agnostic
|
|
75
|
+
|
|
76
|
+
While this Storybook uses Vite + Web Components, PDS works with:
|
|
77
|
+
- Vanilla JavaScript
|
|
78
|
+
- Lit
|
|
79
|
+
- React
|
|
80
|
+
- Vue
|
|
81
|
+
- Svelte
|
|
82
|
+
- Next.js
|
|
83
|
+
|
|
84
|
+
## 🔗 Resources
|
|
85
|
+
|
|
86
|
+
- [GitHub](https://github.com/mvneerven/pure-ds)
|
|
87
|
+
- [NPM Package](https://www.npmjs.com/package/@pure-ds/core)
|
|
88
|
+
- [Documentation](https://puredesignsystem.z6.web.core.windows.net/)
|
|
89
|
+
|
|
90
|
+
## 💡 Tips
|
|
91
|
+
|
|
92
|
+
1. **Start with Foundations** - Understand the token system first
|
|
93
|
+
2. **Experiment with Presets** - See how different designs look
|
|
94
|
+
3. **Open the Configurator** - Try changing values live
|
|
95
|
+
4. **Use Quick Search** - Find tokens and components quickly
|
|
96
|
+
5. **Check Controls** - Each story has customizable parameters
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
3
|
+
import Showdown from 'showdown';
|
|
4
|
+
import markdownContent from './GettingStarted.md?raw';
|
|
5
|
+
|
|
6
|
+
const converter = new Showdown.Converter({
|
|
7
|
+
tables: true,
|
|
8
|
+
strikethrough: true,
|
|
9
|
+
tasklists: true,
|
|
10
|
+
ghCodeBlocks: true,
|
|
11
|
+
simplifiedAutoLink: true,
|
|
12
|
+
emoji: true
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
title: 'General/Getting Started',
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: 'fullscreen',
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: 'Quick start guide to using PDS Storybook and exploring components'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Default = {
|
|
28
|
+
render: () => {
|
|
29
|
+
const htmlContent = converter.makeHtml(markdownContent);
|
|
30
|
+
|
|
31
|
+
return html`
|
|
32
|
+
<style>
|
|
33
|
+
.markdown-container {
|
|
34
|
+
max-width: 900px;
|
|
35
|
+
margin: 0 auto;
|
|
36
|
+
padding: var(--spacing-8) var(--spacing-6);
|
|
37
|
+
background: var(--color-surface-base);
|
|
38
|
+
color: var(--color-text-primary);
|
|
39
|
+
font-family: var(--font-family-base);
|
|
40
|
+
line-height: var(--line-height-relaxed);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.markdown-container h1 {
|
|
44
|
+
font-size: var(--font-size-4xl);
|
|
45
|
+
font-weight: var(--font-weight-bold);
|
|
46
|
+
color: var(--color-text-primary);
|
|
47
|
+
margin: 0 0 var(--spacing-6);
|
|
48
|
+
line-height: var(--line-height-tight);
|
|
49
|
+
padding-bottom: var(--spacing-4);
|
|
50
|
+
border-bottom: 2px solid var(--color-border-subtle);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.markdown-container h2 {
|
|
54
|
+
font-size: var(--font-size-2xl);
|
|
55
|
+
font-weight: var(--font-weight-semibold);
|
|
56
|
+
color: var(--color-text-primary);
|
|
57
|
+
margin: var(--spacing-8) 0 var(--spacing-4);
|
|
58
|
+
line-height: var(--line-height-tight);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.markdown-container h3 {
|
|
62
|
+
font-size: var(--font-size-xl);
|
|
63
|
+
font-weight: var(--font-weight-semibold);
|
|
64
|
+
color: var(--color-text-primary);
|
|
65
|
+
margin: var(--spacing-6) 0 var(--spacing-3);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.markdown-container p {
|
|
69
|
+
margin: var(--spacing-4) 0;
|
|
70
|
+
color: var(--color-text-secondary);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.markdown-container strong {
|
|
74
|
+
color: var(--color-text-primary);
|
|
75
|
+
font-weight: var(--font-weight-semibold);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.markdown-container code {
|
|
79
|
+
background: var(--color-surface-raised);
|
|
80
|
+
color: var(--color-primary-500);
|
|
81
|
+
padding: var(--spacing-1) var(--spacing-2);
|
|
82
|
+
border-radius: var(--radius-sm);
|
|
83
|
+
font-family: var(--font-family-mono);
|
|
84
|
+
font-size: 0.9em;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.markdown-container pre {
|
|
88
|
+
background: var(--color-surface-raised);
|
|
89
|
+
border: 1px solid var(--color-border-subtle);
|
|
90
|
+
border-radius: var(--radius-md);
|
|
91
|
+
padding: var(--spacing-4);
|
|
92
|
+
overflow-x: auto;
|
|
93
|
+
margin: var(--spacing-4) 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.markdown-container pre code {
|
|
97
|
+
background: none;
|
|
98
|
+
padding: 0;
|
|
99
|
+
color: var(--color-text-primary);
|
|
100
|
+
display: block;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.markdown-container ul,
|
|
104
|
+
.markdown-container ol {
|
|
105
|
+
margin: var(--spacing-4) 0;
|
|
106
|
+
padding-left: var(--spacing-6);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.markdown-container li {
|
|
110
|
+
margin: var(--spacing-2) 0;
|
|
111
|
+
color: var(--color-text-secondary);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.markdown-container hr {
|
|
115
|
+
border: none;
|
|
116
|
+
border-top: 1px solid var(--color-border-subtle);
|
|
117
|
+
margin: var(--spacing-8) 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.markdown-container a {
|
|
121
|
+
color: var(--color-primary-500);
|
|
122
|
+
text-decoration: none;
|
|
123
|
+
transition: color 0.2s ease;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.markdown-container a:hover {
|
|
127
|
+
color: var(--color-primary-600);
|
|
128
|
+
text-decoration: underline;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.markdown-container blockquote {
|
|
132
|
+
border-left: 4px solid var(--color-primary-500);
|
|
133
|
+
padding-left: var(--spacing-4);
|
|
134
|
+
margin: var(--spacing-4) 0;
|
|
135
|
+
color: var(--color-text-secondary);
|
|
136
|
+
font-style: italic;
|
|
137
|
+
}
|
|
138
|
+
</style>
|
|
139
|
+
<div class="markdown-container">
|
|
140
|
+
${unsafeHTML(htmlContent)}
|
|
141
|
+
</div>
|
|
142
|
+
`;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
## A standards-native design system built entirely on the Web Platform
|
|
4
|
+
|
|
5
|
+
PDS is not a framework, not a CSS library, and not tied to Storybook.
|
|
6
|
+
|
|
7
|
+
It is a **config-first, architecture-first, standards-only design system generator**.
|
|
8
|
+
|
|
9
|
+
You write a small JavaScript config.
|
|
10
|
+
PDS turns it into:
|
|
11
|
+
|
|
12
|
+
- Deterministic global CSS
|
|
13
|
+
- AdoptedStyleSheets (for Web Components)
|
|
14
|
+
- A full hierarchic token model. Just type `PDS.compiled` in Dev Console...
|
|
15
|
+
|
|
16
|
+
Apart from the layered token/styles generation, PDS offers:
|
|
17
|
+
|
|
18
|
+
- Optional progressive enhancements for semantic HTML
|
|
19
|
+
- Optional lazy-loaded Web Components
|
|
20
|
+
- A custom-elements.json manifest for IDE IntelliSense
|
|
21
|
+
|
|
22
|
+
This Storybook instance showcases the full power of PDS: layers, tokens, enhancements, and components.
|
|
23
|
+
|
|
24
|
+
# Why PDS exists
|
|
25
|
+
|
|
26
|
+
Modern frontend is dominated by frameworks, utility libraries, and toolchains that *replace* the Web Platform rather than *use* it.
|
|
27
|
+
|
|
28
|
+
PDS takes the opposite path:
|
|
29
|
+
- The browser is the framework.
|
|
30
|
+
- Semantic HTML is the component model.
|
|
31
|
+
- Web Standards are enough.
|
|
32
|
+
|
|
33
|
+
PDS follows the [Pure Web Manifesto](https://pureweb.dev/manifesto) and provides sustainable architecture for long-lived apps without lock-in, complexity, or hidden magic.
|
|
34
|
+
|
|
35
|
+
# The PDS Architecture
|
|
36
|
+
|
|
37
|
+
PDS is built on **three fully optional layers**, each powered by your config:
|
|
38
|
+
|
|
39
|
+
## 1. Styles — deterministic global CSS
|
|
40
|
+
|
|
41
|
+
Generated from a single JavaScript config:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
export default {
|
|
45
|
+
colors: { primary: "#0891b2" },
|
|
46
|
+
typography: { baseFontSize: 16, scale: 1.2 },
|
|
47
|
+
radius: 6,
|
|
48
|
+
spacing: { base: 4, ratio: 1.5 }
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
PDS produces:
|
|
54
|
+
|
|
55
|
+
- Color scales (50–900)
|
|
56
|
+
- Semantic palettes (success, warning, info)
|
|
57
|
+
- Typographic modular scale
|
|
58
|
+
- Spacing system
|
|
59
|
+
- Layout tokens
|
|
60
|
+
- All exported as **CSS Custom Properties**
|
|
61
|
+
- Zero specificity by design (`:where()` selectors)
|
|
62
|
+
- Mirrors the same values in JS (`pds.compiled.tokens`)
|
|
63
|
+
|
|
64
|
+
Use **only this layer** if you want PDS as a token + CSS generator.
|
|
65
|
+
|
|
66
|
+
## 2. Progressive Enhancements — semantic HTML made powerful
|
|
67
|
+
|
|
68
|
+
Optional selector-based enhancements that:
|
|
69
|
+
|
|
70
|
+
- Run in both Light DOM and open Shadow DOM
|
|
71
|
+
- Require no framework or build step
|
|
72
|
+
- Upgrade semantic HTML automatically
|
|
73
|
+
- Improve accessibility and defaults with zero JS integration work
|
|
74
|
+
|
|
75
|
+
Examples:
|
|
76
|
+
|
|
77
|
+
- Required fields automatically show markers and help text
|
|
78
|
+
- Checkboxes can become toggles with one attribute
|
|
79
|
+
- `<dialog>` elements get better focus management
|
|
80
|
+
- Form elements gain consistent, theme-based styling
|
|
81
|
+
|
|
82
|
+
Think **HTML → UX upgrades**, powered by your config.
|
|
83
|
+
|
|
84
|
+
## 3. Components — auto-defined, lazy-loaded Web Components
|
|
85
|
+
|
|
86
|
+
A growing set of PDS components:
|
|
87
|
+
|
|
88
|
+
- Auto-defined when imported
|
|
89
|
+
- Lazy-loaded via dynamic ESM imports
|
|
90
|
+
- Styled by your tokens
|
|
91
|
+
- Zero dependencies
|
|
92
|
+
- Always optional: use none, some, or all
|
|
93
|
+
|
|
94
|
+
Examples:
|
|
95
|
+
|
|
96
|
+
- `<pds-dialog>`
|
|
97
|
+
- `<pds-button>`
|
|
98
|
+
- `<pds-card>`
|
|
99
|
+
- `<pds-form>` and JSON Schema–driven config editors
|
|
100
|
+
- `<pds-autocomplete>`
|
|
101
|
+
|
|
102
|
+
PDS automatically generates a `custom-elements.json` (and editor-specific metadata) so editors like VSCode give full **IntelliSense**, autocomplete, and type info.
|
|
103
|
+
|
|
104
|
+
# Why PDS is different
|
|
105
|
+
|
|
106
|
+
### ✓ 100% Web Standards — no dependencies
|
|
107
|
+
|
|
108
|
+
### ✓ Extremely layered — everything optional
|
|
109
|
+
|
|
110
|
+
Use only tokens.\
|
|
111
|
+
Or only CSS.\
|
|
112
|
+
Or CSS + enhancements.\
|
|
113
|
+
Or the full component set.\
|
|
114
|
+
Nothing forces itself into your project.
|
|
115
|
+
|
|
116
|
+
### ✓ Opinionated, but never restrictive
|
|
117
|
+
|
|
118
|
+
Clean defaults that stay out of your way.\
|
|
119
|
+
Everything overrideable.\
|
|
120
|
+
No generated specificity wars.
|
|
121
|
+
|
|
122
|
+
### ✓ No magic, no opacity
|
|
123
|
+
|
|
124
|
+
All generated CSS is readable, inspectable, and deterministic.\
|
|
125
|
+
No toolchain tricks.\
|
|
126
|
+
No runtime class generation.
|
|
127
|
+
|
|
128
|
+
### ✓ Config → Tokens → CSS → JS (single source of truth)
|
|
129
|
+
|
|
130
|
+
Breakpoints, spacing, color ramps all available in:
|
|
131
|
+
|
|
132
|
+
- Global CSS
|
|
133
|
+
- Shadow DOM CSS
|
|
134
|
+
- JavaScript (`pds.compiled`)
|
|
135
|
+
|
|
136
|
+
Your entire codebase stays in sync.
|
|
137
|
+
|
|
138
|
+
# How Storybook fits in
|
|
139
|
+
|
|
140
|
+
Storybook is **not part of PDS**.
|
|
141
|
+
|
|
142
|
+
It is simply the **showcase and documentation environment** for exploring PDS:
|
|
143
|
+
|
|
144
|
+
- It runs PDS in **live config mode**
|
|
145
|
+
- Every story is affected instantly by config changes
|
|
146
|
+
- You can toggle:
|
|
147
|
+
- Themes
|
|
148
|
+
- Layers
|
|
149
|
+
- Enhancements
|
|
150
|
+
- Components
|
|
151
|
+
- It demonstrates how PDS behaves in real applications
|
|
152
|
+
- It helps teams maintain visual consistency across projects
|
|
153
|
+
|
|
154
|
+
Think of Storybook as **“the PDS showroom,”** not the engine.
|
|
155
|
+
|
|
156
|
+
# What you can explore in this Storybook
|
|
157
|
+
|
|
158
|
+
### Foundations
|
|
159
|
+
|
|
160
|
+
The generated tokens — colors, spacing, typography, radii, elevation, surfaces.
|
|
161
|
+
|
|
162
|
+
### Utilities
|
|
163
|
+
|
|
164
|
+
Minimal, generated utility classes based entirely on tokens.
|
|
165
|
+
|
|
166
|
+
### Enhancements
|
|
167
|
+
|
|
168
|
+
Selector-driven UX improvements on semantic HTML.
|
|
169
|
+
|
|
170
|
+
### Components
|
|
171
|
+
|
|
172
|
+
Lazy-loaded Web Components styled by your config.
|
|
173
|
+
|
|
174
|
+
### Patterns
|
|
175
|
+
|
|
176
|
+
Common UI constructions built from the three PDS layers.
|
|
177
|
+
|
|
178
|
+
### Configurator
|
|
179
|
+
|
|
180
|
+
Open the toolbar → 🎨 icon to adjust the live configuration.
|
|
181
|
+
|
|
182
|
+
# Who PDS is for
|
|
183
|
+
|
|
184
|
+
- Teams who want a design system without a framework commitment
|
|
185
|
+
- Developers tired of Tailwind’s utility sprawl or React’s re-render economics
|
|
186
|
+
- Web Components users who want full token theming
|
|
187
|
+
- Apps that need long-term sustainability and simplicity
|
|
188
|
+
- PWAs, MPAs, SPAs, static sites, enterprise dashboards — anything HTML-based
|
|
189
|
+
|
|
190
|
+
# In short
|
|
191
|
+
|
|
192
|
+
> **PDS is a 100% standards-native, extremely layered,
|
|
193
|
+
> dependency-free, and completely transparent design system.
|
|
194
|
+
> This Storybook instance simply demonstrates its power.**
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
3
|
+
import Showdown from 'showdown';
|
|
4
|
+
import markdownContent from './WhatIsPDS.md?raw';
|
|
5
|
+
|
|
6
|
+
const converter = new Showdown.Converter({
|
|
7
|
+
tables: true,
|
|
8
|
+
strikethrough: true,
|
|
9
|
+
tasklists: true,
|
|
10
|
+
ghCodeBlocks: true,
|
|
11
|
+
simplifiedAutoLink: true,
|
|
12
|
+
emoji: true
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
title: 'General/What is PDS',
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: 'fullscreen',
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: 'Learn about Pure Design System and its revolutionary approach to design systems'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Default = {
|
|
28
|
+
render: () => {
|
|
29
|
+
const htmlContent = converter.makeHtml(markdownContent);
|
|
30
|
+
|
|
31
|
+
return html`
|
|
32
|
+
<style>
|
|
33
|
+
.markdown-container {
|
|
34
|
+
max-width: 900px;
|
|
35
|
+
margin: 0 auto;
|
|
36
|
+
padding: var(--spacing-8) var(--spacing-6);
|
|
37
|
+
background: var(--color-surface-base);
|
|
38
|
+
color: var(--color-text-primary);
|
|
39
|
+
font-family: var(--font-family-base);
|
|
40
|
+
line-height: var(--line-height-relaxed);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.markdown-container h1 {
|
|
44
|
+
font-size: var(--font-size-4xl);
|
|
45
|
+
font-weight: var(--font-weight-bold);
|
|
46
|
+
color: var(--color-text-primary);
|
|
47
|
+
margin: 0 0 var(--spacing-6);
|
|
48
|
+
line-height: var(--line-height-tight);
|
|
49
|
+
padding-bottom: var(--spacing-4);
|
|
50
|
+
border-bottom: 2px solid var(--color-border-subtle);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.markdown-container h2 {
|
|
54
|
+
font-size: var(--font-size-2xl);
|
|
55
|
+
font-weight: var(--font-weight-semibold);
|
|
56
|
+
color: var(--color-text-primary);
|
|
57
|
+
margin: var(--spacing-8) 0 var(--spacing-4);
|
|
58
|
+
line-height: var(--line-height-tight);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.markdown-container h3 {
|
|
62
|
+
font-size: var(--font-size-xl);
|
|
63
|
+
font-weight: var(--font-weight-semibold);
|
|
64
|
+
color: var(--color-text-primary);
|
|
65
|
+
margin: var(--spacing-6) 0 var(--spacing-3);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.markdown-container p {
|
|
69
|
+
margin: var(--spacing-4) 0;
|
|
70
|
+
color: var(--color-text-secondary);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.markdown-container strong {
|
|
74
|
+
color: var(--color-text-primary);
|
|
75
|
+
font-weight: var(--font-weight-semibold);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.markdown-container code {
|
|
79
|
+
background: var(--color-surface-raised);
|
|
80
|
+
color: var(--color-primary-500);
|
|
81
|
+
padding: var(--spacing-1) var(--spacing-2);
|
|
82
|
+
border-radius: var(--radius-sm);
|
|
83
|
+
font-family: var(--font-family-mono);
|
|
84
|
+
font-size: 0.9em;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.markdown-container pre {
|
|
88
|
+
background: var(--color-surface-raised);
|
|
89
|
+
border: 1px solid var(--color-border-subtle);
|
|
90
|
+
border-radius: var(--radius-md);
|
|
91
|
+
padding: var(--spacing-4);
|
|
92
|
+
overflow-x: auto;
|
|
93
|
+
margin: var(--spacing-4) 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.markdown-container pre code {
|
|
97
|
+
background: none;
|
|
98
|
+
padding: 0;
|
|
99
|
+
color: var(--color-text-primary);
|
|
100
|
+
display: block;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.markdown-container ul,
|
|
104
|
+
.markdown-container ol {
|
|
105
|
+
margin: var(--spacing-4) 0;
|
|
106
|
+
padding-left: var(--spacing-6);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.markdown-container li {
|
|
110
|
+
margin: var(--spacing-2) 0;
|
|
111
|
+
color: var(--color-text-secondary);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.markdown-container hr {
|
|
115
|
+
border: none;
|
|
116
|
+
border-top: 1px solid var(--color-border-subtle);
|
|
117
|
+
margin: var(--spacing-8) 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.markdown-container a {
|
|
121
|
+
color: var(--color-primary-500);
|
|
122
|
+
text-decoration: none;
|
|
123
|
+
transition: color 0.2s ease;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.markdown-container a:hover {
|
|
127
|
+
color: var(--color-primary-600);
|
|
128
|
+
text-decoration: underline;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.markdown-container blockquote {
|
|
132
|
+
border-left: 4px solid var(--color-primary-500);
|
|
133
|
+
padding-left: var(--spacing-4);
|
|
134
|
+
margin: var(--spacing-4) 0;
|
|
135
|
+
color: var(--color-text-secondary);
|
|
136
|
+
font-style: italic;
|
|
137
|
+
}
|
|
138
|
+
</style>
|
|
139
|
+
<div class="markdown-container">
|
|
140
|
+
${unsafeHTML(htmlContent)}
|
|
141
|
+
</div>
|
|
142
|
+
`;
|
|
143
|
+
}
|
|
144
|
+
};
|