@mathstack/app-kit 1.1.1 → 2.0.3
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/.eslintrc.json +34 -0
- package/LICENSE +21 -21
- package/README.md +36 -32
- package/ng-package.json +15 -0
- package/package.json +13 -12
- package/project.json +76 -0
- package/src/lib/assets/assets-resource.ts +18 -0
- package/src/lib/assets/assets-service.spec.ts +54 -0
- package/src/lib/assets/assets-service.ts +73 -0
- package/src/lib/assets/index.ts +2 -0
- package/{baseline-styles → src/lib/baseline-styles}/_css-reset.scss +118 -118
- package/{baseline-styles → src/lib/baseline-styles}/_grid.scss +4 -4
- package/{baseline-styles → src/lib/baseline-styles}/_index.scss +6 -6
- package/{baseline-styles → src/lib/baseline-styles}/_sass-utils.scss +23 -23
- package/{baseline-styles → src/lib/baseline-styles}/_themes.scss +19 -19
- package/{baseline-styles → src/lib/baseline-styles}/_typography.scss +232 -232
- package/{baseline-styles → src/lib/baseline-styles}/_webkit-scrollbar.scss +22 -22
- package/{baseline-styles → src/lib/baseline-styles}/theming/_colors.scss +46 -46
- package/{baseline-styles → src/lib/baseline-styles}/theming/_index.scss +2 -2
- package/{baseline-styles → src/lib/baseline-styles}/theming/_typography.scss +32 -32
- package/{lib/content-parsing/index.d.ts → src/lib/content-parsing/index.ts} +2 -2
- package/src/lib/content-parsing/markdown-parser.ts +197 -0
- package/src/lib/content-parsing/shiki-highlighter.ts +219 -0
- package/src/lib/core/scss/_colors.scss +37 -0
- package/src/lib/core/scss/_functions.scss +4 -0
- package/src/lib/core/scss/_placeholders.scss +1 -0
- package/src/lib/core/scss/_vars.scss +15 -0
- package/src/lib/core/testing/stubs/services/assets.resource.stub.ts +3 -0
- package/src/lib/core/testing/stubs/services/main.service.stub.ts +5 -0
- package/src/lib/core/utilities/deep-merge.spec.ts +29 -0
- package/src/lib/core/utilities/deep-merge.ts +21 -0
- package/{lib/core/utilities/index.d.ts → src/lib/core/utilities/index.ts} +2 -2
- package/src/lib/core/utilities/safe-assign.spec.ts +41 -0
- package/{lib/core/utilities/safe-assign.d.ts → src/lib/core/utilities/safe-assign.ts} +42 -18
- package/src/lib/documentation-display/active-heading-tracker.ts +61 -0
- package/src/lib/documentation-display/document-index/document-index.component.html +34 -0
- package/src/lib/documentation-display/document-index/document-index.component.scss +56 -0
- package/src/lib/documentation-display/document-index/document-index.component.spec.ts +0 -0
- package/src/lib/documentation-display/document-index/document-index.component.ts +39 -0
- package/src/lib/documentation-display/documentation-config-parser.ts +92 -0
- package/src/lib/documentation-display/documentation-content-service.ts +118 -0
- package/src/lib/documentation-display/documentation-display.component.html +33 -0
- package/src/lib/documentation-display/documentation-display.component.scss +142 -0
- package/src/lib/documentation-display/documentation-display.component.spec.ts +0 -0
- package/src/lib/documentation-display/documentation-display.component.ts +129 -0
- package/{lib/documentation-display/index.d.ts → src/lib/documentation-display/index.ts} +6 -6
- package/src/lib/documentation-display/navigation-siblings/navigation-siblings.component.html +31 -0
- package/src/lib/documentation-display/navigation-siblings/navigation-siblings.component.scss +68 -0
- package/src/lib/documentation-display/navigation-siblings/navigation-siblings.component.spec.ts +0 -0
- package/src/lib/documentation-display/navigation-siblings/navigation-siblings.component.ts +52 -0
- package/{lib/ng-utilities/index.d.ts → src/lib/ng-utilities/index.ts} +2 -2
- package/src/lib/ng-utilities/ng-on-changes.spec.ts +117 -0
- package/src/lib/ng-utilities/ng-on-changes.ts +50 -0
- package/{lib/ng-utilities/run-ng-change-detection-then.d.ts → src/lib/ng-utilities/run-ng-change-detection-then.ts} +40 -22
- package/{public-api.d.ts → src/public-api.ts} +6 -6
- package/tsconfig.lib.json +16 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +10 -0
- package/fesm2022/mathstack-app-kit.mjs +0 -846
- package/fesm2022/mathstack-app-kit.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/assets/assets-resource.d.ts +0 -11
- package/lib/assets/assets-service.d.ts +0 -35
- package/lib/assets/index.d.ts +0 -1
- package/lib/content-parsing/markdown-parser.d.ts +0 -54
- package/lib/content-parsing/shiki-highlighter.d.ts +0 -77
- package/lib/core/utilities/deep-merge.d.ts +0 -1
- package/lib/documentation-display/active-heading-tracker.d.ts +0 -14
- package/lib/documentation-display/document-index/document-index.component.d.ts +0 -17
- package/lib/documentation-display/documentation-config-parser.d.ts +0 -41
- package/lib/documentation-display/documentation-content-service.d.ts +0 -50
- package/lib/documentation-display/documentation-display.component.d.ts +0 -39
- package/lib/documentation-display/navigation-siblings/navigation-siblings.component.d.ts +0 -18
- package/lib/ng-utilities/ng-on-changes.d.ts +0 -22
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../.eslintrc.json",
|
|
3
|
+
"ignorePatterns": ["!**/*"],
|
|
4
|
+
"overrides": [
|
|
5
|
+
{
|
|
6
|
+
"files": ["*.ts"],
|
|
7
|
+
"parserOptions": {
|
|
8
|
+
"project": ["libs/app-kit/tsconfig.(lib|spec).json"]
|
|
9
|
+
},
|
|
10
|
+
"rules": {
|
|
11
|
+
"@angular-eslint/directive-selector": [
|
|
12
|
+
"error",
|
|
13
|
+
{
|
|
14
|
+
"type": "attribute",
|
|
15
|
+
"prefix": "hsi-adk",
|
|
16
|
+
"style": "camelCase"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"@angular-eslint/component-selector": [
|
|
20
|
+
"error",
|
|
21
|
+
{
|
|
22
|
+
"type": "element",
|
|
23
|
+
"prefix": "hsi-adk",
|
|
24
|
+
"style": "kebab-case"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"files": ["*.html"],
|
|
31
|
+
"rules": {}
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Mathematica
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mathematica
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
# AppDevKit
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
# AppDevKit
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The app-kit is a library of miscellaneous utilities, styles, and components that are specific to
|
|
6
|
+
neither the `@mathstack/ui` nor the `@mathstack/viz` libraries.
|
|
7
|
+
|
|
8
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version
|
|
9
|
+
19.2.0.
|
|
10
|
+
|
|
11
|
+
## Code scaffolding
|
|
12
|
+
|
|
13
|
+
Run `ng generate component component-name --project app-kit` to generate a new component. You can
|
|
14
|
+
also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project app-kit`.
|
|
15
|
+
|
|
16
|
+
> Note: Don't forget to add `--project app-kit` or else it will be added to the default project in
|
|
17
|
+
> your `angular.json` file.
|
|
18
|
+
|
|
19
|
+
## Build
|
|
20
|
+
|
|
21
|
+
Run `ng build app-kit` to build the project. The build artifacts will be stored in the `dist`
|
|
22
|
+
directory.
|
|
23
|
+
|
|
24
|
+
## Publishing
|
|
25
|
+
|
|
26
|
+
After building your library with `ng build app-kit`, go to the dist folder `cd dist/app-kit` and run
|
|
27
|
+
`npm publish`.
|
|
28
|
+
|
|
29
|
+
## Running unit tests
|
|
30
|
+
|
|
31
|
+
Run `ng test app-kit` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
32
|
+
|
|
33
|
+
## Further help
|
|
34
|
+
|
|
35
|
+
To get more help on the Angular CLI use `ng help` or go check out the
|
|
36
|
+
[Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
package/ng-package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
+
"dest": "../../dist/app-kit",
|
|
4
|
+
"lib": {
|
|
5
|
+
"entryFile": "src/public-api.ts"
|
|
6
|
+
},
|
|
7
|
+
"assets": [
|
|
8
|
+
{
|
|
9
|
+
"input": "src/lib/baseline-styles/",
|
|
10
|
+
"glob": "**/*.scss",
|
|
11
|
+
"output": "baseline-styles"
|
|
12
|
+
},
|
|
13
|
+
"LICENSE"
|
|
14
|
+
]
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mathstack/app-kit",
|
|
3
3
|
"license": "MIT",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build": "ng build"
|
|
6
|
+
},
|
|
7
|
+
"version": "2.0.3",
|
|
4
8
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "
|
|
6
|
-
"@angular/core": "
|
|
9
|
+
"@angular/common": ">=18.0.0 <22.0.0",
|
|
10
|
+
"@angular/core": ">=18.0.0 <22.0.0",
|
|
7
11
|
"hast-util-from-parse5": "^8.0.1",
|
|
8
12
|
"html-entities": "^2.5.2",
|
|
9
13
|
"lodash-es": "^4.17.21",
|
|
@@ -26,16 +30,13 @@
|
|
|
26
30
|
},
|
|
27
31
|
"exports": {
|
|
28
32
|
".": {
|
|
29
|
-
"sass": "./baseline-styles/_index.scss"
|
|
30
|
-
"types": "./index.d.ts",
|
|
31
|
-
"default": "./fesm2022/mathstack-app-kit.mjs"
|
|
32
|
-
},
|
|
33
|
-
"./package.json": {
|
|
34
|
-
"default": "./package.json"
|
|
33
|
+
"sass": "./baseline-styles/_index.scss"
|
|
35
34
|
}
|
|
36
35
|
},
|
|
37
36
|
"sideEffects": false,
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/mathematica-pub/frontend-shared-packages.git",
|
|
40
|
+
"directory": "libs/app-kit"
|
|
41
|
+
}
|
|
42
|
+
}
|
package/project.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "app-kit",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"projectType": "library",
|
|
5
|
+
"sourceRoot": "libs/app-kit/src",
|
|
6
|
+
"prefix": "adk",
|
|
7
|
+
"targets": {
|
|
8
|
+
"build": {
|
|
9
|
+
"executor": "@angular-devkit/build-angular:ng-packagr",
|
|
10
|
+
"options": {
|
|
11
|
+
"project": "libs/app-kit/ng-package.json"
|
|
12
|
+
},
|
|
13
|
+
"configurations": {
|
|
14
|
+
"production": {
|
|
15
|
+
"tsConfig": "libs/app-kit/tsconfig.lib.prod.json"
|
|
16
|
+
},
|
|
17
|
+
"development": {
|
|
18
|
+
"tsConfig": "libs/app-kit/tsconfig.lib.json"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"defaultConfiguration": "production",
|
|
22
|
+
"outputs": ["{workspaceRoot}/dist/app-kit"]
|
|
23
|
+
},
|
|
24
|
+
"build-release": {
|
|
25
|
+
"executor": "nx:run-commands",
|
|
26
|
+
"options": {
|
|
27
|
+
"command": "npx nx build app-kit"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"publish": {
|
|
31
|
+
"executor": "nx:run-commands",
|
|
32
|
+
"options": {
|
|
33
|
+
"command": "cd ./dist/app-kit && npm publish --access public && git push --tags"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"github-release": {
|
|
37
|
+
"executor": "@jscutlery/semver:github",
|
|
38
|
+
"options": {
|
|
39
|
+
"tag": "{tag}",
|
|
40
|
+
"notes": "{notes}"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"test": {
|
|
44
|
+
"executor": "@angular-devkit/build-angular:karma",
|
|
45
|
+
"options": {
|
|
46
|
+
"tsConfig": "libs/app-kit/tsconfig.spec.json",
|
|
47
|
+
"polyfills": ["zone.js", "zone.js/testing"],
|
|
48
|
+
"browsers": "ChromeHeadlessNoSandbox",
|
|
49
|
+
"watch": false
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"lint": {
|
|
53
|
+
"executor": "@angular-eslint/builder:lint",
|
|
54
|
+
"options": {
|
|
55
|
+
"lintFilePatterns": ["libs/app-kit/**/*.ts", "libs/app-kit/**/*.html"]
|
|
56
|
+
},
|
|
57
|
+
"outputs": ["{options.outputFile}"]
|
|
58
|
+
},
|
|
59
|
+
"create-changelog": {
|
|
60
|
+
"executor": "nx:run-commands",
|
|
61
|
+
"options": {
|
|
62
|
+
"command": "touch libs/app-kit/CHANGELOG.md"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"version": {
|
|
66
|
+
"executor": "@jscutlery/semver:version",
|
|
67
|
+
"options": {
|
|
68
|
+
"preset": "angular",
|
|
69
|
+
"skipCommit": true,
|
|
70
|
+
"skipRootChangelog": true,
|
|
71
|
+
"postTargets": ["build-release", "publish", "github-release"],
|
|
72
|
+
"skipCommitTypes": ["build", "ci", "docs", "refactor", "style", "test"]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { inject, Injectable } from '@angular/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { AdkAssetResponse } from './assets-service';
|
|
5
|
+
|
|
6
|
+
@Injectable({
|
|
7
|
+
providedIn: 'root',
|
|
8
|
+
})
|
|
9
|
+
export class AdkAssetsResource {
|
|
10
|
+
private http = inject(HttpClient);
|
|
11
|
+
|
|
12
|
+
getAsset(path: string, responseType: AdkAssetResponse): Observable<unknown> {
|
|
13
|
+
return this.http.get<unknown>(path, {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
responseType: responseType as any,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { TestBed } from '@angular/core/testing';
|
|
3
|
+
import { of } from 'rxjs';
|
|
4
|
+
import { MainServiceStub } from '../core/testing/stubs/services/main.service.stub';
|
|
5
|
+
import { AdkAssetsResource } from './assets-resource';
|
|
6
|
+
import { AdkAssetResponse, AdkAssetsService } from './assets-service';
|
|
7
|
+
|
|
8
|
+
describe('AssetsService', () => {
|
|
9
|
+
let service: AdkAssetsService;
|
|
10
|
+
let mainServiceStub: MainServiceStub;
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
mainServiceStub = new MainServiceStub();
|
|
14
|
+
TestBed.configureTestingModule({
|
|
15
|
+
providers: [
|
|
16
|
+
AdkAssetsService,
|
|
17
|
+
{
|
|
18
|
+
provide: AdkAssetsResource,
|
|
19
|
+
useValue: mainServiceStub.assetsResourceStub,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
service = TestBed.inject(AdkAssetsService);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('setAssetsPath()', () => {
|
|
27
|
+
it('should set the assets path', () => {
|
|
28
|
+
service.setAssetsPath('test/');
|
|
29
|
+
expect(service['assetsPath']).toBe('test/');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('getAsset()', () => {
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
spyOn(service as any, 'fetchAsset').and.returnValue(of('asset text'));
|
|
36
|
+
});
|
|
37
|
+
it('calls fetch asset if asset does not exist in assets object', (done) => {
|
|
38
|
+
service.getAsset('test', AdkAssetResponse.Text).subscribe(() => {
|
|
39
|
+
expect(service['fetchAsset']).toHaveBeenCalledOnceWith(
|
|
40
|
+
'test',
|
|
41
|
+
AdkAssetResponse.Text
|
|
42
|
+
);
|
|
43
|
+
done();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
it('does not call fetch asset if asset exists in assets object', (done) => {
|
|
47
|
+
service['assets']['test'] = of('asset text');
|
|
48
|
+
service.getAsset('test', AdkAssetResponse.Text).subscribe(() => {
|
|
49
|
+
expect(service['fetchAsset']).not.toHaveBeenCalled();
|
|
50
|
+
done();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { inject, Injectable } from '@angular/core';
|
|
2
|
+
import { csvParse } from 'd3';
|
|
3
|
+
import { forkJoin, Observable } from 'rxjs';
|
|
4
|
+
import { parse as yamlParse } from 'yaml';
|
|
5
|
+
import { AdkAssetsResource } from './assets-resource';
|
|
6
|
+
|
|
7
|
+
export enum AdkAssetResponse {
|
|
8
|
+
ArrayBuffer = 'arraybuffer',
|
|
9
|
+
Blob = 'blob',
|
|
10
|
+
Json = 'json',
|
|
11
|
+
Text = 'text',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@Injectable({ providedIn: 'root' })
|
|
15
|
+
export class AdkAssetsService {
|
|
16
|
+
private assets: { [key: string]: Observable<unknown> } = {};
|
|
17
|
+
private assetsPath = 'assets/';
|
|
18
|
+
|
|
19
|
+
private resource = inject(AdkAssetsResource);
|
|
20
|
+
|
|
21
|
+
setAssetsPath(path: string): void {
|
|
22
|
+
this.assetsPath = path;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Loads an asset from the assets folder.
|
|
27
|
+
*
|
|
28
|
+
* @param assetName The path to the asset from assets/. Should not include leading slash.
|
|
29
|
+
* @returns An observable that emits the asset data.
|
|
30
|
+
*/
|
|
31
|
+
getAsset(
|
|
32
|
+
assetName: string,
|
|
33
|
+
responseType: AdkAssetResponse
|
|
34
|
+
): Observable<unknown> {
|
|
35
|
+
if (!this.assets[assetName]) {
|
|
36
|
+
this.assets[assetName] = this.fetchAsset(assetName, responseType);
|
|
37
|
+
}
|
|
38
|
+
return this.assets[assetName];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private fetchAsset(
|
|
42
|
+
assetName: string,
|
|
43
|
+
responseType: AdkAssetResponse
|
|
44
|
+
): Observable<unknown> {
|
|
45
|
+
return this.resource.getAsset(
|
|
46
|
+
`${this.assetsPath}${assetName}`,
|
|
47
|
+
responseType
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Loads multiple assets concurrently.
|
|
53
|
+
*
|
|
54
|
+
* @param assetNames An array of asset names to load.
|
|
55
|
+
* @returns An observable that emits an array of asset data.
|
|
56
|
+
*/
|
|
57
|
+
getAssets(
|
|
58
|
+
assetNames: string[],
|
|
59
|
+
responseType: AdkAssetResponse
|
|
60
|
+
): Observable<unknown[]> {
|
|
61
|
+
return forkJoin(
|
|
62
|
+
assetNames.map((assetName) => this.getAsset(assetName, responseType))
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
parseCsv<T>(str: string): T[] {
|
|
67
|
+
return csvParse(str) as unknown as T[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
parseYaml<T>(str: string): T {
|
|
71
|
+
return yamlParse(str) as T;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
@mixin css-reset($default-font: var(--hsi-adk-font-sans), $color-text: #000) {
|
|
2
|
-
$system-font-family:
|
|
3
|
-
-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica,
|
|
4
|
-
Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
|
|
5
|
-
|
|
6
|
-
*,
|
|
7
|
-
*::before,
|
|
8
|
-
*::after {
|
|
9
|
-
box-sizing: border-box;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
body {
|
|
13
|
-
min-height: 100vh;
|
|
14
|
-
width: 100vw;
|
|
15
|
-
overflow-x: hidden;
|
|
16
|
-
background: white;
|
|
17
|
-
font-family: $default-font, $system-font-family;
|
|
18
|
-
color: $color-text;
|
|
19
|
-
font-size: 1rem;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
body,
|
|
23
|
-
h1,
|
|
24
|
-
h2,
|
|
25
|
-
h3,
|
|
26
|
-
h4,
|
|
27
|
-
p,
|
|
28
|
-
figure,
|
|
29
|
-
blockquote,
|
|
30
|
-
dl,
|
|
31
|
-
dd {
|
|
32
|
-
margin: 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
p {
|
|
36
|
-
line-height: 1.5;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
button,
|
|
40
|
-
a {
|
|
41
|
-
cursor: pointer;
|
|
42
|
-
color: $color-text;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
button {
|
|
46
|
-
border: none;
|
|
47
|
-
background: none;
|
|
48
|
-
padding: 0;
|
|
49
|
-
padding-block: 0;
|
|
50
|
-
padding-inline: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
a {
|
|
54
|
-
text-decoration: none;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
ul[role='list'],
|
|
58
|
-
ol[role='list'] {
|
|
59
|
-
list-style: none;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
html:focus-within {
|
|
63
|
-
scroll-behavior: smooth;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
a:not([class]) {
|
|
67
|
-
text-decoration-skip-ink: auto;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
img,
|
|
71
|
-
picture {
|
|
72
|
-
max-width: 100%;
|
|
73
|
-
display: block;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
input,
|
|
77
|
-
button,
|
|
78
|
-
textarea,
|
|
79
|
-
select {
|
|
80
|
-
font: inherit;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
fieldset {
|
|
84
|
-
border: none;
|
|
85
|
-
padding: 0;
|
|
86
|
-
margin: 0;
|
|
87
|
-
padding-inline-start: 0;
|
|
88
|
-
padding-inline-end: 0;
|
|
89
|
-
margin-inline-start: 0;
|
|
90
|
-
margin-inline-end: 0;
|
|
91
|
-
padding-block-start: 0;
|
|
92
|
-
padding-block-end: 0;
|
|
93
|
-
min-inline-size: 0px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
legend {
|
|
97
|
-
padding: 0;
|
|
98
|
-
margin: 0;
|
|
99
|
-
padding-inline-start: 0;
|
|
100
|
-
padding-inline-end: 0;
|
|
101
|
-
border: none;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@media (prefers-reduced-motion: reduce) {
|
|
105
|
-
html:focus-within {
|
|
106
|
-
scroll-behavior: auto;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
*,
|
|
110
|
-
*::before,
|
|
111
|
-
*::after {
|
|
112
|
-
animation-duration: 0.01ms !important;
|
|
113
|
-
animation-iteration-count: 1 !important;
|
|
114
|
-
transition-duration: 0.01ms !important;
|
|
115
|
-
scroll-behavior: auto !important;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
1
|
+
@mixin css-reset($default-font: var(--hsi-adk-font-sans), $color-text: #000) {
|
|
2
|
+
$system-font-family:
|
|
3
|
+
-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica,
|
|
4
|
+
Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
|
|
5
|
+
|
|
6
|
+
*,
|
|
7
|
+
*::before,
|
|
8
|
+
*::after {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
body {
|
|
13
|
+
min-height: 100vh;
|
|
14
|
+
width: 100vw;
|
|
15
|
+
overflow-x: hidden;
|
|
16
|
+
background: white;
|
|
17
|
+
font-family: $default-font, $system-font-family;
|
|
18
|
+
color: $color-text;
|
|
19
|
+
font-size: 1rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
body,
|
|
23
|
+
h1,
|
|
24
|
+
h2,
|
|
25
|
+
h3,
|
|
26
|
+
h4,
|
|
27
|
+
p,
|
|
28
|
+
figure,
|
|
29
|
+
blockquote,
|
|
30
|
+
dl,
|
|
31
|
+
dd {
|
|
32
|
+
margin: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
p {
|
|
36
|
+
line-height: 1.5;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
button,
|
|
40
|
+
a {
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
color: $color-text;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
button {
|
|
46
|
+
border: none;
|
|
47
|
+
background: none;
|
|
48
|
+
padding: 0;
|
|
49
|
+
padding-block: 0;
|
|
50
|
+
padding-inline: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
a {
|
|
54
|
+
text-decoration: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
ul[role='list'],
|
|
58
|
+
ol[role='list'] {
|
|
59
|
+
list-style: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
html:focus-within {
|
|
63
|
+
scroll-behavior: smooth;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
a:not([class]) {
|
|
67
|
+
text-decoration-skip-ink: auto;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
img,
|
|
71
|
+
picture {
|
|
72
|
+
max-width: 100%;
|
|
73
|
+
display: block;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
input,
|
|
77
|
+
button,
|
|
78
|
+
textarea,
|
|
79
|
+
select {
|
|
80
|
+
font: inherit;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
fieldset {
|
|
84
|
+
border: none;
|
|
85
|
+
padding: 0;
|
|
86
|
+
margin: 0;
|
|
87
|
+
padding-inline-start: 0;
|
|
88
|
+
padding-inline-end: 0;
|
|
89
|
+
margin-inline-start: 0;
|
|
90
|
+
margin-inline-end: 0;
|
|
91
|
+
padding-block-start: 0;
|
|
92
|
+
padding-block-end: 0;
|
|
93
|
+
min-inline-size: 0px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
legend {
|
|
97
|
+
padding: 0;
|
|
98
|
+
margin: 0;
|
|
99
|
+
padding-inline-start: 0;
|
|
100
|
+
padding-inline-end: 0;
|
|
101
|
+
border: none;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@media (prefers-reduced-motion: reduce) {
|
|
105
|
+
html:focus-within {
|
|
106
|
+
scroll-behavior: auto;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
*,
|
|
110
|
+
*::before,
|
|
111
|
+
*::after {
|
|
112
|
+
animation-duration: 0.01ms !important;
|
|
113
|
+
animation-iteration-count: 1 !important;
|
|
114
|
+
transition-duration: 0.01ms !important;
|
|
115
|
+
scroll-behavior: auto !important;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@function grid($number) {
|
|
2
|
-
$grid: 0.25rem;
|
|
3
|
-
@return $number * $grid;
|
|
4
|
-
}
|
|
1
|
+
@function grid($number) {
|
|
2
|
+
$grid: 0.25rem;
|
|
3
|
+
@return $number * $grid;
|
|
4
|
+
}
|