@tmorrow/cre8-wc 2.1.0 → 2.1.1
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/a2ui/catalog.compact.json +2 -2
- package/a2ui/catalog.json +2 -2
- package/a2ui/inert-props.json +1 -1
- package/lib/scripts/generate-react-wrappers.js +62 -0
- package/lib/scripts/generate-react-wrappers.js.map +1 -1
- package/mcp-manifest.json +1 -1
- package/package.json +3 -1
- package/react-manifest.json +2 -2
package/a2ui/catalog.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://cre8.dev/a2ui/catalogs/cre8-wc/2.
|
|
3
|
+
"$id": "https://cre8.dev/a2ui/catalogs/cre8-wc/2.1.1",
|
|
4
4
|
"title": "cre8-wc A2UI Catalog",
|
|
5
5
|
"description": "cre8 Web Components is a library of presentational UI web components to be consumed by # web applications.",
|
|
6
6
|
"x-native-events": [
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"x-a2ui": {
|
|
55
55
|
"catalogId": "cre8-wc",
|
|
56
56
|
"library": "@tmorrow/cre8-wc",
|
|
57
|
-
"libraryVersion": "2.
|
|
57
|
+
"libraryVersion": "2.1.1",
|
|
58
58
|
"tagPrefix": "cre8",
|
|
59
59
|
"framework": "Lit 3.3.1"
|
|
60
60
|
},
|
package/a2ui/inert-props.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "Generated by a2ui/render-audit.mjs. Props that are declared in the catalog but never reach the DOM — confirmed twice, by rendering under jsdom and by reading the component source. Setting one validates cleanly and does nothing.",
|
|
3
|
-
"libraryVersion": "2.
|
|
3
|
+
"libraryVersion": "2.1.1",
|
|
4
4
|
"components": {
|
|
5
5
|
"cre8-link-list-item": {
|
|
6
6
|
"text": {
|
|
@@ -291,6 +291,21 @@ async function main() {
|
|
|
291
291
|
},
|
|
292
292
|
},
|
|
293
293
|
files: ['dist'],
|
|
294
|
+
/**
|
|
295
|
+
* This package is published from its own directory, separately from
|
|
296
|
+
* cre8-wc, so cre8-wc's publish guards never see it. Without a guard of its
|
|
297
|
+
* own, a stale regeneration ships: the version and the `@tmorrow/cre8-wc`
|
|
298
|
+
* range here are both derived from the parent at generation time, so
|
|
299
|
+
* bumping the parent and publishing React without re-running
|
|
300
|
+
* `build:react` produces a package that misdescribes what it wraps.
|
|
301
|
+
*
|
|
302
|
+
* `prepack` covers `npm pack`; `prepublishOnly` covers `npm publish` from
|
|
303
|
+
* this directory. The checker is not in `files`, so it never ships.
|
|
304
|
+
*/
|
|
305
|
+
scripts: {
|
|
306
|
+
prepack: 'node ./check-version-sync.mjs',
|
|
307
|
+
prepublishOnly: 'node ./check-version-sync.mjs',
|
|
308
|
+
},
|
|
294
309
|
repository: {
|
|
295
310
|
type: 'git',
|
|
296
311
|
url: 'https://github.com/tmorrowdev/Cre8-Components.git',
|
|
@@ -307,6 +322,53 @@ async function main() {
|
|
|
307
322
|
},
|
|
308
323
|
};
|
|
309
324
|
fs.writeFileSync(path.join(outputDir, 'package.json'), JSON.stringify(packageJson, null, 2) + '\n');
|
|
325
|
+
// The guard the generated package.json points at. Compares this package
|
|
326
|
+
// against the cre8-wc it was generated from, so publishing a stale
|
|
327
|
+
// regeneration fails instead of shipping wrong metadata.
|
|
328
|
+
fs.writeFileSync(path.join(outputDir, 'check-version-sync.mjs'), `#!/usr/bin/env node
|
|
329
|
+
/**
|
|
330
|
+
* Refuses to pack or publish @tmorrow/cre8-react when it is out of sync with
|
|
331
|
+
* the @tmorrow/cre8-wc it wraps.
|
|
332
|
+
*
|
|
333
|
+
* Generated by scripts/generate-react-wrappers.ts — edit that, not this.
|
|
334
|
+
*/
|
|
335
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
336
|
+
import { dirname, join } from 'node:path';
|
|
337
|
+
import { fileURLToPath } from 'node:url';
|
|
338
|
+
|
|
339
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
340
|
+
const read = (p) => JSON.parse(readFileSync(p, 'utf8'));
|
|
341
|
+
|
|
342
|
+
const self = read(join(here, 'package.json'));
|
|
343
|
+
const parent = read(join(here, '..', 'package.json'));
|
|
344
|
+
const problems = [];
|
|
345
|
+
|
|
346
|
+
if (self.version !== parent.version) {
|
|
347
|
+
problems.push(
|
|
348
|
+
\`version \${self.version} does not match @tmorrow/cre8-wc \${parent.version}\`
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
const range = self.dependencies?.['@tmorrow/cre8-wc'];
|
|
353
|
+
if (range !== \`^\${parent.version}\`) {
|
|
354
|
+
problems.push(
|
|
355
|
+
\`depends on @tmorrow/cre8-wc \${range}, expected ^\${parent.version}\`
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (!existsSync(join(here, 'dist', 'index.js'))) {
|
|
360
|
+
problems.push('dist/index.js is missing — nothing would ship');
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (problems.length) {
|
|
364
|
+
console.error('@tmorrow/cre8-react is out of sync with @tmorrow/cre8-wc:');
|
|
365
|
+
for (const p of problems) console.error(' - ' + p);
|
|
366
|
+
console.error('\\nRegenerate with: pnpm --filter @tmorrow/cre8-wc build:react');
|
|
367
|
+
process.exit(1);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
console.log(\`ok — @tmorrow/cre8-react \${self.version} matches @tmorrow/cre8-wc\`);
|
|
371
|
+
`);
|
|
310
372
|
// Generate tsconfig.json
|
|
311
373
|
const tsconfig = {
|
|
312
374
|
compilerOptions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-react-wrappers.js","sourceRoot":"","sources":["../../scripts/generate-react-wrappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;A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gB,EAAE,SAAS;YAC3B,WAAW,EAAE,IAAI;YACjB,cAAc,EAAE,IAAI;YACpB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,GAAG;YACZ,MAAM,EAAE,IAAI;YACZ,eAAe,EAAE,IAAI;YACrB,YAAY,EAAE,IAAI;YAClB,GAAG,EAAE,WAAW;YAChB,KAAK,EAAE;gBACL,kBAAkB,EAAE,CAAC,QAAQ,CAAC;gBAC9B,oBAAoB,EAAE,CAAC,MAAM,CAAC;aAC/B;SACF;QACD,OAAO,EAAE,CAAC,UAAU,EAAE,qBAAqB,CAAC;QAC5C,OAAO,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC;KAClC,CAAC;IACF,EAAE,CAAC,aAAa,CACd,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,EACrC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CACzC,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,eAAe,mBAAmB,CAAC,MAAM,sBAAsB,SAAS,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n\ninterface Attribute {\n name: string;\n description?: string;\n type?: string;\n default?: string;\n}\n\ninterface Event {\n name: string;\n description?: string;\n}\n\ninterface Slot {\n name: string;\n description?: string;\n}\n\ninterface Tag {\n name: string;\n path: string;\n description?: string;\n attributes?: Attribute[];\n events?: Event[];\n slots?: Slot[];\n}\n\ninterface CustomElementsManifest {\n version?: string;\n schemaVersion?: string;\n tags?: Tag[];\n modules?: CemModule[];\n}\n\ninterface CemModule {\n kind: string;\n path: string;\n declarations?: CemDeclaration[];\n}\n\ninterface CemDeclaration {\n kind: string;\n name: string;\n tagName?: string;\n customElement?: boolean;\n description?: string;\n attributes?: Attribute[];\n events?: Event[];\n slots?: Slot[];\n}\n\n/**\n * Convert CEM v1 (modules/declarations) to the Tag[] format used by the generator.\n */\nfunction cemToTags(manifest: CustomElementsManifest): Tag[] {\n if (manifest.tags) return manifest.tags;\n if (!manifest.modules) return [];\n\n const tags: Tag[] = [];\n for (const mod of manifest.modules) {\n if (!mod.declarations) continue;\n for (const decl of mod.declarations) {\n if (decl.kind === 'class' && decl.tagName && decl.customElement) {\n tags.push({\n name: decl.tagName,\n path: './' + mod.path,\n description: decl.description,\n attributes: decl.attributes?.map(a => ({\n ...a,\n type: typeof a.type === 'object' && a.type !== null ? (a.type as any).text : a.type,\n })),\n events: decl.events,\n slots: decl.slots,\n });\n }\n }\n }\n return tags;\n}\n\nfunction toPascalCase(str: string): string {\n return str\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('');\n}\n\n/**\n * Types the wrapper re-exports rather than flattening to `any`.\n *\n * The flattened compound APIs (`columns`, `rows`, `items`, `steps`, `tags`) are\n * the whole reason a React consumer would reach for them, and a prop typed\n * `any` gives no autocomplete and catches no mistakes — which for a data-driven\n * table is most of the value. These interfaces are exported from the component\n * module the element class already comes from, so importing them is free.\n */\nconst FLATTENED_DATA_TYPES = new Set([\n 'Cre8TableColumn', 'Cre8TableRowData', 'Cre8TabItemData', 'Cre8AccordionItemData',\n 'Cre8ListItemData', 'Cre8LinkData', 'Cre8BreadcrumbData', 'Cre8TagData',\n 'Cre8CheckboxItemData', 'Cre8RadioItemData', 'Cre8ProgressStepData', 'Cre8DropdownItemData',\n]);\n\n/**\n * The flattened data type a prop refers to, if any — `Cre8TagData[]` → `Cre8TagData`.\n *\n * The manifest writes an optional property's type as `Cre8TagData[] | undefined`,\n * so the `| undefined` has to come off before matching. Missing that is why the\n * first cut of this silently produced `any` for every one of them.\n */\nexport function flattenedTypeOf(type: string | undefined): string | null {\n if (!type) return null;\n const bare = type\n .split('|')\n .map((part) => part.trim())\n .find((part) => part !== 'undefined' && part !== 'null');\n const match = bare ? /^(Cre8[A-Za-z]+)\\[\\]$/.exec(bare) : null;\n return match && FLATTENED_DATA_TYPES.has(match[1]) ? match[1] : null;\n}\n\nfunction getReactPropType(type: string | undefined): string {\n if (!type) return 'any';\n\n // Keep the flattened data types intact; they are the point of the React layer.\n const flattened = flattenedTypeOf(type);\n if (flattened) return `${flattened}[]`;\n\n // Handle truncated types (e.g., \"... 5 more ...\")\n if (type.includes('...') && type.includes('more')) {\n return 'string';\n }\n\n // Handle unknown/custom types that aren't standard\n const unknownTypes = [\n 'ChartTypeRegistry', 'CalendarModal', 'status', 'Color', 'Shape',\n 'Cre8SelectOption', 'Cre8SelectOptionGroup', 'Chart'\n ];\n for (const unknownType of unknownTypes) {\n if (type.includes(unknownType)) {\n return 'any';\n }\n }\n\n // Handle union types with only quoted strings\n if (type.includes('|')) {\n // Check if it's a valid union type (only strings, numbers, booleans, undefined, or quoted values)\n const parts = type.split('|').map(p => p.trim());\n const isValidUnion = parts.every(p =>\n p === 'undefined' ||\n p === 'string' ||\n p === 'number' ||\n p === 'boolean' ||\n p.startsWith('\"') ||\n p === 'string | undefined' ||\n p === 'number | undefined' ||\n p === 'boolean | undefined'\n );\n if (isValidUnion) {\n return type;\n }\n return 'any';\n }\n\n // Handle common types\n switch (type.toLowerCase()) {\n case 'string':\n return 'string';\n case 'number':\n return 'number';\n case 'boolean':\n case 'boolean | undefined':\n return 'boolean';\n default:\n // If it looks like a custom type (starts with capital letter), use any\n if (/^[A-Z]/.test(type)) {\n return 'any';\n }\n return type;\n }\n}\n\nfunction toValidEventName(eventName: string): string {\n // Convert dots and dashes to camelCase\n return eventName\n .split(/[.-]/)\n .map((part, index) =>\n index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)\n )\n .join('');\n}\n\nfunction generateReactWrapper(tag: Tag): string {\n const componentName = toPascalCase(tag.name);\n const elementClassName = componentName;\n const tagName = tag.name;\n\n // Get the import path from the tag path\n const importPath = tag.path\n .replace('./components/', '')\n .replace('.ts', '');\n\n // Generate props interface\n const propsLines: string[] = [];\n\n if (tag.attributes) {\n for (const attr of tag.attributes) {\n const propName = attr.name.includes('-')\n ? attr.name.replace(/-([a-z])/g, (_, c) => c.toUpperCase())\n : attr.name;\n const propType = getReactPropType(attr.type);\n const description = attr.description ? ` /** ${attr.description.trim().replace(/\\n/g, ' ')} */\\n` : '';\n propsLines.push(`${description} ${propName}?: ${propType};`);\n }\n }\n\n // Add children prop for slots\n if (tag.slots && tag.slots.length > 0) {\n propsLines.push(' children?: React.ReactNode;');\n }\n\n // Generate event props\n const eventProps: string[] = [];\n if (tag.events) {\n for (const event of tag.events) {\n const validEventName = toValidEventName(event.name);\n const eventPropName = 'on' + validEventName.charAt(0).toUpperCase() + validEventName.slice(1);\n eventProps.push(` ${eventPropName}?: (event: CustomEvent) => void;`);\n }\n }\n\n const allProps = [...propsLines, ...eventProps].join('\\n');\n\n const dataTypes = [\n ...new Set(\n (tag.attributes ?? [])\n .map((attr) => flattenedTypeOf(attr.type))\n .filter((name): name is string => Boolean(name))\n ),\n ];\n const dataTypeImport = dataTypes.length\n ? `\\nexport type { ${dataTypes.join(', ')} } from '@tmorrow/cre8-wc/lib/components/${importPath}';`\n : '';\n\n // Generate the component\n return `import { createComponent } from '@lit/react';\nimport { ${elementClassName} as ${elementClassName}Element } from '@tmorrow/cre8-wc/lib/components/${importPath}';\nimport type { ${dataTypes.join(', ')} } from '@tmorrow/cre8-wc/lib/components/${importPath}';\nimport React from 'react';${dataTypeImport}`.replace(\n dataTypes.length ? '' : `import type { } from '@tmorrow/cre8-wc/lib/components/${importPath}';\\n`,\n ''\n ) + `\n\nexport interface ${componentName}Props {\n${allProps}\n}\n\n/**\n * ${tag.description?.trim().split('\\n')[0] || componentName + ' component'}\n */\nexport const ${componentName} = createComponent({\n react: React,\n tagName: '${tagName}',\n elementClass: ${elementClassName}Element,\n${tag.events && tag.events.length > 0 ? ` events: {\n${tag.events.map(e => {\n const validEventName = toValidEventName(e.name);\n const eventPropName = 'on' + validEventName.charAt(0).toUpperCase() + validEventName.slice(1);\n return ` ${eventPropName}: '${e.name}'`;\n }).join(',\\n')}\n }` : ''}\n});\n\nexport default ${componentName};\n`;\n}\n\nfunction generateIndexFile(tags: Tag[]): string {\n // Track which components are exported from which folder\n const folderExports = new Map<string, string[]>();\n\n for (const tag of tags) {\n if (!tag.name.startsWith('cre8-')) continue;\n\n const componentName = toPascalCase(tag.name);\n const importPath = tag.path\n .replace('./components/', '')\n .replace('.ts', '');\n const folderName = toPascalCase(importPath.split('/')[0]);\n\n if (!folderExports.has(folderName)) {\n folderExports.set(folderName, []);\n }\n folderExports.get(folderName)!.push(componentName);\n }\n\n const exports: string[] = [];\n for (const [folderName, components] of folderExports) {\n // Only export the main component (one matching folder name with Cre8 prefix)\n const expectedName = 'Cre8' + folderName;\n const mainComponent = components.find(c => c === expectedName) || components[0];\n exports.push(`export { ${mainComponent} } from './components/${folderName}';`);\n }\n\n return `// Auto-generated React wrappers\n${exports.join('\\n')}\n`;\n}\n\nasync function main() {\n const manifestPath = path.join(process.cwd(), 'custom-elements.json');\n const outputDir = path.join(process.cwd(), 'react-wrappers');\n\n // Read manifest\n const manifest: CustomElementsManifest = JSON.parse(\n fs.readFileSync(manifestPath, 'utf-8')\n );\n\n // Create output directory\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n\n const componentsDir = path.join(outputDir, 'components');\n if (!fs.existsSync(componentsDir)) {\n fs.mkdirSync(componentsDir, { recursive: true });\n }\n\n // Convert manifest to tags format\n const tags = cemToTags(manifest);\n\n // Generate wrapper for each tag\n const generatedComponents: string[] = [];\n\n for (const tag of tags) {\n if (!tag.name.startsWith('cre8-')) continue;\n\n const componentName = toPascalCase(tag.name);\n const folderName = tag.path\n .replace('./components/', '')\n .replace('.ts', '')\n .split('/')[0];\n\n const componentDir = path.join(componentsDir, toPascalCase(folderName));\n if (!fs.existsSync(componentDir)) {\n fs.mkdirSync(componentDir, { recursive: true });\n }\n\n const wrapperCode = generateReactWrapper(tag);\n const outputPath = path.join(componentDir, `${componentName}.tsx`);\n\n fs.writeFileSync(outputPath, wrapperCode);\n\n // Also create index.tsx\n fs.writeFileSync(\n path.join(componentDir, 'index.tsx'),\n `export * from './${componentName}';\\n`\n );\n\n generatedComponents.push(componentName);\n console.log(`Generated: ${componentName}`);\n }\n\n // Generate main index file\n const indexContent = generateIndexFile(tags);\n fs.writeFileSync(path.join(outputDir, 'index.ts'), indexContent);\n\n // Read parent package version for syncing\n const parentPkg = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf-8'));\n const version = parentPkg.version;\n\n // Generate package.json\n const packageJson = {\n name: '@tmorrow/cre8-react',\n version,\n description: 'React wrappers for cre8 Web Components (@tmorrow/cre8-wc)',\n license: parentPkg.license || 'MIT',\n type: 'module',\n main: 'dist/index.js',\n types: 'dist/index.d.ts',\n module: 'dist/index.js',\n exports: {\n '.': {\n import: './dist/index.js',\n types: './dist/index.d.ts',\n },\n './components/*': {\n import: './dist/components/*',\n types: './dist/components/*',\n },\n },\n files: ['dist'],\n repository: {\n type: 'git',\n url: 'https://github.com/tmorrowdev/Cre8-Components.git',\n directory: 'packages/cre8-wc/react-wrappers',\n },\n keywords: ['react', 'web-components', 'lit', 'cre8', 'design-system'],\n peerDependencies: {\n react: '>=18',\n 'react-dom': '>=18',\n },\n dependencies: {\n '@lit/react': parentPkg.dependencies?.['@lit/react'] || '^1.0.8',\n '@tmorrow/cre8-wc': `^${version}`,\n },\n };\n fs.writeFileSync(\n path.join(outputDir, 'package.json'),\n JSON.stringify(packageJson, null, 2) + '\\n'\n );\n\n // Generate tsconfig.json\n const tsconfig = {\n compilerOptions: {\n target: 'ES2021',\n module: 'ESNext',\n moduleResolution: 'bundler',\n declaration: true,\n declarationMap: true,\n outDir: 'dist',\n rootDir: '.',\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n jsx: 'react-jsx',\n paths: {\n '@tmorrow/cre8-wc': ['../lib'],\n '@tmorrow/cre8-wc/*': ['../*'],\n },\n },\n include: ['index.ts', 'components/**/*.tsx'],\n exclude: ['dist', 'node_modules'],\n };\n fs.writeFileSync(\n path.join(outputDir, 'tsconfig.json'),\n JSON.stringify(tsconfig, null, 2) + '\\n'\n );\n\n console.log(`\\nGenerated ${generatedComponents.length} React wrappers in ${outputDir}`);\n}\n\nmain().catch(console.error);\n"]}
|
|
1
|
+
{"version":3,"file":"generate-react-wrappers.js","sourceRoot":"","sources":["../../scripts/generate-react-wrappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAoD7B;;GAEG;AACH,SAAS,SAAS,CAAC,QAAgC;IACjD,IAAI,QAAQ,CAAC,IAAI;QAAE,OAAO,QAAQ,CAAC,IAAI,CAAC;IACxC,IAAI,CAAC,QAAQ,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAEjC,MAAM,IAAI,GAAU,EAAE,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,GAAG,CAAC,YAAY;YAAE,SAAS;QAChC,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;YACpC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBAChE,IAAI,CAAC,IAAI,CAAC;oBACR,IAAI,EAAE,IAAI,CAAC,OAAO;oBAClB,IAAI,EAAE,IAAI,GAAG,GAAG,CAAC,IAAI;oBACrB,WAAW,EAAE,IAAI,CAAC,WAAW;oBAC7B,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;wBACrC,GAAG,CAAC;wBACJ,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,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,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CACzC,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,eAAe,mBAAmB,CAAC,MAAM,sBAAsB,SAAS,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n\ninterface Attribute {\n name: string;\n description?: string;\n type?: string;\n default?: string;\n}\n\ninterface Event {\n name: string;\n description?: string;\n}\n\ninterface Slot {\n name: string;\n description?: string;\n}\n\ninterface Tag {\n name: string;\n path: string;\n description?: string;\n attributes?: Attribute[];\n events?: Event[];\n slots?: Slot[];\n}\n\ninterface CustomElementsManifest {\n version?: string;\n schemaVersion?: string;\n tags?: Tag[];\n modules?: CemModule[];\n}\n\ninterface CemModule {\n kind: string;\n path: string;\n declarations?: CemDeclaration[];\n}\n\ninterface CemDeclaration {\n kind: string;\n name: string;\n tagName?: string;\n customElement?: boolean;\n description?: string;\n attributes?: Attribute[];\n events?: Event[];\n slots?: Slot[];\n}\n\n/**\n * Convert CEM v1 (modules/declarations) to the Tag[] format used by the generator.\n */\nfunction cemToTags(manifest: CustomElementsManifest): Tag[] {\n if (manifest.tags) return manifest.tags;\n if (!manifest.modules) return [];\n\n const tags: Tag[] = [];\n for (const mod of manifest.modules) {\n if (!mod.declarations) continue;\n for (const decl of mod.declarations) {\n if (decl.kind === 'class' && decl.tagName && decl.customElement) {\n tags.push({\n name: decl.tagName,\n path: './' + mod.path,\n description: decl.description,\n attributes: decl.attributes?.map(a => ({\n ...a,\n type: typeof a.type === 'object' && a.type !== null ? (a.type as any).text : a.type,\n })),\n events: decl.events,\n slots: decl.slots,\n });\n }\n }\n }\n return tags;\n}\n\nfunction toPascalCase(str: string): string {\n return str\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('');\n}\n\n/**\n * Types the wrapper re-exports rather than flattening to `any`.\n *\n * The flattened compound APIs (`columns`, `rows`, `items`, `steps`, `tags`) are\n * the whole reason a React consumer would reach for them, and a prop typed\n * `any` gives no autocomplete and catches no mistakes — which for a data-driven\n * table is most of the value. These interfaces are exported from the component\n * module the element class already comes from, so importing them is free.\n */\nconst FLATTENED_DATA_TYPES = new Set([\n 'Cre8TableColumn', 'Cre8TableRowData', 'Cre8TabItemData', 'Cre8AccordionItemData',\n 'Cre8ListItemData', 'Cre8LinkData', 'Cre8BreadcrumbData', 'Cre8TagData',\n 'Cre8CheckboxItemData', 'Cre8RadioItemData', 'Cre8ProgressStepData', 'Cre8DropdownItemData',\n]);\n\n/**\n * The flattened data type a prop refers to, if any — `Cre8TagData[]` → `Cre8TagData`.\n *\n * The manifest writes an optional property's type as `Cre8TagData[] | undefined`,\n * so the `| undefined` has to come off before matching. Missing that is why the\n * first cut of this silently produced `any` for every one of them.\n */\nexport function flattenedTypeOf(type: string | undefined): string | null {\n if (!type) return null;\n const bare = type\n .split('|')\n .map((part) => part.trim())\n .find((part) => part !== 'undefined' && part !== 'null');\n const match = bare ? /^(Cre8[A-Za-z]+)\\[\\]$/.exec(bare) : null;\n return match && FLATTENED_DATA_TYPES.has(match[1]) ? match[1] : null;\n}\n\nfunction getReactPropType(type: string | undefined): string {\n if (!type) return 'any';\n\n // Keep the flattened data types intact; they are the point of the React layer.\n const flattened = flattenedTypeOf(type);\n if (flattened) return `${flattened}[]`;\n\n // Handle truncated types (e.g., \"... 5 more ...\")\n if (type.includes('...') && type.includes('more')) {\n return 'string';\n }\n\n // Handle unknown/custom types that aren't standard\n const unknownTypes = [\n 'ChartTypeRegistry', 'CalendarModal', 'status', 'Color', 'Shape',\n 'Cre8SelectOption', 'Cre8SelectOptionGroup', 'Chart'\n ];\n for (const unknownType of unknownTypes) {\n if (type.includes(unknownType)) {\n return 'any';\n }\n }\n\n // Handle union types with only quoted strings\n if (type.includes('|')) {\n // Check if it's a valid union type (only strings, numbers, booleans, undefined, or quoted values)\n const parts = type.split('|').map(p => p.trim());\n const isValidUnion = parts.every(p =>\n p === 'undefined' ||\n p === 'string' ||\n p === 'number' ||\n p === 'boolean' ||\n p.startsWith('\"') ||\n p === 'string | undefined' ||\n p === 'number | undefined' ||\n p === 'boolean | undefined'\n );\n if (isValidUnion) {\n return type;\n }\n return 'any';\n }\n\n // Handle common types\n switch (type.toLowerCase()) {\n case 'string':\n return 'string';\n case 'number':\n return 'number';\n case 'boolean':\n case 'boolean | undefined':\n return 'boolean';\n default:\n // If it looks like a custom type (starts with capital letter), use any\n if (/^[A-Z]/.test(type)) {\n return 'any';\n }\n return type;\n }\n}\n\nfunction toValidEventName(eventName: string): string {\n // Convert dots and dashes to camelCase\n return eventName\n .split(/[.-]/)\n .map((part, index) =>\n index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)\n )\n .join('');\n}\n\nfunction generateReactWrapper(tag: Tag): string {\n const componentName = toPascalCase(tag.name);\n const elementClassName = componentName;\n const tagName = tag.name;\n\n // Get the import path from the tag path\n const importPath = tag.path\n .replace('./components/', '')\n .replace('.ts', '');\n\n // Generate props interface\n const propsLines: string[] = [];\n\n if (tag.attributes) {\n for (const attr of tag.attributes) {\n const propName = attr.name.includes('-')\n ? attr.name.replace(/-([a-z])/g, (_, c) => c.toUpperCase())\n : attr.name;\n const propType = getReactPropType(attr.type);\n const description = attr.description ? ` /** ${attr.description.trim().replace(/\\n/g, ' ')} */\\n` : '';\n propsLines.push(`${description} ${propName}?: ${propType};`);\n }\n }\n\n // Add children prop for slots\n if (tag.slots && tag.slots.length > 0) {\n propsLines.push(' children?: React.ReactNode;');\n }\n\n // Generate event props\n const eventProps: string[] = [];\n if (tag.events) {\n for (const event of tag.events) {\n const validEventName = toValidEventName(event.name);\n const eventPropName = 'on' + validEventName.charAt(0).toUpperCase() + validEventName.slice(1);\n eventProps.push(` ${eventPropName}?: (event: CustomEvent) => void;`);\n }\n }\n\n const allProps = [...propsLines, ...eventProps].join('\\n');\n\n const dataTypes = [\n ...new Set(\n (tag.attributes ?? [])\n .map((attr) => flattenedTypeOf(attr.type))\n .filter((name): name is string => Boolean(name))\n ),\n ];\n const dataTypeImport = dataTypes.length\n ? `\\nexport type { ${dataTypes.join(', ')} } from '@tmorrow/cre8-wc/lib/components/${importPath}';`\n : '';\n\n // Generate the component\n return `import { createComponent } from '@lit/react';\nimport { ${elementClassName} as ${elementClassName}Element } from '@tmorrow/cre8-wc/lib/components/${importPath}';\nimport type { ${dataTypes.join(', ')} } from '@tmorrow/cre8-wc/lib/components/${importPath}';\nimport React from 'react';${dataTypeImport}`.replace(\n dataTypes.length ? '' : `import type { } from '@tmorrow/cre8-wc/lib/components/${importPath}';\\n`,\n ''\n ) + `\n\nexport interface ${componentName}Props {\n${allProps}\n}\n\n/**\n * ${tag.description?.trim().split('\\n')[0] || componentName + ' component'}\n */\nexport const ${componentName} = createComponent({\n react: React,\n tagName: '${tagName}',\n elementClass: ${elementClassName}Element,\n${tag.events && tag.events.length > 0 ? ` events: {\n${tag.events.map(e => {\n const validEventName = toValidEventName(e.name);\n const eventPropName = 'on' + validEventName.charAt(0).toUpperCase() + validEventName.slice(1);\n return ` ${eventPropName}: '${e.name}'`;\n }).join(',\\n')}\n }` : ''}\n});\n\nexport default ${componentName};\n`;\n}\n\nfunction generateIndexFile(tags: Tag[]): string {\n // Track which components are exported from which folder\n const folderExports = new Map<string, string[]>();\n\n for (const tag of tags) {\n if (!tag.name.startsWith('cre8-')) continue;\n\n const componentName = toPascalCase(tag.name);\n const importPath = tag.path\n .replace('./components/', '')\n .replace('.ts', '');\n const folderName = toPascalCase(importPath.split('/')[0]);\n\n if (!folderExports.has(folderName)) {\n folderExports.set(folderName, []);\n }\n folderExports.get(folderName)!.push(componentName);\n }\n\n const exports: string[] = [];\n for (const [folderName, components] of folderExports) {\n // Only export the main component (one matching folder name with Cre8 prefix)\n const expectedName = 'Cre8' + folderName;\n const mainComponent = components.find(c => c === expectedName) || components[0];\n exports.push(`export { ${mainComponent} } from './components/${folderName}';`);\n }\n\n return `// Auto-generated React wrappers\n${exports.join('\\n')}\n`;\n}\n\nasync function main() {\n const manifestPath = path.join(process.cwd(), 'custom-elements.json');\n const outputDir = path.join(process.cwd(), 'react-wrappers');\n\n // Read manifest\n const manifest: CustomElementsManifest = JSON.parse(\n fs.readFileSync(manifestPath, 'utf-8')\n );\n\n // Create output directory\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n\n const componentsDir = path.join(outputDir, 'components');\n if (!fs.existsSync(componentsDir)) {\n fs.mkdirSync(componentsDir, { recursive: true });\n }\n\n // Convert manifest to tags format\n const tags = cemToTags(manifest);\n\n // Generate wrapper for each tag\n const generatedComponents: string[] = [];\n\n for (const tag of tags) {\n if (!tag.name.startsWith('cre8-')) continue;\n\n const componentName = toPascalCase(tag.name);\n const folderName = tag.path\n .replace('./components/', '')\n .replace('.ts', '')\n .split('/')[0];\n\n const componentDir = path.join(componentsDir, toPascalCase(folderName));\n if (!fs.existsSync(componentDir)) {\n fs.mkdirSync(componentDir, { recursive: true });\n }\n\n const wrapperCode = generateReactWrapper(tag);\n const outputPath = path.join(componentDir, `${componentName}.tsx`);\n\n fs.writeFileSync(outputPath, wrapperCode);\n\n // Also create index.tsx\n fs.writeFileSync(\n path.join(componentDir, 'index.tsx'),\n `export * from './${componentName}';\\n`\n );\n\n generatedComponents.push(componentName);\n console.log(`Generated: ${componentName}`);\n }\n\n // Generate main index file\n const indexContent = generateIndexFile(tags);\n fs.writeFileSync(path.join(outputDir, 'index.ts'), indexContent);\n\n // Read parent package version for syncing\n const parentPkg = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf-8'));\n const version = parentPkg.version;\n\n // Generate package.json\n const packageJson = {\n name: '@tmorrow/cre8-react',\n version,\n description: 'React wrappers for cre8 Web Components (@tmorrow/cre8-wc)',\n license: parentPkg.license || 'MIT',\n type: 'module',\n main: 'dist/index.js',\n types: 'dist/index.d.ts',\n module: 'dist/index.js',\n exports: {\n '.': {\n import: './dist/index.js',\n types: './dist/index.d.ts',\n },\n './components/*': {\n import: './dist/components/*',\n types: './dist/components/*',\n },\n },\n files: ['dist'],\n /**\n * This package is published from its own directory, separately from\n * cre8-wc, so cre8-wc's publish guards never see it. Without a guard of its\n * own, a stale regeneration ships: the version and the `@tmorrow/cre8-wc`\n * range here are both derived from the parent at generation time, so\n * bumping the parent and publishing React without re-running\n * `build:react` produces a package that misdescribes what it wraps.\n *\n * `prepack` covers `npm pack`; `prepublishOnly` covers `npm publish` from\n * this directory. The checker is not in `files`, so it never ships.\n */\n scripts: {\n prepack: 'node ./check-version-sync.mjs',\n prepublishOnly: 'node ./check-version-sync.mjs',\n },\n repository: {\n type: 'git',\n url: 'https://github.com/tmorrowdev/Cre8-Components.git',\n directory: 'packages/cre8-wc/react-wrappers',\n },\n keywords: ['react', 'web-components', 'lit', 'cre8', 'design-system'],\n peerDependencies: {\n react: '>=18',\n 'react-dom': '>=18',\n },\n dependencies: {\n '@lit/react': parentPkg.dependencies?.['@lit/react'] || '^1.0.8',\n '@tmorrow/cre8-wc': `^${version}`,\n },\n };\n fs.writeFileSync(\n path.join(outputDir, 'package.json'),\n JSON.stringify(packageJson, null, 2) + '\\n'\n );\n\n // The guard the generated package.json points at. Compares this package\n // against the cre8-wc it was generated from, so publishing a stale\n // regeneration fails instead of shipping wrong metadata.\n fs.writeFileSync(\n path.join(outputDir, 'check-version-sync.mjs'),\n `#!/usr/bin/env node\n/**\n * Refuses to pack or publish @tmorrow/cre8-react when it is out of sync with\n * the @tmorrow/cre8-wc it wraps.\n *\n * Generated by scripts/generate-react-wrappers.ts — edit that, not this.\n */\nimport { readFileSync, existsSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst here = dirname(fileURLToPath(import.meta.url));\nconst read = (p) => JSON.parse(readFileSync(p, 'utf8'));\n\nconst self = read(join(here, 'package.json'));\nconst parent = read(join(here, '..', 'package.json'));\nconst problems = [];\n\nif (self.version !== parent.version) {\n problems.push(\n \\`version \\${self.version} does not match @tmorrow/cre8-wc \\${parent.version}\\`\n );\n}\n\nconst range = self.dependencies?.['@tmorrow/cre8-wc'];\nif (range !== \\`^\\${parent.version}\\`) {\n problems.push(\n \\`depends on @tmorrow/cre8-wc \\${range}, expected ^\\${parent.version}\\`\n );\n}\n\nif (!existsSync(join(here, 'dist', 'index.js'))) {\n problems.push('dist/index.js is missing — nothing would ship');\n}\n\nif (problems.length) {\n console.error('@tmorrow/cre8-react is out of sync with @tmorrow/cre8-wc:');\n for (const p of problems) console.error(' - ' + p);\n console.error('\\\\nRegenerate with: pnpm --filter @tmorrow/cre8-wc build:react');\n process.exit(1);\n}\n\nconsole.log(\\`ok — @tmorrow/cre8-react \\${self.version} matches @tmorrow/cre8-wc\\`);\n`\n );\n\n // Generate tsconfig.json\n const tsconfig = {\n compilerOptions: {\n target: 'ES2021',\n module: 'ESNext',\n moduleResolution: 'bundler',\n declaration: true,\n declarationMap: true,\n outDir: 'dist',\n rootDir: '.',\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n jsx: 'react-jsx',\n paths: {\n '@tmorrow/cre8-wc': ['../lib'],\n '@tmorrow/cre8-wc/*': ['../*'],\n },\n },\n include: ['index.ts', 'components/**/*.tsx'],\n exclude: ['dist', 'node_modules'],\n };\n fs.writeFileSync(\n path.join(outputDir, 'tsconfig.json'),\n JSON.stringify(tsconfig, null, 2) + '\\n'\n );\n\n console.log(`\\nGenerated ${generatedComponents.length} React wrappers in ${outputDir}`);\n}\n\nmain().catch(console.error);\n"]}
|
package/mcp-manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmorrow/cre8-wc",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "cre8 Web Components is a library of presentational UI web components to be consumed by # web applications.",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "pnpm run build:custom-elements.json && pnpm run storybook",
|
|
8
8
|
"compile-styles": "npx tsx scripts/convert-scss-to-ts.ts",
|
|
9
9
|
"build": "rm -rf lib && pnpm run compile-styles && pnpm build:cdn && vite build && tsc && cp .storybook/custom-elements.json custom-elements.json && pnpm run build:react && pnpm run build:mcp-manifest && pnpm run build:react-manifest",
|
|
10
|
+
"prepack": "node a2ui/check-layer-parity.mjs",
|
|
11
|
+
"prepublishOnly": "node a2ui/check-layer-parity.mjs",
|
|
10
12
|
"build:mcp-manifest": "npx web-component-analyzer analyze \"components/**/*.ts\" --format json --outFile /tmp/wca-raw.json && npx tsx scripts/generate-mcp-manifest.ts",
|
|
11
13
|
"build:react-manifest": "npx tsx scripts/generate-react-manifest.ts",
|
|
12
14
|
"build:cdn": "rm -rf cdn && vite build --config vite.config.cdn.ts",
|
package/react-manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.
|
|
2
|
+
"version": "2.1.1",
|
|
3
3
|
"library": "@tmorrow/cre8-react",
|
|
4
4
|
"componentPrefix": "Cre8",
|
|
5
5
|
"description": "React wrappers for cre8 Web Components (@tmorrow/cre8-wc)",
|
|
@@ -3693,7 +3693,7 @@
|
|
|
3693
3693
|
},
|
|
3694
3694
|
"dependencies": {
|
|
3695
3695
|
"@lit/react": "^1.0.8",
|
|
3696
|
-
"@tmorrow/cre8-wc": "^2.1.
|
|
3696
|
+
"@tmorrow/cre8-wc": "^2.1.1",
|
|
3697
3697
|
"react": ">=18",
|
|
3698
3698
|
"react-dom": ">=18"
|
|
3699
3699
|
}
|