@selimssevgi/cube-design-angular 0.4.0 → 0.5.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.4.0",
3
+ "version": "0.5.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",
@@ -468,6 +468,38 @@ export declare const TEXT_ORDERS: readonly TextOrder[];
468
468
  * the items' own order.
469
469
  */
470
470
  export declare function sortItems<T>(items: readonly T[], by: (item: T) => SortValue, dir: Direction, text?: TextOrder): T[];
471
+ /** the sort key of my own order, beside an app's other `SortOption`s (kept by the app, per place). */
472
+ export declare const MINE_SORT = "mine";
473
+ /** why a move in my own order is refused: the fixed first piece stays first. */
474
+ export type OrderRefusal = 'fixed-first';
475
+ /**
476
+ * the order after `piece` is put just before `before` (null: last); the others keep their turn.
477
+ * refused when `piece` or `before` is the fixed first one; the same order when `piece` is not in
478
+ * it or `before` is itself.
479
+ */
480
+ export declare function moveBefore<T>(order: readonly T[], piece: T, before: T | null, opts?: {
481
+ fixedFirst?: T | null;
482
+ }): {
483
+ order: T[];
484
+ refused: OrderRefusal | null;
485
+ };
486
+ /** one piece of a place, as the order level shows it to the held one. */
487
+ export interface CubeOrderPlace {
488
+ key: string;
489
+ /** its turn in the place now, from 0. */
490
+ at: number;
491
+ /** the held piece: ticked, "here now". */
492
+ held: boolean;
493
+ /** the fixed first piece: pale, it stays first. */
494
+ fixed: boolean;
495
+ /** a tap puts the held piece just before it; null for the held one itself. */
496
+ tap: 'before' | null;
497
+ refused: OrderRefusal | null;
498
+ }
499
+ /** the order level's pieces: the place's, in their order, as the held piece sees them. */
500
+ export declare function orderOf(order: readonly string[], held: string, opts?: {
501
+ fixedFirst?: string | null;
502
+ }): CubeOrderPlace[];
471
503
  /** what an app gives for where: its places and how they hold each other, from its own world. */
