@nysds/playground 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/LICENSE +25 -0
- package/README.md +364 -0
- package/bin/cli.mjs +223 -0
- package/bin/cli.test.mjs +36 -0
- package/decks/customizing-components.json +97 -0
- package/dist/assets/index-LO1tomgR.css +6 -0
- package/dist/assets/index-bBtGCGL_.js +5190 -0
- package/dist/assets/internal/typescript.js +193739 -0
- package/dist/assets/nys-icon.library-Bi_7DKlD-YSs5zqZy-DXISxj9N.js +609 -0
- package/dist/assets/nys-icon.library-CwuPZJAc-TryaOS7Z.js +600 -0
- package/dist/assets/playground-typescript-worker-BcTrPYfY.js +87 -0
- package/dist/assets/playground-typescript-worker.js +87 -0
- package/dist/favicon.svg +10 -0
- package/dist/index.html +769 -0
- package/dist/nysds-logo.svg +21 -0
- package/dist/nysds-symbol.svg +7 -0
- package/index.html +768 -0
- package/package.json +59 -0
- package/presets/00-welcome.json +8 -0
- package/presets/01-button.json +7 -0
- package/presets/02-alert.json +7 -0
- package/presets/03-badge-and-avatar.json +7 -0
- package/presets/04-text-input.json +7 -0
- package/presets/05-select-radio-checkbox.json +7 -0
- package/presets/06-form-validation.json +7 -0
- package/presets/07-card.json +7 -0
- package/presets/08-accordion.json +7 -0
- package/presets/09-tabs.json +7 -0
- package/presets/10-modal.json +7 -0
- package/presets/11-stepper.json +7 -0
- package/presets/12-table-and-pagination.json +7 -0
- package/presets/13-tooltip-and-dropdown.json +7 -0
- package/presets/14-navigation.json +7 -0
- package/presets/15-page-structure.json +7 -0
- package/presets/16-themes.json +7 -0
- package/presets/17-utility-classes.json +7 -0
- package/presets/README.md +118 -0
- package/public/favicon.svg +10 -0
- package/public/nysds-logo.svg +21 -0
- package/public/nysds-symbol.svg +7 -0
- package/src/app.css +1087 -0
- package/src/debounce.ts +86 -0
- package/src/deck-model.ts +299 -0
- package/src/deck-store.ts +144 -0
- package/src/decks.test.ts +288 -0
- package/src/editor-panes.ts +190 -0
- package/src/editors.ts +92 -0
- package/src/home.ts +225 -0
- package/src/icon-names.ts +117 -0
- package/src/icons.test.ts +58 -0
- package/src/keys.ts +162 -0
- package/src/main.ts +1456 -0
- package/src/playground.config.ts +74 -0
- package/src/playground.ts +261 -0
- package/src/present.ts +398 -0
- package/src/preset-schema.ts +228 -0
- package/src/route.test.ts +56 -0
- package/src/routing.ts +60 -0
- package/src/settings.ts +211 -0
- package/src/starters.ts +86 -0
- package/src/state.test.ts +544 -0
- package/src/state.ts +237 -0
- package/src/theme.ts +82 -0
- package/src/version-catalog.ts +42 -0
- package/src/versions.ts +88 -0
- package/src/wrapper.ts +84 -0
- package/tsconfig.json +25 -0
- package/vite.config.ts +62 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Customizing components",
|
|
3
|
+
"description": "Three ways a design system handles customization: lock it down, make it configurable, or write guidance and hope.",
|
|
4
|
+
"boilerplate": {
|
|
5
|
+
"baseCss": "body { margin: 0; padding: 2rem; display: grid; gap: 2rem; font-family: var(--nys-font-family-body); }\n.stage { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }"
|
|
6
|
+
},
|
|
7
|
+
"presets": [
|
|
8
|
+
{
|
|
9
|
+
"id": "01-header-drop-in",
|
|
10
|
+
"group": "1. Lock it down",
|
|
11
|
+
"title": "Drop in the header",
|
|
12
|
+
"notes": "One tag. Nothing else. Let it render before you say anything.",
|
|
13
|
+
"html": "<nys-globalheader\n appName=\"Design System Playground\"\n agencyName=\"Office of Information Technology Services\"\n homepageLink=\"/\"\n nysLogo>\n <ul>\n <li><a href=\"/components\">Components</a></li>\n <li><a href=\"/tokens\">Tokens</a></li>\n <li><a href=\"/guidance\">Guidance</a></li>\n </ul>\n</nys-globalheader>",
|
|
14
|
+
"css": "",
|
|
15
|
+
"js": ""
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "02-header-try-to-style",
|
|
19
|
+
"group": "1. Lock it down",
|
|
20
|
+
"title": "Try to restyle it",
|
|
21
|
+
"notes": "Type the CSS live. Nothing changes. The component exposes no CSS custom properties and its styles live in shadow DOM. That's the point.",
|
|
22
|
+
"html": "<nys-globalheader\n appName=\"Design System Playground\"\n agencyName=\"Office of Information Technology Services\"\n homepageLink=\"/\"\n nysLogo>\n <ul>\n <li><a href=\"/components\">Components</a></li>\n <li><a href=\"/tokens\">Tokens</a></li>\n <li><a href=\"/guidance\">Guidance</a></li>\n </ul>\n</nys-globalheader>",
|
|
23
|
+
"css": "/* Let's make it red. */\nnys-globalheader {\n background: crimson;\n font-family: \"Comic Sans MS\", cursive;\n}\n\nnys-globalheader a {\n color: yellow;\n text-decoration: underline wavy;\n}\n\n/* ...nothing happens. */",
|
|
24
|
+
"js": "",
|
|
25
|
+
"editors": [
|
|
26
|
+
"html",
|
|
27
|
+
"css"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "03-button-default",
|
|
32
|
+
"group": "2. Make it configurable",
|
|
33
|
+
"title": "The button, as shipped",
|
|
34
|
+
"notes": "Someone asks for a red button. Here's what we have.",
|
|
35
|
+
"html": "<div class=\"stage\">\n <nys-button label=\"Submit application\" variant=\"filled\"></nys-button>\n <nys-button label=\"Save draft\" variant=\"outline\"></nys-button>\n</div>",
|
|
36
|
+
"css": "",
|
|
37
|
+
"js": ""
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "04-button-override",
|
|
41
|
+
"group": "2. Make it configurable",
|
|
42
|
+
"title": "Add the sanctioned override",
|
|
43
|
+
"notes": "Three custom properties, all documented on the component. Color only — nothing else is exposed. Add the class to the first button in the HTML, then type the CSS.",
|
|
44
|
+
"html": "<div class=\"stage\">\n <nys-button class=\"danger\" label=\"Delete application\" variant=\"filled\"></nys-button>\n <nys-button label=\"Save draft\" variant=\"outline\"></nys-button>\n</div>",
|
|
45
|
+
"css": "/* Documented on nys-button. Color is the only thing you can change. */\n.danger {\n --nys-button-background-color: var(--nys-color-danger);\n --nys-button-background-color--hover: var(--nys-color-danger-strong);\n --nys-button-background-color--active: var(--nys-color-danger-strongest);\n}",
|
|
46
|
+
"js": "",
|
|
47
|
+
"editors": [
|
|
48
|
+
"html",
|
|
49
|
+
"css"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "05-system-change-flows-through",
|
|
54
|
+
"group": "2. Make it configurable",
|
|
55
|
+
"title": "Roll out a system change",
|
|
56
|
+
"notes": "Simulate next quarter's release: change the UI font and the radius at the token level. Both buttons update. The red one stays red and still gets the new font and radius. Verify which radius token nys-button consumes before recording (see README note).",
|
|
57
|
+
"html": "<div class=\"stage\">\n <nys-button class=\"danger\" label=\"Delete application\" variant=\"filled\"></nys-button>\n <nys-button label=\"Save draft\" variant=\"outline\"></nys-button>\n</div>",
|
|
58
|
+
"css": ".danger {\n --nys-button-background-color: var(--nys-color-danger);\n --nys-button-background-color--hover: var(--nys-color-danger-strong);\n --nys-button-background-color--active: var(--nys-color-danger-strongest);\n}\n\n/* Pretend this is the next release of @nysds/styles. */\n:root {\n --nys-font-family-ui: var(--nys-font-family-serif);\n --nys-radius-xl: var(--nys-radius-round);\n}",
|
|
59
|
+
"js": "",
|
|
60
|
+
"editors": [
|
|
61
|
+
"html",
|
|
62
|
+
"css"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "06-guidance-tokens",
|
|
67
|
+
"group": "3. Write it down and hope",
|
|
68
|
+
"title": "Guidance, not enforcement",
|
|
69
|
+
"notes": "Two nys-cards. The card is the system's: same border, radius, and heading on both. What you slot into it is yours. The left stat block uses tokens; the right one is hard-coded to the same values, so they look identical today. Nothing in the system stops the second one. Uncomment the :root block to release a system change and watch only the left one follow.",
|
|
70
|
+
"html": "<div class=\"stage\">\n <nys-card heading=\"Uses tokens\" headingLevel=\"h3\">\n <p class=\"stat stat--tokens\">\n <strong>12,480</strong>\n <span>applications processed this quarter</span>\n </p>\n </nys-card>\n <nys-card heading=\"Hard-coded\" headingLevel=\"h3\">\n <p class=\"stat stat--hardcoded\">\n <strong>12,480</strong>\n <span>applications processed this quarter</span>\n </p>\n </nys-card>\n</div>",
|
|
71
|
+
"css": "nys-card { width: 20rem; }\n.stat { display: grid; margin: 0; }\n.stat strong { display: block; line-height: 1.1; }\n\n/* The card is the system's. What you slot into it is yours. */\n\n/* What the guidance asks for */\n.stat--tokens {\n gap: var(--nys-space-100);\n padding: var(--nys-space-300);\n border-left: var(--nys-border-width-md) solid var(--nys-color-theme);\n background: var(--nys-color-theme-faint);\n font-family: var(--nys-font-family-ui);\n color: var(--nys-color-text);\n}\n.stat--tokens strong {\n font-size: var(--nys-font-size-h2);\n font-weight: var(--nys-font-weight-bold);\n}\n.stat--tokens span {\n font-size: var(--nys-font-size-body-sm);\n color: var(--nys-color-text-weak);\n}\n\n/* What the guidance can't prevent */\n.stat--hardcoded {\n gap: 0.5rem;\n padding: 1.5rem;\n border-left: 2px solid #154973;\n background: #f7fafd;\n font-family: \"Proxima Nova\", Arial, sans-serif;\n color: #1b1b1b;\n}\n.stat--hardcoded strong {\n font-size: 2rem;\n font-weight: 700;\n}\n.stat--hardcoded span {\n font-size: 0.875rem;\n color: #4a4d4f;\n}\n\n/* Uncomment to \"release\" a system change:\n:root {\n --nys-font-family-ui: var(--nys-font-family-serif);\n --nys-color-theme: var(--nys-color-danger);\n}\n*/",
|
|
72
|
+
"js": "",
|
|
73
|
+
"editors": [
|
|
74
|
+
"html",
|
|
75
|
+
"css"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"id": "07-ai-three-levels",
|
|
80
|
+
"group": "The AI part",
|
|
81
|
+
"title": "Three levels, one agent",
|
|
82
|
+
"notes": "Split view. Each column is a level; the caption is the one-liner from the script. The JS just cycles which caption is highlighted if you press a key, so you can walk them one at a time.",
|
|
83
|
+
"html": "<div class=\"levels\">\n <section>\n <nys-globalheader appName=\"Locked\" agencyName=\"Zero decisions\" nysLogo></nys-globalheader>\n <p class=\"caption\">Uses it. No decisions.</p>\n </section>\n <section>\n <div class=\"stage\">\n <nys-button label=\"Default\" variant=\"filled\"></nys-button>\n <nys-button class=\"danger\" label=\"Override\" variant=\"filled\"></nys-button>\n </div>\n <p class=\"caption\">Defaults, with guarded exits.</p>\n </section>\n <section>\n <pre class=\"doc\">## Using tokens\n\nPrefer <code>var(--nys-*)</code> over\nhard-coded values so your UI\ntracks system updates.</pre>\n <p class=\"caption\">Hopefully it read the docs.</p>\n </section>\n</div>",
|
|
84
|
+
"css": ".levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--nys-space-600); align-items: start; }\n.levels section { display: grid; gap: var(--nys-space-300); }\n.caption { font: var(--nys-font-weight-semibold) var(--nys-font-size-ui-lg) var(--nys-font-family-ui); color: var(--nys-color-text); margin: 0; }\n.caption.is-dim { opacity: 0.35; }\n.doc { padding: var(--nys-space-400); border: var(--nys-border-width-sm) solid var(--nys-color-neutral-300); border-radius: var(--nys-radius-xl); background: var(--nys-color-surface); font-family: var(--nys-font-family-monospace); font-size: var(--nys-font-size-sm); margin: 0; }\n.danger {\n --nys-button-background-color: var(--nys-color-danger);\n --nys-button-background-color--hover: var(--nys-color-danger-strong);\n --nys-button-background-color--active: var(--nys-color-danger-strongest);\n}",
|
|
85
|
+
"js": "// Press Space to reveal captions one at a time.\nconst captions = [...document.querySelectorAll('.caption')];\ncaptions.forEach(c => c.classList.add('is-dim'));\nlet i = 0;\ndocument.addEventListener('keydown', (e) => {\n if (e.code !== 'Space') return;\n e.preventDefault();\n if (captions[i]) captions[i].classList.remove('is-dim');\n i += 1;\n});"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"id": "08-spectrum",
|
|
89
|
+
"group": "Close",
|
|
90
|
+
"title": "The spectrum",
|
|
91
|
+
"notes": "Static closing frame. 'How strict should this component be' — not the system.",
|
|
92
|
+
"html": "<figure class=\"spectrum\">\n <div class=\"line\"></div>\n <ol>\n <li style=\"--x: 8%\"><span>Locked</span><small>nys-globalheader</small></li>\n <li style=\"--x: 50%\"><span>Configurable</span><small>nys-button + overrides</small></li>\n <li style=\"--x: 92%\"><span>Guided</span><small>tokens + guidance</small></li>\n </ol>\n <figcaption>Pick a spot per component, not per system.</figcaption>\n</figure>",
|
|
93
|
+
"css": ".spectrum { position: relative; margin: 4rem 0 0; padding: 0 2rem; font-family: var(--nys-font-family-ui); }\n.line { height: var(--nys-border-width-md); background: var(--nys-color-neutral-400); border-radius: var(--nys-radius-round); }\n.spectrum ol { list-style: none; margin: 0; padding: 0; position: relative; height: 5rem; }\n.spectrum li { position: absolute; left: var(--x); top: 0; transform: translateX(-50%); text-align: center; display: grid; gap: var(--nys-space-100); }\n.spectrum li::before { content: ''; width: 1rem; height: 1rem; border-radius: var(--nys-radius-round); background: var(--nys-color-theme); justify-self: center; margin-top: -0.6rem; }\n.spectrum span { font-weight: var(--nys-font-weight-bold); font-size: var(--nys-font-size-ui-xl); }\n.spectrum small { color: var(--nys-color-text-weak); font-family: var(--nys-font-family-monospace); }\nfigcaption { margin-top: var(--nys-space-800); text-align: center; font-size: var(--nys-font-size-h4); color: var(--nys-color-text); }",
|
|
94
|
+
"js": ""
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|