@aliens-syndicate/cli 0.1.5 → 0.1.6
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 +1 -1
- package/README.md +1 -1
- package/README.pt-BR.md +1 -1
- package/README.zh-CN.md +1 -1
- package/package.json +2 -2
- package/tools/build.mjs +11 -10
- package/tools/cli-shared.mjs +1 -1
- package/tools/create.mjs +3 -3
- package/tools/starter/ai/rules/architecture.rule +1 -1
- package/tools/style-docs.mjs +7 -7
package/README.es-ES.md
CHANGED
|
@@ -127,7 +127,7 @@ Style Counter
|
|
|
127
127
|
bg-(--primary) text-(--primary-ink)
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
Dentro de un selector, una línea escrita como `propiedad: valor` es una declaración CSS. Por defecto, `.style` acepta solo CSS normal. Las utilidades son opcionales y viven en su propio paquete: instala `@aliens-syndicate/
|
|
130
|
+
Dentro de un selector, una línea escrita como `propiedad: valor` es una declaración CSS. Por defecto, `.style` acepta solo CSS normal. Las utilidades son opcionales y viven en su propio paquete: instala `@aliens-syndicate/utilities` y decláralo en `.config` bajo `utilities:` con `from: @aliens-syndicate/utilities`. Sin él, una línea de utilidades detiene el build y explica cómo añadir el paquete. Con él, cualquier otra línea enumera utilidades con los nombres popularizados por frameworks de CSS existentes: `flex`, `gap-4`, `rounded-lg`, `text-sm`. Variantes como `md:`, `max-lg:`, `hover:` y `dark:` escriben la regla `@media` o el selector, y utilidades como `backdrop-blur-md` y `bg-clip-text` añaden las declaraciones `-webkit-`. Los corchetes aceptan cualquier valor, como en `w-[1240px]`, y los paréntesis leen una propiedad personalizada, como en `text-(--muted)`. Cada `--color-<nombre>` de los estilos globales se convierte en un color, como en `bg-brand`. Una utilidad desconocida detiene el build con el archivo y la línea. La página **Styles** del sitio de documentación (`#style-docs`) enumera cada clase con su CSS; `node tools/style-docs.mjs` la vuelve a generar a partir del catálogo del paquete.
|
|
131
131
|
|
|
132
132
|
Los iconos son opcionales y viven en su propio paquete. Instala `@aliens-syndicate/icons` y declaralo en `.config` en `icons:` con `from: @aliens-syndicate/icons` y un `style:` predeterminado. Los iconos pertenecen al markup, sin span y sin clase: `icon add-01 size-4 blue-500 red-500` nombra el icono y después, en cualquier orden, uno de los diez estilos, un tamaño, hasta dos colores (el segundo pinta el tono claro de bulk, duotone y twotone) y un estado como `disabled` o `hidden`; `id`, `variant` y `label` son sus únicos atributos. El build dibuja cada icono inline, y un proyecto sin el paquete se genera igual. La página **Icons** (`#icon-docs`) lista los 6070 iconos por categoría y copia la etiqueta de cualquiera; `node tools/icon-docs.mjs` la regenera a partir del paquete.
|
|
133
133
|
|
package/README.md
CHANGED
|
@@ -127,7 +127,7 @@ Style Counter
|
|
|
127
127
|
bg-(--primary) text-(--primary-ink)
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
Inside a selector, a line written as `property: value` is a CSS declaration. By default `.style` reads plain CSS only. Utilities are optional and live in their own package: install `@aliens-syndicate/
|
|
130
|
+
Inside a selector, a line written as `property: value` is a CSS declaration. By default `.style` reads plain CSS only. Utilities are optional and live in their own package: install `@aliens-syndicate/utilities` and declare it in `.config` under `utilities:` with `from: @aliens-syndicate/utilities`. Without it, a utility line stops the build and says how to add the package. With it, any other line lists utilities with the names popularized by existing CSS frameworks: `flex`, `gap-4`, `rounded-lg`, `text-sm`. Variants such as `md:`, `max-lg:`, `hover:` and `dark:` write the `@media` rule or the selector, and utilities such as `backdrop-blur-md` and `bg-clip-text` add the `-webkit-` declarations. Brackets take any value, as in `w-[1240px]`, and parentheses read a custom property, as in `text-(--muted)`. Each `--color-<name>` in the global styles becomes a color, as in `bg-brand`. An unknown utility stops the build with the file and the line. The **Styles** page of the documentation site (`#style-docs`) lists every class with its CSS; `node tools/style-docs.mjs` regenerates it from the package's catalog.
|
|
131
131
|
|
|
132
132
|
Icons are optional and live in their own package. Install `@aliens-syndicate/icons` and declare it in `.config` under `icons:` with `from: @aliens-syndicate/icons` and a default `style:`. Icons belong to the markup, with no span and no class: `icon add-01 size-4 blue-500 red-500` names the icon and then, in any order, one of the ten styles, a size, up to two colors (the second paints the light tone of bulk, duotone and twotone) and a state such as `disabled` or `hidden`; `id`, `variant` and `label` are its only attributes. The build draws each icon inline, and a project without the package builds the same way. The **Icons** page (`#icon-docs`) lists all 6,070 icons by category and copies the tag of any of them; `node tools/icon-docs.mjs` regenerates it from the package.
|
|
133
133
|
|
package/README.pt-BR.md
CHANGED
|
@@ -127,7 +127,7 @@ Style Counter
|
|
|
127
127
|
bg-(--primary) text-(--primary-ink)
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
Dentro de um seletor, uma linha escrita como `propriedade: valor` é uma declaração CSS. Por padrão, `.style` aceita apenas CSS normal. Os utilitários são opcionais e ficam num pacote próprio: instale `@aliens-syndicate/
|
|
130
|
+
Dentro de um seletor, uma linha escrita como `propriedade: valor` é uma declaração CSS. Por padrão, `.style` aceita apenas CSS normal. Os utilitários são opcionais e ficam num pacote próprio: instale `@aliens-syndicate/utilities` e declare-o no `.config` em `utilities:` com `from: @aliens-syndicate/utilities`. Sem ele, uma linha de utilitários interrompe o build e diz como adicionar o pacote. Com ele, qualquer outra linha lista utilitários com os nomes popularizados por frameworks de CSS existentes: `flex`, `gap-4`, `rounded-lg`, `text-sm`. Variantes como `md:`, `max-lg:`, `hover:` e `dark:` escrevem a regra `@media` ou o seletor, e utilitários como `backdrop-blur-md` e `bg-clip-text` acrescentam as declarações `-webkit-`. Colchetes aceitam qualquer valor, como em `w-[1240px]`, e parênteses leem uma propriedade customizada, como em `text-(--muted)`. Cada `--color-<nome>` dos estilos globais vira uma cor, como em `bg-brand`. Um utilitário desconhecido interrompe o build com o arquivo e a linha. A página **Styles** do site de documentação (`#style-docs`) lista cada classe com o seu CSS; `node tools/style-docs.mjs` a gera de novo a partir do catálogo do pacote.
|
|
131
131
|
|
|
132
132
|
Os ícones são opcionais e ficam em um pacote próprio. Instale `@aliens-syndicate/icons` e declare no `.config` em `icons:` com `from: @aliens-syndicate/icons` e um `style:` padrão. Os ícones pertencem ao markup, sem span e sem classe: `icon add-01 size-4 blue-500 red-500` dá o nome do ícone e depois, em qualquer ordem, um dos dez estilos, um tamanho, até duas cores (a segunda pinta o tom claro do bulk, duotone e twotone) e um estado como `disabled` ou `hidden`; `id`, `variant` e `label` são seus únicos atributos. O build desenha cada ícone inline, e um projeto sem o pacote é gerado do mesmo jeito. A página **Icons** (`#icon-docs`) lista os 6.070 ícones por categoria e copia a tag de qualquer um; `node tools/icon-docs.mjs` a regenera a partir do pacote.
|
|
133
133
|
|
package/README.zh-CN.md
CHANGED
|
@@ -127,7 +127,7 @@ Style Counter
|
|
|
127
127
|
bg-(--primary) text-(--primary-ink)
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
在选择器内部,写成 `属性: 值` 的行是 CSS 声明。默认情况下 `.style` 只接受普通 CSS。工具类是可选的,位于独立的包中:安装 `@aliens-syndicate/
|
|
130
|
+
在选择器内部,写成 `属性: 值` 的行是 CSS 声明。默认情况下 `.style` 只接受普通 CSS。工具类是可选的,位于独立的包中:安装 `@aliens-syndicate/utilities`,并在 `.config` 的 `utilities:` 下声明 `from: @aliens-syndicate/utilities`。没有该包时,工具类行会让构建停止并提示如何添加它。有了该包,其他行列出现有 CSS 框架普及的工具类名称:`flex`、`gap-4`、`rounded-lg`、`text-sm`。`md:`、`max-lg:`、`hover:` 和 `dark:` 等变体会写出 `@media` 规则或选择器,`backdrop-blur-md` 和 `bg-clip-text` 等工具类会补上 `-webkit-` 声明。方括号接受任意值,例如 `w-[1240px]`;圆括号读取自定义属性,例如 `text-(--muted)`。全局样式中的每个 `--color-<名称>` 都会成为颜色,例如 `bg-brand`。未知的工具类会让构建停止,并给出文件和行号。文档站点的 **Styles** 页面(`#style-docs`)列出了每个类及其 CSS;`node tools/style-docs.mjs` 会根据该包的目录重新生成该页面。
|
|
131
131
|
|
|
132
132
|
图标是可选的,位于独立的包中。安装 `@aliens-syndicate/icons`,在 `.config` 的 `icons:` 下写 `from: @aliens-syndicate/icons` 和默认的 `style:`。图标属于 markup,不需要 span,也不需要 class:`icon add-01 size-4 blue-500 red-500` 先写图标名称,再按任意顺序写十种样式之一、尺寸、最多两种颜色(第二种用于 bulk、duotone 和 twotone 的浅色部分),以及 `disabled` 或 `hidden` 等状态;`id`、`variant` 和 `label` 是它仅有的属性。构建会把每个图标内联绘制,没有该包的项目照常构建。**Icons**页面(`#icon-docs`)按分类列出全部 6,070 个图标,并可复制任意图标的标签;`node tools/icon-docs.mjs` 会根据该包重新生成它。
|
|
133
133
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aliens-syndicate/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "CLI for Aliens, the AI-era front-end framework written in Space.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Aliens Syndicate",
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@aliens-syndicate/elements": "file:../aliens-syndicate-elements",
|
|
35
35
|
"@aliens-syndicate/icons": "^0.1.0",
|
|
36
|
-
"@aliens-syndicate/
|
|
36
|
+
"@aliens-syndicate/utilities": "file:../aliens-syndicate-utilities"
|
|
37
37
|
}
|
|
38
38
|
}
|
package/tools/build.mjs
CHANGED
|
@@ -115,11 +115,12 @@ const settings = name => Object.fromEntries(config.find(node => node.value === n
|
|
|
115
115
|
const { entry, assets: assetDirectory, shared: configuredShared, styles, agent: map, environment } = settings('files');
|
|
116
116
|
const { default: defaultLocale, detection, directory: languageDirectory } = settings('language');
|
|
117
117
|
const { from: iconPackage, style: configuredIconStyle } = settings('icons');
|
|
118
|
-
|
|
118
|
+
if (config.some(node => node.value === 'style:')) throw new Error('.config: style: is now utilities:. Write utilities:\n from: @aliens-syndicate/utilities');
|
|
119
|
+
const { from: stylePackage } = settings('utilities');
|
|
119
120
|
const { from: elementPackage } = settings('elements');
|
|
120
121
|
// Extensions are separate packages that the project installs and declares in .config under <section>: from:, or a
|
|
121
122
|
// local folder written as ./path. Icons (usually @aliens-syndicate/icons) let markup draw the icon tag inline (see
|
|
122
|
-
// renderIcon);
|
|
123
|
+
// renderIcon); utilities (usually @aliens-syndicate/utilities) lets .style list utilities besides plain CSS declarations;
|
|
123
124
|
// elements (usually @aliens-syndicate/elements) adds ready-made Elements that any markup can render.
|
|
124
125
|
async function loadExtension(section, name) {
|
|
125
126
|
let entry;
|
|
@@ -131,14 +132,14 @@ async function loadExtension(section, name) {
|
|
|
131
132
|
return import(pathToFileURL(entry).href);
|
|
132
133
|
}
|
|
133
134
|
const iconModule = iconPackage ? await loadExtension('icons', iconPackage) : null;
|
|
134
|
-
const styleModule = stylePackage ? await loadExtension('
|
|
135
|
-
if (styleModule && typeof styleModule.resolveUtility !== 'function') throw new Error(`.config:
|
|
135
|
+
const styleModule = stylePackage ? await loadExtension('utilities', stylePackage) : null;
|
|
136
|
+
if (styleModule && typeof styleModule.resolveUtility !== 'function') throw new Error(`.config: utilities: from: ${stylePackage} is not an Aliens utilities package.`);
|
|
136
137
|
const elementModule = elementPackage ? await loadExtension('elements', elementPackage) : null;
|
|
137
138
|
if (elementModule && typeof elementModule.elementsDirectory !== 'string') throw new Error(`.config: elements: from: ${elementPackage} is not an Aliens elements package.`);
|
|
138
|
-
const noStyle = (where, what) => new Error(`${where}: ${what} need the
|
|
139
|
-
'npm install @aliens-syndicate/
|
|
140
|
-
// Without the
|
|
141
|
-
const resolveUtility = (token, options) => styleModule ? styleModule.resolveUtility(token, options) : { error: 'no
|
|
139
|
+
const noStyle = (where, what) => new Error(`${where}: ${what} need the utilities package. Write CSS as "property: value", or run ` +
|
|
140
|
+
'npm install @aliens-syndicate/utilities and declare it in .config:\nutilities:\n from: @aliens-syndicate/utilities');
|
|
141
|
+
// Without the utilities package, .style reads plain CSS declarations only.
|
|
142
|
+
const resolveUtility = (token, options) => styleModule ? styleModule.resolveUtility(token, options) : { error: 'no utilities package' };
|
|
142
143
|
const iconRenderer = iconModule?.createIconRenderer();
|
|
143
144
|
const iconCatalog = iconModule ? await iconModule.readCatalog() : null;
|
|
144
145
|
const iconStyle = iconRenderer ? configuredIconStyle ?? 'stroke-rounded' : null;
|
|
@@ -627,8 +628,8 @@ function render(file, rootProps = {}, ancestry = [], parentScope = null) {
|
|
|
627
628
|
return renderNode(nodes[0], true);
|
|
628
629
|
}
|
|
629
630
|
|
|
630
|
-
// Inside a selector, "property: value" is a CSS declaration. With the
|
|
631
|
-
// from: @aliens-syndicate/
|
|
631
|
+
// Inside a selector, "property: value" is a CSS declaration. With the utilities package declared in .config (utilities:
|
|
632
|
+
// from: @aliens-syndicate/utilities), any other line lists utilities with the Tailwind CSS names: "flex items-center gap-4 max-md:flex-col hover:bg-surface". State variants such as
|
|
632
633
|
// hover: and dark: rewrite the selector; responsive variants such as md: and max-lg: become @media rules, written
|
|
633
634
|
// after the rest of the file from the widest max-* to the narrowest and then from the narrowest min-width up.
|
|
634
635
|
const declarationLine = /^-{0,2}[A-Za-z][\w-]*:\s+\S/;
|
package/tools/cli-shared.mjs
CHANGED
|
@@ -24,7 +24,7 @@ export const projectToolDirectories = ['vscode-space'];
|
|
|
24
24
|
|
|
25
25
|
// The optional extensions a project can declare in .config under <section>: from:.
|
|
26
26
|
export const extensions = [
|
|
27
|
-
{ section: '
|
|
27
|
+
{ section: 'utilities', name: '@aliens-syndicate/utilities' },
|
|
28
28
|
{ section: 'icons', name: '@aliens-syndicate/icons', extra: ' style: stroke-rounded\n' },
|
|
29
29
|
{ section: 'elements', name: '@aliens-syndicate/elements' }
|
|
30
30
|
];
|
package/tools/create.mjs
CHANGED
|
@@ -78,11 +78,11 @@ The configuration lives in \`.config\` and the build generates the \`ai/.map\` i
|
|
|
78
78
|
The Home includes the style library, with tokens in \`project/styles/settings/\`, components in \`project/styles/components/\` and themes in \`project/styles/settings/theme.style\`.
|
|
79
79
|
Add a \`:root[data-theme="name"]\` block to that file and run the build to make the theme available in the picker.
|
|
80
80
|
|
|
81
|
-
\`.style\` reads plain CSS (\`property: value\`). To write utility classes like \`flex gap-4 md:flex-row\`, run \`npm install @aliens-syndicate/
|
|
81
|
+
\`.style\` reads plain CSS (\`property: value\`). To write utility classes like \`flex gap-4 md:flex-row\`, run \`npm install @aliens-syndicate/utilities\` and add to \`.config\`:
|
|
82
82
|
|
|
83
83
|
\`\`\`
|
|
84
|
-
|
|
85
|
-
from: @aliens-syndicate/
|
|
84
|
+
utilities:
|
|
85
|
+
from: @aliens-syndicate/utilities
|
|
86
86
|
\`\`\`
|
|
87
87
|
|
|
88
88
|
To use buttons, badges, alerts, cards and fields written in Space, run \`npm install @aliens-syndicate/elements\` and add to \`.config\`:
|
|
@@ -8,5 +8,5 @@ Rule Architecture
|
|
|
8
8
|
# Compose atoms into molecules, organisms, and templates. A reusable Element does not depend on a page.
|
|
9
9
|
# Keep the .markup, .logic, .style, and .test files of an Element together in its folder.
|
|
10
10
|
# Use .style for element stylesheets and the global layers declared in project/styles/main.style.
|
|
11
|
-
# In .style, write plain CSS as property: value. Utility class names, like flex gap-4 md:flex-row, need npm install @aliens-syndicate/
|
|
11
|
+
# In .style, write plain CSS as property: value. Utility class names, like flex gap-4 md:flex-row, need npm install @aliens-syndicate/utilities and utilities: from: @aliens-syndicate/utilities in .config.
|
|
12
12
|
# Ready-made Elements, like ui-button and ui-card, need npm install @aliens-syndicate/elements and elements: from: @aliens-syndicate/elements in .config; ai/.map then lists them.
|
package/tools/style-docs.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Generates the Style page (project/app/pages/style-docs) from the utility catalog of the
|
|
2
|
-
// declares under
|
|
1
|
+
// Generates the Style page (project/app/pages/style-docs) from the utility catalog of the utilities package that .config
|
|
2
|
+
// declares under utilities: from: (usually @aliens-syndicate/utilities), so every class the page lists is a class the build
|
|
3
3
|
// accepts. Run it after updating the package: node tools/style-docs.mjs
|
|
4
4
|
import { readFile, readdir, writeFile, mkdir } from 'node:fs/promises';
|
|
5
5
|
import { createRequire } from 'node:module';
|
|
@@ -8,8 +8,8 @@ import { pathToFileURL } from 'node:url';
|
|
|
8
8
|
|
|
9
9
|
const workspace = resolve(import.meta.dirname, '..');
|
|
10
10
|
const config = await readFile(join(workspace, '.config'), 'utf8');
|
|
11
|
-
const from = /^
|
|
12
|
-
if (!from) throw new Error('style-docs: declare the
|
|
11
|
+
const from = /^utilities:\r?\n(?: {3}.*\r?\n)*? {3}from: (.+)$/m.exec(config)?.[1].trim();
|
|
12
|
+
if (!from) throw new Error('style-docs: declare the utilities package in .config under utilities: from:.');
|
|
13
13
|
const entry = /^\.{1,2}\//.test(from) ? join(workspace, from, 'index.mjs') : createRequire(join(workspace, 'package.json')).resolve(from);
|
|
14
14
|
const {
|
|
15
15
|
breakpoints, describeVariant, groups, paletteNames, registeredDefaults, resolveUtility, shadeSteps, variantCatalog
|
|
@@ -159,8 +159,8 @@ add(4, 'h2={@styleDocs.installTitle}');
|
|
|
159
159
|
add(4, 'p={@styleDocs.installDetail} variant="style-docs-lead"');
|
|
160
160
|
add(4, 'ol variant="style-docs-steps"');
|
|
161
161
|
for (const [key, title, code] of [
|
|
162
|
-
['installStep', 'terminal', ['npm install @aliens-syndicate/
|
|
163
|
-
['configStep', '.config', ['
|
|
162
|
+
['installStep', 'terminal', ['npm install @aliens-syndicate/utilities']],
|
|
163
|
+
['configStep', '.config', ['utilities:', ' from: @aliens-syndicate/utilities']],
|
|
164
164
|
['useStep', 'counter.style', ['Style Counter', ' counter', ' flex items-center gap-3 md:gap-4', ' transition: color .15s',
|
|
165
165
|
' counter-button', ' px-4 py-2 rounded-lg hover:bg-(--surface)']]]) {
|
|
166
166
|
add(5, 'li');
|
|
@@ -266,7 +266,7 @@ add(4, `ui-link href="#kit-overview" variant="ui-link_secondary" label={@styleDo
|
|
|
266
266
|
await mkdir(page, { recursive: true });
|
|
267
267
|
await writeFile(join(page, 'style-docs.markup'), lines.join('\n') + '\n');
|
|
268
268
|
await writeFile(join(page, 'style-docs.logic'), `Logic StyleDocs
|
|
269
|
-
# Generated by tools/style-docs.mjs from the utility catalog of @aliens-syndicate/
|
|
269
|
+
# Generated by tools/style-docs.mjs from the utility catalog of @aliens-syndicate/utilities. Update the package, not this file.
|
|
270
270
|
${lists.join('\n')}
|
|
271
271
|
`);
|
|
272
272
|
const total = sections.reduce((sum, group) => sum + group.sections.reduce((count, section) => count + section.rows.length, 0), 0);
|