472
504
  export interface WhereSource {
473
505
  /** the place everything stands in at last: the top (mine, mosaic, my to-dos). */
@@ -569,14 +601,69 @@ export interface WhereWords {
569
601
  export declare function whereLevel(places: readonly CubePlace[], words?: WhereWords, opts?: {
570
602
  pathOf?: (place: CubePlace) => string[];
571
603
  }): ContextTile<CubePlace>[];
604
+ /** one piece, as a bring level shows it. the words for it are the app's. */
605
+ export interface CubeBring {
606
+ /** the piece's key, as the app's source knows it. */
607
+ key: string;
608
+ /** its name, from the source's `nameOf`. */
609
+ title: string;
610
+ /** it stands in the place things are brought into already (ticked). */
611
+ in: boolean;
612
+ /** the app put it in that place: it never leaves it. */
613
+ given: boolean;
614
+ /** it is the place things are brought into, listed pale where it stands. */
615
+ into: boolean;
616
+ /** the place stands inside it: bringing it would put it inside itself (pale). */
617
+ holdsInto: boolean;
618
+ /** what a tap asks for: bring it in too, or take it out of the place; null for the place itself. */
619
+ tap: 'stand' | 'take-out' | null;
620
+ /** why that tap would be refused, or null when it would be done. */
621
+ refused: WhereRefusal | null;
622
+ /** every other place it stands in, in order: for the app's line ("here too · and in kitchen"). */
623
+ places: string[];
624
+ /** inside it are pieces worth looking into (›): something there can be brought in, or is in. */
625
+ deeper: boolean;
626
+ }
627
+ /** how `bringOf` lists. */
628
+ export interface BringOptions {
629
+ /** the place to look inside; the source's top by default. */
630
+ at?: string;
631
+ /** the pieces to list in place of what stands in `at` (lately, worked out by the app); no ›. */
632
+ pieces?: readonly string[];
633
+ }
634
+ /**
635
+ * the pieces that could be brought into `into`, as one level of bring things in: what stands in
636
+ * `at` (the top by default), in its order, hidden ones left out. a piece already in is ticked; the
637
+ * place itself and a piece holding it come pale; a piece with something to bring inside it gets
638
+ * `deeper` (›). a tap on one that is in takes it out, refused where the app put it and when it is
639
+ * its only place; on one that is not, it stands there too, refused when it would go inside itself
640
+ * or by the app's own rules (`WhereSource.refuses`).
641
+ */
642
+ export declare function bringOf(source: WhereSource, into: string, opts?: BringOptions): CubeBring[];
643
+ /** the words of bring things in, the app's: a piece's title and line. */
644
+ export interface BringWords {
645
+ /** its title; the piece's name by default. */
646
+ title?(piece: CubeBring): string;
647
+ /** the line under it: here too and where else, where the app put it, why it can't come. */
648
+ line?(piece: CubeBring): string | null;
649
+ }
572
650
  /**
573
- * the parts a context cube can have. the seven are the ones cubes found, and where (one piece in
574
- * many places, 0.3.0); an app may add its own, any string, and they come after the known ones.
651
+ * bring things in as context tiles: every piece, ticked (`inUse`) where it is in already; pale
652
+ * where a tap can do nothing or would be refused. each tile's `data` is its `CubeBring`, and a
653
+ * piece with `deeper` gets `zoom` (`['bring', key]` by default), drawn as a ›.
575
654
  */
576
- export type ContextPartKey = 'names' | 'change' | 'view' | 'sort' | 'move' | 'where' | 'whose' | 'hide' | (string & {});
655
+ export declare function bringLevel(pieces: readonly CubeBring[], words?: BringWords, opts?: {
656
+ pathOf?: (piece: CubeBring) => string[];
657
+ }): ContextTile<CubeBring>[];
577
658
  /**
578
- * cubes' rows: how it is called (names, change), how it is shown (view, sort), what i do with it
579
- * (move, where, whose, hide).
659
+ * the parts a context cube can have. the seven are the ones cubes found, where (one piece in many
660
+ * places, 0.3.0), and bring and order (bringing things in and my own order, 0.5.0); an app may add
661
+ * its own, any string, and they come after the known ones.
662
+ */
663
+ export type ContextPartKey = 'names' | 'change' | 'bring' | 'view' | 'sort' | 'order' | 'move' | 'where' | 'whose' | 'hide' | (string & {});
664
+ /**
665
+ * cubes' rows: how it is called (names, change, and bring things into it), how it is shown (view,
666
+ * sort, my own order), what i do with it (move, where, whose, hide).
580
667
  */
581
668
  export declare const CONTEXT_PART_ORDER: readonly ContextPartKey[];
582
669
  /** the parts in their rows; parts an app added come last, in the order it gave them. twice is once. */
@@ -743,6 +830,38 @@ export declare function sortLevel(options: readonly SortOption[], now: SortNow,
743
830
  * found is not known yet and comes last (`sortItems`); the words say so in their lines.
744
831
  */
745
832
  export declare function sortDirectionsLevel(option: SortOption, now: SortNow, words: ContextWords): ContextTile<Direction>[];
833
+ /** the words of my own order, the app's. */
834
+ export interface OrderWords {
835
+ /** a piece's title: its name. */
836
+ title(place: CubeOrderPlace): string;
837
+ /** the line under it ("here now", "stays first", "{held} before it"). */
838
+ line?(place: CubeOrderPlace): string | null;
839
+ /** the last tile: put it after everything. */
840
+ last: ContextWord;
841
+ }
842
+ /**
843
+ * order: the place's pieces as they come, the held one ticked; a tap on another puts the held one
844
+ * just before it (`moveBefore`), the fixed first one is pale; **last** comes at the end unless the
845
+ * held piece is last already. each tile's `data` is its `CubeOrderPlace`, or null for last.
846
+ */
847
+ export declare function orderLevel(places: readonly CubeOrderPlace[], words: OrderWords): ContextTile<CubeOrderPlace | null>[];
848
+ /** one way an app adds something to a place: bring things in, a new group, from lately. */
849
+ export interface AddWay {
850
+ /** the app's own key. */
851
+ key: string;
852
+ title: string;
853
+ line?: string | null;
854
+ /** the icon's name; `plus` for the plus, `move` for the others by default. */
855
+ icon?: string;
856
+ /** the plus: something new (a name only), drawn last, as every own box is. */
857
+ adds?: boolean;
858
+ }
859
+ /**
860
+ * add as a level of its own (way b of the study): the app's ways to add to a place, as context
861
+ * tiles, the plus last. what add holds is the app's and may differ from place to place (somewhere
862
+ * it is only the plus, and then the app opens the name at once instead of this level).
863
+ */
864
+ export declare function addLevel(ways: readonly AddWay[]): ContextTile<AddWay>[];
746
865
  /** how close a square's places are: from one big tile (0) to only its icon or small cube (4). */
747
866
  export type SquareLevel = 0 | 1 | 2 | 3 | 4;
748
867
  /** cubes' steps (`levelFor`), by a cell's side in px: a tile says less as the square fills. */
@@ -777,16 +896,32 @@ export interface SquareLayout {
777
896
  export declare const SQUARE_MAX_SIDE = 880;
778
897
  /** a row's height in one across, the list (cubes'). */
779
898
  export declare const SQUARE_LIST_ROW = 76;
899
+ /** the place a square something can be added to aims for, in px (cube design, 2026-11-04). */
900
+ export declare const SQUARE_LEAST_CELL = 200;
901
+ /**
902
+ * how many across a square something can be added to stands at least, in a side this wide: as many
903
+ * as keep a place near `cell` px, at least `min` (3, the phone's turning front) and at most `max`.
904
+ * an empty piece is then a square of places with add first, never one place as wide as the screen
905
+ * (selim, 2026-11-04, way c of `studies/empty-piece-places.md`): 3 × 3 on a phone, 4 × 4 in a
906
+ * desktop column, 5 × 5 at the widest.
907
+ */
908
+ export declare function squareLeast(side: number, opts?: {
909
+ cell?: number;
910
+ min?: number;
911
+ max?: number;
912
+ }): number;
780
913
  /**
781
914
  * how this many tiles are laid out in a view, in this much room. the square view is the smallest
782
915
  * n × n that holds them, as wide as the room and the window's height allow; the other views are as
783
916
  * long as they need and scroll. open places only finish the last row, so a view never draws a whole
784
917
  * empty row (decision of 2026-11-01): three pieces in 4 × 5 are one row of four. the square keeps
785
- * its own rule, its size coming from the pieces.
918
+ * its own rule, its size coming from the pieces, and with `least` it stands at least that many
919
+ * across (a square something can be added to, decision of 2026-11-04).
786
920
  */
787
921
  export declare function squareLayout(view: ViewKey, count: number, room: SquareRoom, opts?: {
788
922
  maxSide?: number;
789
923
  listRow?: number;
924
+ least?: number;
790
925
  }): SquareLayout;
791
926
  /** what a tile's template is given. */
792
927
  export interface CubeSquareTileContext<T> {
@@ -846,6 +981,13 @@ export declare class CubeSquare<T> {
846
981
  readonly listRow: import("@angular/core").InputSignal<number>;
847
982
  /** open places dashed, where something could come (a cube of mine, a level with a plus). */
848
983
  readonly dashed: import("@angular/core").InputSignal<boolean>;
984
+ /**
985
+ * how many across a dashed square stands at least (decision of 2026-11-04): `'room'` (the
986
+ * default) as many as keep a place near 200 px (`squareLeast`: 3 × 3 on a phone, 4 × 4 or 5 × 5
987
+ * wider), a number for that many, `0` for the smallest square that holds the tiles. a square
988
+ * that is not dashed (nothing can come) always keeps the smallest.
989
+ */
990
+ readonly least: import("@angular/core").InputSignal<number | "room">;
849
991
  /** what keeps a tile the same tile across changes, so it is not drawn anew; its place by default. */
850
992
  readonly keyOf: import("@angular/core").InputSignal<(tile: T, index: number) => unknown>;
851
993
  /**
@@ -938,6 +1080,11 @@ export declare class CubeSquare<T> {
938
1080
  "required": false;
939
1081
  "isSignal": true;
940
1082
  };
1083
+ "least": {
1084
+ "alias": "least";
1085
+ "required": false;
1086
+ "isSignal": true;
1087
+ };
941
1088
  "keyOf": {
942
1089
  "alias": "keyOf";
943
1090
  "required": false;