@selimssevgi/cube-design-angular 0.6.2 → 0.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selimssevgi/cube-design-angular",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "cube design in angular: the pieces anlat, mosaic and cubes share, starting with the isometric cube picture.",
5
5
  "keywords": [
6
6
  "angular",
package/tokens/dark.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * cube design's dark dialect (mosaic; cube design `04-screens.md`): black plastic with one light
2
+ * cube design's dark dialect (mosaic; cube design `applications/screens/screens.md`): black plastic with one light
3
3
  * source. import it once in an app's global styles, or set the same variables yourself.
4
4
  */
5
5
  :root {
@@ -49,4 +49,12 @@
49
49
  /* something on its way (<cube-loading>) */
50
50
  --cube-loading-place: rgba(156, 163, 175, 0.1);
51
51
  --cube-loading-gap: 12px;
52
+ /* the cube's art (cube-picture's art): its edges, what is not known yet, the glass */
53
+ --cube-art-edge: rgba(3, 7, 18, 0.45);
54
+ --cube-art-unknown-edge: #4b5563;
55
+ --cube-glass-back: rgba(148, 163, 184, 0.06);
56
+ --cube-glass-edge: rgba(203, 213, 225, 0.22);
57
+ --cube-glass: rgba(186, 230, 253, 0.07);
58
+ --cube-glass-edge-front: rgba(226, 232, 240, 0.6);
59
+ --cube-glass-top: rgba(224, 242, 254, 0.12);
52
60
  }
package/tokens/light.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * cube design's light dialect (cubes, anlat; cube design `04-screens.md`): import it once in an
2
+ * cube design's light dialect (cubes, anlat; cube design `applications/screens/screens.md`): import it once in an
3
3
  * app's global styles, or set the same variables yourself.
4
4
  */
5
5
  :root {
@@ -49,4 +49,12 @@
49
49
  /* something on its way (<cube-loading>) */
50
50
  --cube-loading-place: #e3e7e1;
51
51
  --cube-loading-gap: 12px;
52
+ /* the cube's art (cube-picture's art): its edges, what is not known yet, the glass */
53
+ --cube-art-edge: rgba(31, 45, 39, 0.35);
54
+ --cube-art-unknown-edge: #87938c;
55
+ --cube-glass-back: rgba(42, 48, 45, 0.04);
56
+ --cube-glass-edge: rgba(42, 48, 45, 0.18);
57
+ --cube-glass: rgba(95, 154, 128, 0.06);
58
+ --cube-glass-edge-front: rgba(42, 48, 45, 0.5);
59
+ --cube-glass-top: rgba(255, 255, 255, 0.35);
52
60
  }
@@ -8,7 +8,7 @@ import { Observable } from "rxjs";
8
8
  * n × n stickers. a sticker is coloured by a piece, or pale while nothing is known for it.
9
9
  *
10
10
  * the same projection anlat, mosaic and cubes drew by hand before this package (cube design,
11
- * `04-screens.md`). pure functions, no angular: they can be used anywhere.
11
+ * `applications/screens/screens.md`). pure functions, no angular: they can be used anywhere.
12
12
  */
13
13
  /** The side of the smallest cube that holds this many pieces, up to 7 × 7 × 7. */
14
14
  export declare function sizeFor(count: number): number;
@@ -39,9 +39,56 @@ export interface DrawOptions {
39
39
  }
40
40
  /** A cube for `count` pieces, `width` wide, coloured by `colours` in sticker order. */
41
41
  export declare function drawCube(count: number, colours: (string | null)[], width: number, options?: DrawOptions): Drawing;
