@selimssevgi/cube-design-angular 0.6.2 → 0.7.1

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.1",
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. */
@@ -181,7 +268,7 @@ export interface CubePinched {
181
268
  * firefox send a trackpad's pinch; `gesture`: safari's own gesture events for a trackpad's pinch.
182
269
  */
183
270
  via: 'touch' | 'wheel' | 'gesture';
184
- /** the event that decided it: the `pointerup`, the first `wheel` of the stream, the `gestureend`. */
271
+ /** the event that decided it: the `pointerup`, the stream's first real `wheel` step, the `gestureend`. */
185
272
  event: Event;
186
273
  }
187
274
  /** two fingers this much further apart than they started is a pinch in (cubes', mosaic's, anlat's). */
@@ -199,6 +286,19 @@ export declare const CUBE_WHEEL_QUIET_MS = 250;
199
286
  * the same rule.
200
287
  */
201
288
  export declare function startsWheelGesture(lastAt: number, now: number, quietMs?: number): boolean;
289
+ /**
290
+ * the least `deltaY` of one ctrl + wheel event that decides a pinch's way. a trackpad begins a pinch
291
+ * with a still event (0) or the fingers settling the other way (-1) before the real steps come, so a
292
+ * smaller step only moves the stream's end (the every-level prototype's rule, 6 nov 2026).
293
+ */
294
+ export declare const CUBE_WHEEL_STEP = 2;
295
+ /**
296
+ * which way a ctrl + wheel stream that has not decided yet goes, given its event's `deltaY` and the
297
+ * sum of the stream's deltas so far, this one counted: the first step of at least `least` decides
298
+ * by its own sign; a slow pinch of small steps decides once they add up to three times `least`;
299
+ * else not yet (null). pure, so an app with a wheel of its own reads a stream the same way.
300
+ */
301
+ export declare function wheelWay(deltaY: number, sum: number, least?: number): 'in' | 'out' | null;
202
302
  /**
203
303
  * the pinch (principle 25, two fingers together is one level out): fingers apart on a piece raise
204
304
  * one `cubePinched` with `way: 'in'`, fingers together one with `way: 'out'`. on a computer a
@@ -709,6 +809,17 @@ export interface ContextTile<D = unknown> {
709
809
  * names are set; a null value leaves one out. none by default (0.4.0, from mosaic's home).
710
810
  */
711
811
  attrs?: Readonly<Record<string, string | null>> | null;
812
+ /**
813
+ * draws the tile's cube in place of its icon: the look it stands for, drawn with that art (the
814
+ * arts of the cube on top, `artLevel`, 0.7.0). none by default.
815
+ */
816
+ art?: ContextArt | null;
817
+ }
818
+ /** the cube an art tile draws: how, and the look (how many small cubes, their colours). */
819
+ export interface ContextArt {
820
+ art: CubeArt;
821
+ count: number;
822
+ colours: readonly (string | null)[];
712
823
  }
713
824
  /** where in the context cube one is: [] is its top (its parts), ['names'] a part, ['sort', by] deeper. */
714
825
  export type ContextPath = readonly string[];
@@ -776,6 +887,8 @@ export interface ContextWords {
776
887
  * (the person says it without choosing). an app without them shows tell with empty titles.
777
888
  */
778
889
  tell?: TellWords;
890
+ /** each art's title and line (`artLevel`); the art's key and no line without. */
891
+ arts?: Partial<Record<CubeArt, ContextWord>>;
779
892
  }
780
893
  /** the words of tell's level, one for each kind of report and one for not known yet. */
781
894
  export interface TellWords {
@@ -934,6 +1047,15 @@ export type TellData = ReportKind | null;
934
1047
  * it with `ReportClient`. no kind is in use: nothing has been told yet.
935
1048
  */
936
1049
  export declare function tellLevel(words: ContextWords): ContextTile<TellData>[];
1050
+ /**
1051
+ * the cube's art: every way to draw the cube on top, each tile drawing the cube i am looking at
1052
+ * (`look`) that way, the one in use first in place of its line. the app adds it where it fits (the
1053
+ * cube on top's view, in mosaic); a tap is the app's to keep (`CubeArtChoices`). 0.7.0.
1054
+ */
1055
+ export declare function artLevel(now: CubeArt, look: {
1056
+ count: number;
1057
+ colours: readonly (string | null)[];
1058
+ }, words: ContextWords, arts?: readonly CubeArt[]): ContextTile<CubeArt>[];
937
1059
  /** how close a square's places are: from one big tile (0) to only its icon or small cube (4). */
938
1060
  export type SquareLevel = 0 | 1 | 2 | 3 | 4;
939
1061
  /** cubes' steps (`levelFor`), by a cell's side in px: a tile says less as the square fills. */
@@ -1244,6 +1366,8 @@ export declare function contextSquare(count: number, room: number, maxSide?: num
1244
1366
  * package does not have).
1245
1367
  */
1246
1368
  export declare function contextIcon(tile: Pick<ContextTile, 'icon' | 'adds'>): CubeIconName;
1369
+ /** how wide an art tile draws its cube at each closeness of the square (its icon's room). */
1370
+ export declare function contextArtWidth(level: number): number;
1247
1371
  /** a tapped tile and the element it is drawn in. */
1248
1372
  export interface ContextTapped {
1249
1373
  tile: ContextTile;
@@ -1303,6 +1427,7 @@ export declare class CubeContext {
1303
1427
  protected readonly keyOf: (t: ContextTile) => string;
1304
1428
  protected readonly inUseWord: import("@angular/core").Signal<string | null>;
1305
1429
  protected readonly iconOf: typeof contextIcon;
1430
+ protected readonly artWidth: typeof contextArtWidth;
1306
1431
  constructor();
1307
1432
  /** the › of a tile with a way inside: walks into its path, without asking the source. */
1308
1433
  protected zoomInto(tile: ContextTile, element?: HTMLElement): void;
@@ -1369,7 +1494,7 @@ export declare function turningRows<T>(pieces: readonly T[], own: T | null, cols
1369
1494
  /**
1370
1495
  * something on its way, the cube design way: the cube picture's pale stickers take colour (a page,
1371
1496
  * 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
1497
+ * on 3 november 2026 (cube design's `record/decisions-until-2026-11-05.md`, the study `studies/loading-pieces.md`), in
1373
1498
  * place of grey pulsing cards and primeng's ring. it says no word: the app's own line is projected.
1374
1499
  */
1375
1500
  /**
@@ -1656,4 +1781,5 @@ export declare class ReportClient {
1656
1781
  undo(id: string): Observable<void>;
1657
1782
  static ɵfac: i0.ɵɵFactoryDeclaration<ReportClient, never>;
1658
1783
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1659
- }
1784
+ }
1785
+ export type { ArtDrawing, ArtOptions, ArtShape, CubeArt, DrawnArt };