@kirana-style/angular 0.3.4 → 0.3.5
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/CHANGELOG.md +44 -0
- package/README.md +3 -0
- package/package.json +4 -4
- package/src/fesm2022/directive.d.ts +12 -3
- package/src/fesm2022/directive.js +22 -1
- package/src/index.d.ts +3 -3
- package/src/index.js +3 -3
- package/src/sx.d.ts +16 -1
- package/src/sx.js +13 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.5](https://github.com/kirana-style/kirana/compare/v0.3.4...v0.3.5) (2026-10-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* a part that anchors a relation can read its own kind beside it ([#163](https://github.com/kirana-style/kirana/pull/163)) ([71131ad](https://github.com/kirana-style/kirana/commit/71131adc72d053b547879b1ebaddbc4f22b012bc))
|
|
9
|
+
* add @kirana-style/compiler-browser, the engine in a browser page ([#155](https://github.com/kirana-style/kirana/pull/155)) ([566f300](https://github.com/kirana-style/kirana/commit/566f300bfe33f94f4c51399f1b199b0ae3915b64))
|
|
10
|
+
* angular parts merge sx through partSx beside SxDirective ([#167](https://github.com/kirana-style/kirana/pull/167)) ([0138926](https://github.com/kirana-style/kirana/commit/0138926c8249b337682b84f64d1587fb3e2d1740))
|
|
11
|
+
* font items, imported by ui add and installed by a preset ([#168](https://github.com/kirana-style/kirana/pull/168)) ([e6dc629](https://github.com/kirana-style/kirana/commit/e6dc62989b81038a6110eb731ccf4fc0b8325c12))
|
|
12
|
+
* own() claims an attribute for one component's style ([#169](https://github.com/kirana-style/kirana/pull/169)) ([52f6e52](https://github.com/kirana-style/kirana/commit/52f6e52bb3840521e3fc86ac6b1017aed6a6b8bb))
|
|
13
|
+
* style helpers evaluate object.entries, fromEntries and map ([#160](https://github.com/kirana-style/kirana/pull/160)) ([05421b8](https://github.com/kirana-style/kirana/commit/05421b8cccff73fdc0cf57aa288a2606b200eafd))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug fixes
|
|
17
|
+
|
|
18
|
+
* a relation read compiles in a module that does not import kirana ([#159](https://github.com/kirana-style/kirana/pull/159)) ([cb073a4](https://github.com/kirana-style/kirana/commit/cb073a4aa5f1c5039ed2182a18118d8123d11851))
|
|
19
|
+
* an import no style reads is not reported unresolved or cyclic ([#148](https://github.com/kirana-style/kirana/pull/148)) ([40eff25](https://github.com/kirana-style/kirana/commit/40eff2516620feade8130c8a2cf74b3d1b45fd06))
|
|
20
|
+
* an import of a file created during a watch session resolves ([#164](https://github.com/kirana-style/kirana/pull/164)) ([afdb700](https://github.com/kirana-style/kirana/commit/afdb7007c9908f7c3f3036e6eaec9cb0d2ac197f))
|
|
21
|
+
* angular and ember peer @kirana-style/vite at the release's version ([#157](https://github.com/kirana-style/kirana/pull/157)) ([09d71db](https://github.com/kirana-style/kirana/commit/09d71db1124dc722e54fbcfee70f3a511cfceea4))
|
|
22
|
+
* props() and keyframes() are typed as they compile ([#158](https://github.com/kirana-style/kirana/pull/158)) ([b797caa](https://github.com/kirana-style/kirana/commit/b797caa8f040ffc0e0dccfb513b76ef0517e407b))
|
|
23
|
+
* removing a whole box removes its logical sides too ([#171](https://github.com/kirana-style/kirana/pull/171)) ([f838ff1](https://github.com/kirana-style/kirana/commit/f838ff1de7c7b31c0c576fcda3394fc27abd5cd5))
|
|
24
|
+
* ui init gives a javascript next.js app its tsconfig and typescript ([#149](https://github.com/kirana-style/kirana/pull/149)) ([6eee0fd](https://github.com/kirana-style/kirana/commit/6eee0fdda35deca7ad66721ff12b3791bfba228c))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Performance
|
|
28
|
+
|
|
29
|
+
* a dev server and a watch build reuse unchanged transforms ([#170](https://github.com/kirana-style/kirana/pull/170)) ([3eac1cf](https://github.com/kirana-style/kirana/commit/3eac1cfb6a730fae900d6c81ed86b9b5833baf22))
|
|
30
|
+
* a style written out in full compiles once a session ([#166](https://github.com/kirana-style/kirana/pull/166)) ([ec84bd3](https://github.com/kirana-style/kirana/commit/ec84bd35af1068fbfe0a6aa52972b70ed2eff05f))
|
|
31
|
+
* dense names build the renaming's source map only when the build writes maps ([#161](https://github.com/kirana-style/kirana/pull/161)) ([a655efd](https://github.com/kirana-style/kirana/commit/a655efd0632b97c86190cca95c5ce7b73dd38a88))
|
|
32
|
+
* reading a preset's tokens no longer walks the whole preset ([#165](https://github.com/kirana-style/kirana/pull/165)) ([b92775d](https://github.com/kirana-style/kirana/commit/b92775d74d96b8f4b357616937ddc7921ac1c73a))
|
|
33
|
+
* the engine loader looks up the c library once per process ([#156](https://github.com/kirana-style/kirana/pull/156)) ([344a932](https://github.com/kirana-style/kirana/commit/344a932ed212900c6cdeb980d135d5c248fd93c2))
|
|
34
|
+
* the stylesheet is written from one atom index, not every module's atoms ([#162](https://github.com/kirana-style/kirana/pull/162)) ([6718147](https://github.com/kirana-style/kirana/commit/6718147b0bb444f3d63403047c726d31e823a517))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Documentation
|
|
38
|
+
|
|
39
|
+
* take the benchmarks of kirana 0.3.4 from kirana-lab ([#153](https://github.com/kirana-style/kirana/pull/153)) ([f093aa7](https://github.com/kirana-style/kirana/commit/f093aa7a693e38fcc8d252f9e797c775e2321ca1))
|
|
40
|
+
* the roadmap lists the products planned beside the compiler ([#154](https://github.com/kirana-style/kirana/pull/154)) ([7806842](https://github.com/kirana-style/kirana/commit/7806842cbd7ebf67efa98131f3343891351df01c))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Dependencies
|
|
44
|
+
|
|
45
|
+
* bump the minor-and-patch group with 4 updates ([#151](https://github.com/kirana-style/kirana/pull/151)) ([4bb63be](https://github.com/kirana-style/kirana/commit/4bb63be11279c059c28f33e120b6fc36af06da02))
|
|
46
|
+
|
|
3
47
|
## [0.3.4](https://github.com/kirana-style/kirana/compare/v0.3.3...v0.3.4) (2026-10-27)
|
|
4
48
|
|
|
5
49
|
|
package/README.md
CHANGED
|
@@ -23,6 +23,9 @@ export class Card {
|
|
|
23
23
|
|
|
24
24
|
- **`SxDirective`** merges the handles with Kirana's runtime and adds and removes only the classes
|
|
25
25
|
and custom properties it set. `provideKirana({ prefix })` matches a `names.prefix` other than `k`.
|
|
26
|
+
- **Parts.** A directive that takes `sx` merges it with its own styles through `partSx(own, sx)`,
|
|
27
|
+
binds the `class` and `style` it returns to its host, types the input `SxInput`, and lists
|
|
28
|
+
`provideSxPart()` in its `providers`, which keeps `SxDirective` off its element.
|
|
26
29
|
- **Analog.** `kiranaAngular()` from `@kirana-style/angular/vite`, after `analog()`, compiles the JavaScript
|
|
27
30
|
Angular emits. Import `@kirana-style/core/stylesheet.css` from `src/main.ts`.
|
|
28
31
|
- **Angular CLI.** In `angular.json`, `@kirana-style/angular:application` and `@kirana-style/angular:dev-server`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirana-style/angular",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Kirana for Angular: the [sx] directive, the Analog (Vite) plugin and Angular CLI builders.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "The Kirana authors",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"./builders.json": "./builders.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@kirana-style/compiler": "0.3.
|
|
34
|
-
"@kirana-style/core": "0.3.
|
|
33
|
+
"@kirana-style/compiler": "0.3.5",
|
|
34
|
+
"@kirana-style/core": "0.3.5"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@angular/core": ">=20.0.0",
|
|
38
38
|
"@angular/build": ">=20.0.0",
|
|
39
39
|
"@angular-devkit/architect": ">=0.2000.0",
|
|
40
|
-
"@kirana-style/vite": "0.
|
|
40
|
+
"@kirana-style/vite": "0.3.5"
|
|
41
41
|
},
|
|
42
42
|
"builders": "./builders.json",
|
|
43
43
|
"peerDependenciesMeta": {
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
import { SxInput } from "../sx.js";
|
|
1
2
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { Handle } from "@kirana-style/core/internal";
|
|
3
|
-
import { Sx } from "@kirana-style/core";
|
|
4
3
|
/** The class-name prefix (`names.prefix`); `k` unless the app provides another (`provideKirana`). */
|
|
5
4
|
export declare const KIRANA_PREFIX: i0.InjectionToken<string>;
|
|
6
5
|
/** Providers for an app whose `kirana.config` sets another class-name prefix. */
|
|
7
6
|
export declare function provideKirana(options: {
|
|
8
7
|
prefix: string;
|
|
9
8
|
}): i0.Provider[];
|
|
9
|
+
/**
|
|
10
|
+
* Provided by a part: an attribute directive that takes `sx` itself and merges it with its own
|
|
11
|
+
* styles, the caller's last (D-100, `partSx`). `SxDirective` on the same element then applies nothing, so a
|
|
12
|
+
* template can import it for its plain elements and still hold parts (KF-049): both would read the
|
|
13
|
+
* one `[sx]` binding, and a class `SxDirective` added would be dropped when the part's `[class]`
|
|
14
|
+
* binding next changed. A part lists `provideSxPart()` in its `providers`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SX_PART: i0.InjectionToken<boolean>;
|
|
17
|
+
/** The provider that marks a part's element, so `SxDirective` leaves `[sx]` to the part. */
|
|
18
|
+
export declare function provideSxPart(): i0.Provider;
|
|
10
19
|
export declare class SxDirective implements i0.OnChanges {
|
|
11
20
|
#private;
|
|
12
21
|
/**
|
|
@@ -14,7 +23,7 @@ export declare class SxDirective implements i0.OnChanges {
|
|
|
14
23
|
* handles are class strings (the Angular CLI builders type-check the compiled copy), so both are
|
|
15
24
|
* accepted.
|
|
16
25
|
*/
|
|
17
|
-
sx:
|
|
26
|
+
sx: SxInput;
|
|
18
27
|
ngOnChanges(): void;
|
|
19
28
|
static ɵfac: i0.ɵɵFactoryDeclaration<SxDirective, never>;
|
|
20
29
|
static ɵdir: i0.ɵɵDirectiveDeclaration<SxDirective, "[sx]", never, {
|
|
@@ -26,6 +26,21 @@ function provideKirana(options) {
|
|
|
26
26
|
useValue: options.prefix
|
|
27
27
|
}];
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Provided by a part: an attribute directive that takes `sx` itself and merges it with its own
|
|
31
|
+
* styles, the caller's last (D-100, `partSx`). `SxDirective` on the same element then applies nothing, so a
|
|
32
|
+
* template can import it for its plain elements and still hold parts (KF-049): both would read the
|
|
33
|
+
* one `[sx]` binding, and a class `SxDirective` added would be dropped when the part's `[class]`
|
|
34
|
+
* binding next changed. A part lists `provideSxPart()` in its `providers`.
|
|
35
|
+
*/
|
|
36
|
+
const SX_PART = new i0.InjectionToken("kirana sx part");
|
|
37
|
+
/** The provider that marks a part's element, so `SxDirective` leaves `[sx]` to the part. */
|
|
38
|
+
function provideSxPart() {
|
|
39
|
+
return {
|
|
40
|
+
provide: SX_PART,
|
|
41
|
+
useValue: true
|
|
42
|
+
};
|
|
43
|
+
}
|
|
29
44
|
var SxDirective = class SxDirective {
|
|
30
45
|
/**
|
|
31
46
|
* The handles: one, or an array with falsy guards (`[styles.card, active && styles.on]`). Compiled
|
|
@@ -36,11 +51,17 @@ var SxDirective = class SxDirective {
|
|
|
36
51
|
#element = i0.inject(i0.ElementRef).nativeElement;
|
|
37
52
|
#renderer = i0.inject(i0.Renderer2);
|
|
38
53
|
#prefix = i0.inject(KIRANA_PREFIX);
|
|
54
|
+
/** Whether a part on this element merges `sx` itself (`SX_PART`). */
|
|
55
|
+
#part = i0.inject(SX_PART, {
|
|
56
|
+
self: true,
|
|
57
|
+
optional: true
|
|
58
|
+
}) ?? false;
|
|
39
59
|
#applied = {
|
|
40
60
|
classes: /* @__PURE__ */ new Set(),
|
|
41
61
|
styles: /* @__PURE__ */ new Set()
|
|
42
62
|
};
|
|
43
63
|
ngOnChanges() {
|
|
64
|
+
if (this.#part) return;
|
|
44
65
|
this.#applied = applySx(this.#renderer, this.#element, this.#applied, this.sx, this.#prefix);
|
|
45
66
|
}
|
|
46
67
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
@@ -62,4 +83,4 @@ var SxDirective = class SxDirective {
|
|
|
62
83
|
ngImport: i0
|
|
63
84
|
});
|
|
64
85
|
};
|
|
65
|
-
export { KIRANA_PREFIX, SxDirective, provideKirana };
|
|
86
|
+
export { KIRANA_PREFIX, SX_PART, SxDirective, provideKirana, provideSxPart };
|
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export { type Applied, KIRANA_PREFIX, type Renderer, SxDirective, applySx, provideKirana, runtimeFor };
|
|
1
|
+
import { Applied, Renderer, SxInput, applySx, partSx, runtimeFor } from "./sx.js";
|
|
2
|
+
import { KIRANA_PREFIX, SX_PART, SxDirective, provideKirana, provideSxPart } from "./fesm2022/directive.js";
|
|
3
|
+
export { type Applied, KIRANA_PREFIX, type Renderer, SX_PART, SxDirective, type SxInput, applySx, partSx, provideKirana, provideSxPart, runtimeFor };
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { applySx, runtimeFor } from "./sx.js";
|
|
2
|
-
import { KIRANA_PREFIX, SxDirective, provideKirana } from "./fesm2022/directive.js";
|
|
3
|
-
export { KIRANA_PREFIX, SxDirective, applySx, provideKirana, runtimeFor };
|
|
1
|
+
import { applySx, partSx, runtimeFor } from "./sx.js";
|
|
2
|
+
import { KIRANA_PREFIX, SX_PART, SxDirective, provideKirana, provideSxPart } from "./fesm2022/directive.js";
|
|
3
|
+
export { KIRANA_PREFIX, SX_PART, SxDirective, applySx, partSx, provideKirana, provideSxPart, runtimeFor };
|
package/src/sx.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { runtime } from "@kirana-style/core/internal";
|
|
1
|
+
import { Handle, runtime } from "@kirana-style/core/internal";
|
|
2
|
+
import { Sx } from "@kirana-style/core";
|
|
3
|
+
/**
|
|
4
|
+
* What an `sx` input takes: `Sx`, or the class strings handles are once compiled. The Angular CLI
|
|
5
|
+
* builders type-check the compiled copy, where a template passes those strings.
|
|
6
|
+
*/
|
|
7
|
+
export type SxInput = Sx | Handle;
|
|
2
8
|
/** The part of Angular's `Renderer2` this needs. */
|
|
3
9
|
export type Renderer = {
|
|
4
10
|
addClass: (element: unknown, name: string) => void;
|
|
@@ -15,5 +21,14 @@ export type Applied = {
|
|
|
15
21
|
export declare const DASH_CASE = 2;
|
|
16
22
|
/** One runtime per class-name prefix, as each compiled module creates one. */
|
|
17
23
|
export declare function runtimeFor(prefix: string): ReturnType<typeof runtime>;
|
|
24
|
+
/**
|
|
25
|
+
* A part's host props: its own handles, then its caller's `sx`, merged with Kirana's runtime as
|
|
26
|
+
* `[sx]` merges them, the caller's last (KF-049). A part binds `class` and `style` to its host and
|
|
27
|
+
* lists `provideSxPart()`, so `SxDirective` leaves the element to it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function partSx(own: SxInput, sx: SxInput, prefix?: string): {
|
|
30
|
+
class: string;
|
|
31
|
+
style: Record<string, string>;
|
|
32
|
+
};
|
|
18
33
|
/** Applies `value` (a handle, or an array of handles and falsy guards); returns what is applied now. */
|
|
19
34
|
export declare function applySx(renderer: Renderer, element: unknown, previous: Applied, value: unknown, prefix: string): Applied;
|
package/src/sx.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { runtime } from "@kirana-style/core/internal";
|
|
2
2
|
// src/sx.ts
|
|
3
|
-
/**
|
|
4
|
-
* What `[sx]` does to an element, without Angular: merge the handles with Kirana's runtime (the same
|
|
5
|
-
* one compiled modules call), then bring the element's classes and custom properties from what the
|
|
6
|
-
* last value applied to what this one applies. Only what `[sx]` added is ever removed, so the
|
|
7
|
-
* element's own `class` and `style` stay.
|
|
8
|
-
*/
|
|
9
3
|
/** `RendererStyleFlags2.DashCase`: the name is a custom property, set as written. */
|
|
10
4
|
const DASH_CASE = 2;
|
|
11
5
|
const runtimes = /* @__PURE__ */ new Map();
|
|
@@ -18,6 +12,18 @@ function runtimeFor(prefix) {
|
|
|
18
12
|
}
|
|
19
13
|
return created;
|
|
20
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* A part's host props: its own handles, then its caller's `sx`, merged with Kirana's runtime as
|
|
17
|
+
* `[sx]` merges them, the caller's last (KF-049). A part binds `class` and `style` to its host and
|
|
18
|
+
* lists `provideSxPart()`, so `SxDirective` leaves the element to it.
|
|
19
|
+
*/
|
|
20
|
+
function partSx(own, sx, prefix = "k") {
|
|
21
|
+
const props = runtimeFor(prefix).sx([own, sx], [], []);
|
|
22
|
+
return {
|
|
23
|
+
class: props.class ?? "",
|
|
24
|
+
style: props.style ?? {}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
21
27
|
/** Applies `value` (a handle, or an array of handles and falsy guards); returns what is applied now. */
|
|
22
28
|
function applySx(renderer, element, previous, value, prefix) {
|
|
23
29
|
const handles = Array.isArray(value) ? value : [value];
|
|
@@ -33,4 +39,4 @@ function applySx(renderer, element, previous, value, prefix) {
|
|
|
33
39
|
styles: new Set(Object.keys(styles))
|
|
34
40
|
};
|
|
35
41
|
}
|
|
36
|
-
export { DASH_CASE, applySx, runtimeFor };
|
|
42
|
+
export { DASH_CASE, applySx, partSx, runtimeFor };
|