42
+ /**
43
+ * the cube's art: other ways to draw the same look as the picture's stickers (cube design,
44
+ * `applications/screens/decisions.md`, 7 november 2026: "all of them are options… users can select
45
+ * for one, user can select for all of them"). found in mosaic's todarch head (lang-app-fe #231) and
46
+ * moved in here so every app can offer them. every art draws the same look: one small cube per
47
+ * piece, its colour, not known yet pale or dashed, and the bigger cube it can grow into dashed; only
48
+ * the drawing differs. pure functions, no angular.
49
+ *
50
+ * - `stickers`: a cube with a sticker per small cube on its outer sides (`drawCube`, the first one).
51
+ * - `blocks`: solid coloured blocks with gaps between them, stacked from the bottom; while it is not
52
+ * full, the whole it grows into is dashed around it.
53
+ * - `glass`: a glass cube with the small cubes floating inside it.
54
+ * - `ribbons`: a smooth cube wrapped in bands, one per colour, as wide as its share.
55
+ * - `dots`: a dark cube with a round dot per small cube on its sides, the places left dashed.
56
+ */
57
+ type CubeArt = 'stickers' | 'blocks' | 'glass' | 'ribbons' | 'dots';
58
+ /** every art, in the order they are offered: stickers (the first one) first. */
59
+ export declare const CUBE_ARTS: readonly CubeArt[];
60
+ /** whether a value read back (from storage, a link) is one of the arts. */
61
+ export declare const isArt: (v: unknown) => v is CubeArt;
62
+ /** an art `drawArt` draws: every one but stickers, which is `drawCube`. */
63
+ type DrawnArt = Exclude<CubeArt, 'stickers'>;
64
+ /** one shape of an art: its points, its class (how it looks) and a fill when it has a colour. */
65
+ interface ArtShape {
66
+ points: string;
67
+ cls: string;
68
+ fill: string | null;
69
+ }
70
+ interface ArtDrawing {
71
+ width: number;
72
+ height: number;
73
+ viewBox: string;
74
+ shapes: ArtShape[];
75
+ }
76
+ interface ArtOptions {
77
+ /** Turned this many colours on (a swipe on the head). */
78
+ rot?: number;
79
+ /** One colour on everything (a value, complete in itself). */
80
+ whole?: boolean;
81
+ /** The cube could grow: its next size dashed around it. */
82
+ hint?: boolean;
83
+ }
84
+ /** draws a look the `art` way (any but `stickers`, which is `drawCube`). */
85
+ export declare function drawArt(art: DrawnArt, count: number, colours: readonly (string | null)[], width: number, options?: ArtOptions): ArtDrawing;
42
86
  /**
43
87
  * a cube of small cubes, one per piece: coloured where something is known, pale where not.
44
88
  *
89
+ * `art` says how it is drawn (`cube-art.ts`): stickers on its sides (the first one), or blocks,
90
+ * glass, ribbons or dots. every art draws the same look; only the drawing differs.
91
+ *
45
92
  * its look comes from css variables, so each app keeps its own dialect (the light one of cubes and
46
93
  * anlat, the dark one of mosaic). every variable has a light fallback, so it draws without any;
47
94
  * `tokens/light.css` and `tokens/dark.css` set them all.
@@ -59,7 +106,10 @@ export declare class CubePicture {
59
106
  readonly whole: import("@angular/core").InputSignal<boolean>;
60
107
  /** how many times it was turned: shifts the colours round the stickers. */
61
108
  readonly rot: import("@angular/core").InputSignal<number>;
109
+ /** how it is drawn: stickers (the first one), blocks, glass, ribbons or dots. */
110
+ readonly art: import("@angular/core").InputSignal<CubeArt>;
62
111
  protected readonly drawing: import("@angular/core").Signal<import("@selimssevgi/cube-design-angular").Drawing>;
112
+ protected readonly artDrawing: import("@angular/core").Signal<import("@selimssevgi/cube-design-angular").ArtDrawing>;
63
113
  static ɵfac: i0.ɵɵFactoryDeclaration<CubePicture, never>;
64
114
  static ɵcmp: i0.ɵɵComponentDeclaration<CubePicture, "cube-picture", never, {
65
115
  "count": {
@@ -92,8 +142,45 @@ export declare class CubePicture {
92
142
  "required": false;
93
143
  "isSignal": true;
94
144
  };
145
+ "art": {
146
+ "alias": "art";
147
+ "required": false;
148
+ "isSignal": true;
149
+ };
95
150
  }, {}, never, never, true, never>;
96
151
  }
152
+ /** what i chose: one art for every app, and one for some apps. none chosen: each app's own. */
153
+ export interface ArtChoices {
154
+ /** for every app; null or missing when i chose none. */
155
+ all?: CubeArt | null;
156
+ /** for one app, by the app's own key; it wins over `all`. */
157
+ apps?: Readonly<Record<string, CubeArt>>;
158
+ }
159
+ /** the art an app draws: the one i chose for it, else the one i chose for all, else its own. */
160
+ export declare function artFor(choices: ArtChoices, app: string, start?: CubeArt): CubeArt;
161
+ /**
162
+ * choosing an art. for one app (`app` given) it keeps it for that app only. for every app
163
+ * (`app` null) it becomes the art of all, and what i chose for one app before gives way to it.
164
+ * `null` as the art forgets the choice: the app (or every app) goes back to its own.
165
+ */
166
+ export declare function chooseArt(choices: ArtChoices, app: string | null, art: CubeArt | null): ArtChoices;
167
+ /** reads choices kept as text, keeping only what is still an art. */
168
+ export declare function readArtChoices(text: string | null): ArtChoices;
169
+ /** where the choices are kept on the phone. */
170
+ export declare const ART_CHOICES_KEY = "cube-design.art";
171
+ /**
172
+ * the arts i chose, kept on this phone (localStorage, `ART_CHOICES_KEY`). a phone that keeps
173
+ * nothing starts again from each app's own art.
174
+ */
175
+ export declare class CubeArtChoices {
176
+ readonly choices: import("@angular/core").WritableSignal<ArtChoices>;
177
+ /** the art `app` draws now, starting from `start` when i chose none. */
178
+ artFor(app: string, start?: CubeArt): CubeArt;
179
+ /** chooses `art` for `app`, or for every app when `app` is null; null forgets. */
180
+ choose(app: string | null, art: CubeArt | null): void;
181
+ static ɵfac: i0.ɵɵFactoryDeclaration<CubeArtChoices, never>;
182
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
183
+ }
97
184
  /** what a hold reports: how it came, on which element, and the event that ended it. */
