@trineui/cli 0.1.0-beta.1 → 0.1.0
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 +40 -0
- package/bin/trine.js +24 -0
- package/dist/add-button.js +15 -0
- package/dist/add-component.js +315 -0
- package/dist/index.js +73 -646
- package/package.json +23 -30
- package/templates/button/button.html +11 -0
- package/templates/button/button.skin.ts +128 -0
- package/templates/button/button.ts +39 -0
- package/templates/styles/tokens.css +102 -0
- package/templates/styles/trine-consumer.css +58 -0
- package/CHANGELOG.md +0 -30
- package/src/commands/add.ts +0 -101
- package/src/commands/diff.test.ts +0 -55
- package/src/commands/diff.ts +0 -104
- package/src/commands/eject.ts +0 -95
- package/src/commands/init.ts +0 -92
- package/src/commands/sync-interactive.ts +0 -108
- package/src/commands/sync.test.ts +0 -35
- package/src/commands/sync.ts +0 -113
- package/src/index.ts +0 -18
- package/src/types/manifest.ts +0 -14
- package/src/utils/__tests__/hash.test.ts +0 -35
- package/src/utils/__tests__/template.test.ts +0 -47
- package/src/utils/eject-merger.ts +0 -149
- package/src/utils/hash.ts +0 -43
- package/src/utils/manifest.ts +0 -43
- package/src/utils/template.ts +0 -26
- package/templates/button.blueprint.ts.hbs +0 -41
- package/templates/button.skin.ts.hbs +0 -35
- package/templates/checkbox.blueprint.ts.hbs +0 -57
- package/templates/checkbox.skin.ts.hbs +0 -44
- package/templates/dialog.blueprint.ts.hbs +0 -61
- package/templates/dialog.skin.ts.hbs +0 -27
- package/templates/input.blueprint.ts.hbs +0 -83
- package/templates/input.skin.ts.hbs +0 -29
- package/templates/select.blueprint.ts.hbs +0 -86
- package/templates/select.skin.ts.hbs +0 -53
- package/tsconfig.json +0 -10
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// @trine-generated
|
|
2
|
-
// @trine-version: {{engineVersion}}
|
|
3
|
-
// @trine-schema: {{blueprintSchemaVersion}}
|
|
4
|
-
import {
|
|
5
|
-
AfterViewInit,
|
|
6
|
-
ChangeDetectionStrategy,
|
|
7
|
-
Component,
|
|
8
|
-
inject,
|
|
9
|
-
ViewChild,
|
|
10
|
-
ViewContainerRef,
|
|
11
|
-
} from '@angular/core';
|
|
12
|
-
import { SelectEngine } from '@trineui/engine/select';
|
|
13
|
-
import { SelectSkin } from './select.skin';
|
|
14
|
-
import { SELECT_STYLING_CONTRACT } from '@trineui/engine/select';
|
|
15
|
-
|
|
16
|
-
@Component({
|
|
17
|
-
selector: 'ui-select',
|
|
18
|
-
standalone: true,
|
|
19
|
-
providers: [
|
|
20
|
-
SelectEngine,
|
|
21
|
-
{
|
|
22
|
-
provide: SELECT_STYLING_CONTRACT,
|
|
23
|
-
useExisting: SelectEngine,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
template: `
|
|
27
|
-
<button
|
|
28
|
-
type="button"
|
|
29
|
-
class="select-trigger"
|
|
30
|
-
role="combobox"
|
|
31
|
-
[attr.aria-expanded]="engine.ariaExpanded()"
|
|
32
|
-
[attr.aria-haspopup]="'listbox'"
|
|
33
|
-
[attr.aria-activedescendant]="engine.ariaActiveDescendant()"
|
|
34
|
-
[attr.data-state]="engine.selectState()"
|
|
35
|
-
[disabled]="engine.disabled()"
|
|
36
|
-
(click)="engine.toggle()"
|
|
37
|
-
(keydown)="engine.handleKeydown($event)"
|
|
38
|
-
>
|
|
39
|
-
<span class="select-value">\{{engine.selectedLabel()}}</span>
|
|
40
|
-
<span class="select-arrow" [attr.data-state]="engine.selectState()">
|
|
41
|
-
<svg viewBox="0 0 16 16" fill="none" class="select-arrow-icon">
|
|
42
|
-
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
43
|
-
</svg>
|
|
44
|
-
</span>
|
|
45
|
-
</button>
|
|
46
|
-
|
|
47
|
-
<ng-template #panelTemplate>
|
|
48
|
-
<ul
|
|
49
|
-
class="select-panel"
|
|
50
|
-
role="listbox"
|
|
51
|
-
[attr.data-state]="engine.selectState()"
|
|
52
|
-
>
|
|
53
|
-
@for (option of engine.options(); track option.value; let i = $index) {
|
|
54
|
-
<li
|
|
55
|
-
role="option"
|
|
56
|
-
[id]="'select-option-' + i"
|
|
57
|
-
class="select-option"
|
|
58
|
-
[class.select-option-disabled]="option.disabled"
|
|
59
|
-
[attr.aria-selected]="engine.selectedValue() === option.value"
|
|
60
|
-
[attr.aria-disabled]="option.disabled ?? false"
|
|
61
|
-
[attr.data-state]="engine.selectedValue() === option.value ? 'selected' : 'unselected'"
|
|
62
|
-
[attr.data-active]="engine.activeIndex() === i ? 'true' : 'false'"
|
|
63
|
-
(click)="!option.disabled && engine.selectOption(option.value)"
|
|
64
|
-
>
|
|
65
|
-
{{ option.label }}
|
|
66
|
-
</li>
|
|
67
|
-
}
|
|
68
|
-
</ul>
|
|
69
|
-
</ng-template>
|
|
70
|
-
`,
|
|
71
|
-
host: {
|
|
72
|
-
'[class]': 'skin.classes()',
|
|
73
|
-
},
|
|
74
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
75
|
-
})
|
|
76
|
-
export class SelectComponent implements AfterViewInit {
|
|
77
|
-
protected engine = inject(SelectEngine);
|
|
78
|
-
protected skin = inject(SelectSkin);
|
|
79
|
-
private vcr = inject(ViewContainerRef);
|
|
80
|
-
|
|
81
|
-
@ViewChild('panelTemplate') panelTemplate: any;
|
|
82
|
-
|
|
83
|
-
ngAfterViewInit(): void {
|
|
84
|
-
this.engine.registerPanel(this.panelTemplate, this.vcr);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// @trine-owned
|
|
2
|
-
// DO NOT EDIT — owned by user, never synced
|
|
3
|
-
import { cva } from 'class-variance-authority';
|
|
4
|
-
import { inject, Injectable } from '@angular/core';
|
|
5
|
-
import { SELECT_STYLING_CONTRACT, SelectStylingContract, SelectState } from '@trineui/engine/select';
|
|
6
|
-
|
|
7
|
-
@Injectable()
|
|
8
|
-
export class SelectSkin {
|
|
9
|
-
private contract = inject(SELECT_STYLING_CONTRACT);
|
|
10
|
-
|
|
11
|
-
private triggerVariants = cva('select-trigger-base', {
|
|
12
|
-
variants: {
|
|
13
|
-
state: {
|
|
14
|
-
open: 'select-trigger-open',
|
|
15
|
-
closed: 'select-trigger-closed',
|
|
16
|
-
},
|
|
17
|
-
disabled: {
|
|
18
|
-
true: 'select-trigger-disabled',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
compoundVariants: [
|
|
22
|
-
{
|
|
23
|
-
state: 'open',
|
|
24
|
-
disabled: true,
|
|
25
|
-
class: 'select-trigger-open-disabled',
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
defaultVariants: {
|
|
29
|
-
state: 'closed',
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
private panelVariants = cva('select-panel-base', {
|
|
34
|
-
variants: {
|
|
35
|
-
state: {
|
|
36
|
-
open: 'select-panel-open',
|
|
37
|
-
closed: 'select-panel-closed',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
defaultVariants: {
|
|
41
|
-
state: 'closed',
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
classes(): string {
|
|
46
|
-
const state = this.contract.selectState();
|
|
47
|
-
const disabled = this.contract.disabled();
|
|
48
|
-
return [
|
|
49
|
-
this.triggerVariants({ state, disabled }),
|
|
50
|
-
this.panelVariants({ state }),
|
|
51
|
-
].join(' ');
|
|
52
|
-
}
|
|
53
|
-
}
|