@taiga-ui/addon-doc 2.23.0 → 2.27.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 (101) hide show
  1. package/README.md +123 -135
  2. package/bundles/taiga-ui-addon-doc.umd.js +985 -931
  3. package/bundles/taiga-ui-addon-doc.umd.js.map +1 -1
  4. package/bundles/taiga-ui-addon-doc.umd.min.js +2 -2
  5. package/bundles/taiga-ui-addon-doc.umd.min.js.map +1 -1
  6. package/components/code/code.component.d.ts +4 -1
  7. package/components/demo/demo.component.d.ts +8 -8
  8. package/components/documentation/documentation-property-connector.directive.d.ts +1 -1
  9. package/components/example/example-get-tabs.pipe.d.ts +4 -0
  10. package/components/example/example.component.d.ts +4 -7
  11. package/components/navigation/navigation.component.d.ts +1 -1
  12. package/components/page/page.component.d.ts +1 -1
  13. package/esm2015/addon-doc.module.js +1 -1
  14. package/esm2015/components/code/code.component.js +11 -4
  15. package/esm2015/components/code/code.module.js +1 -1
  16. package/esm2015/components/copy/copy.component.js +2 -2
  17. package/esm2015/components/copy/copy.module.js +1 -1
  18. package/esm2015/components/demo/demo.component.js +13 -13
  19. package/esm2015/components/demo/demo.module.js +1 -1
  20. package/esm2015/components/documentation/documentation-property-connector.directive.js +6 -7
  21. package/esm2015/components/documentation/documentation.component.js +2 -2
  22. package/esm2015/components/documentation/documentation.module.js +2 -2
  23. package/esm2015/components/example/example-get-tabs.pipe.js +12 -0
  24. package/esm2015/components/example/example.component.js +8 -26
  25. package/esm2015/components/example/example.module.js +4 -3
  26. package/esm2015/components/main/main.module.js +1 -1
  27. package/esm2015/components/navigation/navigation.component.js +3 -3
  28. package/esm2015/components/navigation/navigation.module.js +1 -1
  29. package/esm2015/components/navigation/navigation.providers.js +1 -1
  30. package/esm2015/components/page/page.component.js +4 -4
  31. package/esm2015/components/page/page.module.js +2 -2
  32. package/esm2015/components/page/page.providers.js +1 -1
  33. package/esm2015/directives/scroll-into-view/scroll-into-view.module.js +1 -1
  34. package/esm2015/interfaces/page.js +1 -1
  35. package/esm2015/internal/header/header.component.js +2 -2
  36. package/esm2015/internal/header/header.module.js +1 -1
  37. package/esm2015/internal/input-opacity/input-opacity.module.js +1 -1
  38. package/esm2015/internal/see-also/see-also.component.js +2 -2
  39. package/esm2015/internal/see-also/see-also.module.js +1 -1
  40. package/esm2015/internal/source-code/source-code.component.js +2 -2
  41. package/esm2015/internal/source-code/source-code.module.js +1 -1
  42. package/esm2015/languages/russian.js +1 -1
  43. package/esm2015/public-api.js +5 -5
  44. package/esm2015/taiga-ui-addon-doc.js +12 -11
  45. package/esm2015/tokens/code-editor.js +1 -1
  46. package/esm2015/tokens/example-content-processor.js +2 -4
  47. package/esm2015/tokens/i18n.js +13 -5
  48. package/esm2015/tokens/pages.js +1 -1
  49. package/esm2015/tokens/source-code.js +1 -1
  50. package/esm2015/utils/raw-load-record.js +12 -0
  51. package/esm2015/utils/raw-load.js +7 -0
  52. package/esm5/addon-doc.module.js +1 -1
  53. package/esm5/components/code/code.component.js +15 -4
  54. package/esm5/components/code/code.module.js +1 -1
  55. package/esm5/components/copy/copy.component.js +2 -2
  56. package/esm5/components/copy/copy.module.js +1 -1
  57. package/esm5/components/demo/demo.component.js +13 -13
  58. package/esm5/components/demo/demo.module.js +1 -1
  59. package/esm5/components/documentation/documentation-property-connector.directive.js +6 -7
  60. package/esm5/components/documentation/documentation.component.js +2 -2
  61. package/esm5/components/documentation/documentation.module.js +2 -2
  62. package/esm5/components/example/example-get-tabs.pipe.js +15 -0
  63. package/esm5/components/example/example.component.js +9 -43
  64. package/esm5/components/example/example.module.js +4 -3
  65. package/esm5/components/main/main.module.js +1 -1
  66. package/esm5/components/navigation/navigation.component.js +3 -3
  67. package/esm5/components/navigation/navigation.module.js +1 -1
  68. package/esm5/components/navigation/navigation.providers.js +1 -1
  69. package/esm5/components/page/page.component.js +4 -4
  70. package/esm5/components/page/page.module.js +2 -2
  71. package/esm5/components/page/page.providers.js +1 -1
  72. package/esm5/directives/scroll-into-view/scroll-into-view.module.js +1 -1
  73. package/esm5/interfaces/page.js +1 -1
  74. package/esm5/internal/header/header.component.js +2 -2
  75. package/esm5/internal/header/header.module.js +1 -1
  76. package/esm5/internal/input-opacity/input-opacity.module.js +1 -1
  77. package/esm5/internal/see-also/see-also.component.js +2 -2
  78. package/esm5/internal/see-also/see-also.module.js +1 -1
  79. package/esm5/internal/source-code/source-code.component.js +2 -2
  80. package/esm5/internal/source-code/source-code.module.js +1 -1
  81. package/esm5/languages/russian.js +1 -1
  82. package/esm5/public-api.js +5 -5
  83. package/esm5/taiga-ui-addon-doc.js +12 -11
  84. package/esm5/tokens/code-editor.js +1 -1
  85. package/esm5/tokens/example-content-processor.js +2 -4
  86. package/esm5/tokens/i18n.js +13 -5
  87. package/esm5/tokens/pages.js +1 -1
  88. package/esm5/tokens/source-code.js +1 -1
  89. package/esm5/utils/raw-load-record.js +44 -0
  90. package/esm5/utils/raw-load.js +21 -0
  91. package/fesm2015/taiga-ui-addon-doc.js +603 -587
  92. package/fesm2015/taiga-ui-addon-doc.js.map +1 -1
  93. package/fesm5/taiga-ui-addon-doc.js +972 -919
  94. package/fesm5/taiga-ui-addon-doc.js.map +1 -1
  95. package/interfaces/page.d.ts +4 -0
  96. package/package.json +7 -6
  97. package/public-api.d.ts +4 -4
  98. package/taiga-ui-addon-doc.d.ts +11 -10
  99. package/taiga-ui-addon-doc.metadata.json +1 -1
  100. package/utils/raw-load-record.d.ts +2 -0
  101. package/utils/raw-load.d.ts +2 -0