98
185
  export interface CubeHeld {
99
186
  /** `press`: a finger, pen or the main mouse button stayed put; `menu`: a contextmenu event. */
@@ -709,6 +796,17 @@ export interface ContextTile<D = unknown> {
709
796
  * names are set; a null value leaves one out. none by default (0.4.0, from mosaic's home).
710
797
  */
711
798
  attrs?: Readonly<Record<string, string | null>> | null;
799
+ /**
800
+ * draws the tile's cube in place of its icon: the look it stands for, drawn with that art (the
801
+ * arts of the cube on top, `artLevel`, 0.7.0). none by default.
802
+ */
803
+ art?: ContextArt | null;
804
+ }
805
+ /** the cube an art tile draws: how, and the look (how many small cubes, their colours). */
806
+ export interface ContextArt {
807
+ art: CubeArt;
808
+ count: number;
809
+ colours: readonly (string | null)[];
712
810
  }
713
811
  /** where in the context cube one is: [] is its top (its parts), ['names'] a part, ['sort', by] deeper. */
714
812
  export type ContextPath = readonly string[];
@@ -776,6 +874,8 @@ export interface ContextWords {
776
874
  * (the person says it without choosing). an app without them shows tell with empty titles.
777
875
  */
778
876
  tell?: TellWords;
877
+ /** each art's title and line (`artLevel`); the art's key and no line without. */
878
+ arts?: Partial<Record<CubeArt, ContextWord>>;
779
879
  }
780
880
  /** the words of tell's level, one for each kind of report and one for not known yet. */
781
881
  export interface TellWords {
@@ -934,6 +1034,15 @@ export type TellData = ReportKind | null;
934
1034
  * it with `ReportClient`. no kind is in use: nothing has been told yet.
935
1035
  */
936
1036
  export declare function tellLevel(words: ContextWords): ContextTile<TellData>[];
1037
+ /**
1038
+ * the cube's art: every way to draw the cube on top, each tile drawing the cube i am looking at
1039
+ * (`look`) that way, the one in use first in place of its line. the app adds it where it fits (the
1040
+ * cube on top's view, in mosaic); a tap is the app's to keep (`CubeArtChoices`). 0.7.0.
1041
+ */
1042
+ export declare function artLevel(now: CubeArt, look: {
1043
+ count: number;
1044
+ colours: readonly (string | null)[];
1045
+ }, words: ContextWords, arts?: readonly CubeArt[]): ContextTile<CubeArt>[];
937
1046
  /** how close a square's places are: from one big tile (0) to only its icon or small cube (4). */
938
1047
  export type SquareLevel = 0 | 1 | 2 | 3 | 4;
939
1048
  /** cubes' steps (`levelFor`), by a cell's side in px: a tile says less as the square fills. */
@@ -1244,6 +1353,8 @@ export declare function contextSquare(count: number, room: number, maxSide?: num
1244
1353
  * package does not have).
1245
1354
  */
1246
1355
  export declare function contextIcon(tile: Pick<ContextTile, 'icon' | 'adds'>): CubeIconName;
1356
+ /** how wide an art tile draws its cube at each closeness of the square (its icon's room). */
1357
+ export declare function contextArtWidth(level: number): number;
1247
1358
  /** a tapped tile and the element it is drawn in. */
1248
1359
  export interface ContextTapped {
1249
1360
  tile: ContextTile;
@@ -1303,6 +1414,7 @@ export declare class CubeContext {
1303
1414
  protected readonly keyOf: (t: ContextTile) => string;
1304
1415
  protected readonly inUseWord: import("@angular/core").Signal<string | null>;
1305
1416
  protected readonly iconOf: typeof contextIcon;
1417
+ protected readonly artWidth: typeof contextArtWidth;
1306
1418
  constructor();
1307
1419
  /** the › of a tile with a way inside: walks into its path, without asking the source. */
1308
1420
  protected zoomInto(tile: ContextTile, element?: HTMLElement): void;
@@ -1369,7 +1481,7 @@ export declare function turningRows<T>(pieces: readonly T[], own: T | null, cols
1369
1481
  /**
1370
1482
  * something on its way, the cube design way: the cube picture's pale stickers take colour (a page,
1371
1483
  * a cube) or its colours turn round the stickers (a piece: a tile, a button saving). picked by selim
1372
- * on 3 november 2026 (cube design's `08-decisions.md`, the study `studies/loading-pieces.md`), in
1484
+ * on 3 november 2026 (cube design's `record/decisions-until-2026-11-05.md`, the study `studies/loading-pieces.md`), in
1373
1485
  * place of grey pulsing cards and primeng's ring. it says no word: the app's own line is projected.
1374
1486
  */
1375
1487
  /**
@@ -1656,4 +1768,5 @@ export declare class ReportClient {
1656
1768
  undo(id: string): Observable<void>;
1657
1769
  static ɵfac: i0.ɵɵFactoryDeclaration<ReportClient, never>;
1658
1770
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1659
- }
1771
+ }
1772
+ export type { ArtDrawing, ArtOptions, ArtShape, CubeArt, DrawnArt };