@aliens-syndicate/cli 0.1.2 → 0.1.4
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.es-ES.md +53 -10
- package/README.md +53 -10
- package/README.pt-BR.md +53 -10
- package/README.zh-CN.md +53 -10
- package/package.json +6 -1
- package/tools/build.mjs +372 -36
- package/tools/cache.mjs +41 -0
- package/tools/cli-shared.mjs +237 -0
- package/tools/cli.mjs +145 -48
- package/tools/create.mjs +207 -78
- package/tools/doctor.mjs +139 -0
- package/tools/generate.mjs +175 -0
- package/tools/icon-docs.mjs +132 -0
- package/tools/project-layout.mjs +3 -3
- package/tools/runtime.mjs +216 -8
- package/tools/serve.mjs +152 -0
- package/tools/starter/ai/agents/codingbot.agent +5 -0
- package/tools/starter/ai/rules/architecture.rule +12 -0
- package/tools/starter/ai/skills/create-element.skill +7 -0
- package/tools/starter/app/elements/molecules/kit-card-link/kit-card-link.markup +0 -2
- package/tools/starter/app/pages/kit-overview/kit-overview.markup +6 -6
- package/tools/starter/app/pages/style-guide/style-guide.style +57 -57
- package/tools/starter/styles/components/alerts.style +6 -5
- package/tools/starter/styles/components/badges.style +6 -5
- package/tools/starter/styles/components/borders.style +2 -1
- package/tools/starter/styles/components/buttons.style +14 -13
- package/tools/starter/styles/components/cards.style +1 -1
- package/tools/starter/styles/components/feedback.style +3 -2
- package/tools/starter/styles/components/forms.style +5 -4
- package/tools/starter/styles/components/tables.style +4 -3
- package/tools/starter/styles/components/typography.style +6 -5
- package/tools/starter/styles/generic/ui-base.style +1 -1
- package/tools/starter/styles/objects/ui-layout.style +1 -1
- package/tools/style-docs.mjs +274 -0
- package/tools/update.mjs +110 -0
- package/tools/vscode-space/package.json +5 -8
- package/tools/vscode-space/space.tmLanguage.json +1 -1
- package/tools/vscode-space/syntax.cjs +103 -62
- package/tools/watch.mjs +48 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
// Generates the Style page (project/app/pages/style-docs) from the utility catalog of the style extension that .config
|
|
2
|
+
// declares under style: from: (usually @aliens-syndicate/style), so every class the page lists is a class the build
|
|
3
|
+
// accepts. Run it after updating the package: node tools/style-docs.mjs
|
|
4
|
+
import { readFile, readdir, writeFile, mkdir } from 'node:fs/promises';
|
|
5
|
+
import { createRequire } from 'node:module';
|
|
6
|
+
import { join, resolve } from 'node:path';
|
|
7
|
+
import { pathToFileURL } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const workspace = resolve(import.meta.dirname, '..');
|
|
10
|
+
const config = await readFile(join(workspace, '.config'), 'utf8');
|
|
11
|
+
const from = /^style:\r?\n(?: {3}.*\r?\n)*? {3}from: (.+)$/m.exec(config)?.[1].trim();
|
|
12
|
+
if (!from) throw new Error('style-docs: declare the style extension in .config under style: from:.');
|
|
13
|
+
const entry = /^\.{1,2}\//.test(from) ? join(workspace, from, 'index.mjs') : createRequire(join(workspace, 'package.json')).resolve(from);
|
|
14
|
+
const {
|
|
15
|
+
breakpoints, describeVariant, groups, paletteNames, registeredDefaults, resolveUtility, shadeSteps, variantCatalog
|
|
16
|
+
} = await import(pathToFileURL(entry).href);
|
|
17
|
+
const page = join(workspace, 'project/app/pages/style-docs');
|
|
18
|
+
const styles = join(workspace, 'project/styles');
|
|
19
|
+
|
|
20
|
+
async function styleFiles(directory) {
|
|
21
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
22
|
+
const nested = await Promise.all(entries.map(entry => entry.isDirectory() ? styleFiles(join(directory, entry.name))
|
|
23
|
+
: entry.name.endsWith('.style') ? [join(directory, entry.name)] : []));
|
|
24
|
+
return nested.flat();
|
|
25
|
+
}
|
|
26
|
+
const themeColors = [];
|
|
27
|
+
for (const file of (await styleFiles(styles)).sort()) {
|
|
28
|
+
for (const match of (await readFile(file, 'utf8')).matchAll(/^ +--color-([a-z][a-z0-9-]*):\s/gm)) {
|
|
29
|
+
if (!themeColors.includes(match[1])) themeColors.push(match[1]);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// The page shows the CSS a reader expects: the --tw-* helpers are folded into the declarations that read them.
|
|
34
|
+
const displayDefaults = { ...registeredDefaults, '--tw-shadow': '', '--tw-ring-shadow': '', '--tw-content': "''" };
|
|
35
|
+
function pretty(declarations) {
|
|
36
|
+
const helpers = Object.fromEntries(declarations.filter(([property]) => property.startsWith('--tw-')));
|
|
37
|
+
const visible = declarations.filter(([property]) => !property.startsWith('--tw-'));
|
|
38
|
+
const shown = (visible.length ? visible : declarations).map(([property, value]) => {
|
|
39
|
+
let resolved = value;
|
|
40
|
+
for (let previous = ''; previous !== resolved;) {
|
|
41
|
+
previous = resolved;
|
|
42
|
+
resolved = resolved.replace(/var\((--tw-[\w-]+)(?:,\s*([^()]*(?:\([^()]*\))?[^()]*))?\)/g, (_, name, fallback) =>
|
|
43
|
+
helpers[name] ?? (fallback !== undefined && fallback.trim() ? fallback.trim() : displayDefaults[name] ?? ''));
|
|
44
|
+
}
|
|
45
|
+
const clean = resolved.replace(/\s+/g, ' ').replace(/^[\s,]+|[\s,]+$/g, '').replace(/,\s*,/g, ',').replace(/\(\s*,\s*/g, '(').trim();
|
|
46
|
+
return `${property}: ${clean || 'none'}`;
|
|
47
|
+
});
|
|
48
|
+
return shown.join('; ');
|
|
49
|
+
}
|
|
50
|
+
function row(name) {
|
|
51
|
+
const utility = resolveUtility(name, { colors: themeColors });
|
|
52
|
+
if (utility.error) throw new Error(`style-docs: ${name}: ${utility.error}`);
|
|
53
|
+
const css = pretty(utility.declarations);
|
|
54
|
+
return { name, css: utility.child ? `${utility.child.trim()} { ${css} }` : css };
|
|
55
|
+
}
|
|
56
|
+
const camel = id => id.replace(/-([a-z0-9])/g, (_, letter) => letter.toUpperCase());
|
|
57
|
+
const titleKey = id => `@styleDocs.group.${camel(id)}`;
|
|
58
|
+
const properties = rows => [...new Set(rows.flatMap(({ css }) => css.replace(/^[^{]*\{ | \}$/g, '').split('; ')
|
|
59
|
+
.map(entry => entry.slice(0, entry.indexOf(':'))).filter(property => property && !property.startsWith('-webkit-'))))].slice(0, 2);
|
|
60
|
+
|
|
61
|
+
const lists = [];
|
|
62
|
+
function list(name, items) {
|
|
63
|
+
lists.push(` list ${name}:\n${items.map((fields, index) => ` r${index + 1}:\n${Object.entries(fields)
|
|
64
|
+
.map(([key, value]) => ` ${key}: ${value}`).join('\n')}`).join('\n')}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const sections = groups.map(group => ({
|
|
68
|
+
...group,
|
|
69
|
+
sections: group.sections.map(section => {
|
|
70
|
+
const rows = [...new Set([...section.statics, ...section.examples])].map(row);
|
|
71
|
+
list(camel(section.id), rows);
|
|
72
|
+
return { ...section, rows, properties: properties(rows) };
|
|
73
|
+
})
|
|
74
|
+
}));
|
|
75
|
+
|
|
76
|
+
list('benefits', ['Names', 'Typing', 'Prefix', 'Responsive', 'States', 'Arbitrary', 'Checked', 'Css'].map(name => ({
|
|
77
|
+
title: `@styleDocs.benefit${name}Title`, text: `@styleDocs.benefit${name}`
|
|
78
|
+
})));
|
|
79
|
+
const variantRows = names => names.map(name => {
|
|
80
|
+
const described = describeVariant(name);
|
|
81
|
+
return { name: `${name}:`, css: described.startsWith('@') ? described.slice(1) : described };
|
|
82
|
+
});
|
|
83
|
+
list('responsiveVariants', variantRows(variantCatalog.responsive));
|
|
84
|
+
list('stateVariants', variantRows([...variantCatalog.states, ...variantCatalog.elements, ...variantCatalog.media]));
|
|
85
|
+
list('arbitraryValues', ['w-[1240px]', 'grid-cols-[minmax(220px,1fr)_2fr]', 'text-[clamp(1rem,2vw,1.18rem)]', 'bg-(--surface)',
|
|
86
|
+
'text-(length:--text-small)', 'shadow-[0_18px_30px_var(--shadow)]', '[mask-type:luminance]', 'max-lg:[font:0.9rem_var(--mono)]']
|
|
87
|
+
.map(row));
|
|
88
|
+
list('themeColors', themeColors.map(name => ({ ...row(`bg-${name}`), swatch: `background: var(--color-${name})` })));
|
|
89
|
+
list('palette', paletteNames.flatMap(family => shadeSteps.map(shade => ({
|
|
90
|
+
name: `${family}-${shade}`, swatch: `background: ${row(`bg-${family}-${shade}`).css.slice('background-color: '.length)}`
|
|
91
|
+
}))));
|
|
92
|
+
|
|
93
|
+
const indent = level => ' '.repeat(level);
|
|
94
|
+
const lines = [];
|
|
95
|
+
const add = (level, text) => lines.push(indent(level) + text);
|
|
96
|
+
function table(level, listName, first = '@styleDocs.classColumn', second = '@styleDocs.stylesColumn') {
|
|
97
|
+
add(level, 'div variant="style-docs-table-frame" tabindex="0"');
|
|
98
|
+
add(level + 1, 'table variant="style-docs-table"');
|
|
99
|
+
add(level + 2, 'thead');
|
|
100
|
+
add(level + 3, 'tr');
|
|
101
|
+
add(level + 4, `th={${first}} scope="col"`);
|
|
102
|
+
add(level + 4, `th={${second}} scope="col"`);
|
|
103
|
+
add(level + 2, 'tbody');
|
|
104
|
+
add(level + 3, `for row in ${listName}`);
|
|
105
|
+
add(level + 4, 'tr data-filter-item');
|
|
106
|
+
add(level + 5, 'td');
|
|
107
|
+
add(level + 6, 'code={$row.name} variant="style-docs-class"');
|
|
108
|
+
add(level + 5, 'td');
|
|
109
|
+
add(level + 6, 'code={$row.css}');
|
|
110
|
+
}
|
|
111
|
+
function window(level, title, source) {
|
|
112
|
+
add(level, 'div variant="home-guide-window"');
|
|
113
|
+
add(level + 1, 'div variant="home-guide-window-bar"');
|
|
114
|
+
add(level + 2, 'span variant="home-guide-window-dots" aria-hidden="true"');
|
|
115
|
+
add(level + 2, `code={${title}}`);
|
|
116
|
+
add(level + 1, 'pre variant="home-guide-window-code" tabindex="0"');
|
|
117
|
+
add(level + 2, `code data-source="${source}"`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
lines.push('Markup StyleDocs');
|
|
121
|
+
add(1, 'article variant="home-view" id="style-docs" data-view data-search-entry hidden tabindex="-1"');
|
|
122
|
+
add(2, 'aside id="style-docs-sidebar"');
|
|
123
|
+
// The search field sits on top of the sidebar, which stays in view while the page scrolls, and filters the sections.
|
|
124
|
+
add(3, 'div id="style-docs-finder"');
|
|
125
|
+
add(4, 'form id="style-docs-finder-form" role="search"');
|
|
126
|
+
add(5, 'label={@styleDocs.searchLabel} for="style-docs-finder-input" id="style-docs-finder-label"');
|
|
127
|
+
add(5, 'icon search-01 id="style-docs-finder-icon"');
|
|
128
|
+
add(5, 'input type="search" id="style-docs-finder-input" placeholder={@styleDocs.searchPlaceholder} autocomplete="off" spellcheck="false" data-filter');
|
|
129
|
+
add(4, 'p id="style-docs-finder-status" data-filter-status aria-live="polite" hidden');
|
|
130
|
+
add(5, 'span text="0" id="style-docs-finder-count" data-filter-count');
|
|
131
|
+
add(5, 'span={@styleDocs.searchResults}');
|
|
132
|
+
add(3, 'nav id="style-docs-nav" aria-label={@styleDocs.navLabel} data-toc');
|
|
133
|
+
add(4, 'p={@styleDocs.groupStart} variant="style-docs-nav-title"');
|
|
134
|
+
for (const [anchor, key] of [['overview', 'overviewNav'], ['install', 'installNav'], ['benefits', 'benefitsNav'], ['writing', 'writingNav'],
|
|
135
|
+
['responsive', 'responsiveNav'], ['states', 'statesNav'], ['arbitrary', 'arbitraryNav'], ['colors', 'colorsNav']]) {
|
|
136
|
+
add(4, `a={@styleDocs.${key}} href="#style-docs-${anchor}" variant="style-docs-nav-link"`);
|
|
137
|
+
}
|
|
138
|
+
add(4, 'a={@styleDocs.libraryNav} href="#kit-overview" variant="style-docs-nav-link"');
|
|
139
|
+
for (const group of sections) {
|
|
140
|
+
add(4, `p={${titleKey(group.id)}} variant="style-docs-nav-title"`);
|
|
141
|
+
for (const section of group.sections) add(4, `a={${section.title}} href="#style-docs-${section.id}" variant="style-docs-nav-link"`);
|
|
142
|
+
}
|
|
143
|
+
add(2, 'div id="style-docs-main"');
|
|
144
|
+
add(3, 'header id="style-docs-overview"');
|
|
145
|
+
add(4, 'p variant="home-breadcrumb"');
|
|
146
|
+
add(5, 'a={@nav.home} href="#home-guide"');
|
|
147
|
+
add(5, 'span={/} aria-hidden="true"');
|
|
148
|
+
add(5, 'span={@nav.styles}');
|
|
149
|
+
add(4, 'p={@styleDocs.eyebrow} id="style-docs-eyebrow"');
|
|
150
|
+
add(4, 'h1={@styleDocs.title} data-search-label');
|
|
151
|
+
add(4, 'p={@styleDocs.lead} variant="home-topic-lead" data-search-summary');
|
|
152
|
+
add(4, 'div id="style-docs-hero-code" aria-hidden="true"');
|
|
153
|
+
add(5, 'code={flex items-center gap-4 md:flex-row hover:bg-surface dark:text-white} id="style-docs-hero-line"');
|
|
154
|
+
|
|
155
|
+
add(3, 'p={@styleDocs.searchEmpty} id="style-docs-finder-empty" data-filter-empty hidden');
|
|
156
|
+
// Installation: plain CSS works without the package; utilities need it installed and declared in .config.
|
|
157
|
+
add(3, 'section variant="style-docs-block" data-filter-group id="style-docs-install"');
|
|
158
|
+
add(4, 'h2={@styleDocs.installTitle}');
|
|
159
|
+
add(4, 'p={@styleDocs.installDetail} variant="style-docs-lead"');
|
|
160
|
+
add(4, 'ol variant="style-docs-steps"');
|
|
161
|
+
for (const [key, title, code] of [
|
|
162
|
+
['installStep', 'terminal', ['npm install @aliens-syndicate/style']],
|
|
163
|
+
['configStep', '.config', ['style:', ' from: @aliens-syndicate/style']],
|
|
164
|
+
['useStep', 'counter.style', ['Style Counter', ' counter', ' flex items-center gap-3 md:gap-4', ' transition: color .15s',
|
|
165
|
+
' counter-button', ' px-4 py-2 rounded-lg hover:bg-(--surface)']]]) {
|
|
166
|
+
add(5, 'li');
|
|
167
|
+
add(6, `p={@styleDocs.${key}}`);
|
|
168
|
+
add(6, 'div variant="home-guide-window"');
|
|
169
|
+
add(7, 'div variant="home-guide-window-bar"');
|
|
170
|
+
add(8, 'span variant="home-guide-window-dots" aria-hidden="true"');
|
|
171
|
+
add(8, `code={${title}}`);
|
|
172
|
+
add(7, 'div variant="home-guide-window-code home-guide-code" tabindex="0"');
|
|
173
|
+
for (const text of code) add(8, `code text="${text}" variant="home-guide-code-line"`);
|
|
174
|
+
}
|
|
175
|
+
add(3, 'section variant="style-docs-block" data-filter-group id="style-docs-benefits"');
|
|
176
|
+
add(4, 'h2={@styleDocs.benefitsTitle}');
|
|
177
|
+
add(4, 'p={@styleDocs.benefitsDetail} variant="style-docs-lead"');
|
|
178
|
+
add(4, 'ul id="style-docs-benefit-list"');
|
|
179
|
+
add(5, 'for benefit in benefits');
|
|
180
|
+
add(6, 'li data-filter-item');
|
|
181
|
+
add(7, 'strong={$benefit.title}');
|
|
182
|
+
add(7, 'span={$benefit.text}');
|
|
183
|
+
add(4, 'h3={@styleDocs.compareTitle}');
|
|
184
|
+
add(4, 'p={@styleDocs.compareDetail} variant="style-docs-lead"');
|
|
185
|
+
add(4, 'div id="style-docs-compare"');
|
|
186
|
+
add(5, 'div variant="home-guide-window"');
|
|
187
|
+
add(6, 'div variant="home-guide-window-bar"');
|
|
188
|
+
add(7, 'span variant="home-guide-window-dots" aria-hidden="true"');
|
|
189
|
+
add(7, 'code={@styleDocs.compareBefore}');
|
|
190
|
+
add(6, 'div variant="home-guide-window-code home-guide-code" tabindex="0"');
|
|
191
|
+
for (const text of ['Style SiteHeader', ' site-header', ' position: sticky', ' top: 0', ' z-index: 5',
|
|
192
|
+
' border-bottom: 1px solid var(--line)', ' background: color-mix(in srgb, var(--page) 82%, transparent)',
|
|
193
|
+
' backdrop-filter: saturate(1.8) blur(12px)', ' -webkit-backdrop-filter: saturate(1.8) blur(12px)',
|
|
194
|
+
' @media (max-width: 900px)', ' site-header-inner', ' min-height: 58px', ' padding: 0 14px']) {
|
|
195
|
+
add(7, `code text="${text}" variant="home-guide-code-line"`);
|
|
196
|
+
}
|
|
197
|
+
add(5, 'div variant="home-guide-window"');
|
|
198
|
+
add(6, 'div variant="home-guide-window-bar"');
|
|
199
|
+
add(7, 'span variant="home-guide-window-dots" aria-hidden="true"');
|
|
200
|
+
add(7, 'code={@styleDocs.compareAfter}');
|
|
201
|
+
add(6, 'div variant="home-guide-window-code home-guide-code" tabindex="0"');
|
|
202
|
+
for (const text of ['Style SiteHeader', ' site-header', ' sticky top-0 z-5 border-b border-b-(--line) bg-(--page)/82',
|
|
203
|
+
' backdrop-saturate-180 backdrop-blur-md', ' site-header-inner', ' max-lg:min-h-14.5 max-lg:py-0 max-lg:px-3.5']) {
|
|
204
|
+
add(7, `code text="${text}" variant="home-guide-code-line"`);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
add(3, 'section variant="style-docs-block" data-filter-group id="style-docs-writing"');
|
|
208
|
+
add(4, 'h2={@styleDocs.writingTitle}');
|
|
209
|
+
add(4, 'p={@styleDocs.writingDetail} variant="style-docs-lead"');
|
|
210
|
+
add(4, 'ul variant="home-guide-checks"');
|
|
211
|
+
for (const key of ['writingDeclaration', 'writingUtilities', 'writingVariants', 'writingImportant']) {
|
|
212
|
+
add(5, 'li');
|
|
213
|
+
add(6, 'icon tick-02 variant="home-guide-check"');
|
|
214
|
+
add(6, `span={@styleDocs.${key}}`);
|
|
215
|
+
}
|
|
216
|
+
window(4, 'site-header.style', 'project/app/elements/organisms/site-header/site-header.style');
|
|
217
|
+
|
|
218
|
+
add(3, 'section variant="style-docs-block" data-filter-group id="style-docs-responsive"');
|
|
219
|
+
add(4, 'h2={@styleDocs.responsiveTitle}');
|
|
220
|
+
add(4, 'p={@styleDocs.responsiveDetail} variant="style-docs-lead"');
|
|
221
|
+
table(4, 'responsiveVariants', '@styleDocs.variantColumn', '@styleDocs.conditionColumn');
|
|
222
|
+
add(3, 'section variant="style-docs-block" data-filter-group id="style-docs-states"');
|
|
223
|
+
add(4, 'h2={@styleDocs.statesTitle}');
|
|
224
|
+
add(4, 'p={@styleDocs.statesDetail} variant="style-docs-lead"');
|
|
225
|
+
table(4, 'stateVariants', '@styleDocs.variantColumn', '@styleDocs.conditionColumn');
|
|
226
|
+
add(3, 'section variant="style-docs-block" data-filter-group id="style-docs-arbitrary"');
|
|
227
|
+
add(4, 'h2={@styleDocs.arbitraryTitle}');
|
|
228
|
+
add(4, 'p={@styleDocs.arbitraryDetail} variant="style-docs-lead"');
|
|
229
|
+
table(4, 'arbitraryValues');
|
|
230
|
+
add(3, 'section variant="style-docs-block" data-filter-group id="style-docs-colors"');
|
|
231
|
+
add(4, 'h2={@styleDocs.colorsTitle}');
|
|
232
|
+
add(4, 'p={@styleDocs.colorsDetail} variant="style-docs-lead"');
|
|
233
|
+
add(4, 'h3={@styleDocs.themeColorsTitle}');
|
|
234
|
+
add(4, 'ul id="style-docs-theme-colors"');
|
|
235
|
+
add(5, 'for color in themeColors');
|
|
236
|
+
add(6, 'li data-filter-item');
|
|
237
|
+
add(7, 'span variant="style-docs-swatch" style={$color.swatch} aria-hidden="true"');
|
|
238
|
+
add(7, 'code={$color.name}');
|
|
239
|
+
add(4, 'h3={@styleDocs.paletteTitle}');
|
|
240
|
+
add(4, 'ul id="style-docs-palette"');
|
|
241
|
+
add(5, 'for color in palette');
|
|
242
|
+
add(6, 'li title={$color.name} data-filter-item');
|
|
243
|
+
add(7, 'span variant="style-docs-swatch" style={$color.swatch} aria-hidden="true"');
|
|
244
|
+
add(7, 'code={$color.name}');
|
|
245
|
+
for (const group of sections) {
|
|
246
|
+
add(3, `section variant="style-docs-group" data-filter-set id="style-docs-${group.id}"`);
|
|
247
|
+
add(4, `h2={${titleKey(group.id)}}`);
|
|
248
|
+
for (const section of group.sections) {
|
|
249
|
+
add(4, `section variant="style-docs-section" data-filter-group id="style-docs-${section.id}"`);
|
|
250
|
+
add(5, `h3={${section.title}}`);
|
|
251
|
+
add(5, 'p variant="style-docs-lead"');
|
|
252
|
+
add(6, 'span={@styleDocs.setsBefore}');
|
|
253
|
+
section.properties.forEach((property, index) => {
|
|
254
|
+
if (index) add(6, 'span={@styleDocs.and}');
|
|
255
|
+
add(6, `code={${property}}`);
|
|
256
|
+
});
|
|
257
|
+
add(6, 'span={@styleDocs.setsAfter}');
|
|
258
|
+
table(5, camel(section.id));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
add(3, 'section variant="style-docs-block" data-filter-group id="style-docs-library"');
|
|
262
|
+
add(4, 'h2={@styleDocs.libraryTitle}');
|
|
263
|
+
add(4, 'p={@styleDocs.libraryDetail} variant="style-docs-lead"');
|
|
264
|
+
add(4, `ui-link href="#kit-overview" variant="ui-link_secondary" label={@styleDocs.libraryLink} icon="arrow-up-right-01"`);
|
|
265
|
+
|
|
266
|
+
await mkdir(page, { recursive: true });
|
|
267
|
+
await writeFile(join(page, 'style-docs.markup'), lines.join('\n') + '\n');
|
|
268
|
+
await writeFile(join(page, 'style-docs.logic'), `Logic StyleDocs
|
|
269
|
+
# Generated by tools/style-docs.mjs from the utility catalog of @aliens-syndicate/style. Update the package, not this file.
|
|
270
|
+
${lists.join('\n')}
|
|
271
|
+
`);
|
|
272
|
+
const total = sections.reduce((sum, group) => sum + group.sections.reduce((count, section) => count + section.rows.length, 0), 0);
|
|
273
|
+
console.log(`Style page generated: ${sections.reduce((sum, group) => sum + group.sections.length, 0)} sections, ${total} classes, ` +
|
|
274
|
+
`breakpoints ${Object.keys(breakpoints).join(', ')}.`);
|
package/tools/update.mjs
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// aliens update: brings the project's @aliens-syndicate packages to their latest versions and its tools/ to the CLI's.
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { cp, readdir, readFile } from 'node:fs/promises';
|
|
4
|
+
import { join, relative } from 'node:path';
|
|
5
|
+
import {
|
|
6
|
+
bold, cliPackage, cliRoot, installedVersion, cliVersion, compareVersions, cyan, dim, green, latestVersion, parseFlags, pick,
|
|
7
|
+
projectToolDirectories, projectToolFiles, red, requireProject, runCommand, yellow, CliError
|
|
8
|
+
} from './cli-shared.mjs';
|
|
9
|
+
|
|
10
|
+
const text = {
|
|
11
|
+
en: { tools: 'Project tools', packages: 'Packages', update: 'UPDATE', same: 'tools/ already matches the CLI {version}.',
|
|
12
|
+
self: 'This is the framework repository: its tools/ is the CLI itself.', none: 'No @aliens-syndicate package to update.',
|
|
13
|
+
current: '{name} {version} is the latest', newer: '{name} {from} → {to}', local: '{name} comes from {spec} and is not updated from npm',
|
|
14
|
+
offline: 'Could not reach npm to check {name}.', unpublished: '{name} is not published on npm.', installing: 'Running npm install…', installFailed: 'npm install failed. Fix the error above and run aliens update again.',
|
|
15
|
+
dryRun: 'Dry run: nothing was changed. Run aliens update to apply.', done: 'Project updated.', cliNewer: 'Aliens CLI {latest} is available (you have {version}): npm install -g {package}@latest' },
|
|
16
|
+
pt: { tools: 'Ferramentas do projeto', packages: 'Pacotes', update: 'ATUALIZADO', same: 'tools/ já está igual ao da CLI {version}.',
|
|
17
|
+
self: 'Este é o repositório do framework: o tools/ dele é a própria CLI.', none: 'Nenhum pacote @aliens-syndicate para atualizar.',
|
|
18
|
+
current: '{name} {version} é a mais recente', newer: '{name} {from} → {to}', local: '{name} vem de {spec} e não é atualizado pelo npm',
|
|
19
|
+
offline: 'Não foi possível consultar o npm para {name}.', unpublished: '{name} não está publicado no npm.', installing: 'Rodando npm install…', installFailed: 'O npm install falhou. Corrija o erro acima e rode aliens update de novo.',
|
|
20
|
+
dryRun: 'Simulação: nada foi alterado. Rode aliens update para aplicar.', done: 'Projeto atualizado.', cliNewer: 'A Aliens CLI {latest} está disponível (você tem a {version}): npm install -g {package}@latest' },
|
|
21
|
+
es: { tools: 'Herramientas del proyecto', packages: 'Paquetes', update: 'ACTUALIZADO', same: 'tools/ ya coincide con la CLI {version}.',
|
|
22
|
+
self: 'Este es el repositorio del framework: su tools/ es la propia CLI.', none: 'Ningún paquete @aliens-syndicate para actualizar.',
|
|
23
|
+
current: '{name} {version} es la más reciente', newer: '{name} {from} → {to}', local: '{name} viene de {spec} y no se actualiza desde npm',
|
|
24
|
+
offline: 'No se pudo consultar npm para {name}.', unpublished: '{name} no está publicado en npm.', installing: 'Ejecutando npm install…', installFailed: 'npm install falló. Corrige el error de arriba y ejecuta aliens update otra vez.',
|
|
25
|
+
dryRun: 'Simulación: no se cambió nada. Ejecuta aliens update para aplicar.', done: 'Proyecto actualizado.', cliNewer: 'La Aliens CLI {latest} está disponible (tienes la {version}): npm install -g {package}@latest' },
|
|
26
|
+
zh: { tools: '项目工具', packages: '依赖包', update: '已更新', same: 'tools/ 已与 CLI {version} 一致。',
|
|
27
|
+
self: '这是框架仓库:它的 tools/ 就是 CLI 本身。', none: '没有需要更新的 @aliens-syndicate 包。',
|
|
28
|
+
current: '{name} {version} 已是最新', newer: '{name} {from} → {to}', local: '{name} 来自 {spec},不会从 npm 更新',
|
|
29
|
+
offline: '无法连接 npm 检查 {name}。', unpublished: '{name} 尚未发布到 npm。', installing: '正在运行 npm install…', installFailed: 'npm install 失败。请修复上面的错误后再次运行 aliens update。',
|
|
30
|
+
dryRun: '试运行:没有做任何更改。运行 aliens update 以应用。', done: '项目已更新。', cliNewer: 'Aliens CLI {latest} 已发布(当前为 {version}):npm install -g {package}@latest' }
|
|
31
|
+
};
|
|
32
|
+
const t = (key, values = {}) => Object.entries(values).reduce((message, [name, value]) => message.replaceAll(`{${name}}`, value), pick(text)[key]);
|
|
33
|
+
|
|
34
|
+
async function filesUnder(directory) {
|
|
35
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
36
|
+
const files = await Promise.all(entries.map(entry => entry.isDirectory() ? filesUnder(join(directory, entry.name)) : [join(directory, entry.name)]));
|
|
37
|
+
return files.flat();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// The tool files of the project that are missing or differ from the CLI's, as paths relative to the project.
|
|
41
|
+
export async function toolsDifferences(root) {
|
|
42
|
+
const source = join(cliRoot, 'tools');
|
|
43
|
+
const files = [...projectToolFiles.map(file => join(source, file)),
|
|
44
|
+
...(await Promise.all(projectToolDirectories.map(directory => filesUnder(join(source, directory))))).flat()];
|
|
45
|
+
const changed = [];
|
|
46
|
+
for (const file of files) {
|
|
47
|
+
const target = join(root, 'tools', relative(source, file));
|
|
48
|
+
if (!existsSync(target) || !(await readFile(file)).equals(await readFile(target))) changed.push(relative(root, target));
|
|
49
|
+
}
|
|
50
|
+
return changed;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export async function update(args) {
|
|
55
|
+
const { flags } = parseFlags(args, { booleans: ['dry-run'] });
|
|
56
|
+
const dryRun = Boolean(flags['dry-run']);
|
|
57
|
+
const root = requireProject();
|
|
58
|
+
|
|
59
|
+
console.log(bold(t('tools')));
|
|
60
|
+
if (root === cliRoot) console.log(dim(t('self')));
|
|
61
|
+
else {
|
|
62
|
+
const changed = await toolsDifferences(root);
|
|
63
|
+
for (const file of changed) {
|
|
64
|
+
console.log(`${green(t('update').padEnd(11))}${file}`);
|
|
65
|
+
if (!dryRun) await cp(join(cliRoot, 'tools', relative(join(root, 'tools'), join(root, file))), join(root, file));
|
|
66
|
+
}
|
|
67
|
+
if (!changed.length) console.log(dim(t('same', { version: cliVersion })));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.log('\n' + bold(t('packages')));
|
|
71
|
+
const manifestPath = join(root, 'package.json');
|
|
72
|
+
const manifest = existsSync(manifestPath) ? JSON.parse(await readFile(manifestPath, 'utf8')) : {};
|
|
73
|
+
const wanted = { dependencies: [], devDependencies: [] };
|
|
74
|
+
for (const group of Object.keys(wanted)) {
|
|
75
|
+
for (const [name, spec] of Object.entries(manifest[group] ?? {})) {
|
|
76
|
+
if (!name.startsWith('@aliens-syndicate/')) continue;
|
|
77
|
+
if (/^(file|link|git|github|http|https):|^\.{0,2}\//.test(spec)) {
|
|
78
|
+
console.log(dim(t('local', { name, spec })));
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const latest = await latestVersion(name);
|
|
82
|
+
const installed = installedVersion(root, name);
|
|
83
|
+
if (latest === false) console.log(yellow(t('unpublished', { name })));
|
|
84
|
+
else if (!latest) console.log(yellow(t('offline', { name })));
|
|
85
|
+
else if (installed && compareVersions(installed, latest) >= 0) console.log(dim(t('current', { name, version: installed })));
|
|
86
|
+
else {
|
|
87
|
+
console.log(`${green(t('update').padEnd(11))}${t('newer', { name, from: installed ?? spec, to: cyan(latest) })}`);
|
|
88
|
+
wanted[group].push(`${name}@${latest}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const toInstall = wanted.dependencies.length + wanted.devDependencies.length;
|
|
93
|
+
if (!toInstall && !Object.keys({ ...manifest.dependencies, ...manifest.devDependencies }).some(name => name.startsWith('@aliens-syndicate/'))) {
|
|
94
|
+
console.log(dim(t('none')));
|
|
95
|
+
}
|
|
96
|
+
if (toInstall && !dryRun) {
|
|
97
|
+
console.log(dim(t('installing')));
|
|
98
|
+
for (const [group, packages] of Object.entries(wanted)) {
|
|
99
|
+
if (!packages.length) continue;
|
|
100
|
+
const code = await runCommand('npm', ['install', ...(group === 'devDependencies' ? ['--save-dev'] : []), ...packages], { cwd: root });
|
|
101
|
+
if (code) throw new CliError(red(t('installFailed')));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const latestCli = await latestVersion(cliPackage);
|
|
106
|
+
if (latestCli && compareVersions(cliVersion, latestCli) < 0) {
|
|
107
|
+
console.log('\n' + yellow(t('cliNewer', { latest: latestCli, version: cliVersion, package: cliPackage })));
|
|
108
|
+
}
|
|
109
|
+
console.log('\n' + (dryRun ? dim(t('dryRun')) : green(t('done'))));
|
|
110
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "space-language-preview",
|
|
3
3
|
"displayName": "Space Language",
|
|
4
4
|
"description": "Native semantic highlighting and inline stylesheet colors for Space.",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.3",
|
|
6
6
|
"publisher": "aliens-local",
|
|
7
7
|
"private": true,
|
|
8
8
|
"engines": {"vscode": "^1.90.0"},
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
{"id": "spaceTranslation", "superType": "string", "description": "Space translation reference."},
|
|
55
55
|
{"id": "spaceSelector", "superType": "class", "description": "Space stylesheet selector."},
|
|
56
56
|
{"id": "spaceElement", "superType": "class", "description": "Space markup element."},
|
|
57
|
-
{"id": "spaceColor", "superType": "number", "description": "Space stylesheet color literal."},
|
|
58
57
|
{"id": "spaceActions", "superType": "keyword", "description": "Space action declaration block."},
|
|
59
58
|
{"id": "spaceLiteral", "superType": "keyword", "description": "Space boolean or null literal."}
|
|
60
59
|
],
|
|
@@ -67,7 +66,6 @@
|
|
|
67
66
|
"spaceTranslation": ["string.unquoted"],
|
|
68
67
|
"spaceSelector": ["entity.name.tag.css"],
|
|
69
68
|
"spaceElement": ["entity.name.tag"],
|
|
70
|
-
"spaceColor": ["constant.other.color.rgb-value.hex.css"],
|
|
71
69
|
"spaceActions": ["entity.name.function"],
|
|
72
70
|
"spaceLiteral": ["constant.language"]
|
|
73
71
|
}
|
|
@@ -80,7 +78,8 @@
|
|
|
80
78
|
"editor.insertSpaces": true,
|
|
81
79
|
"editor.detectIndentation": false,
|
|
82
80
|
"editor.semanticHighlighting.enabled": true,
|
|
83
|
-
"editor.colorDecorators": true
|
|
81
|
+
"editor.colorDecorators": true,
|
|
82
|
+
"editor.bracketPairColorization.enabled": false
|
|
84
83
|
},
|
|
85
84
|
"editor.semanticTokenColorCustomizations": {
|
|
86
85
|
"rules": {
|
|
@@ -89,7 +88,7 @@
|
|
|
89
88
|
"type:space": "#75dbd3",
|
|
90
89
|
"function:space": "#81c7ff",
|
|
91
90
|
"spaceActions:space": "#81c7ff",
|
|
92
|
-
"spaceSelector:space": "#
|
|
91
|
+
"spaceSelector:space": "#d5a9ff",
|
|
93
92
|
"spaceElement:space": "#81c7ff",
|
|
94
93
|
"variable:space": "#ff9098",
|
|
95
94
|
"property:space": "#ff9098",
|
|
@@ -98,7 +97,6 @@
|
|
|
98
97
|
"spaceReturn:space": "#81e0a1",
|
|
99
98
|
"spaceLiteral:space": "#81e0a1",
|
|
100
99
|
"spaceTranslation:space": "#81e0a1",
|
|
101
|
-
"spaceColor:space": "#81e0a1",
|
|
102
100
|
"spaceReactive:space": "#d5a9ff",
|
|
103
101
|
"comment:space": "#b0b0b0"
|
|
104
102
|
},
|
|
@@ -109,7 +107,7 @@
|
|
|
109
107
|
"type:space": "#006864",
|
|
110
108
|
"function:space": "#145c9e",
|
|
111
109
|
"spaceActions:space": "#145c9e",
|
|
112
|
-
"spaceSelector:space": "#
|
|
110
|
+
"spaceSelector:space": "#6d349e",
|
|
113
111
|
"spaceElement:space": "#145c9e",
|
|
114
112
|
"variable:space": "#a22c37",
|
|
115
113
|
"property:space": "#a22c37",
|
|
@@ -118,7 +116,6 @@
|
|
|
118
116
|
"spaceReturn:space": "#17683b",
|
|
119
117
|
"spaceLiteral:space": "#17683b",
|
|
120
118
|
"spaceTranslation:space": "#17683b",
|
|
121
|
-
"spaceColor:space": "#17683b",
|
|
122
119
|
"spaceReactive:space": "#6d349e",
|
|
123
120
|
"comment:space": "#595959"
|
|
124
121
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"scopeName": "source.space",
|
|
3
3
|
"name": "Space",
|
|
4
4
|
"patterns": [
|
|
5
|
-
{ "name": "comment.line.number-sign.space", "match": "^\\s*#(?:\\s.*|(?:AI|TODO|FIXME|NOTE|WARN|DEPRECATED)\\b.*)?$" },
|
|
5
|
+
{ "name": "comment.line.number-sign.space", "match": "^\\s*#(?:\\s.*|(?:AGENT|AI|TODO|FIXME|NOTE|WARN|DEPRECATED)\\b.*)?$" },
|
|
6
6
|
{
|
|
7
7
|
"match": "^([A-Z][a-z]+)( +)([A-Z]\\w*)\\s*$",
|
|
8
8
|
"captures": {
|