@semantic-components/code 0.63.0 → 0.64.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.
Files changed (64) hide show
  1. package/esm2022/index.js +2 -0
  2. package/esm2022/index.js.map +1 -0
  3. package/esm2022/lib/components/code-editor/code-editor-content.js +435 -0
  4. package/esm2022/lib/components/code-editor/code-editor-content.js.map +1 -0
  5. package/esm2022/lib/components/code-editor/code-editor-copy-button.js +90 -0
  6. package/esm2022/lib/components/code-editor/code-editor-copy-button.js.map +1 -0
  7. package/esm2022/lib/components/code-editor/code-editor-footer.js +27 -0
  8. package/esm2022/lib/components/code-editor/code-editor-footer.js.map +1 -0
  9. package/esm2022/lib/components/code-editor/code-editor-header.js +27 -0
  10. package/esm2022/lib/components/code-editor/code-editor-header.js.map +1 -0
  11. package/esm2022/lib/components/code-editor/code-editor-label.js +27 -0
  12. package/esm2022/lib/components/code-editor/code-editor-label.js.map +1 -0
  13. package/esm2022/lib/components/code-editor/code-editor.js +27 -0
  14. package/esm2022/lib/components/code-editor/code-editor.js.map +1 -0
  15. package/esm2022/lib/components/code-editor/index.js +7 -0
  16. package/esm2022/lib/components/code-editor/index.js.map +1 -0
  17. package/esm2022/lib/components/code-viewer/code-viewer-content.js +70 -0
  18. package/esm2022/lib/components/code-viewer/code-viewer-content.js.map +1 -0
  19. package/esm2022/lib/components/code-viewer/code-viewer-header.js +27 -0
  20. package/esm2022/lib/components/code-viewer/code-viewer-header.js.map +1 -0
  21. package/esm2022/lib/components/code-viewer/code-viewer-label.js +27 -0
  22. package/esm2022/lib/components/code-viewer/code-viewer-label.js.map +1 -0
  23. package/esm2022/lib/components/code-viewer/code-viewer.js +27 -0
  24. package/esm2022/lib/components/code-viewer/code-viewer.js.map +1 -0
  25. package/esm2022/lib/components/code-viewer/index.js +5 -0
  26. package/esm2022/lib/components/code-viewer/index.js.map +1 -0
  27. package/esm2022/lib/components/index.js +3 -0
  28. package/esm2022/lib/components/index.js.map +1 -0
  29. package/esm2022/semantic-components-code.js +5 -0
  30. package/esm2022/semantic-components-code.js.map +1 -0
  31. package/lib/components/code-editor/code-editor-content.d.ts +57 -0
  32. package/lib/components/code-editor/code-editor-copy-button.d.ts +11 -0
  33. package/lib/components/code-editor/code-editor-footer.d.ts +7 -0
  34. package/lib/components/code-editor/code-editor-header.d.ts +7 -0
  35. package/lib/components/code-editor/code-editor-label.d.ts +7 -0
  36. package/lib/components/code-editor/code-editor.d.ts +7 -0
  37. package/lib/components/code-viewer/code-viewer-content.d.ts +17 -0
  38. package/lib/components/code-viewer/code-viewer-header.d.ts +7 -0
  39. package/lib/components/code-viewer/code-viewer-label.d.ts +7 -0
  40. package/lib/components/code-viewer/code-viewer.d.ts +7 -0
  41. package/package.json +15 -3
  42. package/semantic-components-code.d.ts +5 -0
  43. package/eslint.config.mjs +0 -48
  44. package/ng-package.json +0 -8
  45. package/project.json +0 -28
  46. package/src/lib/components/code-editor/README.md +0 -368
  47. package/src/lib/components/code-editor/code-editor-content.ts +0 -507
  48. package/src/lib/components/code-editor/code-editor-copy-button.ts +0 -77
  49. package/src/lib/components/code-editor/code-editor-footer.ts +0 -31
  50. package/src/lib/components/code-editor/code-editor-header.ts +0 -31
  51. package/src/lib/components/code-editor/code-editor-label.ts +0 -28
  52. package/src/lib/components/code-editor/code-editor.ts +0 -31
  53. package/src/lib/components/code-viewer/README.md +0 -178
  54. package/src/lib/components/code-viewer/code-viewer-content.ts +0 -96
  55. package/src/lib/components/code-viewer/code-viewer-header.ts +0 -31
  56. package/src/lib/components/code-viewer/code-viewer-label.ts +0 -28
  57. package/src/lib/components/code-viewer/code-viewer.ts +0 -28
  58. package/tsconfig.json +0 -28
  59. package/tsconfig.lib.json +0 -12
  60. package/tsconfig.lib.prod.json +0 -7
  61. /package/{src/index.ts → index.d.ts} +0 -0
  62. /package/{src/lib/components/code-editor/index.ts → lib/components/code-editor/index.d.ts} +0 -0
  63. /package/{src/lib/components/code-viewer/index.ts → lib/components/code-viewer/index.d.ts} +0 -0
  64. /package/{src/lib/components/index.ts → lib/components/index.d.ts} +0 -0