package/README.md CHANGED
@@ -26,154 +26,142 @@ npm i @taiga-ui/addon-doc
26
26
 
27
27
  1. Include `TuiDocMainModule` in your App module and use in your template:
28
28
 
29
- ```html
30
- <tui-doc-main>
31
- You can add content here, it will be shown below navigation in the sidebar
32
- </tui-doc-main>
33
- ```
29
+ ```html
30
+ <tui-doc-main>You can add content here, it will be shown below navigation in the sidebar</tui-doc-main>
31
+ ```
34
32
 
35
33
  2. Configure languages to highlight in your main module:
36
34
 
37
- ```typescript
38
- import {NgModule} from '@angular/core';
39
- import {TuiDocMainModule} from '@taiga-ui/addon-doc';
40
- import {hljsLanguages} from './hljsLanguages';
41
- import {HIGHLIGHT_OPTIONS, HighlightLanguage} from 'ngx-highlightjs';
42
- import {AppComponent} from './app.component';
43
-
44
- @NgModule({
45
- bootstrap: [AppComponent],
46
- imports: [TuiDocMainModule],
47
- declarations: [AppComponent],
48
- providers: [
49
- {
50
- provide: HIGHLIGHT_OPTIONS,
51
- useValue: {
52
- coreLibraryLoader: () => import('highlight.js/lib/core' as string),
53
- lineNumbersLoader: () =>
54
- import('highlightjs-line-numbers.js' as string), // Optional, only if you want the line numbers
55
- languages: {
56
- typescript: () =>
57
- import('highlight.js/lib/languages/typescript' as string),
58
- less: () => import('highlight.js/lib/languages/less' as string),
59
- xml: () => import('highlight.js/lib/languages/xml' as string),
60
- },
61
- },
62
- },
63
- ],
64
- })
65
- export class AppBrowserModule {}
66
- ```
35
+ ```typescript
36
+ import {NgModule} from '@angular/core';
37
+ import {TuiDocMainModule} from '@taiga-ui/addon-doc';
38
+ import {hljsLanguages} from './hljsLanguages';
39
+ import {HIGHLIGHT_OPTIONS, HighlightLanguage} from 'ngx-highlightjs';
40
+ import {AppComponent} from './app.component';
41
+
42
+ @NgModule({
43
+ bootstrap: [AppComponent],
44
+ imports: [TuiDocMainModule],
45
+ declarations: [AppComponent],
46
+ providers: [
47
+ {
48
+ provide: HIGHLIGHT_OPTIONS,
49
+ useValue: {
50
+ coreLibraryLoader: () => import('highlight.js/lib/core' as string),
51
+ lineNumbersLoader: () => import('highlightjs-line-numbers.js' as string), // Optional, only if you want the line numbers
52
+ languages: {
53
+ typescript: () => import('highlight.js/lib/languages/typescript' as string),
54
+ less: () => import('highlight.js/lib/languages/less' as string),
55
+ xml: () => import('highlight.js/lib/languages/xml' as string),
56
+ },
57
+ },
58
+ },
59
+ ],
60
+ })
61
+ export class AppBrowserModule {}
62
+ ```
67
63
 
