@scalio-cloud/ui 0.111.0 → 0.111.2-dev.139
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/auth.css +10 -8
- package/dist/config/index.d.ts +14 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +17 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/index.mjs +15 -0
- package/dist/config/index.mjs.map +1 -1
- package/nav.css +5 -5
- package/package.json +1 -1
package/auth.css
CHANGED
|
@@ -110,13 +110,13 @@
|
|
|
110
110
|
.scalio-auth-msg-success { color: hsl(142 72% 26%); border-color: hsl(142 60% 40% / 0.35); background: hsl(142 60% 40% / 0.08); }
|
|
111
111
|
.dark .scalio-auth-msg-success { color: hsl(142 60% 60%); }
|
|
112
112
|
|
|
113
|
-
/* Profile
|
|
113
|
+
/* Profile & settings sections: stack title above card on mobile/tablet/narrow windows; side-by-side from 1180px. */
|
|
114
114
|
.scalio-profile-section {
|
|
115
115
|
display: grid; grid-template-columns: 1fr; gap: 1rem;
|
|
116
116
|
padding: 1.5rem 0; border-top: 1px solid hsl(var(--border));
|
|
117
117
|
}
|
|
118
118
|
.scalio-profile-section:first-of-type { border-top: 0; padding-top: 0; }
|
|
119
|
-
@media (min-width:
|
|
119
|
+
@media (min-width: 1180px) { .scalio-profile-section { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); gap: 2rem; } }
|
|
120
120
|
.scalio-profile-section-title {
|
|
121
121
|
margin: 0; font-family: 'Chivo', sans-serif; font-weight: 900; font-size: 0.875rem;
|
|
122
122
|
text-transform: uppercase; letter-spacing: 0.02em;
|
|
@@ -142,11 +142,12 @@
|
|
|
142
142
|
}
|
|
143
143
|
.scalio-profile-options { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
|
|
144
144
|
@media (min-width: 640px) {
|
|
145
|
-
.scalio-profile-options.is-2 { grid-template-columns: repeat(
|
|
146
|
-
.scalio-profile-options.is-3 { grid-template-columns: repeat(
|
|
145
|
+
.scalio-profile-options.is-2 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
|
|
146
|
+
.scalio-profile-options.is-3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
|
|
147
147
|
}
|
|
148
148
|
.scalio-profile-option {
|
|
149
|
-
display: flex; align-items: center; justify-content: space-between; gap: 0.
|
|
149
|
+
display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.75rem 0.875rem; text-align: left;
|
|
150
|
+
min-width: 0; overflow: hidden;
|
|
150
151
|
border: 1px solid hsl(var(--input)); border-radius: 2px; background: hsl(var(--background)); color: hsl(var(--foreground));
|
|
151
152
|
font: inherit; cursor: pointer; transition: border-color 0.15s, background-color 0.15s;
|
|
152
153
|
}
|
|
@@ -154,10 +155,11 @@
|
|
|
154
155
|
.scalio-profile-option.is-on { border-color: hsl(var(--primary)); background: hsl(var(--primary) / 0.05); }
|
|
155
156
|
.scalio-profile-option:disabled { opacity: 0.6; cursor: default; }
|
|
156
157
|
.scalio-profile-option:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 0; }
|
|
157
|
-
.scalio-profile-option-label { display: flex; align-items: center; gap: 0.
|
|
158
|
-
.scalio-profile-option-label >
|
|
158
|
+
.scalio-profile-option-label { display: flex; align-items: center; gap: 0.5rem; min-width: 0; font-size: 0.875rem; font-weight: 600; }
|
|
159
|
+
.scalio-profile-option-label > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
160
|
+
.scalio-profile-option-label > .scalio-icon { width: 18px; height: 18px; flex-shrink: 0; color: hsl(var(--muted-foreground)); }
|
|
159
161
|
.scalio-profile-option.is-on .scalio-profile-option-label > .scalio-icon,
|
|
160
|
-
.scalio-profile-option-check { color: hsl(var(--primary)); width: 18px; height: 18px; }
|
|
162
|
+
.scalio-profile-option-check { color: hsl(var(--primary)); width: 18px; height: 18px; flex-shrink: 0; }
|
|
161
163
|
.scalio-profile-flag { font-size: 1.25rem; line-height: 1; }
|
|
162
164
|
.scalio-profile-sublabel {
|
|
163
165
|
display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -8,6 +8,20 @@ export interface ScalioPostcssConfig {
|
|
|
8
8
|
readonly autoprefixer: Record<string, never>;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Standard Tailwind `content` globs covering `@scalio-cloud/ui` (`shadcn/`, `react/`, and compiled `dist/`)
|
|
13
|
+
* so Tailwind never purges utility classes used by shared components.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SCALIO_UI_TAILWIND_CONTENT: readonly string[];
|
|
16
|
+
export interface CreateTailwindConfigOptions {
|
|
17
|
+
readonly preset: Record<string, unknown>;
|
|
18
|
+
readonly content?: readonly string[];
|
|
19
|
+
readonly plugins?: readonly unknown[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Standard Tailwind 3 configuration shared across Scalio frontends.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createTailwindConfig(options: CreateTailwindConfigOptions): Record<string, unknown>;
|
|
11
25
|
/**
|
|
12
26
|
* Standard PostCSS configuration used across Scalio Tailwind 3 frontends.
|
|
13
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC5C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KAC9C,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,mBAAmB,CAOzD;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,EAAE;QAA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,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACpD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CA4CzG;AAED,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,uBAAuB,EACvB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,GAC7B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -21,10 +21,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var config_exports = {};
|
|
22
22
|
__export(config_exports, {
|
|
23
23
|
DEFAULT_OPENAPI_TYPEGEN_CONFIG: () => DEFAULT_OPENAPI_TYPEGEN_CONFIG,
|
|
24
|
+
SCALIO_UI_TAILWIND_CONTENT: () => SCALIO_UI_TAILWIND_CONTENT,
|
|
24
25
|
buildOpenApiTypegenArgs: () => buildOpenApiTypegenArgs,
|
|
25
26
|
createEslintConfig: () => createEslintConfig,
|
|
26
27
|
createOpenApiTypegenConfig: () => createOpenApiTypegenConfig,
|
|
27
28
|
createPostcssConfig: () => createPostcssConfig,
|
|
29
|
+
createTailwindConfig: () => createTailwindConfig,
|
|
28
30
|
extractPlaceholders: () => extractPlaceholders,
|
|
29
31
|
formatI18nValidationReport: () => formatI18nValidationReport,
|
|
30
32
|
validateI18nCatalogs: () => validateI18nCatalogs
|
|
@@ -201,6 +203,19 @@ function formatI18nValidationReport(result) {
|
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
// src/config/index.ts
|
|
206
|
+
var SCALIO_UI_TAILWIND_CONTENT = [
|
|
207
|
+
"./node_modules/@scalio-cloud/ui/shadcn/*.mjs",
|
|
208
|
+
"./node_modules/@scalio-cloud/ui/react/*.js",
|
|
209
|
+
"./node_modules/@scalio-cloud/ui/dist/**/*.{js,mjs}"
|
|
210
|
+
];
|
|
211
|
+
function createTailwindConfig(options) {
|
|
212
|
+
const { preset, content = ["./src/**/*.{js,jsx,ts,tsx}", "./index.html"], plugins = [] } = options;
|
|
213
|
+
return {
|
|
214
|
+
presets: [preset],
|
|
215
|
+
content: [...SCALIO_UI_TAILWIND_CONTENT, ...content],
|
|
216
|
+
plugins: [...plugins]
|
|
217
|
+
};
|
|
218
|
+
}
|
|
204
219
|
function createPostcssConfig() {
|
|
205
220
|
return {
|
|
206
221
|
plugins: {
|
|
@@ -257,10 +272,12 @@ function createEslintConfig(options) {
|
|
|
257
272
|
// Annotate the CommonJS export names for ESM import in node:
|
|
258
273
|
0 && (module.exports = {
|
|
259
274
|
DEFAULT_OPENAPI_TYPEGEN_CONFIG,
|
|
275
|
+
SCALIO_UI_TAILWIND_CONTENT,
|
|
260
276
|
buildOpenApiTypegenArgs,
|
|
261
277
|
createEslintConfig,
|
|
262
278
|
createOpenApiTypegenConfig,
|
|
263
279
|
createPostcssConfig,
|
|
280
|
+
createTailwindConfig,
|
|
264
281
|
extractPlaceholders,
|
|
265
282
|
formatI18nValidationReport,
|
|
266
283
|
validateI18nCatalogs
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config/index.ts","../../src/config/openapi.ts","../../src/config/i18nCheck.ts"],"sourcesContent":["/**\n * @scalio-cloud/ui/config — Shared build, styling and lint configuration helpers\n * for Scalio frontend apps (ADR 0151).\n */\n\nexport interface ScalioPostcssConfig {\n readonly plugins: {\n readonly tailwindcss: Record<string, never>;\n readonly autoprefixer: Record<string, never>;\n };\n}\n\n/**\n * Standard PostCSS configuration used across Scalio Tailwind 3 frontends.\n */\nexport function createPostcssConfig(): ScalioPostcssConfig {\n return {\n plugins: {\n tailwindcss: {},\n autoprefixer: {},\n },\n };\n}\n\nexport interface CreateEslintConfigOptions {\n readonly js: { readonly configs: { readonly recommended: Record<string, unknown> } };\n readonly globals: {\n readonly browser: Record<string, unknown>;\n readonly node: Record<string, unknown>;\n readonly vitest?: Record<string, unknown>;\n };\n readonly reactPlugin: unknown;\n readonly reactHooks: unknown;\n readonly ignores?: readonly string[];\n readonly rules?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * Standard flat ESLint configuration shared across Scalio React frontends.\n */\nexport function createEslintConfig(options: CreateEslintConfigOptions): readonly Record<string, unknown>[] {\n const { js, globals, reactPlugin, reactHooks, ignores = [], rules = {} } = options;\n return [\n {\n ignores: [\"build/**\", \"dist/**\", \"node_modules/**\", \"src/vendor/**\", \"**/*.d.ts\", ...ignores],\n },\n js.configs.recommended,\n {\n files: [\"**/*.{js,jsx,cjs,mjs}\"],\n linterOptions: {\n reportUnusedDisableDirectives: false,\n },\n languageOptions: {\n ecmaVersion: 2022,\n sourceType: \"module\",\n parserOptions: {\n ecmaFeatures: { jsx: true },\n },\n globals: {\n ...globals.browser,\n ...globals.node,\n ...(globals.vitest ?? {}),\n },\n },\n plugins: {\n react: reactPlugin,\n \"react-hooks\": reactHooks,\n },\n settings: {\n react: { version: \"detect\" },\n },\n rules: {\n \"no-unused-vars\": \"off\",\n \"no-undef\": \"off\",\n \"react/prop-types\": \"off\",\n \"react/react-in-jsx-scope\": \"off\",\n \"no-empty\": \"off\",\n \"no-constant-condition\": \"off\",\n \"no-useless-escape\": \"off\",\n \"no-prototype-builtins\": \"off\",\n ...rules,\n },\n },\n ];\n}\n\nexport {\n DEFAULT_OPENAPI_TYPEGEN_CONFIG,\n createOpenApiTypegenConfig,\n buildOpenApiTypegenArgs,\n type OpenApiTypegenConfig,\n type OpenApiTypegenOverrides,\n} from \"./openapi.js\";\n\nexport {\n extractPlaceholders,\n validateI18nCatalogs,\n formatI18nValidationReport,\n type I18nCatalog,\n type I18nCatalogMap,\n type I18nIssueKind,\n type I18nValidationIssue,\n type I18nValidationOptions,\n type I18nValidationResult,\n} from \"./i18nCheck.js\";\n","/**\n * Standard OpenAPI-to-TypeScript generation configuration for Scalio frontends.\n *\n * Consumes the `openapi.json` exported by each Rust backend (`utoipa`) and produces\n * deterministic, readonly TypeScript definitions via `openapi-typescript`.\n */\n\nexport interface OpenApiTypegenConfig {\n /** Path to the OpenAPI 3.x specification file (default: `\"../openapi.json\"`). */\n readonly input: string;\n /** Output path for the generated `.d.ts` file (default: `\"src/api/schema.d.ts\"`). */\n readonly output: string;\n /** Emit `readonly` properties on generated object types (default: `true`). */\n readonly immutableTypes: boolean;\n /** Prefer `type` aliases over `interface` declarations (default: `true`). */\n readonly exportType: boolean;\n /** Sort generated keys alphabetically for minimal diffs (default: `true`). */\n readonly alphabetize: boolean;\n /** Emit `Record<string, unknown>` instead of `Record<string, never>` for open objects (default: `true`). */\n readonly emptyObjectsUnknown: boolean;\n}\n\nexport type OpenApiTypegenOverrides = Partial<OpenApiTypegenConfig>;\n\nexport const DEFAULT_OPENAPI_TYPEGEN_CONFIG: OpenApiTypegenConfig = {\n input: \"../openapi.json\",\n output: \"src/api/schema.d.ts\",\n immutableTypes: true,\n exportType: true,\n alphabetize: true,\n emptyObjectsUnknown: true,\n};\n\n/**\n * Returns the standard OpenAPI type generation configuration merged with optional overrides.\n */\nexport function createOpenApiTypegenConfig(\n overrides: OpenApiTypegenOverrides = {},\n): OpenApiTypegenConfig {\n return {\n ...DEFAULT_OPENAPI_TYPEGEN_CONFIG,\n ...overrides,\n };\n}\n\n/**\n * Builds the CLI argument list for `openapi-typescript` from a configuration object.\n *\n * Example usage in an app script:\n * `npx openapi-typescript ...buildOpenApiTypegenArgs()`\n */\nexport function buildOpenApiTypegenArgs(\n config: OpenApiTypegenOverrides = {},\n): readonly string[] {\n const resolved = createOpenApiTypegenConfig(config);\n const args: string[] = [resolved.input, \"-o\", resolved.output];\n\n if (resolved.immutableTypes) {\n args.push(\"--immutable\");\n }\n if (resolved.exportType) {\n args.push(\"--export-type\");\n }\n if (resolved.alphabetize) {\n args.push(\"--alphabetize\");\n }\n if (resolved.emptyObjectsUnknown) {\n args.push(\"--empty-objects-unknown\");\n }\n\n return args;\n}\n","/**\n * Translation catalog validator for Scalio frontends.\n *\n * Ensures that every target locale matches the English source catalog:\n * - No missing or orphan keys\n * - No empty translation values\n * - Identical `{placeholder}` / `{{placeholder}}` sets\n * - Swiss German spelling (no sharp-s `\\u00df`) in German catalogs\n */\n\nexport type I18nCatalog = Readonly<Record<string, string>>;\nexport type I18nCatalogMap = Readonly<Record<string, I18nCatalog>>;\n\nexport type I18nIssueKind =\n | \"missing-source-locale\"\n | \"missing-key\"\n | \"extra-key\"\n | \"empty-value\"\n | \"placeholder-mismatch\"\n | \"sharp-s\";\n\nexport interface I18nValidationIssue {\n readonly locale: string;\n readonly key: string;\n readonly kind: I18nIssueKind;\n readonly message: string;\n}\n\nexport interface I18nValidationOptions {\n /** Authoritative source locale (default: `\"en\"`). */\n readonly sourceLocale?: string;\n /** Report keys that exist in a target locale but not in the source locale (default: `true`). */\n readonly failOnExtraKeys?: boolean;\n /** Forbid sharp-s (`\\u00df`) in German locales (`de`, `de-*`, default: `true`). */\n readonly forbidSharpSInGerman?: boolean;\n /** Report empty or whitespace-only values (default: `true`). */\n readonly failOnEmptyValues?: boolean;\n}\n\nexport interface I18nValidationResult {\n readonly ok: boolean;\n readonly sourceLocale: string;\n readonly localesChecked: readonly string[];\n readonly issues: readonly I18nValidationIssue[];\n}\n\nconst PLACEHOLDER_RE = /\\{\\{\\s*([a-zA-Z0-9_.-]+)\\s*\\}\\}|\\{\\s*([a-zA-Z0-9_.-]+)\\s*\\}/g;\nconst SHARP_S = \"\\u00df\";\n\n/**\n * Extracts all unique `{name}` and `{{name}}` placeholders from a translation string,\n * sorted lexicographically for deterministic comparison.\n */\nexport function extractPlaceholders(text: string): readonly string[] {\n const found = new Set<string>();\n for (const match of text.matchAll(PLACEHOLDER_RE)) {\n const name = match[1] ?? match[2];\n if (name) {\n found.add(name);\n }\n }\n return Array.from(found).sort();\n}\n\nfunction isGermanLocale(locale: string): boolean {\n const lower = locale.toLowerCase();\n return lower === \"de\" || lower.startsWith(\"de-\") || lower.startsWith(\"de_\");\n}\n\nfunction sameStringList(a: readonly string[], b: readonly string[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i += 1) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\n/**\n * Validates a map of locale catalogs (e.g. `{ en: {...}, de: {...} }`) against\n * the source locale catalog.\n */\nexport function validateI18nCatalogs(\n catalogs: I18nCatalogMap,\n options: I18nValidationOptions = {},\n): I18nValidationResult {\n const sourceLocale = options.sourceLocale ?? \"en\";\n const failOnExtraKeys = options.failOnExtraKeys ?? true;\n const forbidSharpSInGerman = options.forbidSharpSInGerman ?? true;\n const failOnEmptyValues = options.failOnEmptyValues ?? true;\n\n const issues: I18nValidationIssue[] = [];\n const localeNames = Object.keys(catalogs).sort();\n const source = catalogs[sourceLocale];\n\n if (!source) {\n issues.push({\n locale: sourceLocale,\n key: \"*\",\n kind: \"missing-source-locale\",\n message: `Source locale \"${sourceLocale}\" is missing from catalogs.`,\n });\n return {\n ok: false,\n sourceLocale,\n localesChecked: localeNames,\n issues,\n };\n }\n\n const sourceKeys = Object.keys(source).sort();\n\n // Check source catalog itself for empty values.\n if (failOnEmptyValues) {\n for (const key of sourceKeys) {\n const sourceValue = source[key];\n if (sourceValue !== undefined && sourceValue.trim().length === 0) {\n issues.push({\n locale: sourceLocale,\n key,\n kind: \"empty-value\",\n message: `Empty translation value in source locale \"${sourceLocale}\" for key \"${key}\".`,\n });\n }\n }\n }\n\n for (const locale of localeNames) {\n if (locale === sourceLocale) continue;\n const target = catalogs[locale];\n if (!target) continue;\n const targetKeys = Object.keys(target).sort();\n const checkSharpS = forbidSharpSInGerman && isGermanLocale(locale);\n\n for (const key of sourceKeys) {\n if (!Object.prototype.hasOwnProperty.call(target, key)) {\n issues.push({\n locale,\n key,\n kind: \"missing-key\",\n message: `Locale \"${locale}\" is missing key \"${key}\".`,\n });\n continue;\n }\n\n const sourceValue = source[key] ?? \"\";\n const value = target[key] ?? \"\";\n if (failOnEmptyValues && value.trim().length === 0) {\n issues.push({\n locale,\n key,\n kind: \"empty-value\",\n message: `Empty translation value in locale \"${locale}\" for key \"${key}\".`,\n });\n }\n\n const expectedPlaceholders = extractPlaceholders(sourceValue);\n const actualPlaceholders = extractPlaceholders(value);\n if (!sameStringList(expectedPlaceholders, actualPlaceholders)) {\n issues.push({\n locale,\n key,\n kind: \"placeholder-mismatch\",\n message: `Placeholder mismatch in \"${locale}.${key}\": expected [${expectedPlaceholders.join(\", \")}], got [${actualPlaceholders.join(\", \")}].`,\n });\n }\n\n if (checkSharpS && value.includes(SHARP_S)) {\n issues.push({\n locale,\n key,\n kind: \"sharp-s\",\n message: `Locale \"${locale}\" key \"${key}\" contains forbidden sharp-s; use \"ss\" instead.`,\n });\n }\n }\n\n if (failOnExtraKeys) {\n for (const key of targetKeys) {\n if (!Object.prototype.hasOwnProperty.call(source, key)) {\n issues.push({\n locale,\n key,\n kind: \"extra-key\",\n message: `Locale \"${locale}\" contains unknown key \"${key}\" not present in \"${sourceLocale}\".`,\n });\n }\n }\n }\n }\n\n return {\n ok: issues.length === 0,\n sourceLocale,\n localesChecked: localeNames,\n issues,\n };\n}\n\n/**\n * Formats an `I18nValidationResult` as a human-readable CI report.\n */\nexport function formatI18nValidationReport(result: I18nValidationResult): string {\n if (result.ok) {\n return `i18n ok (${result.localesChecked.length} locales checked against \"${result.sourceLocale}\").`;\n }\n const lines = [\n `i18n validation failed (${result.issues.length} issue${result.issues.length === 1 ? \"\" : \"s\"}):`,\n ...result.issues.map((issue) => ` - [${issue.locale}] (${issue.kind}) ${issue.message}`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A,MACA,SAAS;AAAA,QACP,OAAO;AAAA,QACP,eAAe;AAAA,MACjB;AAAA,MACA,UAAU;AAAA,QACR,OAAO,EAAE,SAAS,SAAS;AAAA,MAC7B;AAAA,MACA,OAAO;AAAA,QACL,kBAAkB;AAAA,QAClB,YAAY;AAAA,QACZ,oBAAoB;AAAA,QACpB,4BAA4B;AAAA,QAC5B,YAAY;AAAA,QACZ,yBAAyB;AAAA,QACzB,qBAAqB;AAAA,QACrB,yBAAyB;AAAA,QACzB,GAAG;AAAA,MACL;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/config/index.ts","../../src/config/openapi.ts","../../src/config/i18nCheck.ts"],"sourcesContent":["/**\n * @scalio-cloud/ui/config — Shared build, styling and lint configuration helpers\n * for Scalio frontend apps (ADR 0151).\n */\n\nexport interface ScalioPostcssConfig {\n readonly plugins: {\n readonly tailwindcss: Record<string, never>;\n readonly autoprefixer: Record<string, never>;\n };\n}\n\n/**\n * Standard Tailwind `content` globs covering `@scalio-cloud/ui` (`shadcn/`, `react/`, and compiled `dist/`)\n * so Tailwind never purges utility classes used by shared components.\n */\nexport const SCALIO_UI_TAILWIND_CONTENT: readonly string[] = [\n \"./node_modules/@scalio-cloud/ui/shadcn/*.mjs\",\n \"./node_modules/@scalio-cloud/ui/react/*.js\",\n \"./node_modules/@scalio-cloud/ui/dist/**/*.{js,mjs}\",\n];\n\nexport interface CreateTailwindConfigOptions {\n readonly preset: Record<string, unknown>;\n readonly content?: readonly string[];\n readonly plugins?: readonly unknown[];\n}\n\n/**\n * Standard Tailwind 3 configuration shared across Scalio frontends.\n */\nexport function createTailwindConfig(options: CreateTailwindConfigOptions): Record<string, unknown> {\n const { preset, content = [\"./src/**/*.{js,jsx,ts,tsx}\", \"./index.html\"], plugins = [] } = options;\n return {\n presets: [preset],\n content: [...SCALIO_UI_TAILWIND_CONTENT, ...content],\n plugins: [...plugins],\n };\n}\n\n/**\n * Standard PostCSS configuration used across Scalio Tailwind 3 frontends.\n */\nexport function createPostcssConfig(): ScalioPostcssConfig {\n return {\n plugins: {\n tailwindcss: {},\n autoprefixer: {},\n },\n };\n}\n\nexport interface CreateEslintConfigOptions {\n readonly js: { readonly configs: { readonly recommended: Record<string, unknown> } };\n readonly globals: {\n readonly browser: Record<string, unknown>;\n readonly node: Record<string, unknown>;\n readonly vitest?: Record<string, unknown>;\n };\n readonly reactPlugin: unknown;\n readonly reactHooks: unknown;\n readonly ignores?: readonly string[];\n readonly rules?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * Standard flat ESLint configuration shared across Scalio React frontends.\n */\nexport function createEslintConfig(options: CreateEslintConfigOptions): readonly Record<string, unknown>[] {\n const { js, globals, reactPlugin, reactHooks, ignores = [], rules = {} } = options;\n return [\n {\n ignores: [\"build/**\", \"dist/**\", \"node_modules/**\", \"src/vendor/**\", \"**/*.d.ts\", ...ignores],\n },\n js.configs.recommended,\n {\n files: [\"**/*.{js,jsx,cjs,mjs}\"],\n linterOptions: {\n reportUnusedDisableDirectives: false,\n },\n languageOptions: {\n ecmaVersion: 2022,\n sourceType: \"module\",\n parserOptions: {\n ecmaFeatures: { jsx: true },\n },\n globals: {\n ...globals.browser,\n ...globals.node,\n ...(globals.vitest ?? {}),\n },\n },\n plugins: {\n react: reactPlugin,\n \"react-hooks\": reactHooks,\n },\n settings: {\n react: { version: \"detect\" },\n },\n rules: {\n \"no-unused-vars\": \"off\",\n \"no-undef\": \"off\",\n \"react/prop-types\": \"off\",\n \"react/react-in-jsx-scope\": \"off\",\n \"no-empty\": \"off\",\n \"no-constant-condition\": \"off\",\n \"no-useless-escape\": \"off\",\n \"no-prototype-builtins\": \"off\",\n ...rules,\n },\n },\n ];\n}\n\nexport {\n DEFAULT_OPENAPI_TYPEGEN_CONFIG,\n createOpenApiTypegenConfig,\n buildOpenApiTypegenArgs,\n type OpenApiTypegenConfig,\n type OpenApiTypegenOverrides,\n} from \"./openapi.js\";\n\nexport {\n extractPlaceholders,\n validateI18nCatalogs,\n formatI18nValidationReport,\n type I18nCatalog,\n type I18nCatalogMap,\n type I18nIssueKind,\n type I18nValidationIssue,\n type I18nValidationOptions,\n type I18nValidationResult,\n} from \"./i18nCheck.js\";\n","/**\n * Standard OpenAPI-to-TypeScript generation configuration for Scalio frontends.\n *\n * Consumes the `openapi.json` exported by each Rust backend (`utoipa`) and produces\n * deterministic, readonly TypeScript definitions via `openapi-typescript`.\n */\n\nexport interface OpenApiTypegenConfig {\n /** Path to the OpenAPI 3.x specification file (default: `\"../openapi.json\"`). */\n readonly input: string;\n /** Output path for the generated `.d.ts` file (default: `\"src/api/schema.d.ts\"`). */\n readonly output: string;\n /** Emit `readonly` properties on generated object types (default: `true`). */\n readonly immutableTypes: boolean;\n /** Prefer `type` aliases over `interface` declarations (default: `true`). */\n readonly exportType: boolean;\n /** Sort generated keys alphabetically for minimal diffs (default: `true`). */\n readonly alphabetize: boolean;\n /** Emit `Record<string, unknown>` instead of `Record<string, never>` for open objects (default: `true`). */\n readonly emptyObjectsUnknown: boolean;\n}\n\nexport type OpenApiTypegenOverrides = Partial<OpenApiTypegenConfig>;\n\nexport const DEFAULT_OPENAPI_TYPEGEN_CONFIG: OpenApiTypegenConfig = {\n input: \"../openapi.json\",\n output: \"src/api/schema.d.ts\",\n immutableTypes: true,\n exportType: true,\n alphabetize: true,\n emptyObjectsUnknown: true,\n};\n\n/**\n * Returns the standard OpenAPI type generation configuration merged with optional overrides.\n */\nexport function createOpenApiTypegenConfig(\n overrides: OpenApiTypegenOverrides = {},\n): OpenApiTypegenConfig {\n return {\n ...DEFAULT_OPENAPI_TYPEGEN_CONFIG,\n ...overrides,\n };\n}\n\n/**\n * Builds the CLI argument list for `openapi-typescript` from a configuration object.\n *\n * Example usage in an app script:\n * `npx openapi-typescript ...buildOpenApiTypegenArgs()`\n */\nexport function buildOpenApiTypegenArgs(\n config: OpenApiTypegenOverrides = {},\n): readonly string[] {\n const resolved = createOpenApiTypegenConfig(config);\n const args: string[] = [resolved.input, \"-o\", resolved.output];\n\n if (resolved.immutableTypes) {\n args.push(\"--immutable\");\n }\n if (resolved.exportType) {\n args.push(\"--export-type\");\n }\n if (resolved.alphabetize) {\n args.push(\"--alphabetize\");\n }\n if (resolved.emptyObjectsUnknown) {\n args.push(\"--empty-objects-unknown\");\n }\n\n return args;\n}\n","/**\n * Translation catalog validator for Scalio frontends.\n *\n * Ensures that every target locale matches the English source catalog:\n * - No missing or orphan keys\n * - No empty translation values\n * - Identical `{placeholder}` / `{{placeholder}}` sets\n * - Swiss German spelling (no sharp-s `\\u00df`) in German catalogs\n */\n\nexport type I18nCatalog = Readonly<Record<string, string>>;\nexport type I18nCatalogMap = Readonly<Record<string, I18nCatalog>>;\n\nexport type I18nIssueKind =\n | \"missing-source-locale\"\n | \"missing-key\"\n | \"extra-key\"\n | \"empty-value\"\n | \"placeholder-mismatch\"\n | \"sharp-s\";\n\nexport interface I18nValidationIssue {\n readonly locale: string;\n readonly key: string;\n readonly kind: I18nIssueKind;\n readonly message: string;\n}\n\nexport interface I18nValidationOptions {\n /** Authoritative source locale (default: `\"en\"`). */\n readonly sourceLocale?: string;\n /** Report keys that exist in a target locale but not in the source locale (default: `true`). */\n readonly failOnExtraKeys?: boolean;\n /** Forbid sharp-s (`\\u00df`) in German locales (`de`, `de-*`, default: `true`). */\n readonly forbidSharpSInGerman?: boolean;\n /** Report empty or whitespace-only values (default: `true`). */\n readonly failOnEmptyValues?: boolean;\n}\n\nexport interface I18nValidationResult {\n readonly ok: boolean;\n readonly sourceLocale: string;\n readonly localesChecked: readonly string[];\n readonly issues: readonly I18nValidationIssue[];\n}\n\nconst PLACEHOLDER_RE = /\\{\\{\\s*([a-zA-Z0-9_.-]+)\\s*\\}\\}|\\{\\s*([a-zA-Z0-9_.-]+)\\s*\\}/g;\nconst SHARP_S = \"\\u00df\";\n\n/**\n * Extracts all unique `{name}` and `{{name}}` placeholders from a translation string,\n * sorted lexicographically for deterministic comparison.\n */\nexport function extractPlaceholders(text: string): readonly string[] {\n const found = new Set<string>();\n for (const match of text.matchAll(PLACEHOLDER_RE)) {\n const name = match[1] ?? match[2];\n if (name) {\n found.add(name);\n }\n }\n return Array.from(found).sort();\n}\n\nfunction isGermanLocale(locale: string): boolean {\n const lower = locale.toLowerCase();\n return lower === \"de\" || lower.startsWith(\"de-\") || lower.startsWith(\"de_\");\n}\n\nfunction sameStringList(a: readonly string[], b: readonly string[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i += 1) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\n/**\n * Validates a map of locale catalogs (e.g. `{ en: {...}, de: {...} }`) against\n * the source locale catalog.\n */\nexport function validateI18nCatalogs(\n catalogs: I18nCatalogMap,\n options: I18nValidationOptions = {},\n): I18nValidationResult {\n const sourceLocale = options.sourceLocale ?? \"en\";\n const failOnExtraKeys = options.failOnExtraKeys ?? true;\n const forbidSharpSInGerman = options.forbidSharpSInGerman ?? true;\n const failOnEmptyValues = options.failOnEmptyValues ?? true;\n\n const issues: I18nValidationIssue[] = [];\n const localeNames = Object.keys(catalogs).sort();\n const source = catalogs[sourceLocale];\n\n if (!source) {\n issues.push({\n locale: sourceLocale,\n key: \"*\",\n kind: \"missing-source-locale\",\n message: `Source locale \"${sourceLocale}\" is missing from catalogs.`,\n });\n return {\n ok: false,\n sourceLocale,\n localesChecked: localeNames,\n issues,\n };\n }\n\n const sourceKeys = Object.keys(source).sort();\n\n // Check source catalog itself for empty values.\n if (failOnEmptyValues) {\n for (const key of sourceKeys) {\n const sourceValue = source[key];\n if (sourceValue !== undefined && sourceValue.trim().length === 0) {\n issues.push({\n locale: sourceLocale,\n key,\n kind: \"empty-value\",\n message: `Empty translation value in source locale \"${sourceLocale}\" for key \"${key}\".`,\n });\n }\n }\n }\n\n for (const locale of localeNames) {\n if (locale === sourceLocale) continue;\n const target = catalogs[locale];\n if (!target) continue;\n const targetKeys = Object.keys(target).sort();\n const checkSharpS = forbidSharpSInGerman && isGermanLocale(locale);\n\n for (const key of sourceKeys) {\n if (!Object.prototype.hasOwnProperty.call(target, key)) {\n issues.push({\n locale,\n key,\n kind: \"missing-key\",\n message: `Locale \"${locale}\" is missing key \"${key}\".`,\n });\n continue;\n }\n\n const sourceValue = source[key] ?? \"\";\n const value = target[key] ?? \"\";\n if (failOnEmptyValues && value.trim().length === 0) {\n issues.push({\n locale,\n key,\n kind: \"empty-value\",\n message: `Empty translation value in locale \"${locale}\" for key \"${key}\".`,\n });\n }\n\n const expectedPlaceholders = extractPlaceholders(sourceValue);\n const actualPlaceholders = extractPlaceholders(value);\n if (!sameStringList(expectedPlaceholders, actualPlaceholders)) {\n issues.push({\n locale,\n key,\n kind: \"placeholder-mismatch\",\n message: `Placeholder mismatch in \"${locale}.${key}\": expected [${expectedPlaceholders.join(\", \")}], got [${actualPlaceholders.join(\", \")}].`,\n });\n }\n\n if (checkSharpS && value.includes(SHARP_S)) {\n issues.push({\n locale,\n key,\n kind: \"sharp-s\",\n message: `Locale \"${locale}\" key \"${key}\" contains forbidden sharp-s; use \"ss\" instead.`,\n });\n }\n }\n\n if (failOnExtraKeys) {\n for (const key of targetKeys) {\n if (!Object.prototype.hasOwnProperty.call(source, key)) {\n issues.push({\n locale,\n key,\n kind: \"extra-key\",\n message: `Locale \"${locale}\" contains unknown key \"${key}\" not present in \"${sourceLocale}\".`,\n });\n }\n }\n }\n }\n\n return {\n ok: issues.length === 0,\n sourceLocale,\n localesChecked: localeNames,\n issues,\n };\n}\n\n/**\n * Formats an `I18nValidationResult` as a human-readable CI report.\n */\nexport function formatI18nValidationReport(result: I18nValidationResult): string {\n if (result.ok) {\n return `i18n ok (${result.localesChecked.length} locales checked against \"${result.sourceLocale}\").`;\n }\n const lines = [\n `i18n validation failed (${result.issues.length} issue${result.issues.length === 1 ? \"\" : \"s\"}):`,\n ...result.issues.map((issue) => ` - [${issue.locale}] (${issue.kind}) ${issue.message}`),\n ];\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;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AA,QACb,+BAA+B;AAAA,MACjC;AAAA,MACA,iBAAiB;AAAA,QACf,aAAa;AAAA,QACb,YAAY;AAAA,QACZ,eAAe;AAAA,UACb,cAAc,EAAE,KAAK,KAAK;AAAA,QAC5B;AAAA,QACA,SAAS;AAAA,UACP,GAAG,QAAQ;AAAA,UACX,GAAG,QAAQ;AAAA,UACX,GAAI,QAAQ,UAAU,CAAC;AAAA,QACzB;AAAA,MACF;AAAA,MACA,SAAS;AAAA,QACP,OAAO;AAAA,QACP,eAAe;AAAA,MACjB;AAAA,MACA,UAAU;AAAA,QACR,OAAO,EAAE,SAAS,SAAS;AAAA,MAC7B;AAAA,MACA,OAAO;AAAA,QACL,kBAAkB;AAAA,QAClB,YAAY;AAAA,QACZ,oBAAoB;AAAA,QACpB,4BAA4B;AAAA,QAC5B,YAAY;AAAA,QACZ,yBAAyB;AAAA,QACzB,qBAAqB;AAAA,QACrB,yBAAyB;AAAA,QACzB,GAAG;AAAA,MACL;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
package/dist/config/index.mjs
CHANGED
|
@@ -168,6 +168,19 @@ function formatI18nValidationReport(result) {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
// src/config/index.ts
|
|
171
|
+
var SCALIO_UI_TAILWIND_CONTENT = [
|
|
172
|
+
"./node_modules/@scalio-cloud/ui/shadcn/*.mjs",
|
|
173
|
+
"./node_modules/@scalio-cloud/ui/react/*.js",
|
|
174
|
+
"./node_modules/@scalio-cloud/ui/dist/**/*.{js,mjs}"
|
|
175
|
+
];
|
|
176
|
+
function createTailwindConfig(options) {
|
|
177
|
+
const { preset, content = ["./src/**/*.{js,jsx,ts,tsx}", "./index.html"], plugins = [] } = options;
|
|
178
|
+
return {
|
|
179
|
+
presets: [preset],
|
|
180
|
+
content: [...SCALIO_UI_TAILWIND_CONTENT, ...content],
|
|
181
|
+
plugins: [...plugins]
|
|
182
|
+
};
|
|
183
|
+
}
|
|
171
184
|
function createPostcssConfig() {
|
|
172
185
|
return {
|
|
173
186
|
plugins: {
|
|
@@ -223,10 +236,12 @@ function createEslintConfig(options) {
|
|
|
223
236
|
}
|
|
224
237
|
export {
|
|
225
238
|
DEFAULT_OPENAPI_TYPEGEN_CONFIG,
|
|
239
|
+
SCALIO_UI_TAILWIND_CONTENT,
|
|
226
240
|
buildOpenApiTypegenArgs,
|
|
227
241
|
createEslintConfig,
|
|
228
242
|
createOpenApiTypegenConfig,
|
|
229
243
|
createPostcssConfig,
|
|
244
|
+
createTailwindConfig,
|
|
230
245
|
extractPlaceholders,
|
|
231
246
|
formatI18nValidationReport,
|
|
232
247
|
validateI18nCatalogs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config/openapi.ts","../../src/config/i18nCheck.ts","../../src/config/index.ts"],"sourcesContent":["/**\n * Standard OpenAPI-to-TypeScript generation configuration for Scalio frontends.\n *\n * Consumes the `openapi.json` exported by each Rust backend (`utoipa`) and produces\n * deterministic, readonly TypeScript definitions via `openapi-typescript`.\n */\n\nexport interface OpenApiTypegenConfig {\n /** Path to the OpenAPI 3.x specification file (default: `\"../openapi.json\"`). */\n readonly input: string;\n /** Output path for the generated `.d.ts` file (default: `\"src/api/schema.d.ts\"`). */\n readonly output: string;\n /** Emit `readonly` properties on generated object types (default: `true`). */\n readonly immutableTypes: boolean;\n /** Prefer `type` aliases over `interface` declarations (default: `true`). */\n readonly exportType: boolean;\n /** Sort generated keys alphabetically for minimal diffs (default: `true`). */\n readonly alphabetize: boolean;\n /** Emit `Record<string, unknown>` instead of `Record<string, never>` for open objects (default: `true`). */\n readonly emptyObjectsUnknown: boolean;\n}\n\nexport type OpenApiTypegenOverrides = Partial<OpenApiTypegenConfig>;\n\nexport const DEFAULT_OPENAPI_TYPEGEN_CONFIG: OpenApiTypegenConfig = {\n input: \"../openapi.json\",\n output: \"src/api/schema.d.ts\",\n immutableTypes: true,\n exportType: true,\n alphabetize: true,\n emptyObjectsUnknown: true,\n};\n\n/**\n * Returns the standard OpenAPI type generation configuration merged with optional overrides.\n */\nexport function createOpenApiTypegenConfig(\n overrides: OpenApiTypegenOverrides = {},\n): OpenApiTypegenConfig {\n return {\n ...DEFAULT_OPENAPI_TYPEGEN_CONFIG,\n ...overrides,\n };\n}\n\n/**\n * Builds the CLI argument list for `openapi-typescript` from a configuration object.\n *\n * Example usage in an app script:\n * `npx openapi-typescript ...buildOpenApiTypegenArgs()`\n */\nexport function buildOpenApiTypegenArgs(\n config: OpenApiTypegenOverrides = {},\n): readonly string[] {\n const resolved = createOpenApiTypegenConfig(config);\n const args: string[] = [resolved.input, \"-o\", resolved.output];\n\n if (resolved.immutableTypes) {\n args.push(\"--immutable\");\n }\n if (resolved.exportType) {\n args.push(\"--export-type\");\n }\n if (resolved.alphabetize) {\n args.push(\"--alphabetize\");\n }\n if (resolved.emptyObjectsUnknown) {\n args.push(\"--empty-objects-unknown\");\n }\n\n return args;\n}\n","/**\n * Translation catalog validator for Scalio frontends.\n *\n * Ensures that every target locale matches the English source catalog:\n * - No missing or orphan keys\n * - No empty translation values\n * - Identical `{placeholder}` / `{{placeholder}}` sets\n * - Swiss German spelling (no sharp-s `\\u00df`) in German catalogs\n */\n\nexport type I18nCatalog = Readonly<Record<string, string>>;\nexport type I18nCatalogMap = Readonly<Record<string, I18nCatalog>>;\n\nexport type I18nIssueKind =\n | \"missing-source-locale\"\n | \"missing-key\"\n | \"extra-key\"\n | \"empty-value\"\n | \"placeholder-mismatch\"\n | \"sharp-s\";\n\nexport interface I18nValidationIssue {\n readonly locale: string;\n readonly key: string;\n readonly kind: I18nIssueKind;\n readonly message: string;\n}\n\nexport interface I18nValidationOptions {\n /** Authoritative source locale (default: `\"en\"`). */\n readonly sourceLocale?: string;\n /** Report keys that exist in a target locale but not in the source locale (default: `true`). */\n readonly failOnExtraKeys?: boolean;\n /** Forbid sharp-s (`\\u00df`) in German locales (`de`, `de-*`, default: `true`). */\n readonly forbidSharpSInGerman?: boolean;\n /** Report empty or whitespace-only values (default: `true`). */\n readonly failOnEmptyValues?: boolean;\n}\n\nexport interface I18nValidationResult {\n readonly ok: boolean;\n readonly sourceLocale: string;\n readonly localesChecked: readonly string[];\n readonly issues: readonly I18nValidationIssue[];\n}\n\nconst PLACEHOLDER_RE = /\\{\\{\\s*([a-zA-Z0-9_.-]+)\\s*\\}\\}|\\{\\s*([a-zA-Z0-9_.-]+)\\s*\\}/g;\nconst SHARP_S = \"\\u00df\";\n\n/**\n * Extracts all unique `{name}` and `{{name}}` placeholders from a translation string,\n * sorted lexicographically for deterministic comparison.\n */\nexport function extractPlaceholders(text: string): readonly string[] {\n const found = new Set<string>();\n for (const match of text.matchAll(PLACEHOLDER_RE)) {\n const name = match[1] ?? match[2];\n if (name) {\n found.add(name);\n }\n }\n return Array.from(found).sort();\n}\n\nfunction isGermanLocale(locale: string): boolean {\n const lower = locale.toLowerCase();\n return lower === \"de\" || lower.startsWith(\"de-\") || lower.startsWith(\"de_\");\n}\n\nfunction sameStringList(a: readonly string[], b: readonly string[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i += 1) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\n/**\n * Validates a map of locale catalogs (e.g. `{ en: {...}, de: {...} }`) against\n * the source locale catalog.\n */\nexport function validateI18nCatalogs(\n catalogs: I18nCatalogMap,\n options: I18nValidationOptions = {},\n): I18nValidationResult {\n const sourceLocale = options.sourceLocale ?? \"en\";\n const failOnExtraKeys = options.failOnExtraKeys ?? true;\n const forbidSharpSInGerman = options.forbidSharpSInGerman ?? true;\n const failOnEmptyValues = options.failOnEmptyValues ?? true;\n\n const issues: I18nValidationIssue[] = [];\n const localeNames = Object.keys(catalogs).sort();\n const source = catalogs[sourceLocale];\n\n if (!source) {\n issues.push({\n locale: sourceLocale,\n key: \"*\",\n kind: \"missing-source-locale\",\n message: `Source locale \"${sourceLocale}\" is missing from catalogs.`,\n });\n return {\n ok: false,\n sourceLocale,\n localesChecked: localeNames,\n issues,\n };\n }\n\n const sourceKeys = Object.keys(source).sort();\n\n // Check source catalog itself for empty values.\n if (failOnEmptyValues) {\n for (const key of sourceKeys) {\n const sourceValue = source[key];\n if (sourceValue !== undefined && sourceValue.trim().length === 0) {\n issues.push({\n locale: sourceLocale,\n key,\n kind: \"empty-value\",\n message: `Empty translation value in source locale \"${sourceLocale}\" for key \"${key}\".`,\n });\n }\n }\n }\n\n for (const locale of localeNames) {\n if (locale === sourceLocale) continue;\n const target = catalogs[locale];\n if (!target) continue;\n const targetKeys = Object.keys(target).sort();\n const checkSharpS = forbidSharpSInGerman && isGermanLocale(locale);\n\n for (const key of sourceKeys) {\n if (!Object.prototype.hasOwnProperty.call(target, key)) {\n issues.push({\n locale,\n key,\n kind: \"missing-key\",\n message: `Locale \"${locale}\" is missing key \"${key}\".`,\n });\n continue;\n }\n\n const sourceValue = source[key] ?? \"\";\n const value = target[key] ?? \"\";\n if (failOnEmptyValues && value.trim().length === 0) {\n issues.push({\n locale,\n key,\n kind: \"empty-value\",\n message: `Empty translation value in locale \"${locale}\" for key \"${key}\".`,\n });\n }\n\n const expectedPlaceholders = extractPlaceholders(sourceValue);\n const actualPlaceholders = extractPlaceholders(value);\n if (!sameStringList(expectedPlaceholders, actualPlaceholders)) {\n issues.push({\n locale,\n key,\n kind: \"placeholder-mismatch\",\n message: `Placeholder mismatch in \"${locale}.${key}\": expected [${expectedPlaceholders.join(\", \")}], got [${actualPlaceholders.join(\", \")}].`,\n });\n }\n\n if (checkSharpS && value.includes(SHARP_S)) {\n issues.push({\n locale,\n key,\n kind: \"sharp-s\",\n message: `Locale \"${locale}\" key \"${key}\" contains forbidden sharp-s; use \"ss\" instead.`,\n });\n }\n }\n\n if (failOnExtraKeys) {\n for (const key of targetKeys) {\n if (!Object.prototype.hasOwnProperty.call(source, key)) {\n issues.push({\n locale,\n key,\n kind: \"extra-key\",\n message: `Locale \"${locale}\" contains unknown key \"${key}\" not present in \"${sourceLocale}\".`,\n });\n }\n }\n }\n }\n\n return {\n ok: issues.length === 0,\n sourceLocale,\n localesChecked: localeNames,\n issues,\n };\n}\n\n/**\n * Formats an `I18nValidationResult` as a human-readable CI report.\n */\nexport function formatI18nValidationReport(result: I18nValidationResult): string {\n if (result.ok) {\n return `i18n ok (${result.localesChecked.length} locales checked against \"${result.sourceLocale}\").`;\n }\n const lines = [\n `i18n validation failed (${result.issues.length} issue${result.issues.length === 1 ? \"\" : \"s\"}):`,\n ...result.issues.map((issue) => ` - [${issue.locale}] (${issue.kind}) ${issue.message}`),\n ];\n return lines.join(\"\\n\");\n}\n","/**\n * @scalio-cloud/ui/config — Shared build, styling and lint configuration helpers\n * for Scalio frontend apps (ADR 0151).\n */\n\nexport interface ScalioPostcssConfig {\n readonly plugins: {\n readonly tailwindcss: Record<string, never>;\n readonly autoprefixer: Record<string, never>;\n };\n}\n\n/**\n * Standard PostCSS configuration used across Scalio Tailwind 3 frontends.\n */\nexport function createPostcssConfig(): ScalioPostcssConfig {\n return {\n plugins: {\n tailwindcss: {},\n autoprefixer: {},\n },\n };\n}\n\nexport interface CreateEslintConfigOptions {\n readonly js: { readonly configs: { readonly recommended: Record<string, unknown> } };\n readonly globals: {\n readonly browser: Record<string, unknown>;\n readonly node: Record<string, unknown>;\n readonly vitest?: Record<string, unknown>;\n };\n readonly reactPlugin: unknown;\n readonly reactHooks: unknown;\n readonly ignores?: readonly string[];\n readonly rules?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * Standard flat ESLint configuration shared across Scalio React frontends.\n */\nexport function createEslintConfig(options: CreateEslintConfigOptions): readonly Record<string, unknown>[] {\n const { js, globals, reactPlugin, reactHooks, ignores = [], rules = {} } = options;\n return [\n {\n ignores: [\"build/**\", \"dist/**\", \"node_modules/**\", \"src/vendor/**\", \"**/*.d.ts\", ...ignores],\n },\n js.configs.recommended,\n {\n files: [\"**/*.{js,jsx,cjs,mjs}\"],\n linterOptions: {\n reportUnusedDisableDirectives: false,\n },\n languageOptions: {\n ecmaVersion: 2022,\n sourceType: \"module\",\n parserOptions: {\n ecmaFeatures: { jsx: true },\n },\n globals: {\n ...globals.browser,\n ...globals.node,\n ...(globals.vitest ?? {}),\n },\n },\n plugins: {\n react: reactPlugin,\n \"react-hooks\": reactHooks,\n },\n settings: {\n react: { version: \"detect\" },\n },\n rules: {\n \"no-unused-vars\": \"off\",\n \"no-undef\": \"off\",\n \"react/prop-types\": \"off\",\n \"react/react-in-jsx-scope\": \"off\",\n \"no-empty\": \"off\",\n \"no-constant-condition\": \"off\",\n \"no-useless-escape\": \"off\",\n \"no-prototype-builtins\": \"off\",\n ...rules,\n },\n },\n ];\n}\n\nexport {\n DEFAULT_OPENAPI_TYPEGEN_CONFIG,\n createOpenApiTypegenConfig,\n buildOpenApiTypegenArgs,\n type OpenApiTypegenConfig,\n type OpenApiTypegenOverrides,\n} from \"./openapi.js\";\n\nexport {\n extractPlaceholders,\n validateI18nCatalogs,\n formatI18nValidationReport,\n type I18nCatalog,\n type I18nCatalogMap,\n type I18nIssueKind,\n type I18nValidationIssue,\n type I18nValidationOptions,\n type I18nValidationResult,\n} from \"./i18nCheck.js\";\n"],"mappings":";AAwBO,IAAM,iCAAuD;AAAA,EAClE,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,qBAAqB;AACvB;AAKO,SAAS,2BACd,YAAqC,CAAC,GAChB;AACtB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAQO,SAAS,wBACd,SAAkC,CAAC,GAChB;AACnB,QAAM,WAAW,2BAA2B,MAAM;AAClD,QAAM,OAAiB,CAAC,SAAS,OAAO,MAAM,SAAS,MAAM;AAE7D,MAAI,SAAS,gBAAgB;AAC3B,SAAK,KAAK,aAAa;AAAA,EACzB;AACA,MAAI,SAAS,YAAY;AACvB,SAAK,KAAK,eAAe;AAAA,EAC3B;AACA,MAAI,SAAS,aAAa;AACxB,SAAK,KAAK,eAAe;AAAA,EAC3B;AAC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,EAAE,IAAI,SAAS,aAAa,YAAY,UAAU,CAAC,GAAG,QAAQ,CAAC,EAAE,IAAI;AAC3E,SAAO;AAAA,IACL;AAAA,MACE,SAAS,CAAC,YAAY,WAAW,mBAAmB,iBAAiB,aAAa,GAAG,OAAO;AAAA,IAC9F;AAAA,IACA,GAAG,QAAQ;AAAA,IACX;AAAA,MACE,OAAO,CAAC,uBAAuB;AAAA,MAC/B,eAAe;AAAA,QACb,+BAA+B;AAAA,MACjC;AAAA,MACA,iBAAiB;AAAA,QACf,aAAa;AAAA,QACb,YAAY;AAAA,QACZ,eAAe;AAAA,UACb,cAAc,EAAE,KAAK,KAAK;AAAA,QAC5B;AAAA,QACA,SAAS;AAAA,UACP,GAAG,QAAQ;AAAA,UACX,GAAG,QAAQ;AAAA,UACX,GAAI,QAAQ,UAAU,CAAC;AAAA,QACzB;AAAA,MACF;AAAA,MACA,SAAS;AAAA,QACP,OAAO;AAAA,QACP,eAAe;AAAA,MACjB;AAAA,MACA,UAAU;AAAA,QACR,OAAO,EAAE,SAAS,SAAS;AAAA,MAC7B;AAAA,MACA,OAAO;AAAA,QACL,kBAAkB;AAAA,QAClB,YAAY;AAAA,QACZ,oBAAoB;AAAA,QACpB,4BAA4B;AAAA,QAC5B,YAAY;AAAA,QACZ,yBAAyB;AAAA,QACzB,qBAAqB;AAAA,QACrB,yBAAyB;AAAA,QACzB,GAAG;AAAA,MACL;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/config/openapi.ts","../../src/config/i18nCheck.ts","../../src/config/index.ts"],"sourcesContent":["/**\n * Standard OpenAPI-to-TypeScript generation configuration for Scalio frontends.\n *\n * Consumes the `openapi.json` exported by each Rust backend (`utoipa`) and produces\n * deterministic, readonly TypeScript definitions via `openapi-typescript`.\n */\n\nexport interface OpenApiTypegenConfig {\n /** Path to the OpenAPI 3.x specification file (default: `\"../openapi.json\"`). */\n readonly input: string;\n /** Output path for the generated `.d.ts` file (default: `\"src/api/schema.d.ts\"`). */\n readonly output: string;\n /** Emit `readonly` properties on generated object types (default: `true`). */\n readonly immutableTypes: boolean;\n /** Prefer `type` aliases over `interface` declarations (default: `true`). */\n readonly exportType: boolean;\n /** Sort generated keys alphabetically for minimal diffs (default: `true`). */\n readonly alphabetize: boolean;\n /** Emit `Record<string, unknown>` instead of `Record<string, never>` for open objects (default: `true`). */\n readonly emptyObjectsUnknown: boolean;\n}\n\nexport type OpenApiTypegenOverrides = Partial<OpenApiTypegenConfig>;\n\nexport const DEFAULT_OPENAPI_TYPEGEN_CONFIG: OpenApiTypegenConfig = {\n input: \"../openapi.json\",\n output: \"src/api/schema.d.ts\",\n immutableTypes: true,\n exportType: true,\n alphabetize: true,\n emptyObjectsUnknown: true,\n};\n\n/**\n * Returns the standard OpenAPI type generation configuration merged with optional overrides.\n */\nexport function createOpenApiTypegenConfig(\n overrides: OpenApiTypegenOverrides = {},\n): OpenApiTypegenConfig {\n return {\n ...DEFAULT_OPENAPI_TYPEGEN_CONFIG,\n ...overrides,\n };\n}\n\n/**\n * Builds the CLI argument list for `openapi-typescript` from a configuration object.\n *\n * Example usage in an app script:\n * `npx openapi-typescript ...buildOpenApiTypegenArgs()`\n */\nexport function buildOpenApiTypegenArgs(\n config: OpenApiTypegenOverrides = {},\n): readonly string[] {\n const resolved = createOpenApiTypegenConfig(config);\n const args: string[] = [resolved.input, \"-o\", resolved.output];\n\n if (resolved.immutableTypes) {\n args.push(\"--immutable\");\n }\n if (resolved.exportType) {\n args.push(\"--export-type\");\n }\n if (resolved.alphabetize) {\n args.push(\"--alphabetize\");\n }\n if (resolved.emptyObjectsUnknown) {\n args.push(\"--empty-objects-unknown\");\n }\n\n return args;\n}\n","/**\n * Translation catalog validator for Scalio frontends.\n *\n * Ensures that every target locale matches the English source catalog:\n * - No missing or orphan keys\n * - No empty translation values\n * - Identical `{placeholder}` / `{{placeholder}}` sets\n * - Swiss German spelling (no sharp-s `\\u00df`) in German catalogs\n */\n\nexport type I18nCatalog = Readonly<Record<string, string>>;\nexport type I18nCatalogMap = Readonly<Record<string, I18nCatalog>>;\n\nexport type I18nIssueKind =\n | \"missing-source-locale\"\n | \"missing-key\"\n | \"extra-key\"\n | \"empty-value\"\n | \"placeholder-mismatch\"\n | \"sharp-s\";\n\nexport interface I18nValidationIssue {\n readonly locale: string;\n readonly key: string;\n readonly kind: I18nIssueKind;\n readonly message: string;\n}\n\nexport interface I18nValidationOptions {\n /** Authoritative source locale (default: `\"en\"`). */\n readonly sourceLocale?: string;\n /** Report keys that exist in a target locale but not in the source locale (default: `true`). */\n readonly failOnExtraKeys?: boolean;\n /** Forbid sharp-s (`\\u00df`) in German locales (`de`, `de-*`, default: `true`). */\n readonly forbidSharpSInGerman?: boolean;\n /** Report empty or whitespace-only values (default: `true`). */\n readonly failOnEmptyValues?: boolean;\n}\n\nexport interface I18nValidationResult {\n readonly ok: boolean;\n readonly sourceLocale: string;\n readonly localesChecked: readonly string[];\n readonly issues: readonly I18nValidationIssue[];\n}\n\nconst PLACEHOLDER_RE = /\\{\\{\\s*([a-zA-Z0-9_.-]+)\\s*\\}\\}|\\{\\s*([a-zA-Z0-9_.-]+)\\s*\\}/g;\nconst SHARP_S = \"\\u00df\";\n\n/**\n * Extracts all unique `{name}` and `{{name}}` placeholders from a translation string,\n * sorted lexicographically for deterministic comparison.\n */\nexport function extractPlaceholders(text: string): readonly string[] {\n const found = new Set<string>();\n for (const match of text.matchAll(PLACEHOLDER_RE)) {\n const name = match[1] ?? match[2];\n if (name) {\n found.add(name);\n }\n }\n return Array.from(found).sort();\n}\n\nfunction isGermanLocale(locale: string): boolean {\n const lower = locale.toLowerCase();\n return lower === \"de\" || lower.startsWith(\"de-\") || lower.startsWith(\"de_\");\n}\n\nfunction sameStringList(a: readonly string[], b: readonly string[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i += 1) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\n/**\n * Validates a map of locale catalogs (e.g. `{ en: {...}, de: {...} }`) against\n * the source locale catalog.\n */\nexport function validateI18nCatalogs(\n catalogs: I18nCatalogMap,\n options: I18nValidationOptions = {},\n): I18nValidationResult {\n const sourceLocale = options.sourceLocale ?? \"en\";\n const failOnExtraKeys = options.failOnExtraKeys ?? true;\n const forbidSharpSInGerman = options.forbidSharpSInGerman ?? true;\n const failOnEmptyValues = options.failOnEmptyValues ?? true;\n\n const issues: I18nValidationIssue[] = [];\n const localeNames = Object.keys(catalogs).sort();\n const source = catalogs[sourceLocale];\n\n if (!source) {\n issues.push({\n locale: sourceLocale,\n key: \"*\",\n kind: \"missing-source-locale\",\n message: `Source locale \"${sourceLocale}\" is missing from catalogs.`,\n });\n return {\n ok: false,\n sourceLocale,\n localesChecked: localeNames,\n issues,\n };\n }\n\n const sourceKeys = Object.keys(source).sort();\n\n // Check source catalog itself for empty values.\n if (failOnEmptyValues) {\n for (const key of sourceKeys) {\n const sourceValue = source[key];\n if (sourceValue !== undefined && sourceValue.trim().length === 0) {\n issues.push({\n locale: sourceLocale,\n key,\n kind: \"empty-value\",\n message: `Empty translation value in source locale \"${sourceLocale}\" for key \"${key}\".`,\n });\n }\n }\n }\n\n for (const locale of localeNames) {\n if (locale === sourceLocale) continue;\n const target = catalogs[locale];\n if (!target) continue;\n const targetKeys = Object.keys(target).sort();\n const checkSharpS = forbidSharpSInGerman && isGermanLocale(locale);\n\n for (const key of sourceKeys) {\n if (!Object.prototype.hasOwnProperty.call(target, key)) {\n issues.push({\n locale,\n key,\n kind: \"missing-key\",\n message: `Locale \"${locale}\" is missing key \"${key}\".`,\n });\n continue;\n }\n\n const sourceValue = source[key] ?? \"\";\n const value = target[key] ?? \"\";\n if (failOnEmptyValues && value.trim().length === 0) {\n issues.push({\n locale,\n key,\n kind: \"empty-value\",\n message: `Empty translation value in locale \"${locale}\" for key \"${key}\".`,\n });\n }\n\n const expectedPlaceholders = extractPlaceholders(sourceValue);\n const actualPlaceholders = extractPlaceholders(value);\n if (!sameStringList(expectedPlaceholders, actualPlaceholders)) {\n issues.push({\n locale,\n key,\n kind: \"placeholder-mismatch\",\n message: `Placeholder mismatch in \"${locale}.${key}\": expected [${expectedPlaceholders.join(\", \")}], got [${actualPlaceholders.join(\", \")}].`,\n });\n }\n\n if (checkSharpS && value.includes(SHARP_S)) {\n issues.push({\n locale,\n key,\n kind: \"sharp-s\",\n message: `Locale \"${locale}\" key \"${key}\" contains forbidden sharp-s; use \"ss\" instead.`,\n });\n }\n }\n\n if (failOnExtraKeys) {\n for (const key of targetKeys) {\n if (!Object.prototype.hasOwnProperty.call(source, key)) {\n issues.push({\n locale,\n key,\n kind: \"extra-key\",\n message: `Locale \"${locale}\" contains unknown key \"${key}\" not present in \"${sourceLocale}\".`,\n });\n }\n }\n }\n }\n\n return {\n ok: issues.length === 0,\n sourceLocale,\n localesChecked: localeNames,\n issues,\n };\n}\n\n/**\n * Formats an `I18nValidationResult` as a human-readable CI report.\n */\nexport function formatI18nValidationReport(result: I18nValidationResult): string {\n if (result.ok) {\n return `i18n ok (${result.localesChecked.length} locales checked against \"${result.sourceLocale}\").`;\n }\n const lines = [\n `i18n validation failed (${result.issues.length} issue${result.issues.length === 1 ? \"\" : \"s\"}):`,\n ...result.issues.map((issue) => ` - [${issue.locale}] (${issue.kind}) ${issue.message}`),\n ];\n return lines.join(\"\\n\");\n}\n","/**\n * @scalio-cloud/ui/config — Shared build, styling and lint configuration helpers\n * for Scalio frontend apps (ADR 0151).\n */\n\nexport interface ScalioPostcssConfig {\n readonly plugins: {\n readonly tailwindcss: Record<string, never>;\n readonly autoprefixer: Record<string, never>;\n };\n}\n\n/**\n * Standard Tailwind `content` globs covering `@scalio-cloud/ui` (`shadcn/`, `react/`, and compiled `dist/`)\n * so Tailwind never purges utility classes used by shared components.\n */\nexport const SCALIO_UI_TAILWIND_CONTENT: readonly string[] = [\n \"./node_modules/@scalio-cloud/ui/shadcn/*.mjs\",\n \"./node_modules/@scalio-cloud/ui/react/*.js\",\n \"./node_modules/@scalio-cloud/ui/dist/**/*.{js,mjs}\",\n];\n\nexport interface CreateTailwindConfigOptions {\n readonly preset: Record<string, unknown>;\n readonly content?: readonly string[];\n readonly plugins?: readonly unknown[];\n}\n\n/**\n * Standard Tailwind 3 configuration shared across Scalio frontends.\n */\nexport function createTailwindConfig(options: CreateTailwindConfigOptions): Record<string, unknown> {\n const { preset, content = [\"./src/**/*.{js,jsx,ts,tsx}\", \"./index.html\"], plugins = [] } = options;\n return {\n presets: [preset],\n content: [...SCALIO_UI_TAILWIND_CONTENT, ...content],\n plugins: [...plugins],\n };\n}\n\n/**\n * Standard PostCSS configuration used across Scalio Tailwind 3 frontends.\n */\nexport function createPostcssConfig(): ScalioPostcssConfig {\n return {\n plugins: {\n tailwindcss: {},\n autoprefixer: {},\n },\n };\n}\n\nexport interface CreateEslintConfigOptions {\n readonly js: { readonly configs: { readonly recommended: Record<string, unknown> } };\n readonly globals: {\n readonly browser: Record<string, unknown>;\n readonly node: Record<string, unknown>;\n readonly vitest?: Record<string, unknown>;\n };\n readonly reactPlugin: unknown;\n readonly reactHooks: unknown;\n readonly ignores?: readonly string[];\n readonly rules?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * Standard flat ESLint configuration shared across Scalio React frontends.\n */\nexport function createEslintConfig(options: CreateEslintConfigOptions): readonly Record<string, unknown>[] {\n const { js, globals, reactPlugin, reactHooks, ignores = [], rules = {} } = options;\n return [\n {\n ignores: [\"build/**\", \"dist/**\", \"node_modules/**\", \"src/vendor/**\", \"**/*.d.ts\", ...ignores],\n },\n js.configs.recommended,\n {\n files: [\"**/*.{js,jsx,cjs,mjs}\"],\n linterOptions: {\n reportUnusedDisableDirectives: false,\n },\n languageOptions: {\n ecmaVersion: 2022,\n sourceType: \"module\",\n parserOptions: {\n ecmaFeatures: { jsx: true },\n },\n globals: {\n ...globals.browser,\n ...globals.node,\n ...(globals.vitest ?? {}),\n },\n },\n plugins: {\n react: reactPlugin,\n \"react-hooks\": reactHooks,\n },\n settings: {\n react: { version: \"detect\" },\n },\n rules: {\n \"no-unused-vars\": \"off\",\n \"no-undef\": \"off\",\n \"react/prop-types\": \"off\",\n \"react/react-in-jsx-scope\": \"off\",\n \"no-empty\": \"off\",\n \"no-constant-condition\": \"off\",\n \"no-useless-escape\": \"off\",\n \"no-prototype-builtins\": \"off\",\n ...rules,\n },\n },\n ];\n}\n\nexport {\n DEFAULT_OPENAPI_TYPEGEN_CONFIG,\n createOpenApiTypegenConfig,\n buildOpenApiTypegenArgs,\n type OpenApiTypegenConfig,\n type OpenApiTypegenOverrides,\n} from \"./openapi.js\";\n\nexport {\n extractPlaceholders,\n validateI18nCatalogs,\n formatI18nValidationReport,\n type I18nCatalog,\n type I18nCatalogMap,\n type I18nIssueKind,\n type I18nValidationIssue,\n type I18nValidationOptions,\n type I18nValidationResult,\n} from \"./i18nCheck.js\";\n"],"mappings":";AAwBO,IAAM,iCAAuD;AAAA,EAClE,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,qBAAqB;AACvB;AAKO,SAAS,2BACd,YAAqC,CAAC,GAChB;AACtB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAQO,SAAS,wBACd,SAAkC,CAAC,GAChB;AACnB,QAAM,WAAW,2BAA2B,MAAM;AAClD,QAAM,OAAiB,CAAC,SAAS,OAAO,MAAM,SAAS,MAAM;AAE7D,MAAI,SAAS,gBAAgB;AAC3B,SAAK,KAAK,aAAa;AAAA,EACzB;AACA,MAAI,SAAS,YAAY;AACvB,SAAK,KAAK,eAAe;AAAA,EAC3B;AACA,MAAI,SAAS,aAAa;AACxB,SAAK,KAAK,eAAe;AAAA,EAC3B;AACA,MAAI,SAAS,qBAAqB;AAChC,SAAK,KAAK,yBAAyB;AAAA,EACrC;AAEA,SAAO;AACT;;;ACzBA,IAAM,iBAAiB;AACvB,IAAM,UAAU;AAMT,SAAS,oBAAoB,MAAiC;A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F;AAKO,SAAS,sBAA2C;AACzD,SAAO;AAAA,IACL,SAAS;AAAA,MACP,aAAa,CAAC;AAAA,MACd,cAAc,CAAC;AAAA,IACjB;AAAA,EACF;AACF;AAkBO,SAAS,mBAAmB,SAAwE;AACzG,QAAM,EAAE,IAAI,SAAS,aAAa,YAAY,UAAU,CAAC,GAAG,QAAQ,CAAC,EAAE,IAAI;AAC3E,SAAO;AAAA,IACL;AAAA,MACE,SAAS,CAAC,YAAY,WAAW,mBAAmB,iBAAiB,aAAa,GAAG,OAAO;AAAA,IAC9F;AAAA,IACA,GAAG,QAAQ;AAAA,IACX;AAAA,MACE,OAAO,CAAC,uBAAuB;AAAA,MAC/B,eAAe;AAAA,QACb,+BAA+B;AAAA,MACjC;AAAA,MACA,iBAAiB;AAAA,QACf,aAAa;AAAA,QACb,YAAY;AAAA,QACZ,eAAe;AAAA,UACb,cAAc,EAAE,KAAK,KAAK;AAAA,QAC5B;AAAA,QACA,SAAS;AAAA,UACP,GAAG,QAAQ;AAAA,UACX,GAAG,QAAQ;AAAA,UACX,GAAI,QAAQ,UAAU,CAAC;AAAA,QACzB;AAAA,MACF;AAAA,MACA,SAAS;AAAA,QACP,OAAO;AAAA,QACP,eAAe;AAAA,MACjB;AAAA,MACA,UAAU;AAAA,QACR,OAAO,EAAE,SAAS,SAAS;AAAA,MAC7B;AAAA,MACA,OAAO;AAAA,QACL,kBAAkB;AAAA,QAClB,YAAY;AAAA,QACZ,oBAAoB;AAAA,QACpB,4BAA4B;AAAA,QAC5B,YAAY;AAAA,QACZ,yBAAyB;AAAA,QACzB,qBAAqB;AAAA,QACrB,yBAAyB;AAAA,QACzB,GAAG;AAAA,MACL;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
package/nav.css
CHANGED
|
@@ -359,12 +359,12 @@
|
|
|
359
359
|
.dark .scalio-badge.is-ok, .dark .scalio-kpi.is-ok .scalio-kpi-value { color: #4ade80; }
|
|
360
360
|
.dark .scalio-badge.is-warn, .dark .scalio-kpi.is-warn .scalio-kpi-value { color: #fbbf24; }
|
|
361
361
|
|
|
362
|
-
/* Settings page:
|
|
362
|
+
/* Settings page: top select on phones/tablets/narrow windows (before tables need horizontal scroll); left sub-nav from 1120px. */
|
|
363
363
|
/* No outer padding: the app's content area already has its own. */
|
|
364
364
|
.scalio-settings { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
|
|
365
|
-
@media (min-width:
|
|
365
|
+
@media (min-width: 1120px) { .scalio-settings { flex-direction: row; align-items: flex-start; gap: 2.5rem; } }
|
|
366
366
|
.scalio-settings-nav { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
|
|
367
|
-
@media (min-width:
|
|
367
|
+
@media (min-width: 1120px) { .scalio-settings-nav { width: 15rem; flex-shrink: 0; position: sticky; top: 1.5rem; } }
|
|
368
368
|
.scalio-settings-search {
|
|
369
369
|
display: flex; align-items: center; gap: 0.5rem; height: 2.25rem; padding: 0 0.625rem;
|
|
370
370
|
border: 1px solid hsl(var(--input)); border-radius: 2px; background: hsl(var(--background)); color: hsl(var(--muted-foreground));
|
|
@@ -375,9 +375,9 @@
|
|
|
375
375
|
display: block; height: 2.25rem; padding: 0 0.5rem; border: 1px solid hsl(var(--input)); border-radius: 2px;
|
|
376
376
|
background: hsl(var(--background)); color: hsl(var(--foreground)); font: inherit; font-size: 0.875rem;
|
|
377
377
|
}
|
|
378
|
-
/*
|
|
378
|
+
/* Below 1120px: only the select; the search filters the list, which compact viewports do not show. */
|
|
379
379
|
.scalio-settings-list, .scalio-settings-search { display: none; }
|
|
380
|
-
@media (min-width:
|
|
380
|
+
@media (min-width: 1120px) {
|
|
381
381
|
.scalio-settings-select { display: none; }
|
|
382
382
|
.scalio-settings-search { display: flex; }
|
|
383
383
|
.scalio-settings-list { display: flex; flex-direction: column; gap: 1rem; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.111.
|
|
3
|
+
"version": "0.111.2-dev.139",
|
|
4
4
|
"description": "Scalio Control Room design tokens, Tailwind preset, self-hosted fonts, the shared app header, sign-in layout, sidebar and page blocks",
|
|
5
5
|
"license": "SEE LICENSE IN README.md",
|
|
6
6
|
"private": false,
|