@zambon-dev/ui 1.4.1 → 1.5.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.
@@ -1 +1 @@
1
- {"version":3,"file":"zambon-dev-ui-testing.mjs","names":[],"sources":["../../../../libs/ui/src/testing/inert-host.ts","../../../../libs/ui/src/testing/render-under-on-push.ts"],"sourcesContent":["import { Component, ViewContainerRef, viewChild } from '@angular/core';\n\n/**\n * A host that behaves exactly like a consumer application's own component: it declares no\n * change-detection strategy, which in Angular 22 means `OnPush`. Once it has rendered it goes\n * clean, and a top-down pass skips it -- `detectChangesInView` only refreshes a view in Global\n * mode when it is `CheckAlways`, which an `OnPush` view never is, and then descends in Targeted\n * mode where nothing below is reached either unless the path was marked.\n *\n * That is what makes it an oracle. A component that mutates state without telling Angular\n * cannot update its DOM underneath this host, which is precisely the failure that a plain\n * `TestBed.createComponent` + `fixture.detectChanges()` cannot express.\n */\n@Component({\n selector: 'lib-inert-host',\n template: '<ng-container #outlet />',\n})\nexport class InertHostComponent {\n //#region ViewChilds, Inputs, Outputs\n public readonly outlet = viewChild.required('outlet', { read: ViewContainerRef });\n //#endregion\n}\n","import { ApplicationRef, ComponentRef, Type, ɵZONELESS_ENABLED as ZONELESS_ENABLED } from '@angular/core';\nimport { ComponentFixture, TestBed } from '@angular/core/testing';\nimport { InertHostComponent } from './inert-host';\n\n/** A component rendered beneath {@link InertHostComponent}, plus the handles a spec needs. */\nexport interface OnPushRender<TComponent> {\n /** The component under test. */\n readonly component: TComponent;\n readonly componentRef: ComponentRef<TComponent>;\n /** The component under test's own host element -- host bindings included. */\n readonly element: HTMLElement;\n /** The fixture whose root is the inert host. */\n readonly fixture: ComponentFixture<InertHostComponent>;\n /** Binds an input the way a template would, notifying Angular. */\n setInput(name: string, value: unknown): void;\n /**\n * Runs a change-detection pass that a clean `OnPush` ancestor can still short-circuit.\n *\n * Call this and never `fixture.detectChanges()` yourself -- under a zoneless test environment\n * that call forces every test view and hands the component a refresh it did not earn.\n */\n tick(): void;\n}\n\n/**\n * Renders `type` beneath a clean `OnPush` ancestor and returns once it has painted for the\n * first time.\n *\n * Three rules make this an oracle rather than decoration:\n *\n * 1. Drive the source **after** this call returns. Before the first paint every strategy renders.\n * 2. The source must be genuinely asynchronous. `of(...)` emits inside `ngOnInit`, i.e. inside\n * the first paint, so the failure cannot occur. Use a `Subject` you control.\n * 3. Assert the DOM, never a field. `expect(component.loading).toBe(false)` passes on a blank\n * screen.\n */\nexport function renderUnderOnPush<TComponent>(\n type: Type<TComponent>,\n inputs: Record<string, unknown> = {},\n): OnPushRender<TComponent> {\n const fixture: ComponentFixture<InertHostComponent> = TestBed.createComponent(InertHostComponent);\n\n // Resolves the signal view query and leaves the host clean before anything is inserted into it.\n fixture.detectChanges();\n\n const componentRef: ComponentRef<TComponent> = fixture.componentInstance.outlet().createComponent(type);\n\n Object.entries(inputs).forEach(([name, value]: [string, unknown]) => componentRef.setInput(name, value));\n\n // Which call reaches the component differs by test environment, and getting it wrong makes the\n // harness useless in opposite directions.\n //\n // Zoneless: the fixture registers its host view for auto-detection, so ApplicationRef.tick()\n // reaches it -- and fixture.detectChanges() must be avoided, because it sets includeAllTestViews\n // and refreshes everything regardless of what notified.\n //\n // Zone (what consumer applications still use): the host view is NOT registered, so tick() does\n // nothing at all. fixture.detectChanges() is the one that works, and it still discriminates --\n // it refreshes the fixture's own CheckAlways host view in Global mode, where a clean OnPush\n // ancestor is skipped and the descent below it continues in Targeted mode.\n const applicationRef: ApplicationRef = TestBed.inject(ApplicationRef);\n const isZoneless: boolean = TestBed.inject(ZONELESS_ENABLED, false, { optional: true }) ?? false;\n const tick = (): void => (isZoneless ? applicationRef.tick() : fixture.detectChanges());\n\n // The component under test is brand new and therefore dirty, so this first pass paints it and\n // then leaves the whole path clean -- the state a consumer application sits in between events.\n tick();\n\n return {\n component: componentRef.instance,\n componentRef,\n element: componentRef.location.nativeElement,\n fixture,\n setInput: (name: string, value: unknown): void => componentRef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BAAkB,OAAO,EAAE,UAAU,KAAI,CAAE,KAAK;CAC3F,MAAM,aAAoB,aAAa,eAAe,KAAI,IAAK,QAAQ,cAAa;CAIpF,KAAI;CAEJ,OAAO;EACL,WAAW,aAAa;EACxB;EACA,SAAS,aAAa,SAAS;EAC/B;EACA,WAAW,MAAc,UAAyB,aAAa,SAAS,MAAM,KAAK;EACnF;CACD;AACH"}
1
+ {"version":3,"file":"zambon-dev-ui-testing.mjs","names":[],"sources":["../../../../libs/ui/src/testing/inert-host.ts","../../../../libs/ui/src/testing/render-under-on-push.ts"],"sourcesContent":["import { Component, ViewContainerRef, viewChild } from '@angular/core';\n\n/**\n * A host that behaves exactly like a consumer application's own component: it declares no\n * change-detection strategy, which in Angular 22 means `OnPush`. Once it has rendered it goes\n * clean, and a top-down pass skips it -- `detectChangesInView` only refreshes a view in Global\n * mode when it is `CheckAlways`, which an `OnPush` view never is, and then descends in Targeted\n * mode where nothing below is reached either unless the path was marked.\n *\n * That is what makes it an oracle. A component that mutates state without telling Angular\n * cannot update its DOM underneath this host, which is precisely the failure that a plain\n * `TestBed.createComponent` + `fixture.detectChanges()` cannot express.\n */\n@Component({\n selector: 'lib-inert-host',\n template: '<ng-container #outlet />',\n})\nexport class InertHostComponent {\n //#region ViewChilds, Inputs, Outputs\n /** Where the component under test is created, e.g. `host.outlet().createComponent(MyComponent)`. */\n public readonly outlet = viewChild.required('outlet', { read: ViewContainerRef });\n //#endregion\n}\n","import { ApplicationRef, ComponentRef, Type, ɵZONELESS_ENABLED as ZONELESS_ENABLED } from '@angular/core';\nimport { ComponentFixture, TestBed } from '@angular/core/testing';\nimport { InertHostComponent } from './inert-host';\n\n/** A component rendered beneath {@link InertHostComponent}, plus the handles a spec needs. */\nexport interface OnPushRender<TComponent> {\n /** The component under test. */\n readonly component: TComponent;\n readonly componentRef: ComponentRef<TComponent>;\n /** The component under test's own host element -- host bindings included. */\n readonly element: HTMLElement;\n /** The fixture whose root is the inert host. */\n readonly fixture: ComponentFixture<InertHostComponent>;\n /** Binds an input the way a template would, notifying Angular. */\n setInput(name: string, value: unknown): void;\n /**\n * Runs a change-detection pass that a clean `OnPush` ancestor can still short-circuit.\n *\n * Call this and never `fixture.detectChanges()` yourself -- under a zoneless test environment\n * that call forces every test view and hands the component a refresh it did not earn.\n */\n tick(): void;\n}\n\n/**\n * Renders `type` beneath a clean `OnPush` ancestor and returns once it has painted for the\n * first time.\n *\n * Three rules make this an oracle rather than decoration:\n *\n * 1. Drive the source **after** this call returns. Before the first paint every strategy renders.\n * 2. The source must be genuinely asynchronous. `of(...)` emits inside `ngOnInit`, i.e. inside\n * the first paint, so the failure cannot occur. Use a `Subject` you control.\n * 3. Assert the DOM, never a field. `expect(component.loading).toBe(false)` passes on a blank\n * screen.\n */\nexport function renderUnderOnPush<TComponent>(\n type: Type<TComponent>,\n inputs: Record<string, unknown> = {},\n): OnPushRender<TComponent> {\n const fixture: ComponentFixture<InertHostComponent> = TestBed.createComponent(InertHostComponent);\n\n // Resolves the signal view query and leaves the host clean before anything is inserted into it.\n fixture.detectChanges();\n\n const componentRef: ComponentRef<TComponent> = fixture.componentInstance.outlet().createComponent(type);\n\n Object.entries(inputs).forEach(([name, value]: [string, unknown]) => componentRef.setInput(name, value));\n\n // Which call reaches the component differs by test environment, and getting it wrong makes the\n // harness useless in opposite directions.\n //\n // Zoneless: the fixture registers its host view for auto-detection, so ApplicationRef.tick()\n // reaches it -- and fixture.detectChanges() must be avoided, because it sets includeAllTestViews\n // and refreshes everything regardless of what notified.\n //\n // Zone (what consumer applications still use): the host view is NOT registered, so tick() does\n // nothing at all. fixture.detectChanges() is the one that works, and it still discriminates --\n // it refreshes the fixture's own CheckAlways host view in Global mode, where a clean OnPush\n // ancestor is skipped and the descent below it continues in Targeted mode.\n const applicationRef: ApplicationRef = TestBed.inject(ApplicationRef);\n const isZoneless: boolean = TestBed.inject(ZONELESS_ENABLED, false, { optional: true }) ?? false;\n const tick = (): void => (isZoneless ? applicationRef.tick() : fixture.detectChanges());\n\n // The component under test is brand new and therefore dirty, so this first pass paints it and\n // then leaves the whole path clean -- the state a consumer application sits in between events.\n tick();\n\n return {\n component: componentRef.instance,\n componentRef,\n element: componentRef.location.nativeElement,\n fixture,\n setInput: (name: string, value: unknown): void => componentRef.setInput(name, value),\n tick,\n };\n}\n"],"mappings":";;;AAiBA,IAAa,qBAAb,MAAa,mBAAkB;CAGb,SAAS,UAAU,SAAS,UAAQ;EAAA,GAAA,YAAA,EAAA,WAAA,SAAA,+BAAA,CAAA;EAAI,MAAM;CAAgB,CAAA;CAHnE,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAkB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAlB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAkB,cAAA;EAAA,UAAA;EAAA,aAAA,CAAA;GAAA,cAAA;GAAA,OAAA;GAAA,WAAA,CAAA,QAAA;GAAA,aAAA;GAAA,MAGiC;GAAgB,UAAA;EAAA,CAAA;EAAA,UAAA;EAAA,UALpE;EAA0B,UAAA;CAAA,CAAA;;AAEzB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAkB,YAAA,CAAA;EAJ9B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;EACX,CAAA;CAI6C,CAAA;CAAA,gBAAA,EAAA,QAAA,CAAA;EAAA,MAAA,GAAA;EAAA,MAAA,CAAA,UAAQ;GAAI,MAAM;GAAkB,UAAA;EAAA,CAAA;CAAA,CAAA,EAAA;AAAA,CAAA;ACgBlF,SAAgB,kBACd,MACA,SAAkC,CAAA,GAAE;CAEpC,MAAM,UAAgD,QAAQ,gBAAgB,kBAAkB;CAGhG,QAAQ,cAAa;CAErB,MAAM,eAAyC,QAAQ,kBAAkB,OAAM,CAAE,CAAC,gBAAgB,IAAI;CAEtG,OAAO,QAAQ,MAAM,CAAC,CAAC,SAAS,CAAC,MAAM,WAA8B,aAAa,SAAS,MAAM,KAAK,CAAC;CAavG,MAAM,iBAAiC,QAAQ,OAAO,cAAc;CACpE,MAAM,aAAsB,QAAQ,OAAO,mBAAkB,OAAO,EAAE,UAAU,KAAI,CAAE,KAAK;CAC3F,MAAM,aAAoB,aAAa,eAAe,KAAI,IAAK,QAAQ,cAAa;CAIpF,KAAI;CAEJ,OAAO;EACL,WAAW,aAAa;EACxB;EACA,SAAS,aAAa,SAAS;EAC/B;EACA,WAAW,MAAc,UAAyB,aAAa,SAAS,MAAM,KAAK;EACnF;CACD;AACH"}
@@ -5,6 +5,10 @@
5
5
  "TopBar-Theme-Light": "Light theme",
6
6
  "TopBar-Theme-Dark": "Dark theme",
7
7
  "TopBar-Theme-System": "Theme follows the system",
8
+ "Main-Logout": "Logout",
9
+ "Main-Logout-Modal-Message": "Are you sure you want to log out?",
10
+ "Main-Logout-Modal-Message-Cancel": "Cancel",
11
+ "Main-Logout-Modal-Message-Confirm": "Logout",
8
12
 
9
13
  "": ""
10
14
  }