68
64
  3. Configure documentation providers:
69
65
 
70
- `TUI_DOC_PAGES` — an array of pages, see `TuiDocPages` type
66
+ `TUI_DOC_PAGES` — an array of pages, see `TuiDocPages` type
71
67
 
72
- `TUI_DOC_LOGO` — an src for the SVG logo in the sidebar
68
+ `TUI_DOC_LOGO` — an src for the SVG logo in the sidebar
73
69
 
74
- `TUI_DOC_DEFAULT_TABS` — an array of default named for tabs on your typical page
70
+ `TUI_DOC_DEFAULT_TABS` — an array of default named for tabs on your typical page
75
71
 
76
- `TUI_DOC_TITLE` — a title prefix for the browser tab
72
+ `TUI_DOC_TITLE` — a title prefix for the browser tab
77
73
 
78
- `TUI_DOC_SEE_ALSO` — a two dimensional array of related pages by their titles
74
+ `TUI_DOC_SEE_ALSO` — a two dimensional array of related pages by their titles
79
75
 
80
76
  4. Configure routing:
81
77
 
82
- ```typescript
83
- import {Routes} from '@angular/router';
84
-
85
- const appRoutes: Routes = [
86
- {
87
- path: 'super-page',
88
- loadChildren: '../super-page/super-page.module#SuperModule',
89
- data: {
90
- title: 'Super Page',
91
- },
92
- },
93
- // ...
94
- ];
95
- ```
96
-
97
- > You must have title in route data in order for `TUI_DOC_SEE_ALSO` to work.
98
- > It would also be automatically added to `TUI_DOC_TITLE` for browser tab title
99
- > when navigating to that route.
78
+ ```typescript
79
+ import {Routes} from '@angular/router';
80
+
81
+ const appRoutes: Routes = [
82
+ {
83
+ path: 'super-page',
84
+ loadChildren: '../super-page/super-page.module#SuperModule',
85
+ data: {
86
+ title: 'Super Page',
87
+ },
88
+ },
89
+ // ...
90
+ ];
91
+ ```
92
+
93
+ > You must have title in route data in order for `TUI_DOC_SEE_ALSO` to work. It would also be automatically added to
94
+ > `TUI_DOC_TITLE` for browser tab title when navigating to that route.
100
95
 
101
96
  5. Create pages.
102
97
 
