@chill-sharp/create-app 1.1.12 → 1.1.15

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 (40) hide show
  1. package/README.md +12 -12
  2. package/package.json +36 -36
  3. package/template/.agents/skills/chillsharp-current-user-preferences/SKILL.md +70 -70
  4. package/template/.agents/skills/chillsharp-ui-template/SKILL.md +18 -18
  5. package/template/.editorconfig +11 -11
  6. package/template/.github/workflows/ci.yml +33 -33
  7. package/template/.github/workflows/deploy.yml +36 -36
  8. package/template/angular.json +131 -131
  9. package/template/doc/CurrentUserPreferences.md +106 -106
  10. package/template/doc/it/CurrentUserPreferences.md +106 -106
  11. package/template/gitignore +6 -6
  12. package/template/package.json +43 -43
  13. package/template/public/env.js +15 -15
  14. package/template/public/runtime-config.js +10 -10
  15. package/template/public/sw.js +8 -8
  16. package/template/src/app/app.component.spec.ts +15 -15
  17. package/template/src/app/app.component.ts +10 -10
  18. package/template/src/app/app.config.ts +22 -22
  19. package/template/src/app/app.routes.ts +14 -14
  20. package/template/src/app/core/overrides/README.md +12 -12
  21. package/template/src/app/core/overrides/register-client-overrides.ts +5 -5
  22. package/template/src/app/core/plugins/README.md +17 -17
  23. package/template/src/app/core/plugins/hello-plugin/README.md +25 -25
  24. package/template/src/app/core/plugins/hello-plugin/hello-plugin.component.ts +28 -28
  25. package/template/src/app/core/plugins/register-client-plugins.ts +16 -16
  26. package/template/src/app/core/providers/client-template.providers.ts +8 -8
  27. package/template/src/app/pages/client-home/client-home.component.ts +41 -41
  28. package/template/src/assets/branding/logo.svg +7 -7
  29. package/template/src/config/app-config.ts +17 -17
  30. package/template/src/config/runtime-config.ts +13 -13
  31. package/template/src/environments/environment.prod.ts +4 -4
  32. package/template/src/environments/environment.ts +4 -4
  33. package/template/src/index.html +22 -22
  34. package/template/src/main.ts +6 -6
  35. package/template/src/runtime-config.d.ts +10 -10
  36. package/template/src/styles.scss +116 -116
  37. package/template/tsconfig.app.json +13 -13
  38. package/template/tsconfig.json +33 -33
  39. package/template/tsconfig.spec.json +13 -13
  40. package/bin/create-chill-sharp-app.mjs +0 -60
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # Create ChillSharp App
2
-
3
- Creates a ready-to-run Angular application shell backed by the published ChillSharp npm packages.
4
-
5
- ```bash
6
- npm create @chill-sharp/app my-app
7
- cd my-app
8
- npm install
9
- npm start
10
- ```
11
-
12
- The generator copies the client-owned application shell and configures it to use `@chill-sharp/ts-client`, `@chill-sharp/ng-client`, and `@chill-sharp/ui-core` from npm.
1
+ # Create ChillSharp App
2
+
3
+ Creates a ready-to-run Angular application shell backed by the published ChillSharp npm packages.
4
+
5
+ ```bash
6
+ npm create @chill-sharp/app my-app
7
+ cd my-app
8
+ npm install
9
+ npm start
10
+ ```
11
+
12
+ The generator copies the client-owned application shell and configures it to use `@chill-sharp/ts-client`, `@chill-sharp/ng-client`, and `@chill-sharp/ui-core` from npm.
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
- {
2
- "name": "@chill-sharp/create-app",
3
- "repository": {
4
- "type": "git",
5
- "url": "git+https://github.com/e-500/chill-sharp.git",
6
- "directory": "extra/chill-sharp-create-app"
7
- },
8
- "version": "1.1.12",
9
- "description": "Create an Angular application powered by ChillSharp UI.",
10
- "license": "AGPL-3.0-or-later",
11
- "type": "module",
12
- "bin": {
13
- "create-chill-sharp-app": "./bin/create-chill-sharp-app.mjs"
14
- },
15
- "scripts": {
16
- "build": "node --check bin/create-chill-sharp-app.mjs"
17
- },
18
- "files": [
19
- "bin",
20
- "template",
21
- "README.md"
22
- ],
23
- "engines": {
24
- "node": ">=20"
25
- },
26
- "keywords": [
27
- "chillsharp",
28
- "angular",
29
- "starter",
30
- "generator"
31
- ],
32
- "author": "Andrea Piovesan",
33
- "publishConfig": {
34
- "access": "public"
35
- }
36
- }
1
+ {
2
+ "name": "@chill-sharp/create-app",
3
+ "repository": {
4
+ "type": "git",
5
+ "url": "git+https://github.com/e-500/chill-sharp.git",
6
+ "directory": "extra/chill-sharp-create-app"
7
+ },
8
+ "version": "1.1.15",
9
+ "description": "Create an Angular application powered by ChillSharp UI.",
10
+ "license": "AGPL-3.0-or-later",
11
+ "type": "module",
12
+ "bin": {
13
+ "create-chill-sharp-app": "./bin/create-chill-sharp-app.mjs"
14
+ },
15
+ "scripts": {
16
+ "build": "node --check bin/create-chill-sharp-app.mjs"
17
+ },
18
+ "files": [
19
+ "bin",
20
+ "template",
21
+ "README.md"
22
+ ],
23
+ "engines": {
24
+ "node": ">=20"
25
+ },
26
+ "keywords": [
27
+ "chillsharp",
28
+ "angular",
29
+ "starter",
30
+ "generator"
31
+ ],
32
+ "author": "Andrea Piovesan",
33
+ "publishConfig": {
34
+ "access": "public"
35
+ }
36
+ }
@@ -1,70 +1,70 @@
1
- ---
2
- name: chillsharp-current-user-preferences
3
- description: Configure, expose, and consume ChillSharp.Auth's cached current-user culture, time zone, date-format, number-format, and theme preferences in server logic and UI clients.
4
- ---
5
-
6
- # ChillSharp Current User Preferences
7
-
8
- Use this skill when a ChillSharp feature needs the authenticated user's display culture, time zone, date format, or number format. It covers server-side lifecycle hooks and UI/client consumption of the authoritative `AuthUser` preferences. Do not use it for browser-only preferences unrelated to `AuthUser`.
9
-
10
- ## Model
11
-
12
- `ChillUserPreferences` is an immutable snapshot with `DisplayCultureName`, `DisplayTimeZone`, `DisplayDateFormat`, `DisplayNumberFormat`, and `PreferredTheme`. The backend stores `PreferredTheme` as an opaque string. In UI Core, unauthenticated users follow browser `prefers-color-scheme`; clients register extra themes with `provideChillSharpUiCore({ additionalThemes: ['theme-name'] })`. Entity hooks read the snapshot synchronously through:
13
-
14
- ```csharp
15
- var preferences = context.GetCurrentUserPreferences();
16
- ```
17
-
18
- Never load `AuthUser` from an `OnCreate`, `OnUpdate`, or other lifecycle hook merely to obtain these values.
19
-
20
- ## Auth integration
21
-
22
- `AddChillAuthApi` registers `IChillAuthUserPreferencesAccessor` and the singleton `IChillAuthUserPreferencesCache`. Login and token refresh warm the snapshot; `ChillAuthService` refreshes it after an `AuthUser` save and removes it for deleted or renamed external identities.
23
-
24
- For a custom host DbContext, inject the scoped accessor and implement the two `IChillContext` methods below. Keep the accessor optional only when the context must also be constructible outside DI, such as for migrations or tests.
25
-
26
- ```csharp
27
- private readonly IChillAuthUserPreferencesAccessor? _userPreferencesAccessor;
28
-
29
- public ChillUserPreferences GetCurrentUserPreferences() =>
30
- _userPreferencesAccessor?.Current ?? ChillUserPreferences.Empty;
31
-
32
- public string GetDefaultUserCultureName()
33
- {
34
- var cultureName = GetCurrentUserPreferences().DisplayCultureName;
35
- return string.IsNullOrWhiteSpace(cultureName) ? GetPrimaryCultureName() : cultureName;
36
- }
37
- ```
38
-
39
- The accessor is cache-only: when there is no authenticated principal or no warmed snapshot, it returns `ChillUserPreferences.Empty`. Do not add a fallback database query to lifecycle hooks.
40
-
41
- ## API and client use
42
-
43
- The authenticated endpoint `GET /api/chill-auth/current-user-preferences` returns the same `ChillUserPreferences` snapshot as JSON:
44
-
45
- ```json
46
- {
47
- "displayCultureName": "it-IT",
48
- "displayTimeZone": "Europe/Rome",
49
- "displayDateFormat": "dd/MM/yyyy",
50
- "displayNumberFormat": "N2"
51
- }
52
- ```
53
-
54
- Use this endpoint after authentication and when restoring a session; do not infer the active display culture or time zone from the browser, operating system, token claims, or auth-management user endpoints. The C#, Python, TypeScript, Angular, Vue, and React clients expose it as `GetCurrentUserPreferences`, `get_current_user_preferences`, or `getCurrentUserPreferences`; the Vue and React packages also provide `useCurrentUserPreferences`.
55
-
56
- In Angular UI Core, inject `ChillService` and read its `userPreferences` signal (or its `displayCultureName`, `displayTimeZone`, `displayDateFormat`, and `displayNumberFormat` projections). Use these values to select UI language, format and parse dates and numbers, and convert UTC timestamps. Treat all fields as optional and choose an explicit fallback only when needed.
57
-
58
- ## Entity use
59
-
60
- Use `DisplayTimeZone` as an IANA zone identifier only after validating it with the application's time-zone policy. Treat all fields as optional and provide an explicit fallback where one is required.
61
-
62
- ```csharp
63
- public override void OnUpdate(IChillContext context)
64
- {
65
- var timeZone = context.GetCurrentUserPreferences().DisplayTimeZone;
66
- // Apply application-specific behavior only when timeZone is available.
67
- }
68
- ```
69
-
70
- For full setup and cache behavior, read [CurrentUserPreferences.md](../../../doc/CurrentUserPreferences.md).
1
+ ---
2
+ name: chillsharp-current-user-preferences
3
+ description: Configure, expose, and consume ChillSharp.Auth's cached current-user culture, time zone, date-format, number-format, and theme preferences in server logic and UI clients.
4
+ ---
5
+
6
+ # ChillSharp Current User Preferences
7
+
8
+ Use this skill when a ChillSharp feature needs the authenticated user's display culture, time zone, date format, or number format. It covers server-side lifecycle hooks and UI/client consumption of the authoritative `AuthUser` preferences. Do not use it for browser-only preferences unrelated to `AuthUser`.
9
+
10
+ ## Model
11
+
12
+ `ChillUserPreferences` is an immutable snapshot with `DisplayCultureName`, `DisplayTimeZone`, `DisplayDateFormat`, `DisplayNumberFormat`, and `PreferredTheme`. The backend stores `PreferredTheme` as an opaque string. In UI Core, unauthenticated users follow browser `prefers-color-scheme`; clients register extra themes with `provideChillSharpUiCore({ additionalThemes: ['theme-name'] })`. Entity hooks read the snapshot synchronously through:
13
+
14
+ ```csharp
15
+ var preferences = context.GetCurrentUserPreferences();
16
+ ```
17
+
18
+ Never load `AuthUser` from an `OnCreate`, `OnUpdate`, or other lifecycle hook merely to obtain these values.
19
+
20
+ ## Auth integration
21
+
22
+ `AddChillAuthApi` registers `IChillAuthUserPreferencesAccessor` and the singleton `IChillAuthUserPreferencesCache`. Login and token refresh warm the snapshot; `ChillAuthService` refreshes it after an `AuthUser` save and removes it for deleted or renamed external identities.
23
+
24
+ For a custom host DbContext, inject the scoped accessor and implement the two `IChillContext` methods below. Keep the accessor optional only when the context must also be constructible outside DI, such as for migrations or tests.
25
+
26
+ ```csharp
27
+ private readonly IChillAuthUserPreferencesAccessor? _userPreferencesAccessor;
28
+
29
+ public ChillUserPreferences GetCurrentUserPreferences() =>
30
+ _userPreferencesAccessor?.Current ?? ChillUserPreferences.Empty;
31
+
32
+ public string GetDefaultUserCultureName()
33
+ {
34
+ var cultureName = GetCurrentUserPreferences().DisplayCultureName;
35
+ return string.IsNullOrWhiteSpace(cultureName) ? GetPrimaryCultureName() : cultureName;
36
+ }
37
+ ```
38
+
39
+ The accessor is cache-only: when there is no authenticated principal or no warmed snapshot, it returns `ChillUserPreferences.Empty`. Do not add a fallback database query to lifecycle hooks.
40
+
41
+ ## API and client use
42
+
43
+ The authenticated endpoint `GET /api/chill-auth/current-user-preferences` returns the same `ChillUserPreferences` snapshot as JSON:
44
+
45
+ ```json
46
+ {
47
+ "displayCultureName": "it-IT",
48
+ "displayTimeZone": "Europe/Rome",
49
+ "displayDateFormat": "dd/MM/yyyy",
50
+ "displayNumberFormat": "N2"
51
+ }
52
+ ```
53
+
54
+ Use this endpoint after authentication and when restoring a session; do not infer the active display culture or time zone from the browser, operating system, token claims, or auth-management user endpoints. The C#, Python, TypeScript, Angular, Vue, and React clients expose it as `GetCurrentUserPreferences`, `get_current_user_preferences`, or `getCurrentUserPreferences`; the Vue and React packages also provide `useCurrentUserPreferences`.
55
+
56
+ In Angular UI Core, inject `ChillService` and read its `userPreferences` signal (or its `displayCultureName`, `displayTimeZone`, `displayDateFormat`, and `displayNumberFormat` projections). Use these values to select UI language, format and parse dates and numbers, and convert UTC timestamps. Treat all fields as optional and choose an explicit fallback only when needed.
57
+
58
+ ## Entity use
59
+
60
+ Use `DisplayTimeZone` as an IANA zone identifier only after validating it with the application's time-zone policy. Treat all fields as optional and provide an explicit fallback where one is required.
61
+
62
+ ```csharp
63
+ public override void OnUpdate(IChillContext context)
64
+ {
65
+ var timeZone = context.GetCurrentUserPreferences().DisplayTimeZone;
66
+ // Apply application-specific behavior only when timeZone is available.
67
+ }
68
+ ```
69
+
70
+ For full setup and cache behavior, read [CurrentUserPreferences.md](../../../doc/CurrentUserPreferences.md).
@@ -1,18 +1,18 @@
1
- ---
2
- name: chillsharp-ui-template
3
- description: Build and customize Angular ChillSharp client projects from the UI template, including plugins, overrides, i18n, permissions, and runtime configuration.
4
- ---
5
-
6
- # ChillSharp UI Client Template
7
-
8
- Use this skill for work in `chill-sharp-ui-template` or a client repository created from it.
9
-
10
- The template owns runtime configuration, branding, routes, client plugins, and overrides. Shared controls, data access, schema rendering, auth, i18n primitives, and permission evaluation belong in `@chill-sharp/ui-core` and the ChillSharp client packages. Do not copy or patch shared package internals.
11
-
12
- Keep `provideClientTemplateProviders()` in the app provider chain. Register feature routes in `src/app/core/plugins/register-client-plugins.ts`; register deliberate provider replacements in `src/app/core/overrides/register-client-overrides.ts`. Use public package APIs only.
13
-
14
- Treat backend schema as the source of entity/property metadata rather than duplicating it in Angular. Use runtime API configuration from `public/env.js`. Request localized text with an explicit culture and preserve backend fallback behavior. UI permission checks can hide or disable operations, but the protected backend is the enforcement boundary.
15
-
16
- Permission-sensitive features must account for `Module -> Entity -> Property`: entity `Query/Create/Update/Delete` is separate from property `See/Modify`. Never infer write access from a visible field.
17
-
18
- Add plugins under the client-owned plugin folder, register providers through the override/provider points, keep tenant/feature flags/branding in runtime config, add focused tests, and run `npm run build` after registration changes. This `.agents/skills` directory travels with the template into client repositories.
1
+ ---
2
+ name: chillsharp-ui-template
3
+ description: Build and customize Angular ChillSharp client projects from the UI template, including plugins, overrides, i18n, permissions, and runtime configuration.
4
+ ---
5
+
6
+ # ChillSharp UI Client Template
7
+
8
+ Use this skill for work in `chill-sharp-ui-template` or a client repository created from it.
9
+
10
+ The template owns runtime configuration, branding, routes, client plugins, and overrides. Shared controls, data access, schema rendering, auth, i18n primitives, and permission evaluation belong in `@chill-sharp/ui-core` and the ChillSharp client packages. Do not copy or patch shared package internals.
11
+
12
+ Keep `provideClientTemplateProviders()` in the app provider chain. Register feature routes in `src/app/core/plugins/register-client-plugins.ts`; register deliberate provider replacements in `src/app/core/overrides/register-client-overrides.ts`. Use public package APIs only.
13
+
14
+ Treat backend schema as the source of entity/property metadata rather than duplicating it in Angular. Use runtime API configuration from `public/env.js`. Request localized text with an explicit culture and preserve backend fallback behavior. UI permission checks can hide or disable operations, but the protected backend is the enforcement boundary.
15
+
16
+ Permission-sensitive features must account for `Module -> Entity -> Property`: entity `Query/Create/Update/Delete` is separate from property `See/Modify`. Never infer write access from a visible field.
17
+
18
+ Add plugins under the client-owned plugin folder, register providers through the override/provider points, keep tenant/feature flags/branding in runtime config, add focused tests, and run `npm run build` after registration changes. This `.agents/skills` directory travels with the template into client repositories.
@@ -1,11 +1,11 @@
1
- root = true
2
-
3
- [*.{ts,js,json,md,scss,html}]
4
- charset = utf-8
5
- indent_style = space
6
- indent_size = 2
7
- insert_final_newline = true
8
- trim_trailing_whitespace = true
9
-
10
- [*.md]
11
- trim_trailing_whitespace = false
1
+ root = true
2
+
3
+ [*.{ts,js,json,md,scss,html}]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ insert_final_newline = true
8
+ trim_trailing_whitespace = true
9
+
10
+ [*.md]
11
+ trim_trailing_whitespace = false
@@ -1,33 +1,33 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- pull_request:
8
-
9
- jobs:
10
- build-and-test:
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - name: Checkout
15
- uses: actions/checkout@v4
16
-
17
- - name: Setup Node
18
- uses: actions/setup-node@v4
19
- with:
20
- node-version: 22
21
- cache: npm
22
-
23
- - name: Install
24
- run: npm ci
25
-
26
- - name: Lint
27
- run: npm run lint
28
-
29
- - name: Build
30
- run: npm run build
31
-
32
- - name: Test
33
- run: npm run test -- --browsers=ChromeHeadless
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
9
+ jobs:
10
+ build-and-test:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Setup Node
18
+ uses: actions/setup-node@v4
19
+ with:
20
+ node-version: 22
21
+ cache: npm
22
+
23
+ - name: Install
24
+ run: npm ci
25
+
26
+ - name: Lint
27
+ run: npm run lint
28
+
29
+ - name: Build
30
+ run: npm run build
31
+
32
+ - name: Test
33
+ run: npm run test -- --browsers=ChromeHeadless
@@ -1,36 +1,36 @@
1
- name: Deploy
2
-
3
- on:
4
- workflow_dispatch:
5
- push:
6
- tags:
7
- - "v*"
8
-
9
- jobs:
10
- deploy:
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - name: Checkout
15
- uses: actions/checkout@v4
16
-
17
- - name: Setup Node
18
- uses: actions/setup-node@v4
19
- with:
20
- node-version: 22
21
- cache: npm
22
-
23
- - name: Install
24
- run: npm ci
25
-
26
- - name: Build
27
- run: npm run build
28
-
29
- - name: Publish artifact
30
- uses: actions/upload-artifact@v4
31
- with:
32
- name: client-ui-build
33
- path: dist/chill-sharp-ui-template
34
-
35
- - name: Deploy placeholder
36
- run: echo "Replace this step with the target hosting deployment command."
1
+ name: Deploy
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ tags:
7
+ - "v*"
8
+
9
+ jobs:
10
+ deploy:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Setup Node
18
+ uses: actions/setup-node@v4
19
+ with:
20
+ node-version: 22
21
+ cache: npm
22
+
23
+ - name: Install
24
+ run: npm ci
25
+
26
+ - name: Build
27
+ run: npm run build
28
+
29
+ - name: Publish artifact
30
+ uses: actions/upload-artifact@v4
31
+ with:
32
+ name: client-ui-build
33
+ path: dist/chill-sharp-ui-template
34
+
35
+ - name: Deploy placeholder
36
+ run: echo "Replace this step with the target hosting deployment command."