@@ -5,6 +5,10 @@
5
5
  "TopBar-Theme-Light": "Tema claro",
6
6
  "TopBar-Theme-Dark": "Tema escuro",
7
7
  "TopBar-Theme-System": "Tema acompanha o sistema",
8
+ "Main-Logout": "Sair",
9
+ "Main-Logout-Modal-Message": "Tem certeza de que deseja sair?",
10
+ "Main-Logout-Modal-Message-Cancel": "Cancelar",
11
+ "Main-Logout-Modal-Message-Confirm": "Sair",
8
12
 
9
13
  "": ""
10
14
  }
package/package.json CHANGED
@@ -1,15 +1,20 @@
1
1
  {
2
2
  "name": "@zambon-dev/ui",
3
- "version": "1.4.1",
4
- "description": "Angular UI components, application framework and shared application layer for Zambon applications.",
3
+ "version": "1.5.0",
4
+ "description": "Angular 22 component library and application shell: form controls, a virtual-scroll data grid, modals, ribbon, sidebar, tabbed navigation, view base classes and authentication layouts, themed with Tailwind CSS 4 tokens.",
5
5
  "keywords": [
6
6
  "angular",
7
- "components",
8
- "framework",
9
- "shared",
10
- "ui",
11
- "zambon",
12
- "zlibraries"
7
+ "angular-components",
8
+ "component-library",
9
+ "ui-components",
10
+ "design-system",
11
+ "tailwindcss",
12
+ "data-grid",
13
+ "ribbon",
14
+ "sidebar",
15
+ "tabs",
16
+ "signals",
17
+ "zoneless"
13
18
  ],
14
19
  "author": "Ricardo Zambon",
15
20
  "license": "MIT",
@@ -21,7 +26,7 @@
21
26
  "bugs": {
22
27
  "url": "https://github.com/RicardoZambon/ZLibraries/issues"
23
28
  },
24
- "homepage": "https://github.com/RicardoZambon/ZLibraries/tree/main/libs/ui#readme",
29
+ "homepage": "https://ricardozambon.github.io/ZLibraries/",
25
30
  "peerDependencies": {
26
31
  "@angular/cdk": "^22.0.0",
27
32
  "@angular/common": "^22.0.0",
package/styles/theme.css CHANGED
@@ -9,11 +9,11 @@
9
9
  * Two kinds of file consume this:
10
10
  *
11
11
  * An application's global stylesheet imports it, and gets the framework plus the theme:
12
- * @import '@zambon-dev/shared/styles/theme.css';
12
+ * @import '@zambon-dev/ui/styles/theme.css';
13
13
  *
14
14
  * A stylesheet that only uses `@apply` references it, and gets the theme without emitting the
15
15
  * framework a second time:
16
- * @reference '@zambon-dev/shared/styles/theme.css';
16
+ * @reference '@zambon-dev/ui/styles/theme.css';
17
17
  *
18
18
  * That split is new in 4. In 3 the PostCSS plugin carried the config to every file it processed,
19
19
  * so `@apply` worked anywhere; in 4 a file is on its own unless it says where its theme comes from.
@@ -28,6 +28,15 @@
28
28
  */
29
29
  @import 'tailwindcss' theme(static);
30
30
 
31
+ /*
32
+ * Component templates use Tailwind utilities, and Tailwind only generates the ones it finds in the
33
+ * files it scans. Its automatic detection skips node_modules, so an application would build none
34
+ * of the utilities this package's templates need. This points the scan at the package itself: from
35
+ * the published `styles/` folder, `..` is the package root with its compiled templates; in this
36
+ * workspace it is the package source.
37
+ */
38
+ @source '..';
39
+
31
40
  @plugin '@tailwindcss/forms';
32
41
 
33
42
  /*
@@ -39,7 +48,7 @@
39
48
 
40
49
  /*
41
50
  * Tailwind 4 changed the default border colour from `gray-200` to `currentColor`, so every element
42
- * with a border and no colour of its own inherits the text colour. Across the Storybooks that was
51
+ * with a border and no colour of its own inherits the text colour. Across the Storybook that was
43
52
  * 615 elements going from a light grey hairline to solid black -- a change nothing in the build
44
53
  * reports, which is the case tools/style-snapshot exists to catch.
45
54
  *
@@ -59,7 +68,7 @@
59
68
  /*
60
69
  * Tailwind 4 dropped the preflight rule that gave buttons a pointer cursor; the base reset now
61
70
  * leaves them on the browser default. Restored, because every button in these libraries relied on
62
- * it -- 41 elements across the Storybooks lost their pointer.
71
+ * it -- 41 elements across the Storybook lost their pointer.
63
72
  */
64
73
  @layer base {
65
74
  button:not(:disabled),
@@ -220,8 +229,8 @@
220
229
  --focus-ring-offset: 0px;
221
230
 
222
231
  /* Named for how they feel, not what they measure: a `--duration-200` is a number with extra
223
- steps. Routing every transition through these is what makes the reduced-motion block below a
224
- single rule instead of an audit. */
232
+ steps. A transition that reads these collapses under the reduced-motion block below; a few
233
+ older transitions still use fixed durations and do not. */
225
234
  --duration-instant: 120ms;
226
235
  --duration-short: 200ms;
227
236
  --duration-long: 600ms;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * These names are API: applications override them, and the CHANGELOG documents them. So they stay.
5
5
  * What changed is where their values come from. Each one now names a role in the semantic core
6
- * (see shared/styles/theme.css) instead of repeating a literal, which is what lets a theme move
6
+ * (see theme.css) instead of repeating a literal, which is what lets a theme move
7
7
  * them all at once. The component token is the contract; the core is the implementation.
8
8
  *
9
9
  * Wrapped in a cascade layer on purpose. Until now an application's override only won if its
@@ -13,8 +13,8 @@
13
13
  *
14
14
  * A consequence worth knowing: a static override pins that token in both themes. To vary by theme,
15
15
  * write `:root[data-theme='dark'] { --sidebar-bg: ... }` -- same specificity as ours, declared
16
- * later, so it wins. Note that the dark block in theme.css touches core tokens only and never
17
- * these, so a brand override stays yours in both themes without any work.
16
+ * later, so it wins. The dark block in theme.css touches core tokens, plus one of these:
17
+ * `--app-backdrop`. Override that one per theme. Every other override stays yours in both themes.
18
18
  */
19
19
  @layer tokens {
20
20
  :root {