103
- _Module:_
104
-
105
- ```typescript
106
- import {NgModule} from '@angular/core';
107
- import {RouterModule} from '@angular/router';
108
- import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc';
109
- import {SuperComponent} from './super.component';
110
-
111
- @NgModule({
112
- imports: [
113
- TuiAddonDocModule,
114
- RouterModule.forChild(generateRoutes(SuperComponent)),
115
- ],
116
- declarations: [SuperComponent],
117
- exports: [SuperComponent],
118
- })
119
- export class SuperModule {}
120
- ```
121
-
122
- _Component:_
123
-
124
- ```typescript
125
- import {Component} from '@angular/core';
126
-
127
- import {default as exampleHtml} from '!!raw-loader!./examples/1/index.html';
128
- import {default as exampleTs} from '!!raw-loader!./examples/1/index.ts';
129
-
130
- @Component({
131
- selector: 'super-component',
132
- templateUrl: './account.template.html',
133
- })
134
- export class SuperComponent {
135
- // Keys would be used as tabs for code example
136
- readonly example = {
137
- TypeScript: exampleTs,
138
- HTML: exampleHtml,
139
- };
140
-
141
- readonly inputVariants = ['input 1', 'input 2'];
142
- }
143
- ```
144
-
145
- _Template:_
146
-
147
- ```html
148
- <tui-doc-page header="Super" package="SUPER-PACKAGE" deprecated>
149
- <ng-template pageTab>
150
- <!-- default tab name would be used -->
151
- This would be the content of a first tab
152
-
153
- <tui-doc-example
154
- id="basic-example"
155
- heading="Example of usage"
156
- [content]="example"
157
- >
158
- <example-1></example-1>
159
- </tui-doc-example>
160
- </ng-template>
161
-
162
- <ng-template pageTab="Documentation">
163
- <tui-doc-demo>
164
- <super-component [input]="input"></super-component>
165
- </tui-doc-demo>
166
- <tui-doc-documentation>
167
- <ng-template
168
- documentationPropertyName="input"
169
- documentationPropertyMode="input"
170
- documentationPropertyType="T"
171
- [documentationPropertyValues]="inputVariants"
172
- [(documentationPropertyValue)]="input"
173
- >
174
- Some input
175
- </ng-template>
176
- </tui-doc-documentation>
177
- </ng-template>
178
- </tui-doc-page>
179
- ```
98
+ _Module:_
99
+
100
+ ```typescript
101
+ import {NgModule} from '@angular/core';
102
+ import {RouterModule} from '@angular/router';
103
+ import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc';
104
+ import {SuperComponent} from './super.component';
105
+
106
+ @NgModule({
107
+ imports: [TuiAddonDocModule, RouterModule.forChild(generateRoutes(SuperComponent))],
108
+ declarations: [SuperComponent],
109
+ exports: [SuperComponent],
110
+ })
111
+ export class SuperModule {}
112
+ ```
113
+
114
+ _Component:_
115
+
116
+ ```typescript
117
+ import {Component} from '@angular/core';
118
+
119
+ import {default as exampleHtml} from '!!raw-loader!./examples/1/index.html';
120
+ import {default as exampleTs} from '!!raw-loader!./examples/1/index.ts';
121
+
122
+ @Component({
123
+ selector: 'super-component',
124
+ templateUrl: './account.template.html',
125
+ })
126
+ export class SuperComponent {
127
+ // Keys would be used as tabs for code example
128
+ readonly example = {
129
+ TypeScript: exampleTs,
130
+ HTML: exampleHtml,
131
+ };
132
+
133
+ readonly inputVariants = ['input 1', 'input 2'];
134
+ }
135
+ ```
136
+
137
+ _Template:_
138
+
139
+ ```html
140
+ <tui-doc-page header="Super" package="SUPER-PACKAGE" deprecated>
141
+ <ng-template pageTab>
142
+ <!-- default tab name would be used -->
143
+ This would be the content of a first tab
144
+
145
+ <tui-doc-example id="basic-example" heading="Example of usage" [content]="example">
146
+ <example-1></example-1>
147
+ </tui-doc-example>
148
+ </ng-template>
149
+
150
+ <ng-template pageTab="Documentation">
151
+ <tui-doc-demo>
152
+ <super-component [input]="input"></super-component>
153
+ </tui-doc-demo>
154
+ <tui-doc-documentation>
155
+ <ng-template
156
+ documentationPropertyName="input"
157
+ documentationPropertyMode="input"
158
+ documentationPropertyType="T"
159
+ [documentationPropertyValues]="inputVariants"
160
+ [(documentationPropertyValue)]="input"
161
+ >
162
+ Some input
163
+ </ng-template>
164
+ </tui-doc-documentation>
165
+ </ng-template>
166
+ </tui-doc-page>
167
+ ```