@@ -0,0 +1,27 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input, ViewEncapsulation, } from '@angular/core';
2
+ import { cn } from '@semantic-components/ui';
3
+ import * as i0 from "@angular/core";
4
+ export class ScCodeEditorHeader {
5
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
6
+ class = computed(() => cn('flex items-center justify-between border-b border-border bg-background/50 px-3 py-2', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
7
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeEditorHeader, deps: [], target: i0.ɵɵFactoryTarget.Component });
8
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.4", type: ScCodeEditorHeader, isStandalone: true, selector: "div[sc-code-editor-header]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "code-editor-header" }, properties: { "class": "class()" } }, ngImport: i0, template: `
9
+ <ng-content />
10
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
11
+ }
12
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeEditorHeader, decorators: [{
13
+ type: Component,
14
+ args: [{
15
+ selector: 'div[sc-code-editor-header]',
16
+ template: `
17
+ <ng-content />
18
+ `,
19
+ host: {
20
+ 'data-slot': 'code-editor-header',
21
+ '[class]': 'class()',
22
+ },
23
+ encapsulation: ViewEncapsulation.None,
24
+ changeDetection: ChangeDetectionStrategy.OnPush,
25
+ }]
26
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
27
+ //# sourceMappingURL=code-editor-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-editor-header.js","sourceRoot":"","sources":["../../../../../../../libs/code/src/lib/components/code-editor/code-editor-header.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;;AAc7C,MAAM,OAAO,kBAAkB;IACpB,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IAEzC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CACA,qFAAqF,EACrF,IAAI,CAAC,UAAU,EAAE,CAClB,iDACF,CAAC;uGARS,kBAAkB;2FAAlB,kBAAkB,qUAVnB;;GAET;;2FAQU,kBAAkB;kBAZ9B,SAAS;mBAAC;oBACT,QAAQ,EAAE,4BAA4B;oBACtC,QAAQ,EAAE;;GAET;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,oBAAoB;wBACjC,SAAS,EAAE,SAAS;qBACrB;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '@semantic-components/ui';\n\n@Component({\n selector: 'div[sc-code-editor-header]',\n template: `\n <ng-content />\n `,\n host: {\n 'data-slot': 'code-editor-header',\n '[class]': 'class()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScCodeEditorHeader {\n readonly classInput = input<string>('', { alias: 'class' });\n\n protected readonly class = computed(() =>\n cn(\n 'flex items-center justify-between border-b border-border bg-background/50 px-3 py-2',\n this.classInput(),\n ),\n );\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input, ViewEncapsulation, } from '@angular/core';
2
+ import { cn } from '@semantic-components/ui';
3
+ import * as i0 from "@angular/core";
4
+ export class ScCodeEditorLabel {
5
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
6
+ class = computed(() => cn('text-xs font-medium text-muted-foreground', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
7
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeEditorLabel, deps: [], target: i0.ɵɵFactoryTarget.Component });
8
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.4", type: ScCodeEditorLabel, isStandalone: true, selector: "span[sc-code-editor-label]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "code-editor-label" }, properties: { "class": "class()" } }, ngImport: i0, template: `
9
+ <ng-content />
10
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
11
+ }
12
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeEditorLabel, decorators: [{
13
+ type: Component,
14
+ args: [{
15
+ selector: 'span[sc-code-editor-label]',
16
+ template: `
17
+ <ng-content />
18
+ `,
19
+ host: {
20
+ 'data-slot': 'code-editor-label',
21
+ '[class]': 'class()',
22
+ },
23
+ encapsulation: ViewEncapsulation.None,
24
+ changeDetection: ChangeDetectionStrategy.OnPush,
25
+ }]
26
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
27
+ //# sourceMappingURL=code-editor-label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-editor-label.js","sourceRoot":"","sources":["../../../../../../../libs/code/src/lib/components/code-editor/code-editor-label.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;;AAc7C,MAAM,OAAO,iBAAiB;IACnB,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IAEzC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CAAC,2CAA2C,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,iDACnE,CAAC;uGALS,iBAAiB;2FAAjB,iBAAiB,oUAVlB;;GAET;;2FAQU,iBAAiB;kBAZ7B,SAAS;mBAAC;oBACT,QAAQ,EAAE,4BAA4B;oBACtC,QAAQ,EAAE;;GAET;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,mBAAmB;wBAChC,SAAS,EAAE,SAAS;qBACrB;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '@semantic-components/ui';\n\n@Component({\n selector: 'span[sc-code-editor-label]',\n template: `\n <ng-content />\n `,\n host: {\n 'data-slot': 'code-editor-label',\n '[class]': 'class()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScCodeEditorLabel {\n readonly classInput = input<string>('', { alias: 'class' });\n\n protected readonly class = computed(() =>\n cn('text-xs font-medium text-muted-foreground', this.classInput()),\n );\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input, ViewEncapsulation, } from '@angular/core';
2
+ import { cn } from '@semantic-components/ui';
3
+ import * as i0 from "@angular/core";
4
+ export class ScCodeEditor {
5
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
6
+ class = computed(() => cn('overflow-hidden rounded-lg border border-border bg-muted focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
7
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
8
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.4", type: ScCodeEditor, isStandalone: true, selector: "div[sc-code-editor]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "code-editor" }, properties: { "class": "class()" } }, ngImport: i0, template: `
9
+ <ng-content />
10
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
11
+ }
12
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeEditor, decorators: [{
13
+ type: Component,
14
+ args: [{
15
+ selector: 'div[sc-code-editor]',
16
+ template: `
17
+ <ng-content />
18
+ `,
19
+ host: {
20
+ 'data-slot': 'code-editor',
21
+ '[class]': 'class()',
22
+ },
23
+ encapsulation: ViewEncapsulation.None,
24
+ changeDetection: ChangeDetectionStrategy.OnPush,
25
+ }]
26
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
27
+ //# sourceMappingURL=code-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-editor.js","sourceRoot":"","sources":["../../../../../../../libs/code/src/lib/components/code-editor/code-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;;AAc7C,MAAM,OAAO,YAAY;IACd,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IAEzC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CACA,gIAAgI,EAChI,IAAI,CAAC,UAAU,EAAE,CAClB,iDACF,CAAC;uGARS,YAAY;2FAAZ,YAAY,uTAVb;;GAET;;2FAQU,YAAY;kBAZxB,SAAS;mBAAC;oBACT,QAAQ,EAAE,qBAAqB;oBAC/B,QAAQ,EAAE;;GAET;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,aAAa;wBAC1B,SAAS,EAAE,SAAS;qBACrB;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '@semantic-components/ui';\n\n@Component({\n selector: 'div[sc-code-editor]',\n template: `\n <ng-content />\n `,\n host: {\n 'data-slot': 'code-editor',\n '[class]': 'class()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScCodeEditor {\n readonly classInput = input<string>('', { alias: 'class' });\n\n protected readonly class = computed(() =>\n cn(\n 'overflow-hidden rounded-lg border border-border bg-muted focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2',\n this.classInput(),\n ),\n );\n}\n"]}
@@ -0,0 +1,7 @@
1
+ export { ScCodeEditor } from './code-editor';
2
+ export { ScCodeEditorHeader } from './code-editor-header';
3
+ export { ScCodeEditorLabel } from './code-editor-label';
4
+ export { ScCodeEditorFooter } from './code-editor-footer';
5
+ export { ScCodeEditorContent, detectLanguage } from './code-editor-content';
6
+ export { ScCodeEditorCopyButton } from './code-editor-copy-button';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/code/src/lib/components/code-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC","sourcesContent":["export { ScCodeEditor } from './code-editor';\nexport { ScCodeEditorHeader } from './code-editor-header';\nexport { ScCodeEditorLabel } from './code-editor-label';\nexport { ScCodeEditorFooter } from './code-editor-footer';\nexport { ScCodeEditorContent, detectLanguage } from './code-editor-content';\nexport { ScCodeEditorCopyButton } from './code-editor-copy-button';\nexport type { ScCodeEditorLanguage } from './code-editor-content';\n"]}
@@ -0,0 +1,70 @@
1
+ import { ChangeDetectionStrategy, Component, computed, effect, inject, input, signal, ViewEncapsulation, } from '@angular/core';
2
+ import { DomSanitizer } from '@angular/platform-browser';
3
+ import { codeToHtml } from 'shiki';
4
+ import { cn } from '@semantic-components/ui';
5
+ import * as i0 from "@angular/core";
6
+ export class ScCodeViewerContent {
7
+ code = input.required(...(ngDevMode ? [{ debugName: "code" }] : []));
8
+ language = input('plaintext', ...(ngDevMode ? [{ debugName: "language" }] : []));
9
+ showLineNumbers = input(false, ...(ngDevMode ? [{ debugName: "showLineNumbers" }] : []));
10
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
11
+ sanitizer = inject(DomSanitizer);
12
+ highlightedHtml = signal(null, ...(ngDevMode ? [{ debugName: "highlightedHtml" }] : []));
13
+ wrapperClass = computed(() => cn('overflow-auto', this.classInput()), ...(ngDevMode ? [{ debugName: "wrapperClass" }] : []));
14
+ contentClass = computed(() => cn(this.showLineNumbers() && 'shiki-line-numbers'), ...(ngDevMode ? [{ debugName: "contentClass" }] : []));
15
+ constructor() {
16
+ effect(() => {
17
+ const code = this.code();
18
+ const lang = this.language();
19
+ this.highlight(code, lang);
20
+ });
21
+ }
22
+ async highlight(code, lang) {
23
+ try {
24
+ const html = await codeToHtml(code, {
25
+ lang,
26
+ themes: {
27
+ light: 'github-light',
28
+ dark: 'github-dark',
29
+ },
30
+ defaultColor: false,
31
+ });
32
+ this.highlightedHtml.set(this.sanitizer.bypassSecurityTrustHtml(html));
33
+ }
34
+ catch {
35
+ this.highlightedHtml.set(null);
36
+ }
37
+ }
38
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeViewerContent, deps: [], target: i0.ɵɵFactoryTarget.Component });
39
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.4", type: ScCodeViewerContent, isStandalone: true, selector: "div[sc-code-viewer-content]", inputs: { code: { classPropertyName: "code", publicName: "code", isSignal: true, isRequired: true, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, showLineNumbers: { classPropertyName: "showLineNumbers", publicName: "showLineNumbers", isSignal: true, isRequired: false, transformFunction: null }, classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "code-viewer-content" }, properties: { "class": "wrapperClass()" } }, ngImport: i0, template: `
40
+ @if (highlightedHtml()) {
41
+ <div [class]="contentClass()" [innerHTML]="highlightedHtml()"></div>
42
+ } @else {
43
+ <pre
44
+ class="m-0 p-4 text-sm leading-relaxed font-mono text-foreground"
45
+ ><code>{{ code() }}</code></pre>
46
+ }
47
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
48
+ }
49
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeViewerContent, decorators: [{
50
+ type: Component,
51
+ args: [{
52
+ selector: 'div[sc-code-viewer-content]',
53
+ template: `
54
+ @if (highlightedHtml()) {
55
+ <div [class]="contentClass()" [innerHTML]="highlightedHtml()"></div>
56
+ } @else {
57
+ <pre
58
+ class="m-0 p-4 text-sm leading-relaxed font-mono text-foreground"
59
+ ><code>{{ code() }}</code></pre>
60
+ }
61
+ `,
62
+ host: {
63
+ 'data-slot': 'code-viewer-content',
64
+ '[class]': 'wrapperClass()',
65
+ },
66
+ encapsulation: ViewEncapsulation.None,
67
+ changeDetection: ChangeDetectionStrategy.OnPush,
68
+ }]
69
+ }], ctorParameters: () => [], propDecorators: { code: [{ type: i0.Input, args: [{ isSignal: true, alias: "code", required: true }] }], language: [{ type: i0.Input, args: [{ isSignal: true, alias: "language", required: false }] }], showLineNumbers: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLineNumbers", required: false }] }], classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
70
+ //# sourceMappingURL=code-viewer-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-viewer-content.js","sourceRoot":"","sources":["../../../../../../../libs/code/src/lib/components/code-viewer/code-viewer-content.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,EACN,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAY,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;;AAsC7C,MAAM,OAAO,mBAAmB;IACrB,IAAI,GAAG,KAAK,CAAC,QAAQ,+CAAU,CAAC;IAChC,QAAQ,GAAG,KAAK,CAAuB,WAAW,oDAAC,CAAC;IACpD,eAAe,GAAG,KAAK,CAAC,KAAK,2DAAC,CAAC;IAC/B,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IAE3C,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;IAE/B,eAAe,GAAG,MAAM,CAAkB,IAAI,2DAAC,CAAC;IAEhD,YAAY,GAAG,QAAQ,CAAC,GAAG,EAAE,CAC9C,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,wDACvC,CAAC;IAEiB,YAAY,GAAG,QAAQ,CAAC,GAAG,EAAE,CAC9C,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,oBAAoB,CAAC,wDACnD,CAAC;IAEF;QACE,MAAM,CAAC,GAAG,EAAE;YACV,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YAE7B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,SAAS,CACrB,IAAY,EACZ,IAA0B;QAE1B,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,IAAI,EAAE;gBAClC,IAAI;gBACJ,MAAM,EAAE;oBACN,KAAK,EAAE,cAAc;oBACrB,IAAI,EAAE,aAAa;iBACpB;gBACD,YAAY,EAAE,KAAK;aACpB,CAAC,CAAC;YACH,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAC;QACzE,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;uGA5CU,mBAAmB;2FAAnB,mBAAmB,ytBAhBpB;;;;;;;;GAQT;;2FAQU,mBAAmB;kBAlB/B,SAAS;mBAAC;oBACT,QAAQ,EAAE,6BAA6B;oBACvC,QAAQ,EAAE;;;;;;;;GAQT;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,qBAAqB;wBAClC,SAAS,EAAE,gBAAgB;qBAC5B;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n input,\n signal,\n ViewEncapsulation,\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { codeToHtml } from 'shiki';\nimport { cn } from '@semantic-components/ui';\n\nexport type ScCodeViewerLanguage =\n | 'angular-ts'\n | 'typescript'\n | 'javascript'\n | 'html'\n | 'css'\n | 'json'\n | 'python'\n | 'bash'\n | 'shell'\n | 'markdown'\n | 'yaml'\n | 'sql'\n | 'go'\n | 'rust'\n | 'java'\n | 'plaintext';\n\n@Component({\n selector: 'div[sc-code-viewer-content]',\n template: `\n @if (highlightedHtml()) {\n <div [class]=\"contentClass()\" [innerHTML]=\"highlightedHtml()\"></div>\n } @else {\n <pre\n class=\"m-0 p-4 text-sm leading-relaxed font-mono text-foreground\"\n ><code>{{ code() }}</code></pre>\n }\n `,\n host: {\n 'data-slot': 'code-viewer-content',\n '[class]': 'wrapperClass()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScCodeViewerContent {\n readonly code = input.required<string>();\n readonly language = input<ScCodeViewerLanguage>('plaintext');\n readonly showLineNumbers = input(false);\n readonly classInput = input<string>('', { alias: 'class' });\n\n private readonly sanitizer = inject(DomSanitizer);\n\n protected readonly highlightedHtml = signal<SafeHtml | null>(null);\n\n protected readonly wrapperClass = computed(() =>\n cn('overflow-auto', this.classInput()),\n );\n\n protected readonly contentClass = computed(() =>\n cn(this.showLineNumbers() && 'shiki-line-numbers'),\n );\n\n constructor() {\n effect(() => {\n const code = this.code();\n const lang = this.language();\n\n this.highlight(code, lang);\n });\n }\n\n private async highlight(\n code: string,\n lang: ScCodeViewerLanguage,\n ): Promise<void> {\n try {\n const html = await codeToHtml(code, {\n lang,\n themes: {\n light: 'github-light',\n dark: 'github-dark',\n },\n defaultColor: false,\n });\n this.highlightedHtml.set(this.sanitizer.bypassSecurityTrustHtml(html));\n } catch {\n this.highlightedHtml.set(null);\n }\n }\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input, ViewEncapsulation, } from '@angular/core';
2
+ import { cn } from '@semantic-components/ui';
3
+ import * as i0 from "@angular/core";
4
+ export class ScCodeViewerHeader {
5
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
6
+ class = computed(() => cn('flex items-center justify-between border-b border-border px-4 py-2', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
7
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeViewerHeader, deps: [], target: i0.ɵɵFactoryTarget.Component });
8
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.4", type: ScCodeViewerHeader, isStandalone: true, selector: "div[sc-code-viewer-header]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "code-viewer-header" }, properties: { "class": "class()" } }, ngImport: i0, template: `
9
+ <ng-content />
10
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
11
+ }
12
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeViewerHeader, decorators: [{
13
+ type: Component,
14
+ args: [{
15
+ selector: 'div[sc-code-viewer-header]',
16
+ template: `
17
+ <ng-content />
18
+ `,
19
+ host: {
20
+ 'data-slot': 'code-viewer-header',
21
+ '[class]': 'class()',
22
+ },
23
+ encapsulation: ViewEncapsulation.None,
24
+ changeDetection: ChangeDetectionStrategy.OnPush,
25
+ }]
26
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
27
+ //# sourceMappingURL=code-viewer-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-viewer-header.js","sourceRoot":"","sources":["../../../../../../../libs/code/src/lib/components/code-viewer/code-viewer-header.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;;AAc7C,MAAM,OAAO,kBAAkB;IACpB,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IAEzC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CACA,oEAAoE,EACpE,IAAI,CAAC,UAAU,EAAE,CAClB,iDACF,CAAC;uGARS,kBAAkB;2FAAlB,kBAAkB,qUAVnB;;GAET;;2FAQU,kBAAkB;kBAZ9B,SAAS;mBAAC;oBACT,QAAQ,EAAE,4BAA4B;oBACtC,QAAQ,EAAE;;GAET;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,oBAAoB;wBACjC,SAAS,EAAE,SAAS;qBACrB;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '@semantic-components/ui';\n\n@Component({\n selector: 'div[sc-code-viewer-header]',\n template: `\n <ng-content />\n `,\n host: {\n 'data-slot': 'code-viewer-header',\n '[class]': 'class()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScCodeViewerHeader {\n readonly classInput = input<string>('', { alias: 'class' });\n\n protected readonly class = computed(() =>\n cn(\n 'flex items-center justify-between border-b border-border px-4 py-2',\n this.classInput(),\n ),\n );\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input, ViewEncapsulation, } from '@angular/core';
2
+ import { cn } from '@semantic-components/ui';
3
+ import * as i0 from "@angular/core";
4
+ export class ScCodeViewerLabel {
5
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
6
+ class = computed(() => cn('text-xs font-medium text-muted-foreground', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
7
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeViewerLabel, deps: [], target: i0.ɵɵFactoryTarget.Component });
8
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.4", type: ScCodeViewerLabel, isStandalone: true, selector: "span[sc-code-viewer-label]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "code-viewer-label" }, properties: { "class": "class()" } }, ngImport: i0, template: `
9
+ <ng-content />
10
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
11
+ }
12
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeViewerLabel, decorators: [{
13
+ type: Component,
14
+ args: [{
15
+ selector: 'span[sc-code-viewer-label]',
16
+ template: `
17
+ <ng-content />
18
+ `,
19
+ host: {
20
+ 'data-slot': 'code-viewer-label',
21
+ '[class]': 'class()',
22
+ },
23
+ encapsulation: ViewEncapsulation.None,
24
+ changeDetection: ChangeDetectionStrategy.OnPush,
25
+ }]
26
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
27
+ //# sourceMappingURL=code-viewer-label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-viewer-label.js","sourceRoot":"","sources":["../../../../../../../libs/code/src/lib/components/code-viewer/code-viewer-label.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;;AAc7C,MAAM,OAAO,iBAAiB;IACnB,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IAEzC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CAAC,2CAA2C,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,iDACnE,CAAC;uGALS,iBAAiB;2FAAjB,iBAAiB,oUAVlB;;GAET;;2FAQU,iBAAiB;kBAZ7B,SAAS;mBAAC;oBACT,QAAQ,EAAE,4BAA4B;oBACtC,QAAQ,EAAE;;GAET;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,mBAAmB;wBAChC,SAAS,EAAE,SAAS;qBACrB;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '@semantic-components/ui';\n\n@Component({\n selector: 'span[sc-code-viewer-label]',\n template: `\n <ng-content />\n `,\n host: {\n 'data-slot': 'code-viewer-label',\n '[class]': 'class()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScCodeViewerLabel {\n readonly classInput = input<string>('', { alias: 'class' });\n\n protected readonly class = computed(() =>\n cn('text-xs font-medium text-muted-foreground', this.classInput()),\n );\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input, ViewEncapsulation, } from '@angular/core';
2
+ import { cn } from '@semantic-components/ui';
3
+ import * as i0 from "@angular/core";
4
+ export class ScCodeViewer {
5
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
6
+ class = computed(() => cn('overflow-hidden rounded-lg border border-border', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
7
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeViewer, deps: [], target: i0.ɵɵFactoryTarget.Component });
8
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.4", type: ScCodeViewer, isStandalone: true, selector: "div[sc-code-viewer]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "code-viewer" }, properties: { "class": "class()" } }, ngImport: i0, template: `
9
+ <ng-content />
10
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
11
+ }
12
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScCodeViewer, decorators: [{
13
+ type: Component,
14
+ args: [{
15
+ selector: 'div[sc-code-viewer]',
16
+ template: `
17
+ <ng-content />
18
+ `,
19
+ host: {
20
+ 'data-slot': 'code-viewer',
21
+ '[class]': 'class()',
22
+ },
23
+ encapsulation: ViewEncapsulation.None,
24
+ changeDetection: ChangeDetectionStrategy.OnPush,
25
+ }]
26
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
27
+ //# sourceMappingURL=code-viewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-viewer.js","sourceRoot":"","sources":["../../../../../../../libs/code/src/lib/components/code-viewer/code-viewer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;;AAc7C,MAAM,OAAO,YAAY;IACd,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IAEzC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CAAC,iDAAiD,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,iDACzE,CAAC;uGALS,YAAY;2FAAZ,YAAY,uTAVb;;GAET;;2FAQU,YAAY;kBAZxB,SAAS;mBAAC;oBACT,QAAQ,EAAE,qBAAqB;oBAC/B,QAAQ,EAAE;;GAET;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,aAAa;wBAC1B,SAAS,EAAE,SAAS;qBACrB;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '@semantic-components/ui';\n\n@Component({\n selector: 'div[sc-code-viewer]',\n template: `\n <ng-content />\n `,\n host: {\n 'data-slot': 'code-viewer',\n '[class]': 'class()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScCodeViewer {\n readonly classInput = input<string>('', { alias: 'class' });\n\n protected readonly class = computed(() =>\n cn('overflow-hidden rounded-lg border border-border', this.classInput()),\n );\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export { ScCodeViewer } from './code-viewer';
2
+ export { ScCodeViewerHeader } from './code-viewer-header';
3
+ export { ScCodeViewerLabel } from './code-viewer-label';
4
+ export { ScCodeViewerContent } from './code-viewer-content';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/code/src/lib/components/code-viewer/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export type { ScCodeViewerLanguage } from './code-viewer-content';\nexport { ScCodeViewer } from './code-viewer';\nexport { ScCodeViewerHeader } from './code-viewer-header';\nexport { ScCodeViewerLabel } from './code-viewer-label';\nexport { ScCodeViewerContent } from './code-viewer-content';\n"]}
@@ -0,0 +1,3 @@
1
+ export * from './code-editor';
2
+ export * from './code-viewer';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/code/src/lib/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC","sourcesContent":["export * from './code-editor';\nexport * from './code-viewer';\n"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
5
+ //# sourceMappingURL=semantic-components-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semantic-components-code.js","sourceRoot":"","sources":["../../../../libs/code/src/semantic-components-code.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
@@ -0,0 +1,57 @@
1
+ import { SafeHtml } from '@angular/platform-browser';
2
+ import * as i0 from "@angular/core";
3
+ export type ScCodeEditorLanguage = 'angular-ts' | 'typescript' | 'javascript' | 'html' | 'css' | 'json' | 'python' | 'bash' | 'shell' | 'markdown' | 'yaml' | 'sql' | 'go' | 'rust' | 'java' | 'plaintext';
4
+ export declare function detectLanguage(code: string, filename?: string): ScCodeEditorLanguage;
5
+ export declare class ScCodeEditorContent {
6
+ readonly value: import("@angular/core").ModelSignal<string>;
7
+ readonly language: import("@angular/core").InputSignal<ScCodeEditorLanguage>;
8
+ readonly filename: import("@angular/core").InputSignal<string>;
9
+ readonly placeholder: import("@angular/core").InputSignal<string>;
10
+ readonly disabled: import("@angular/core").InputSignal<boolean>;
11
+ readonly readonly: import("@angular/core").InputSignal<boolean>;
12
+ readonly showLineNumbers: import("@angular/core").InputSignal<boolean>;
13
+ readonly tabSize: import("@angular/core").InputSignal<number>;
14
+ readonly insertSpaces: import("@angular/core").InputSignal<boolean>;
15
+ readonly wordWrap: import("@angular/core").InputSignal<boolean>;
16
+ readonly autoDetectLanguage: import("@angular/core").InputSignal<boolean>;
17
+ readonly ariaLabel: import("@angular/core").InputSignal<string>;
18
+ readonly ariaDescribedby: import("@angular/core").InputSignal<string>;
19
+ readonly classInput: import("@angular/core").InputSignal<string>;
20
+ readonly valueChange: import("@angular/core").OutputEmitterRef<string>;
21
+ readonly languageDetected: import("@angular/core").OutputEmitterRef<ScCodeEditorLanguage>;
22
+ readonly cursorChange: import("@angular/core").OutputEmitterRef<{
23
+ line: number;
24
+ column: number;
25
+ }>;
26
+ readonly activeLine: import("@angular/core").WritableSignal<number>;
27
+ readonly activeColumn: import("@angular/core").WritableSignal<number>;
28
+ readonly isFocused: import("@angular/core").WritableSignal<boolean>;
29
+ protected readonly highlightedHtml: import("@angular/core").WritableSignal<SafeHtml | null>;
30
+ private scrollTop;
31
+ private scrollLeft;
32
+ private readonly sanitizer;
33
+ private readonly textarea;
34
+ protected readonly lines: import("@angular/core").Signal<string[]>;
35
+ protected readonly lineNumberWidth: import("@angular/core").Signal<number>;
36
+ protected readonly displayCode: import("@angular/core").Signal<string>;
37
+ protected readonly effectiveLanguage: import("@angular/core").Signal<ScCodeEditorLanguage>;
38
+ protected readonly wrapperClass: import("@angular/core").Signal<string>;
39
+ protected readonly textareaClass: import("@angular/core").Signal<string>;
40
+ protected readonly textareaStyle: import("@angular/core").Signal<{
41
+ whiteSpace: string;
42
+ wordBreak: string;
43
+ overflowWrap: string;
44
+ }>;
45
+ constructor();
46
+ private highlight;
47
+ focusTextarea(): void;
48
+ protected onInput(event: Event): void;
49
+ protected onKeydown(event: KeyboardEvent): void;
50
+ protected onScroll(event: Event): void;
51
+ protected onFocus(): void;
52
+ protected onBlur(): void;
53
+ protected updateActiveLine(event: Event): void;
54
+ private updateCursorPosition;
55
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScCodeEditorContent, never>;
56
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScCodeEditorContent, "div[sc-code-editor-content]", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "language": { "alias": "language"; "required": false; "isSignal": true; }; "filename": { "alias": "filename"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "showLineNumbers": { "alias": "showLineNumbers"; "required": false; "isSignal": true; }; "tabSize": { "alias": "tabSize"; "required": false; "isSignal": true; }; "insertSpaces": { "alias": "insertSpaces"; "required": false; "isSignal": true; }; "wordWrap": { "alias": "wordWrap"; "required": false; "isSignal": true; }; "autoDetectLanguage": { "alias": "autoDetectLanguage"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "ariaDescribedby": { "alias": "ariaDescribedby"; "required": false; "isSignal": true; }; "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "valueChange": "valueChange"; "languageDetected": "languageDetected"; "cursorChange": "cursorChange"; }, never, never, true, never>;
57
+ }
@@ -0,0 +1,11 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class ScCodeEditorCopyButton {
3
+ readonly code: import("@angular/core").InputSignal<string>;
4
+ readonly classInput: import("@angular/core").InputSignal<string>;
5
+ readonly copied: import("@angular/core").WritableSignal<boolean>;
6
+ protected readonly class: import("@angular/core").Signal<string>;
7
+ protected readonly ariaLabel: import("@angular/core").Signal<"Copied!" | "Copy code">;
8
+ protected copyCode(event: Event): Promise<void>;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScCodeEditorCopyButton, never>;
10
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScCodeEditorCopyButton, "button[sc-code-editor-copy-button]", never, { "code": { "alias": "code"; "required": true; "isSignal": true; }; "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
11
+ }
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class ScCodeEditorFooter {
3
+ readonly classInput: import("@angular/core").InputSignal<string>;
4
+ protected readonly class: import("@angular/core").Signal<string>;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScCodeEditorFooter, never>;
6
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScCodeEditorFooter, "div[sc-code-editor-footer]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class ScCodeEditorHeader {
3
+ readonly classInput: import("@angular/core").InputSignal<string>;
4
+ protected readonly class: import("@angular/core").Signal<string>;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScCodeEditorHeader, never>;
6
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScCodeEditorHeader, "div[sc-code-editor-header]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class ScCodeEditorLabel {
3
+ readonly classInput: import("@angular/core").InputSignal<string>;
4
+ protected readonly class: import("@angular/core").Signal<string>;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScCodeEditorLabel, never>;
6
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScCodeEditorLabel, "span[sc-code-editor-label]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class ScCodeEditor {
3
+ readonly classInput: import("@angular/core").InputSignal<string>;
4
+ protected readonly class: import("@angular/core").Signal<string>;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScCodeEditor, never>;
6
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScCodeEditor, "div[sc-code-editor]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
7
+ }
@@ -0,0 +1,17 @@
1
+ import { SafeHtml } from '@angular/platform-browser';
2
+ import * as i0 from "@angular/core";
3
+ export type ScCodeViewerLanguage = 'angular-ts' | 'typescript' | 'javascript' | 'html' | 'css' | 'json' | 'python' | 'bash' | 'shell' | 'markdown' | 'yaml' | 'sql' | 'go' | 'rust' | 'java' | 'plaintext';
4
+ export declare class ScCodeViewerContent {
5
+ readonly code: import("@angular/core").InputSignal<string>;
6
+ readonly language: import("@angular/core").InputSignal<ScCodeViewerLanguage>;
7
+ readonly showLineNumbers: import("@angular/core").InputSignal<boolean>;
8
+ readonly classInput: import("@angular/core").InputSignal<string>;
9
+ private readonly sanitizer;
10
+ protected readonly highlightedHtml: import("@angular/core").WritableSignal<SafeHtml | null>;
11
+ protected readonly wrapperClass: import("@angular/core").Signal<string>;
12
+ protected readonly contentClass: import("@angular/core").Signal<string>;
13
+ constructor();
14
+ private highlight;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScCodeViewerContent, never>;
16
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScCodeViewerContent, "div[sc-code-viewer-content]", never, { "code": { "alias": "code"; "required": true; "isSignal": true; }; "language": { "alias": "language"; "required": false; "isSignal": true; }; "showLineNumbers": { "alias": "showLineNumbers"; "required": false; "isSignal": true; }; "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
17
+ }
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class ScCodeViewerHeader {
3
+ readonly classInput: import("@angular/core").InputSignal<string>;
4
+ protected readonly class: import("@angular/core").Signal<string>;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScCodeViewerHeader, never>;
6
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScCodeViewerHeader, "div[sc-code-viewer-header]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class ScCodeViewerLabel {
3
+ readonly classInput: import("@angular/core").InputSignal<string>;
4
+ protected readonly class: import("@angular/core").Signal<string>;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScCodeViewerLabel, never>;
6
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScCodeViewerLabel, "span[sc-code-viewer-label]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class ScCodeViewer {
3
+ readonly classInput: import("@angular/core").InputSignal<string>;
4
+ protected readonly class: import("@angular/core").Signal<string>;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScCodeViewer, never>;
6
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScCodeViewer, "div[sc-code-viewer]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semantic-components/code",
3
- "version": "0.63.0",
3
+ "version": "0.64.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -16,12 +16,24 @@
16
16
  "@angular/core": ">=21.1.0",
17
17
  "@angular/platform-browser": ">=21.1.4",
18
18
  "shiki": ">=3.21.0",
19
- "@semantic-components/ui": "0.63.0"
19
+ "@semantic-components/ui": "0.64.0"
20
20
  },
21
21
  "exports": {
22
22
  "./styles": {
23
23
  "default": "./src/lib/styles/index.css"
24
+ },
25
+ "./package.json": {
26
+ "default": "./package.json"
27
+ },
28
+ ".": {
29
+ "types": "./semantic-components-code.d.ts",
30
+ "default": "./esm2022/semantic-components-code.js"
24
31
  }
25
32
  },
26
- "sideEffects": false
33
+ "sideEffects": false,
34
+ "module": "esm2022/semantic-components-code.js",
35
+ "typings": "semantic-components-code.d.ts",
36
+ "dependencies": {
37
+ "tslib": "^2.3.0"
38
+ }
27
39
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@semantic-components/code" />
5
+ export * from './index';
package/eslint.config.mjs DELETED
@@ -1,48 +0,0 @@
1
- import nx from '@nx/eslint-plugin';
2
- import baseConfig from '../../eslint.config.mjs';
3
-
4
- export default [
5
- ...baseConfig,
6
- {
7
- files: ['**/*.json'],
8
- rules: {
9
- '@nx/dependency-checks': [
10
- 'error',
11
- {
12
- ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}'],
13
- },
14
- ],
15
- },
16
- languageOptions: {
17
- parser: await import('jsonc-eslint-parser'),
18
- },
19
- },
20
- ...nx.configs['flat/angular'],
21
- ...nx.configs['flat/angular-template'],
22
- {
23
- files: ['**/*.ts'],
24
- rules: {
25
- '@angular-eslint/directive-selector': [
26
- 'error',
27
- {
28
- type: 'attribute',
29
- prefix: 'sc',
30
- style: 'camelCase',
31
- },
32
- ],
33
- '@angular-eslint/component-selector': [
34
- 'error',
35
- {
36
- type: 'element',
37
- prefix: 'sc',
38
- style: 'kebab-case',
39
- },
40
- ],
41
- },
42
- },
43
- {
44
- files: ['**/*.html'],
45
- // Override or add rules here
46
- rules: {},
47
- },
48
- ];
package/ng-package.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/libs/code",
4
- "assets": ["./src/lib/styles"],
5
- "lib": {
6
- "entryFile": "src/index.ts"
7
- }
8
- }