11import { Plugin , TFile } from "obsidian" ;
2- import { buttonsLine , cardStyleFunction } from "./src/createFamily/buttons" ;
3- import {
4- coloringTreePanel ,
5- addUnsortedFilesCounter ,
6- unSortedObserver ,
7- foldPropertiesElement ,
8- } from "./src/createFamily/coloringTreePanel" ;
9- import { fileMenu } from "src/mainParts/fileMenu" ;
10- import { settingTab } from "./src/createFamily/settings" ;
11- import SimpleFocusClass from "src/focus/simpleFocus" ;
12- import { addCommands } from "src/mainParts/addCommands" ;
13- import { addRibbonIcon } from "src/mainParts/addRibbonIcon" ;
2+ import P from "src/util/P" ;
3+ import { settingTab , DEFAULT_SETTINGS , clusterPluginSettings } from "./src/settings/settings" ;
144
15- const SimpleFocus = new SimpleFocusClass ( ) ;
16-
17-
18- export interface clusterPluginSettings {
19- foldProperties : boolean ;
20-
21- firstPageClusters : boolean ;
22- cardStyle : boolean ;
23- restBgClusters : boolean ;
24- newBG_clusters : string ;
25- newBG_orphans : string ;
26- restBgOrphans : boolean ;
27- buttonsLineContainerBG_clusters : string ;
28- buttonsLineContainerBG_orphans : string ;
29- }
30-
31- const DEFAULT_SETTINGS : Partial < clusterPluginSettings > = {
32- foldProperties : true ,
33-
34- firstPageClusters : true ,
35- cardStyle : false ,
36- restBgClusters : true ,
37- restBgOrphans : true ,
38- buttonsLineContainerBG_clusters :
39- "var(--background-button-container-clusters)" ,
40- buttonsLineContainerBG_orphans : "var(--background-button-container-orphans)" ,
41- } ;
425
436export default class clusterPlugin extends Plugin {
44- actions = new Map ( ) ; // ! whats this
457 settings : clusterPluginSettings ;
468
479 async onload ( ) {
@@ -51,44 +13,22 @@ export default class clusterPlugin extends Plugin {
5113
5214 this . addSettingTab ( new settingTab ( this . app , this ) ) ;
5315
54- //- UN-SORTED Folder Styling
16+ // UN-SORTED Folder Styling
5517 setTimeout ( async ( ) => {
56- await addUnsortedFilesCounter ( this . app ) ;
57- await unSortedObserver ( this . app ) ;
18+ await P . addUnsortedFilesCounter ( this . app ) ;
19+ await P . unSortedObserver ( this . app ) ;
5820 } , 1000 ) ;
59- //- Card style
60- await cardStyleFunction ( this . settings ) ;
21+
22+ await P . cardStyleFunction ( this . settings ) ; //card style for lorens theme
6123
6224 const file = this . app . workspace . getActiveFile ( ) as TFile ;
6325 if ( file ) {
64- await buttonsLine ( this . app , file , this . settings ) ;
26+ await P . buttonsLine ( this . app , file , this . settings ) ;
6527 }
66-
67- this . registerEvent (
68- this . app . workspace . on ( "file-open" , async ( file ) => {
69- if ( file ) {
70- //- Add Buttons
71- await buttonsLine ( this . app , file , this . settings ) ;
72-
73- //- Coloring Tree Panel
74- await coloringTreePanel ( this . app , file ) ;
75- //- Fold Properties Element
76- if ( this . settings . foldProperties ) {
77- await foldPropertiesElement ( this . app , file ) ;
78- }
79- await addUnsortedFilesCounter ( this . app ) ;
80- await unSortedObserver ( this . app ) ;
81- }
82- } ) ,
83- ) ;
84-
85-
86- //- add Ribbon Icon
87- addRibbonIcon ( this ) ;
88- //- File Menu
89- fileMenu ( this , SimpleFocus ) ;
90- //- Commands
91- addCommands ( this ) ;
28+ P . addEvents ( this )
29+ P . addRibbonIcon ( this ) ;
30+ P . fileMenu ( this , P . SimpleFocus ) ;
31+ P . addCommands ( this ) ;
9232 }
9333
9434 async loadSettings ( ) {
@@ -103,8 +43,8 @@ export default class clusterPlugin extends Plugin {
10343 //FIX if there more than one file in workspace you need to remove the buttons line from them all
10444 // Remove Buttons line
10545 const file = this . app . workspace . getActiveFile ( ) as TFile ;
106- await buttonsLine ( this . app , file , this . settings , true ) ;
107- unSortedObserver ( this . app , false ) ;
46+ await P . buttonsLine ( this . app , file , this . settings , true ) ;
47+ P . unSortedObserver ( this . app , false ) ;
10848 console . log ( "unloading Cluster plugin" ) ;
10949 }
11050}
0 commit comments