@tony-ui-library/core 0.0.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/README.md +188 -0
- package/fesm2022/tony-ui-library-core.mjs +8756 -0
- package/fesm2022/tony-ui-library-core.mjs.map +1 -0
- package/package.json +55 -0
- package/schematics/collection.json +16 -0
- package/schematics/ng-add/index.d.ts +5 -0
- package/schematics/ng-add/index.js +53 -0
- package/schematics/ng-add/schema.json +19 -0
- package/schematics/ng-generate/component/index.d.ts +9 -0
- package/schematics/ng-generate/component/index.js +439 -0
- package/schematics/ng-generate/component/schema.json +32 -0
- package/src/lib/accordion/accordion.directives.spec.ts +173 -0
- package/src/lib/accordion/accordion.directives.ts +143 -0
- package/src/lib/accordion/index.ts +8 -0
- package/src/lib/alert/alert.directives.spec.ts +154 -0
- package/src/lib/alert/alert.directives.ts +67 -0
- package/src/lib/alert/alert.variants.ts +25 -0
- package/src/lib/alert/index.ts +6 -0
- package/src/lib/avatar/avatar.component.spec.ts +75 -0
- package/src/lib/avatar/avatar.component.ts +43 -0
- package/src/lib/avatar/avatar.variants.ts +26 -0
- package/src/lib/avatar/index.ts +2 -0
- package/src/lib/avatar-group/avatar-group.component.spec.ts +74 -0
- package/src/lib/avatar-group/avatar-group.component.ts +88 -0
- package/src/lib/avatar-group/index.ts +1 -0
- package/src/lib/badge/badge.directive.spec.ts +74 -0
- package/src/lib/badge/badge.directive.ts +17 -0
- package/src/lib/badge/badge.variants.ts +29 -0
- package/src/lib/badge/index.ts +2 -0
- package/src/lib/breadcrumb/breadcrumb.directives.spec.ts +80 -0
- package/src/lib/breadcrumb/breadcrumb.directives.ts +78 -0
- package/src/lib/breadcrumb/index.ts +8 -0
- package/src/lib/button/button.directive.spec.ts +92 -0
- package/src/lib/button/button.directive.ts +28 -0
- package/src/lib/button/button.variants.ts +30 -0
- package/src/lib/button/index.ts +2 -0
- package/src/lib/button-group/button-group.directive.spec.ts +46 -0
- package/src/lib/button-group/button-group.directive.ts +19 -0
- package/src/lib/button-group/button-group.variants.ts +18 -0
- package/src/lib/button-group/index.ts +2 -0
- package/src/lib/calendar/calendar.component.spec.ts +192 -0
- package/src/lib/calendar/calendar.component.ts +342 -0
- package/src/lib/calendar/calendar.types.ts +24 -0
- package/src/lib/calendar/index.ts +7 -0
- package/src/lib/card/card.directives.spec.ts +104 -0
- package/src/lib/card/card.directives.ts +72 -0
- package/src/lib/card/card.variants.ts +28 -0
- package/src/lib/card/index.ts +9 -0
- package/src/lib/carousel/carousel.directives.spec.ts +85 -0
- package/src/lib/carousel/carousel.directives.ts +159 -0
- package/src/lib/carousel/index.ts +8 -0
- package/src/lib/chat-bubble/chat-bubble.directives.spec.ts +52 -0
- package/src/lib/chat-bubble/chat-bubble.directives.ts +96 -0
- package/src/lib/chat-bubble/index.ts +11 -0
- package/src/lib/checkbox/checkbox.directive.spec.ts +57 -0
- package/src/lib/checkbox/checkbox.directive.ts +16 -0
- package/src/lib/checkbox/checkbox.variants.ts +19 -0
- package/src/lib/checkbox/index.ts +2 -0
- package/src/lib/color-picker/color-picker.component.spec.ts +328 -0
- package/src/lib/color-picker/color-picker.component.ts +537 -0
- package/src/lib/color-picker/color-picker.types.ts +24 -0
- package/src/lib/color-picker/color-picker.utils.ts +183 -0
- package/src/lib/color-picker/color-picker.variants.ts +17 -0
- package/src/lib/color-picker/index.ts +20 -0
- package/src/lib/combobox/combobox.component.spec.ts +151 -0
- package/src/lib/combobox/combobox.component.ts +264 -0
- package/src/lib/combobox/combobox.variants.ts +19 -0
- package/src/lib/combobox/index.ts +2 -0
- package/src/lib/command-palette/command-palette.component.spec.ts +178 -0
- package/src/lib/command-palette/command-palette.component.ts +194 -0
- package/src/lib/command-palette/command-palette.service.ts +36 -0
- package/src/lib/command-palette/command-palette.types.ts +23 -0
- package/src/lib/command-palette/index.ts +7 -0
- package/src/lib/data-table/data-table.component.spec.ts +443 -0
- package/src/lib/data-table/data-table.component.ts +622 -0
- package/src/lib/data-table/data-table.directives.ts +31 -0
- package/src/lib/data-table/data-table.types.ts +26 -0
- package/src/lib/data-table/index.ts +14 -0
- package/src/lib/date-picker/date-picker.component.spec.ts +131 -0
- package/src/lib/date-picker/date-picker.component.ts +220 -0
- package/src/lib/date-picker/date-picker.variants.ts +17 -0
- package/src/lib/date-picker/index.ts +2 -0
- package/src/lib/date-range-picker/date-range-picker.component.spec.ts +151 -0
- package/src/lib/date-range-picker/date-range-picker.component.ts +340 -0
- package/src/lib/date-range-picker/index.ts +1 -0
- package/src/lib/diff/diff.component.spec.ts +47 -0
- package/src/lib/diff/diff.component.ts +82 -0
- package/src/lib/diff/index.ts +1 -0
- package/src/lib/divider/divider.component.spec.ts +48 -0
- package/src/lib/divider/divider.component.ts +51 -0
- package/src/lib/divider/divider.variants.ts +22 -0
- package/src/lib/divider/index.ts +2 -0
- package/src/lib/dock/dock.directives.spec.ts +85 -0
- package/src/lib/dock/dock.directives.ts +81 -0
- package/src/lib/dock/index.ts +1 -0
- package/src/lib/drawer/drawer.directives.spec.ts +62 -0
- package/src/lib/drawer/drawer.directives.ts +80 -0
- package/src/lib/drawer/index.ts +8 -0
- package/src/lib/dropdown/dropdown.directives.spec.ts +106 -0
- package/src/lib/dropdown/dropdown.directives.ts +136 -0
- package/src/lib/dropdown/dropdown.variants.ts +27 -0
- package/src/lib/dropdown/index.ts +15 -0
- package/src/lib/fab/fab.directives.spec.ts +60 -0
- package/src/lib/fab/fab.directives.ts +77 -0
- package/src/lib/fab/index.ts +8 -0
- package/src/lib/fieldset/fieldset.directives.spec.ts +74 -0
- package/src/lib/fieldset/fieldset.directives.ts +49 -0
- package/src/lib/fieldset/fieldset.variants.ts +15 -0
- package/src/lib/fieldset/index.ts +6 -0
- package/src/lib/file-input/file-input.component.spec.ts +114 -0
- package/src/lib/file-input/file-input.component.ts +155 -0
- package/src/lib/file-input/file-input.variants.ts +25 -0
- package/src/lib/file-input/index.ts +6 -0
- package/src/lib/indicator/index.ts +6 -0
- package/src/lib/indicator/indicator.directives.spec.ts +64 -0
- package/src/lib/indicator/indicator.directives.ts +59 -0
- package/src/lib/input/index.ts +3 -0
- package/src/lib/input/input.directive.spec.ts +103 -0
- package/src/lib/input/input.directive.ts +25 -0
- package/src/lib/input/input.variants.ts +42 -0
- package/src/lib/input/label.directive.ts +16 -0
- package/src/lib/kbd/index.ts +2 -0
- package/src/lib/kbd/kbd.directive.spec.ts +42 -0
- package/src/lib/kbd/kbd.directive.ts +18 -0
- package/src/lib/kbd/kbd.variants.ts +19 -0
- package/src/lib/link/index.ts +2 -0
- package/src/lib/link/link.directive.spec.ts +41 -0
- package/src/lib/link/link.directive.ts +18 -0
- package/src/lib/link/link.variants.ts +20 -0
- package/src/lib/list/index.ts +8 -0
- package/src/lib/list/list.directives.spec.ts +65 -0
- package/src/lib/list/list.directives.ts +81 -0
- package/src/lib/loader/index.ts +2 -0
- package/src/lib/loader/loader.component.spec.ts +58 -0
- package/src/lib/loader/loader.component.ts +47 -0
- package/src/lib/loader/loader.variants.ts +21 -0
- package/src/lib/modal/dialog-ref.ts +19 -0
- package/src/lib/modal/dialog.directives.ts +84 -0
- package/src/lib/modal/dialog.service.spec.ts +52 -0
- package/src/lib/modal/dialog.service.ts +61 -0
- package/src/lib/modal/dialog.types.ts +16 -0
- package/src/lib/modal/index.ts +11 -0
- package/src/lib/navbar/index.ts +7 -0
- package/src/lib/navbar/navbar.directives.spec.ts +59 -0
- package/src/lib/navbar/navbar.directives.ts +57 -0
- package/src/lib/number-input/index.ts +2 -0
- package/src/lib/number-input/number-input.component.spec.ts +151 -0
- package/src/lib/number-input/number-input.component.ts +152 -0
- package/src/lib/number-input/number-input.variants.ts +17 -0
- package/src/lib/otp-input/index.ts +2 -0
- package/src/lib/otp-input/otp-input.component.spec.ts +252 -0
- package/src/lib/otp-input/otp-input.component.ts +274 -0
- package/src/lib/otp-input/otp-input.variants.ts +18 -0
- package/src/lib/pagination/index.ts +6 -0
- package/src/lib/pagination/pagination.component.spec.ts +59 -0
- package/src/lib/pagination/pagination.component.ts +143 -0
- package/src/lib/pagination/pagination.variants.ts +31 -0
- package/src/lib/popover/index.ts +6 -0
- package/src/lib/popover/popover.directives.spec.ts +147 -0
- package/src/lib/popover/popover.directives.ts +151 -0
- package/src/lib/progress/index.ts +7 -0
- package/src/lib/progress/progress.component.spec.ts +117 -0
- package/src/lib/progress/progress.component.ts +64 -0
- package/src/lib/progress/progress.variants.ts +43 -0
- package/src/lib/radial-progress/index.ts +5 -0
- package/src/lib/radial-progress/radial-progress.component.spec.ts +41 -0
- package/src/lib/radial-progress/radial-progress.component.ts +70 -0
- package/src/lib/radio/index.ts +2 -0
- package/src/lib/radio/radio.directive.spec.ts +46 -0
- package/src/lib/radio/radio.directive.ts +16 -0
- package/src/lib/radio/radio.variants.ts +19 -0
- package/src/lib/rating/index.ts +2 -0
- package/src/lib/rating/rating.component.spec.ts +157 -0
- package/src/lib/rating/rating.component.ts +163 -0
- package/src/lib/rating/rating.variants.ts +20 -0
- package/src/lib/select/index.ts +2 -0
- package/src/lib/select/select.component.spec.ts +112 -0
- package/src/lib/select/select.component.ts +235 -0
- package/src/lib/select/select.variants.ts +19 -0
- package/src/lib/sheet/index.ts +10 -0
- package/src/lib/sheet/sheet-ref.ts +18 -0
- package/src/lib/sheet/sheet.component.spec.ts +67 -0
- package/src/lib/sheet/sheet.directives.ts +70 -0
- package/src/lib/sheet/sheet.service.ts +100 -0
- package/src/lib/sheet/sheet.types.ts +23 -0
- package/src/lib/skeleton/index.ts +2 -0
- package/src/lib/skeleton/skeleton.directive.spec.ts +63 -0
- package/src/lib/skeleton/skeleton.directive.ts +21 -0
- package/src/lib/skeleton/skeleton.variants.ts +27 -0
- package/src/lib/slider/index.ts +2 -0
- package/src/lib/slider/slider.component.spec.ts +104 -0
- package/src/lib/slider/slider.component.ts +181 -0
- package/src/lib/slider/slider.variants.ts +25 -0
- package/src/lib/stat/index.ts +8 -0
- package/src/lib/stat/stat.directives.spec.ts +60 -0
- package/src/lib/stat/stat.directives.ts +79 -0
- package/src/lib/status/index.ts +2 -0
- package/src/lib/status/status.directive.spec.ts +43 -0
- package/src/lib/status/status.directive.ts +37 -0
- package/src/lib/status/status.variants.ts +26 -0
- package/src/lib/steps/index.ts +8 -0
- package/src/lib/steps/steps.directives.spec.ts +52 -0
- package/src/lib/steps/steps.directives.ts +78 -0
- package/src/lib/switch/index.ts +2 -0
- package/src/lib/switch/switch.component.spec.ts +98 -0
- package/src/lib/switch/switch.component.ts +76 -0
- package/src/lib/switch/switch.variants.ts +31 -0
- package/src/lib/table/index.ts +12 -0
- package/src/lib/table/table.directives.spec.ts +111 -0
- package/src/lib/table/table.directives.ts +126 -0
- package/src/lib/table/table.variants.ts +36 -0
- package/src/lib/tabs/index.ts +8 -0
- package/src/lib/tabs/tabs.directives.spec.ts +136 -0
- package/src/lib/tabs/tabs.directives.ts +126 -0
- package/src/lib/tabs/tabs.variants.ts +17 -0
- package/src/lib/tag-input/index.ts +2 -0
- package/src/lib/tag-input/tag-input.component.spec.ts +190 -0
- package/src/lib/tag-input/tag-input.component.ts +172 -0
- package/src/lib/tag-input/tag-input.variants.ts +31 -0
- package/src/lib/textarea/index.ts +7 -0
- package/src/lib/textarea/textarea.directive.spec.ts +84 -0
- package/src/lib/textarea/textarea.directive.ts +71 -0
- package/src/lib/textarea/textarea.variants.ts +34 -0
- package/src/lib/timeline/index.ts +11 -0
- package/src/lib/timeline/timeline.directives.spec.ts +55 -0
- package/src/lib/timeline/timeline.directives.ts +85 -0
- package/src/lib/toast/index.ts +3 -0
- package/src/lib/toast/toast.service.spec.ts +71 -0
- package/src/lib/toast/toast.service.ts +60 -0
- package/src/lib/toast/toast.variants.ts +38 -0
- package/src/lib/toast/toaster.component.spec.ts +38 -0
- package/src/lib/toast/toaster.component.ts +81 -0
- package/src/lib/toggle/index.ts +2 -0
- package/src/lib/toggle/toggle.directive.spec.ts +100 -0
- package/src/lib/toggle/toggle.directive.ts +61 -0
- package/src/lib/toggle/toggle.variants.ts +25 -0
- package/src/lib/tooltip/index.ts +2 -0
- package/src/lib/tooltip/tooltip.directive.spec.ts +113 -0
- package/src/lib/tooltip/tooltip.directive.ts +130 -0
- package/src/lib/tooltip/tooltip.variants.ts +20 -0
- package/src/lib/validator/index.ts +5 -0
- package/src/lib/validator/validator.directives.spec.ts +47 -0
- package/src/lib/validator/validator.directives.ts +50 -0
- package/src/styles/sonny-theme.css +171 -0
- package/types/tony-ui-library-core.d.ts +2179 -0
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tony-ui-library/core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Angular UI component library inspired by shadcn/ui - signals, zoneless, Tailwind CSS v4",
|
|
5
|
+
"peerDependencies": {
|
|
6
|
+
"@angular/common": "^21.0.0",
|
|
7
|
+
"@angular/core": "^21.0.0",
|
|
8
|
+
"@angular/cdk": "^21.0.0",
|
|
9
|
+
"@angular/forms": "^21.0.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"tslib": "^2.3.0",
|
|
13
|
+
"class-variance-authority": "^0.7.0",
|
|
14
|
+
"clsx": "^2.0.0",
|
|
15
|
+
"tailwind-merge": "^3.0.0"
|
|
16
|
+
},
|
|
17
|
+
"schematics": "./schematics/collection.json",
|
|
18
|
+
"ng-add": {
|
|
19
|
+
"save": "dependencies"
|
|
20
|
+
},
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"keywords": [
|
|
23
|
+
"angular",
|
|
24
|
+
"ui",
|
|
25
|
+
"components",
|
|
26
|
+
"tailwind",
|
|
27
|
+
"shadcn",
|
|
28
|
+
"signals",
|
|
29
|
+
"zoneless"
|
|
30
|
+
],
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"author": "coci_dev",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/coci-dev/tony-ui.git"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/coci-dev/tony-ui.git",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/coci-dev/tony-ui/issues"
|
|
40
|
+
},
|
|
41
|
+
"exports": {
|
|
42
|
+
"./styles/*": {
|
|
43
|
+
"default": "./src/styles/*"
|
|
44
|
+
},
|
|
45
|
+
"./package.json": {
|
|
46
|
+
"default": "./package.json"
|
|
47
|
+
},
|
|
48
|
+
".": {
|
|
49
|
+
"types": "./types/tony-ui-library-core.d.ts",
|
|
50
|
+
"default": "./fesm2022/tony-ui-library-core.mjs"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"module": "fesm2022/tony-ui-library-core.mjs",
|
|
54
|
+
"typings": "types/tony-ui-library-core.d.ts"
|
|
55
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"ng-add": {
|
|
5
|
+
"description": "Add TonyUI to a project",
|
|
6
|
+
"factory": "./ng-add/index#ngAdd",
|
|
7
|
+
"schema": "./ng-add/schema.json"
|
|
8
|
+
},
|
|
9
|
+
"component": {
|
|
10
|
+
"description": "Copy a TonyUI component source to your project (shadcn-style)",
|
|
11
|
+
"factory": "./ng-generate/component/index#generateComponent",
|
|
12
|
+
"schema": "./ng-generate/component/schema.json",
|
|
13
|
+
"aliases": ["c"]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ngAdd = ngAdd;
|
|
4
|
+
function ngAdd(options) {
|
|
5
|
+
return (tree, context) => {
|
|
6
|
+
context.logger.info('Adding TonyUI to your project...');
|
|
7
|
+
// Create .postcssrc.json if it doesn't exist
|
|
8
|
+
if (!tree.exists('.postcssrc.json')) {
|
|
9
|
+
tree.create('.postcssrc.json', JSON.stringify({ plugins: { '@tailwindcss/postcss': {} } }, null, 2));
|
|
10
|
+
context.logger.info('Created .postcssrc.json');
|
|
11
|
+
}
|
|
12
|
+
// Add theme import to styles.css
|
|
13
|
+
const stylesPath = 'src/styles.css';
|
|
14
|
+
if (tree.exists(stylesPath)) {
|
|
15
|
+
const content = tree.read(stylesPath).toString('utf-8');
|
|
16
|
+
const themeImport = '@import "@tony-ui-library/core/styles/sonny-theme.css";';
|
|
17
|
+
const sourceDirective = '@source "../node_modules/@tony-ui-library/core";';
|
|
18
|
+
if (!content.includes(themeImport)) {
|
|
19
|
+
const newContent = `${themeImport}\n${sourceDirective}\n\n${content}`;
|
|
20
|
+
tree.overwrite(stylesPath, newContent);
|
|
21
|
+
context.logger.info('Added TonyUI theme import to styles.css');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// Add provideTonyUI to app.config.ts
|
|
25
|
+
const configPath = 'src/app/app.config.ts';
|
|
26
|
+
if (tree.exists(configPath)) {
|
|
27
|
+
let configContent = tree.read(configPath).toString('utf-8');
|
|
28
|
+
const theme = options.theme || 'light';
|
|
29
|
+
if (!configContent.includes('provideTonyUI')) {
|
|
30
|
+
// Add import statement
|
|
31
|
+
const importLine = `import { provideTonyUI } from '@tony-ui-library/core';\n`;
|
|
32
|
+
const lastImportIndex = configContent.lastIndexOf('import ');
|
|
33
|
+
const lastImportEnd = configContent.indexOf('\n', lastImportIndex);
|
|
34
|
+
configContent =
|
|
35
|
+
configContent.slice(0, lastImportEnd + 1) +
|
|
36
|
+
importLine +
|
|
37
|
+
configContent.slice(lastImportEnd + 1);
|
|
38
|
+
// Add provider to providers array
|
|
39
|
+
const providersMatch = configContent.match(/providers\s*:\s*\[/);
|
|
40
|
+
if (providersMatch && providersMatch.index !== undefined) {
|
|
41
|
+
const insertPos = providersMatch.index + providersMatch[0].length;
|
|
42
|
+
configContent =
|
|
43
|
+
configContent.slice(0, insertPos) +
|
|
44
|
+
`\n provideTonyUI({ defaultTheme: '${theme}' }),` +
|
|
45
|
+
configContent.slice(insertPos);
|
|
46
|
+
}
|
|
47
|
+
tree.overwrite(configPath, configContent);
|
|
48
|
+
context.logger.info('Added provideTonyUI to app.config.ts');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return tree;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "TonyUIAddSchema",
|
|
4
|
+
"title": "TonyUI ng-add schematic",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The project to add TonyUI to."
|
|
10
|
+
},
|
|
11
|
+
"theme": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"default": "light",
|
|
14
|
+
"enum": ["light", "dark", "corporate"],
|
|
15
|
+
"description": "Default theme to configure."
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"required": []
|
|
19
|
+
}
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.generateComponent = generateComponent;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const AVAILABLE_COMPONENTS = [
|
|
39
|
+
'accordion',
|
|
40
|
+
'alert',
|
|
41
|
+
'avatar',
|
|
42
|
+
'badge',
|
|
43
|
+
'breadcrumb',
|
|
44
|
+
'button',
|
|
45
|
+
'button-group',
|
|
46
|
+
'calendar',
|
|
47
|
+
'card',
|
|
48
|
+
'carousel',
|
|
49
|
+
'chat-bubble',
|
|
50
|
+
'checkbox',
|
|
51
|
+
'combobox',
|
|
52
|
+
'diff',
|
|
53
|
+
'divider',
|
|
54
|
+
'dock',
|
|
55
|
+
'drawer',
|
|
56
|
+
'dropdown',
|
|
57
|
+
'fab',
|
|
58
|
+
'fieldset',
|
|
59
|
+
'file-input',
|
|
60
|
+
'indicator',
|
|
61
|
+
'input',
|
|
62
|
+
'kbd',
|
|
63
|
+
'link',
|
|
64
|
+
'list',
|
|
65
|
+
'loader',
|
|
66
|
+
'modal',
|
|
67
|
+
'navbar',
|
|
68
|
+
'pagination',
|
|
69
|
+
'progress',
|
|
70
|
+
'radial-progress',
|
|
71
|
+
'radio',
|
|
72
|
+
'rating',
|
|
73
|
+
'select',
|
|
74
|
+
'sheet',
|
|
75
|
+
'skeleton',
|
|
76
|
+
'slider',
|
|
77
|
+
'stat',
|
|
78
|
+
'status',
|
|
79
|
+
'steps',
|
|
80
|
+
'switch',
|
|
81
|
+
'table',
|
|
82
|
+
'tabs',
|
|
83
|
+
'textarea',
|
|
84
|
+
'timeline',
|
|
85
|
+
'toast',
|
|
86
|
+
'toggle',
|
|
87
|
+
'tooltip',
|
|
88
|
+
'validator',
|
|
89
|
+
];
|
|
90
|
+
const COMPONENT_FILES = {
|
|
91
|
+
accordion: [
|
|
92
|
+
'accordion.directives.ts',
|
|
93
|
+
'index.ts',
|
|
94
|
+
],
|
|
95
|
+
alert: [
|
|
96
|
+
'alert.directives.ts',
|
|
97
|
+
'alert.variants.ts',
|
|
98
|
+
'index.ts',
|
|
99
|
+
],
|
|
100
|
+
avatar: [
|
|
101
|
+
'avatar.component.ts',
|
|
102
|
+
'avatar.variants.ts',
|
|
103
|
+
'index.ts',
|
|
104
|
+
],
|
|
105
|
+
badge: [
|
|
106
|
+
'badge.directive.ts',
|
|
107
|
+
'badge.variants.ts',
|
|
108
|
+
'index.ts',
|
|
109
|
+
],
|
|
110
|
+
breadcrumb: [
|
|
111
|
+
'breadcrumb.directives.ts',
|
|
112
|
+
'index.ts',
|
|
113
|
+
],
|
|
114
|
+
button: [
|
|
115
|
+
'button.directive.ts',
|
|
116
|
+
'button.variants.ts',
|
|
117
|
+
'index.ts',
|
|
118
|
+
],
|
|
119
|
+
'button-group': [
|
|
120
|
+
'button-group.directive.ts',
|
|
121
|
+
'button-group.variants.ts',
|
|
122
|
+
'index.ts',
|
|
123
|
+
],
|
|
124
|
+
calendar: [
|
|
125
|
+
'calendar.component.ts',
|
|
126
|
+
'index.ts',
|
|
127
|
+
],
|
|
128
|
+
card: [
|
|
129
|
+
'card.directives.ts',
|
|
130
|
+
'card.variants.ts',
|
|
131
|
+
'index.ts',
|
|
132
|
+
],
|
|
133
|
+
carousel: [
|
|
134
|
+
'carousel.directives.ts',
|
|
135
|
+
'index.ts',
|
|
136
|
+
],
|
|
137
|
+
'chat-bubble': [
|
|
138
|
+
'chat-bubble.directives.ts',
|
|
139
|
+
'index.ts',
|
|
140
|
+
],
|
|
141
|
+
checkbox: [
|
|
142
|
+
'checkbox.directive.ts',
|
|
143
|
+
'checkbox.variants.ts',
|
|
144
|
+
'index.ts',
|
|
145
|
+
],
|
|
146
|
+
combobox: [
|
|
147
|
+
'combobox.component.ts',
|
|
148
|
+
'combobox.variants.ts',
|
|
149
|
+
'index.ts',
|
|
150
|
+
],
|
|
151
|
+
diff: [
|
|
152
|
+
'diff.component.ts',
|
|
153
|
+
'index.ts',
|
|
154
|
+
],
|
|
155
|
+
divider: [
|
|
156
|
+
'divider.component.ts',
|
|
157
|
+
'divider.variants.ts',
|
|
158
|
+
'index.ts',
|
|
159
|
+
],
|
|
160
|
+
dock: [
|
|
161
|
+
'dock.directives.ts',
|
|
162
|
+
'index.ts',
|
|
163
|
+
],
|
|
164
|
+
drawer: [
|
|
165
|
+
'drawer.directives.ts',
|
|
166
|
+
'index.ts',
|
|
167
|
+
],
|
|
168
|
+
dropdown: [
|
|
169
|
+
'dropdown.directives.ts',
|
|
170
|
+
'dropdown.variants.ts',
|
|
171
|
+
'index.ts',
|
|
172
|
+
],
|
|
173
|
+
fab: [
|
|
174
|
+
'fab.directives.ts',
|
|
175
|
+
'index.ts',
|
|
176
|
+
],
|
|
177
|
+
fieldset: [
|
|
178
|
+
'fieldset.directives.ts',
|
|
179
|
+
'fieldset.variants.ts',
|
|
180
|
+
'index.ts',
|
|
181
|
+
],
|
|
182
|
+
'file-input': [
|
|
183
|
+
'file-input.component.ts',
|
|
184
|
+
'file-input.variants.ts',
|
|
185
|
+
'index.ts',
|
|
186
|
+
],
|
|
187
|
+
indicator: [
|
|
188
|
+
'indicator.directives.ts',
|
|
189
|
+
'index.ts',
|
|
190
|
+
],
|
|
191
|
+
input: [
|
|
192
|
+
'input.directive.ts',
|
|
193
|
+
'input.variants.ts',
|
|
194
|
+
'label.directive.ts',
|
|
195
|
+
'index.ts',
|
|
196
|
+
],
|
|
197
|
+
kbd: [
|
|
198
|
+
'kbd.directive.ts',
|
|
199
|
+
'kbd.variants.ts',
|
|
200
|
+
'index.ts',
|
|
201
|
+
],
|
|
202
|
+
link: [
|
|
203
|
+
'link.directive.ts',
|
|
204
|
+
'link.variants.ts',
|
|
205
|
+
'index.ts',
|
|
206
|
+
],
|
|
207
|
+
list: [
|
|
208
|
+
'list.directives.ts',
|
|
209
|
+
'index.ts',
|
|
210
|
+
],
|
|
211
|
+
loader: [
|
|
212
|
+
'loader.component.ts',
|
|
213
|
+
'loader.variants.ts',
|
|
214
|
+
'index.ts',
|
|
215
|
+
],
|
|
216
|
+
modal: [
|
|
217
|
+
'dialog.types.ts',
|
|
218
|
+
'dialog-ref.ts',
|
|
219
|
+
'dialog.service.ts',
|
|
220
|
+
'dialog.directives.ts',
|
|
221
|
+
'index.ts',
|
|
222
|
+
],
|
|
223
|
+
navbar: [
|
|
224
|
+
'navbar.directives.ts',
|
|
225
|
+
'index.ts',
|
|
226
|
+
],
|
|
227
|
+
pagination: [
|
|
228
|
+
'pagination.component.ts',
|
|
229
|
+
'pagination.variants.ts',
|
|
230
|
+
'index.ts',
|
|
231
|
+
],
|
|
232
|
+
progress: [
|
|
233
|
+
'progress.component.ts',
|
|
234
|
+
'progress.variants.ts',
|
|
235
|
+
'index.ts',
|
|
236
|
+
],
|
|
237
|
+
'radial-progress': [
|
|
238
|
+
'radial-progress.component.ts',
|
|
239
|
+
'index.ts',
|
|
240
|
+
],
|
|
241
|
+
radio: [
|
|
242
|
+
'radio.directive.ts',
|
|
243
|
+
'radio.variants.ts',
|
|
244
|
+
'index.ts',
|
|
245
|
+
],
|
|
246
|
+
rating: [
|
|
247
|
+
'rating.component.ts',
|
|
248
|
+
'rating.variants.ts',
|
|
249
|
+
'index.ts',
|
|
250
|
+
],
|
|
251
|
+
select: [
|
|
252
|
+
'select.component.ts',
|
|
253
|
+
'select.variants.ts',
|
|
254
|
+
'index.ts',
|
|
255
|
+
],
|
|
256
|
+
sheet: [
|
|
257
|
+
'sheet-ref.ts',
|
|
258
|
+
'sheet.directives.ts',
|
|
259
|
+
'sheet.service.ts',
|
|
260
|
+
'sheet.types.ts',
|
|
261
|
+
'index.ts',
|
|
262
|
+
],
|
|
263
|
+
skeleton: [
|
|
264
|
+
'skeleton.directive.ts',
|
|
265
|
+
'skeleton.variants.ts',
|
|
266
|
+
'index.ts',
|
|
267
|
+
],
|
|
268
|
+
slider: [
|
|
269
|
+
'slider.component.ts',
|
|
270
|
+
'slider.variants.ts',
|
|
271
|
+
'index.ts',
|
|
272
|
+
],
|
|
273
|
+
stat: [
|
|
274
|
+
'stat.directives.ts',
|
|
275
|
+
'index.ts',
|
|
276
|
+
],
|
|
277
|
+
status: [
|
|
278
|
+
'status.directive.ts',
|
|
279
|
+
'status.variants.ts',
|
|
280
|
+
'index.ts',
|
|
281
|
+
],
|
|
282
|
+
steps: [
|
|
283
|
+
'steps.directives.ts',
|
|
284
|
+
'index.ts',
|
|
285
|
+
],
|
|
286
|
+
switch: [
|
|
287
|
+
'switch.component.ts',
|
|
288
|
+
'switch.variants.ts',
|
|
289
|
+
'index.ts',
|
|
290
|
+
],
|
|
291
|
+
table: [
|
|
292
|
+
'table.directives.ts',
|
|
293
|
+
'table.variants.ts',
|
|
294
|
+
'index.ts',
|
|
295
|
+
],
|
|
296
|
+
tabs: [
|
|
297
|
+
'tabs.directives.ts',
|
|
298
|
+
'tabs.variants.ts',
|
|
299
|
+
'index.ts',
|
|
300
|
+
],
|
|
301
|
+
textarea: [
|
|
302
|
+
'textarea.directive.ts',
|
|
303
|
+
'textarea.variants.ts',
|
|
304
|
+
'index.ts',
|
|
305
|
+
],
|
|
306
|
+
timeline: [
|
|
307
|
+
'timeline.directives.ts',
|
|
308
|
+
'index.ts',
|
|
309
|
+
],
|
|
310
|
+
toast: [
|
|
311
|
+
'toast.service.ts',
|
|
312
|
+
'toast.variants.ts',
|
|
313
|
+
'toaster.component.ts',
|
|
314
|
+
'index.ts',
|
|
315
|
+
],
|
|
316
|
+
toggle: [
|
|
317
|
+
'toggle.directive.ts',
|
|
318
|
+
'toggle.variants.ts',
|
|
319
|
+
'index.ts',
|
|
320
|
+
],
|
|
321
|
+
tooltip: [
|
|
322
|
+
'tooltip.directive.ts',
|
|
323
|
+
'tooltip.variants.ts',
|
|
324
|
+
'index.ts',
|
|
325
|
+
],
|
|
326
|
+
validator: [
|
|
327
|
+
'validator.directives.ts',
|
|
328
|
+
'index.ts',
|
|
329
|
+
],
|
|
330
|
+
};
|
|
331
|
+
const COMPONENT_SPEC_FILES = {
|
|
332
|
+
accordion: ['accordion.directives.spec.ts'],
|
|
333
|
+
alert: ['alert.directives.spec.ts'],
|
|
334
|
+
avatar: ['avatar.component.spec.ts'],
|
|
335
|
+
badge: ['badge.directive.spec.ts'],
|
|
336
|
+
breadcrumb: ['breadcrumb.directives.spec.ts'],
|
|
337
|
+
button: ['button.directive.spec.ts'],
|
|
338
|
+
'button-group': ['button-group.directive.spec.ts'],
|
|
339
|
+
calendar: ['calendar.component.spec.ts'],
|
|
340
|
+
card: ['card.directives.spec.ts'],
|
|
341
|
+
carousel: ['carousel.directives.spec.ts'],
|
|
342
|
+
'chat-bubble': ['chat-bubble.directives.spec.ts'],
|
|
343
|
+
checkbox: ['checkbox.directive.spec.ts'],
|
|
344
|
+
combobox: ['combobox.component.spec.ts'],
|
|
345
|
+
diff: ['diff.component.spec.ts'],
|
|
346
|
+
divider: ['divider.component.spec.ts'],
|
|
347
|
+
dock: ['dock.directives.spec.ts'],
|
|
348
|
+
drawer: ['drawer.directives.spec.ts'],
|
|
349
|
+
dropdown: ['dropdown.directives.spec.ts'],
|
|
350
|
+
fab: ['fab.directives.spec.ts'],
|
|
351
|
+
fieldset: ['fieldset.directives.spec.ts'],
|
|
352
|
+
'file-input': ['file-input.component.spec.ts'],
|
|
353
|
+
indicator: ['indicator.directives.spec.ts'],
|
|
354
|
+
input: ['input.directive.spec.ts'],
|
|
355
|
+
kbd: ['kbd.directive.spec.ts'],
|
|
356
|
+
link: ['link.directive.spec.ts'],
|
|
357
|
+
list: ['list.directives.spec.ts'],
|
|
358
|
+
loader: ['loader.component.spec.ts'],
|
|
359
|
+
modal: ['dialog.service.spec.ts'],
|
|
360
|
+
navbar: ['navbar.directives.spec.ts'],
|
|
361
|
+
pagination: ['pagination.component.spec.ts'],
|
|
362
|
+
progress: ['progress.component.spec.ts'],
|
|
363
|
+
'radial-progress': ['radial-progress.component.spec.ts'],
|
|
364
|
+
radio: ['radio.directive.spec.ts'],
|
|
365
|
+
rating: ['rating.component.spec.ts'],
|
|
366
|
+
select: ['select.component.spec.ts'],
|
|
367
|
+
sheet: ['sheet.component.spec.ts'],
|
|
368
|
+
skeleton: ['skeleton.directive.spec.ts'],
|
|
369
|
+
slider: ['slider.component.spec.ts'],
|
|
370
|
+
stat: ['stat.directives.spec.ts'],
|
|
371
|
+
status: ['status.directive.spec.ts'],
|
|
372
|
+
steps: ['steps.directives.spec.ts'],
|
|
373
|
+
switch: ['switch.component.spec.ts'],
|
|
374
|
+
table: ['table.directives.spec.ts'],
|
|
375
|
+
tabs: ['tabs.directives.spec.ts'],
|
|
376
|
+
textarea: ['textarea.directive.spec.ts'],
|
|
377
|
+
timeline: ['timeline.directives.spec.ts'],
|
|
378
|
+
toast: ['toast.service.spec.ts'],
|
|
379
|
+
toggle: ['toggle.directive.spec.ts'],
|
|
380
|
+
tooltip: ['tooltip.directive.spec.ts'],
|
|
381
|
+
validator: ['validator.directives.spec.ts'],
|
|
382
|
+
};
|
|
383
|
+
function generateComponent(options) {
|
|
384
|
+
return (tree, context) => {
|
|
385
|
+
const name = options.name.toLowerCase();
|
|
386
|
+
if (!AVAILABLE_COMPONENTS.includes(name)) {
|
|
387
|
+
throw new Error(`Unknown component "${name}". Available: ${AVAILABLE_COMPONENTS.join(', ')}`);
|
|
388
|
+
}
|
|
389
|
+
const targetDir = options.path || 'src/app/ui';
|
|
390
|
+
const componentDir = `${targetDir}/${name}`;
|
|
391
|
+
const files = COMPONENT_FILES[name];
|
|
392
|
+
const specFiles = options.skipTests ? [] : (COMPONENT_SPEC_FILES[name] || []);
|
|
393
|
+
// Ensure cn.ts utility exists
|
|
394
|
+
const cnTargetPath = `${targetDir}/utils/cn.ts`;
|
|
395
|
+
if (!tree.exists(cnTargetPath)) {
|
|
396
|
+
const cnContent = `import { clsx, type ClassValue } from 'clsx';
|
|
397
|
+
import { twMerge } from 'tailwind-merge';
|
|
398
|
+
|
|
399
|
+
export function cn(...inputs: ClassValue[]): string {
|
|
400
|
+
return twMerge(clsx(inputs));
|
|
401
|
+
}
|
|
402
|
+
`;
|
|
403
|
+
tree.create(cnTargetPath, cnContent);
|
|
404
|
+
context.logger.info('Created utils/cn.ts');
|
|
405
|
+
}
|
|
406
|
+
// Copy component files from the library source
|
|
407
|
+
const sourceBase = path.join(__dirname, '..', '..', '..', 'src', 'lib', name);
|
|
408
|
+
for (const file of [...files, ...specFiles]) {
|
|
409
|
+
const sourcePath = path.join(sourceBase, file);
|
|
410
|
+
const destPath = `${componentDir}/${file}`;
|
|
411
|
+
if (tree.exists(destPath)) {
|
|
412
|
+
context.logger.warn(`File already exists: ${destPath} — skipping`);
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
// Read from the package's source files
|
|
416
|
+
try {
|
|
417
|
+
const fs = require('fs');
|
|
418
|
+
let content = fs.readFileSync(sourcePath, 'utf-8');
|
|
419
|
+
// Rewrite imports to use local cn utility
|
|
420
|
+
content = content.replace(/from ['"]\.\.\/core\/utils\/cn['"]/g, `from '../utils/cn'`);
|
|
421
|
+
// Rewrite prefix if custom
|
|
422
|
+
if (options.prefix && options.prefix !== 'ton') {
|
|
423
|
+
content = content.replace(/ton/g, options.prefix);
|
|
424
|
+
content = content.replace(/Ton/g, capitalize(options.prefix));
|
|
425
|
+
}
|
|
426
|
+
tree.create(destPath, content);
|
|
427
|
+
context.logger.info(`Created ${destPath}`);
|
|
428
|
+
}
|
|
429
|
+
catch (e) {
|
|
430
|
+
context.logger.error(`Could not read source file: ${sourcePath}`);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
context.logger.info(`Component "${name}" copied to ${componentDir}`);
|
|
434
|
+
return tree;
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
function capitalize(str) {
|
|
438
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
439
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "TonyUIGenerateComponentSchema",
|
|
4
|
+
"title": "TonyUI component generator (copy-paste style)",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The component to copy (accordion, alert, avatar, badge, breadcrumb, button, button-group, calendar, card, carousel, chat-bubble, checkbox, combobox, diff, divider, dock, drawer, dropdown, fab, fieldset, file-input, indicator, input, kbd, link, list, loader, modal, navbar, pagination, progress, radial-progress, radio, rating, select, sheet, skeleton, slider, stat, status, steps, switch, table, tabs, textarea, timeline, toast, toggle, tooltip, validator).",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"path": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"default": "src/app/ui",
|
|
18
|
+
"description": "The path to copy the component into."
|
|
19
|
+
},
|
|
20
|
+
"prefix": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"default": "ton",
|
|
23
|
+
"description": "The prefix to use for selectors."
|
|
24
|
+
},
|
|
25
|
+
"skipTests": {
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"default": false,
|
|
28
|
+
"description": "Skip copying test files."
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": ["name"]
|
|
32
|
+
}
|