mftsccs-browser 2.2.20-beta → 2.2.22-beta

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.
Files changed (117) hide show
  1. package/README.md +1073 -11
  2. package/dist/bundle.js +2 -0
  3. package/dist/bundle.js.LICENSE.txt +1 -0
  4. package/dist/main.bundle.js +1 -1
  5. package/dist/serviceWorker.bundle.js +1 -1
  6. package/dist/types/Api/Create/CreateTheCharacter.d.ts +21 -0
  7. package/dist/types/Api/Create/CreateTheConceptApi.d.ts +18 -0
  8. package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +16 -0
  9. package/dist/types/Api/Create/CreateTheGhostConceptApi.d.ts +25 -0
  10. package/dist/types/Api/Create/CreateTheGhostConnectionApi.d.ts +16 -0
  11. package/dist/types/Api/Create/CreateTheTextData.d.ts +16 -0
  12. package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +13 -0
  13. package/dist/types/Api/Delete/DeleteUserInBackend.d.ts +18 -0
  14. package/dist/types/Api/DeleteConnectionApiBulk.d.ts +1 -0
  15. package/dist/types/Api/DeleteConnectionBulkApi.d.ts +19 -0
  16. package/dist/types/Api/DeleteTheConcept.d.ts +19 -0
  17. package/dist/types/Api/DeleteTheConnection.d.ts +19 -0
  18. package/dist/types/Api/GetAiData.d.ts +9 -0
  19. package/dist/types/Api/GetAllConcepts.d.ts +10 -0
  20. package/dist/types/Api/GetAllConceptsByType.d.ts +11 -0
  21. package/dist/types/Api/GetAllConnections.d.ts +10 -0
  22. package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +20 -0
  23. package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +20 -0
  24. package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +10 -0
  25. package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +10 -0
  26. package/dist/types/Api/GetAllPrefetchConnections.d.ts +11 -0
  27. package/dist/types/Api/GetCharacterDataByCharacter.d.ts +10 -0
  28. package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +12 -0
  29. package/dist/types/Api/GetConceptBulk.d.ts +10 -0
  30. package/dist/types/Api/GetConceptByCharacterAndType.d.ts +14 -0
  31. package/dist/types/Api/GetConceptByCharacterValue.d.ts +10 -0
  32. package/dist/types/Api/GetConnection.d.ts +13 -0
  33. package/dist/types/Api/GetConnectionOfTheConcept.d.ts +14 -0
  34. package/dist/types/Api/GetConnectionToTheConcept.d.ts +15 -0
  35. package/dist/types/Api/GetConnections/GetConnectionsByTypeApi.d.ts +12 -0
  36. package/dist/types/Api/GetReservedConnectionIds.d.ts +9 -0
  37. package/dist/types/Api/GetReservedIds.d.ts +9 -0
  38. package/dist/types/Api/Images/GetImages.d.ts +14 -0
  39. package/dist/types/Api/Local/GetLocalConceptByCharacterValue.d.ts +11 -0
  40. package/dist/types/Api/Login.d.ts +77 -0
  41. package/dist/types/Api/MakeTheNameInBackend.d.ts +13 -0
  42. package/dist/types/Api/Prototype/CreatePrototype.d.ts +12 -0
  43. package/dist/types/Api/Prototype/Selector.d.ts +11 -0
  44. package/dist/types/Api/RecursiveSearch.d.ts +61 -0
  45. package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +16 -0
  46. package/dist/types/Api/Search/Search.d.ts +72 -0
  47. package/dist/types/Api/Search/SearchInternalApi.d.ts +25 -0
  48. package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +13 -0
  49. package/dist/types/Api/Search/SearchWithLinker.d.ts +14 -0
  50. package/dist/types/Api/Search/SearchWithTypeAndLinker.d.ts +12 -0
  51. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +10 -0
  52. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +11 -0
  53. package/dist/types/Api/SearchConcept/GetTypeConceptByBulk.d.ts +13 -0
  54. package/dist/types/Api/Session/CreateSession.d.ts +14 -0
  55. package/dist/types/Api/Session/CreateSessionVisit.d.ts +11 -0
  56. package/dist/types/Api/Signin.d.ts +21 -0
  57. package/dist/types/Api/Signup.d.ts +53 -11
  58. package/dist/types/Api/Translate/TranslateLocalToReal.d.ts +10 -0
  59. package/dist/types/Api/View/ViewInternalDataApi.d.ts +14 -0
  60. package/dist/types/DataStructures/BaseUrl.d.ts +1 -0
  61. package/dist/types/DataStructures/Transaction/Transaction.d.ts +30 -0
  62. package/dist/types/Services/AccessControl/AccessControlCacheService.d.ts +19 -0
  63. package/dist/types/Services/AccessControl/AccessControlService.d.ts +267 -0
  64. package/dist/types/Services/AccessControl/PermissionSet.d.ts +8 -0
  65. package/dist/types/Services/CreateTheConcept.d.ts +118 -0
  66. package/dist/types/Services/CreateTheConnection.d.ts +59 -6
  67. package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +13 -0
  68. package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +16 -0
  69. package/dist/types/Services/GetComposition.d.ts +64 -7
  70. package/dist/types/Services/GetTheConcept.d.ts +91 -4
  71. package/dist/types/Services/Local/ConvertFromLConceptToConcept.d.ts +39 -0
  72. package/dist/types/Services/Local/ConvertFromLConnectionToConnection.d.ts +45 -0
  73. package/dist/types/Services/Local/CreateConnectionBetweenTwoConceptsLocal.d.ts +41 -0
  74. package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +44 -0
  75. package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +6 -1
  76. package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +8 -0
  77. package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +8 -0
  78. package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +100 -10
  79. package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +80 -18
  80. package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +135 -11
  81. package/dist/types/Services/Local/DeleteConceptLocal.d.ts +46 -0
  82. package/dist/types/Services/Local/GetCompositionListLocal.d.ts +31 -8
  83. package/dist/types/Services/Local/GetCompositionLocal.d.ts +95 -0
  84. package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +48 -2
  85. package/dist/types/Services/Local/GetConnectionOfTheConceptLocal.d.ts +17 -0
  86. package/dist/types/Services/Local/GetRelationLocal.d.ts +20 -0
  87. package/dist/types/Services/Local/GetTheConceptLocal.d.ts +60 -6
  88. package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +20 -0
  89. package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +160 -14
  90. package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +29 -9
  91. package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +39 -0
  92. package/dist/types/Services/MakeTheLocalConcept.d.ts +0 -0
  93. package/dist/types/Services/MakeTheName.d.ts +2 -0
  94. package/dist/types/Services/auth/AuthService.d.ts +1 -0
  95. package/dist/types/Widgets/BaseObserver.d.ts +14 -11
  96. package/dist/types/Widgets/BaseWidget.d.ts +24 -11
  97. package/dist/types/Widgets/BuilderSpeceficFunctions.d.ts +9 -0
  98. package/dist/types/Widgets/BuilderStatefulWidget.d.ts +352 -2
  99. package/dist/types/Widgets/CacheWidget.service.d.ts +60 -0
  100. package/dist/types/Widgets/NormalizeStyles.service.d.ts +9 -0
  101. package/dist/types/Widgets/RenderPage.service.d.ts +9 -4
  102. package/dist/types/Widgets/RenderWidgetLibrary.service.d.ts +12 -4
  103. package/dist/types/Widgets/RenderWidgetService.d.ts +158 -21
  104. package/dist/types/Widgets/StatefulWidget.d.ts +94 -29
  105. package/dist/types/Widgets/WidgetBuild.d.ts +41 -0
  106. package/dist/types/Widgets/WidgetTree.d.ts +31 -0
  107. package/dist/types/Widgets/mainView.class.d.ts +21 -0
  108. package/dist/types/WrapperFunctions/DepenedencyObserver.d.ts +48 -27
  109. package/dist/types/WrapperFunctions/GetCompositionListObservable.d.ts +34 -2
  110. package/dist/types/WrapperFunctions/GetCompositionObservable.d.ts +24 -2
  111. package/dist/types/WrapperFunctions/GetLinkListObservable.d.ts +38 -9
  112. package/dist/types/WrapperFunctions/GetLinkObservable.d.ts +30 -12
  113. package/dist/types/WrapperFunctions/RecursiveSearchObservable.d.ts +34 -16
  114. package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +41 -5
  115. package/dist/types/WrapperFunctions/SearchLinkMultipleAllObservable.d.ts +24 -3
  116. package/dist/types/app.d.ts +183 -12
  117. package/package.json +1 -1
@@ -1,50 +1,187 @@
1
1
  import { BuilderStatefulWidget, StatefulWidget, WidgetTree } from "../app";
2
+ /**
3
+ * Renders a complete page with its widgets and properties.
4
+ *
5
+ * Fetches page data, applies page-level properties (meta tags, styles), and renders
6
+ * the page body widget. Adds fspage class for styling.
7
+ *
8
+ * @param pageId - The page concept ID to render
9
+ * @param attachNode - DOM element to attach the page to
10
+ * @param props - Optional properties to pass to the page widget
11
+ * @param showDocumentation - Whether to show documentation button
12
+ */
2
13
  export declare function renderPage(pageId: number, attachNode: HTMLElement, props?: any, showDocumentation?: boolean): Promise<void>;
14
+ /**
15
+ * Imports the latest version of a widget into cache for later rendering.
16
+ *
17
+ * Fetches widget data, builds widget tree, and stores in DataCache.
18
+ * Used for pre-loading widgets before rendering.
19
+ *
20
+ * @param widgetId - The widget origin ID to import
21
+ * @param attachNode - Optional DOM element (for future use)
22
+ * @param props - Optional properties to pass to the widget
23
+ * @param showDocumentation - Whether to show documentation button
24
+ * @returns Promise resolving to the widget tree
25
+ */
3
26
  export declare function importLatestWidget(widgetId: number, attachNode?: HTMLElement, props?: any, showDocumentation?: boolean): Promise<WidgetTree | undefined>;
27
+ /**
28
+ * Imports the latest version of a widget into cache for later rendering.
29
+ *
30
+ * Fetches widget data, builds widget tree, and stores in DataCache.
31
+ * Used for pre-loading widgets before rendering.
32
+ *
33
+ * @param widgetId - The widget origin ID to import
34
+ * @param attachNode - Optional DOM element (for future use)
35
+ * @param props - Optional properties to pass to the widget
36
+ * @param showDocumentation - Whether to show documentation button
37
+ * @returns Promise resolving to the widget tree
38
+ */
39
+ export declare function importRecentWidget(widgetId: number, attachNode?: HTMLElement, props?: any, showDocumentation?: boolean): Promise<WidgetTree | undefined>;
40
+ /**
41
+ * Renders a previously imported widget from cache.
42
+ *
43
+ * Retrieves widget tree from DataCache and renders it to the DOM.
44
+ * Must call importLatestWidget() first to populate cache.
45
+ *
46
+ * @param widgetId - The widget origin ID to render
47
+ * @param attachNode - DOM element to attach the widget to
48
+ * @param props - Optional properties to pass to the widget
49
+ * @param showDocumentation - Whether to show documentation button
50
+ * @returns Promise resolving to the rendered widget instance
51
+ */
4
52
  export declare function renderImportedWidget(widgetId: number, attachNode: HTMLElement, props?: any, showDocumentation?: boolean): Promise<BuilderStatefulWidget | undefined>;
53
+ /**
54
+ * Renders the latest published version of a widget.
55
+ *
56
+ * Fetches and renders the most recent version of a widget by origin ID.
57
+ * Automatically handles "use latest" flag for child widgets.
58
+ *
59
+ * @param widgetId - The widget origin ID to render
60
+ * @param attachNode - DOM element to attach the widget to
61
+ * @param props - Optional properties to pass to the widget
62
+ * @param showDocumentation - Whether to show documentation button
63
+ */
5
64
  export declare function renderLatestWidget(widgetId: number, attachNode: HTMLElement, props?: any, showDocumentation?: boolean): Promise<BuilderStatefulWidget | undefined>;
65
+ /**
66
+ * Renders a specific widget by ID.
67
+ *
68
+ * Fetches widget data and renders the exact version specified (not latest).
69
+ *
70
+ * @param widgetId - The specific widget ID to render
71
+ * @param attachNode - DOM element to attach the widget to
72
+ * @param props - Optional properties to pass to the widget
73
+ * @param showDocumentation - Whether to show documentation button
74
+ * @returns Promise resolving to the rendered widget instance
75
+ */
6
76
  export declare function renderWidget(widgetId: number, attachNode: HTMLElement, props?: any, showDocumentation?: boolean): Promise<BuilderStatefulWidget | undefined>;
77
+ /**
78
+ * Materializes a widget tree into DOM elements with styles and scripts.
79
+ *
80
+ * Core rendering logic that converts widget data into live DOM, applies styles,
81
+ * initializes libraries, and attaches documentation if enabled.
82
+ *
83
+ * @param widgetId - The widget ID being materialized
84
+ * @param bulkWidget - Bulk widget data from backend
85
+ * @param attachNode - DOM element to attach the widget to
86
+ * @param props - Optional properties to pass to the widget
87
+ * @param showDocumentation - Whether to show documentation button (default: true)
88
+ * @returns Promise resolving to the rendered widget instance
89
+ */
7
90
  export declare function materializeWidget(widgetId: number, bulkWidget: any, attachNode: HTMLElement, props?: any, showDocumentation?: boolean): Promise<BuilderStatefulWidget | undefined>;
91
+ /**
92
+ * Fetches and builds a complete widget tree from a widget ID.
93
+ *
94
+ * @param widgetId - The widget ID to fetch
95
+ * @param visitedWidgets - Array to track visited widgets (prevents cycles)
96
+ * @param token - Optional authentication token
97
+ * @returns Promise resolving to the widget tree
98
+ */
8
99
  export declare function getWidgetFromId(widgetId: number, visitedWidgets?: number[], token?: string): Promise<WidgetTree>;
9
100
  /**
10
- * This function builds a widget tree. This tree is built fully along with its children
11
- * This tree can then be used to build the whole dom for the widget.
12
- * This has recursive property so that the recursion can be used to build this tree.
13
- * @param widgetId the id of the widget
14
- * @returns WidgetTree.
101
+ * Builds a complete widget tree from bulk widget data.
102
+ *
103
+ * Recursively processes widget hierarchy including children, custom functions,
104
+ * libraries, and lifecycle hooks to create a full WidgetTree structure.
105
+ *
106
+ * @param widgetId - The widget ID to build tree for
107
+ * @param visitedWidgets - Array tracking visited widgets to prevent cycles
108
+ * @param bulkWidget - Bulk widget data from backend
109
+ * @param token - Optional authentication token
110
+ * @returns Promise resolving to the complete widget tree
15
111
  */
16
112
  export declare function getWidgetBulkFromId(widgetId: number, visitedWidgets: number[] | undefined, bulkWidget: any, token?: string): Promise<WidgetTree>;
17
113
  /**
114
+ * Converts a widget tree structure into live widget instances and mounts to DOM.
115
+ *
116
+ * Recursively instantiates widgets from tree data, sets up parent-child relationships,
117
+ * applies styles, and mounts to the specified parent element.
18
118
  *
19
- * @param tree Widget tree from getWidgetFromId(widgetId);
20
- * @param parentElement this is the dom element on which we want to add our widget
21
- * @returns the widgetree with widgets attached inside of it.
22
- * Also this will add the tree to the dom.
119
+ * @param tree - The widget tree to convert
120
+ * @param parentElement - DOM element to mount the widget to
121
+ * @param isMain - Whether this is the main/root widget
122
+ * @param props - Optional properties to pass to the widget
123
+ * @param state - Optional state data to pass to the widget
124
+ * @param parentWidget - Parent widget instance for context
125
+ * @returns Promise resolving to the instantiated widget
23
126
  */
24
127
  export declare function convertWidgetTreeToWidget(tree: WidgetTree, parentElement: HTMLElement, isMain?: boolean, props?: any, state?: any, parentWidget?: StatefulWidget | null): Promise<BuilderStatefulWidget>;
128
+ /**
129
+ * Creates a shallow copy of an object, excluding arrays and nested objects.
130
+ *
131
+ * @param input - Object to create shallow copy from
132
+ * @returns Shallow copy with only primitive and null values
133
+ */
25
134
  export declare function makeShallow(input: any): any;
26
135
  /**
27
- *
28
- * @param tree Widget tree from getWidgetFromId(widgetId);
29
- * @param parentElement this is the dom element on which we want to add our widget
30
- * @returns the widgetree with widgets attached inside of it.
31
- * Also this will add the tree to the dom.
32
- */
136
+ * Converts widget tree to widget instances with development mode wrapper support.
137
+ *
138
+ * Similar to convertWidgetTreeToWidget but includes development mode features
139
+ * like visual editing and type selection.
140
+ *
141
+ * @param tree - The widget tree to convert
142
+ * @param parentElement - DOM element to mount the widget to
143
+ * @param isMain - Whether this is the main/root widget
144
+ * @param state - Optional state data to pass to the widget
145
+ * @param isInDevelopment - Enable development mode features
146
+ * @param parentWidget - Parent widget instance for context
147
+ * @returns Promise resolving to the instantiated widget
148
+ */
33
149
  export declare function convertWidgetTreeToWidgetWithWrapper(tree: WidgetTree, parentElement: HTMLElement, isMain?: boolean, state?: object, isInDevelopment?: boolean, parentWidget?: StatefulWidget | null): Promise<BuilderStatefulWidget>;
150
+ /**
151
+ * Recursively unwraps all matching container elements within a parent.
152
+ *
153
+ * @param parentElement - Parent element to search within
154
+ * @param selector - CSS selector for containers to unwrap
155
+ */
34
156
  export declare function unwrapContainers(parentElement: HTMLElement, selector: string): Promise<void>;
35
157
  /**
36
- * Opens documentation modal
37
- * @param widgetId
158
+ * Opens the documentation preview modal for a widget.
159
+ *
160
+ * Fetches and displays widget documentation including API specs, code examples,
161
+ * images, videos, and links.
162
+ *
163
+ * @param widgetId - The widget ID to show documentation for
38
164
  */
39
165
  export declare function openDocumentationPreviewModal(widgetId: number): Promise<void>;
166
+ /**
167
+ * Renders widget documentation content into the documentation view.
168
+ *
169
+ * Formats and displays documentation data including text, API details,
170
+ * code examples, and media attachments.
171
+ *
172
+ * @param widgetDocumentData - Documentation data to display
173
+ * @param widgetId - The widget ID being documented
174
+ */
40
175
  export declare function showWidgetDocumentation(widgetDocumentData: any, widgetId: number): Promise<void>;
41
176
  /**
42
- * Opens modal
43
- * @param modalId
177
+ * Opens a modal dialog by ID.
178
+ *
179
+ * @param modalId - The ID of the modal element to open
44
180
  */
45
181
  export declare function openModal(modalId: string): Promise<void>;
46
182
  /**
47
- * Closes modal
48
- * @param modalId
183
+ * Closes a modal dialog by ID and resets its form if present.
184
+ *
185
+ * @param modalId - The ID of the modal element to close
49
186
  */
50
187
  export declare function closeModal(modalId: string): Promise<void>;
@@ -1,102 +1,167 @@
1
1
  import { BaseWidget } from "./BaseWidget";
2
2
  /**
3
- * Implementation of a widget system. If you need to create a widget that is compatible with the concept connection
4
- * system them extend this class and populate the functions such as getHtml() and widgetDidMount()
3
+ * Stateful widget with lifecycle management and hierarchical composition.
4
+ *
5
+ * Provides a React-like component system with state management, lifecycle hooks,
6
+ * and parent-child widget relationships. Extend this class to create custom widgets
7
+ * compatible with the concept connection system.
5
8
  */
6
9
  export declare class StatefulWidget extends BaseWidget {
10
+ /** Optional parameters passed to the widget */
7
11
  params: any;
12
+ /** HTML template string for the widget */
8
13
  html: string;
14
+ /** CSS styles for the widget */
9
15
  css: string;
16
+ /** JavaScript code for the widget */
10
17
  js: string;
18
+ /** Current widget state object */
11
19
  state: {
12
20
  [key: string]: any;
13
21
  };
22
+ /** Previous widget state for change detection */
14
23
  previousState: {
15
24
  [key: string]: any;
16
25
  };
17
- /**
18
- * These are the child widgets that need to be added to this widget
19
- */
26
+ /** Array of child widget instances */
20
27
  childWidgets: any;
28
+ /** Array of DOM elements hosting child widgets */
21
29
  childWidgetElement: any;
30
+ /** Reference to the parent widget instance */
22
31
  parentWidget: any;
23
- /**
24
- * store widget state datas to pass through child widgets
25
- */
32
+ /** Shared state data passed to child widgets */
26
33
  widgetState: {
27
34
  [key: string]: any;
28
35
  };
36
+ /** ID of the parent DOM element containing this widget */
37
+ parentElement: string;
29
38
  /**
30
- * This is the id of the parentElement of this widget.
39
+ * Finds the first element matching a CSS selector within this widget.
40
+ *
41
+ * @param selector - CSS selector string
42
+ * @returns The first matching element or null
31
43
  */
32
- parentElement: string;
33
44
  querySelector(selector: string): Element | null;
45
+ /**
46
+ * Finds all elements matching a CSS selector within this widget.
47
+ *
48
+ * @param selector - CSS selector string
49
+ * @returns NodeList of matching elements or null
50
+ */
34
51
  querySelectorAll(selector: string): NodeListOf<Element> | null;
52
+ /**
53
+ * Gets the root DOM element of this widget.
54
+ *
55
+ * @returns The widget's root HTML element
56
+ */
35
57
  getElement(): HTMLElement | null;
58
+ /**
59
+ * Sets the browser document title.
60
+ *
61
+ * @param title - The new document title
62
+ */
36
63
  setTitle(title: string): void;
37
64
  /**
65
+ * Gets the HTML template for this widget.
38
66
  *
39
- * @returns the html string that needs to be mounted to the DOM.
67
+ * @returns HTML string to be rendered
40
68
  */
41
69
  getHtml(): string;
42
70
  /**
43
- * This will help us update the data of the child widget. This will also call another function inside of the child widget
44
- * called udpateWidget which the user can call after some data is udpated.
45
- * @param value
46
- * @param widget
71
+ * Updates a child widget's data and triggers re-render.
72
+ *
73
+ * @param value - New data to pass to the child widget
74
+ * @param widget - The child widget instance to update
47
75
  */
48
76
  UpdateChildData(value: any, widget: StatefulWidget): void;
49
77
  /**
50
- * This is called after the data has been udpated by some other component.
78
+ * Lifecycle hook called after widget data is updated.
79
+ * Override this method to handle post-update logic.
51
80
  */
52
81
  update(): void;
53
82
  /**
83
+ * Updates the entire widget state and triggers re-render if changed.
54
84
  *
55
- * @param newState
85
+ * @param newState - New state data to replace current state
56
86
  */
57
87
  setState(newState: any): void;
88
+ /**
89
+ * Updates specific state properties and triggers re-render if changed.
90
+ *
91
+ * @param newProperty - Object containing properties to update
92
+ */
58
93
  setStateProperty(newProperty: Object): void;
94
+ /**
95
+ * Checks if the widget state has changed since last update.
96
+ *
97
+ * @returns True if state changed, false otherwise
98
+ */
59
99
  hasStateChanged(): boolean;
100
+ /**
101
+ * Compares two state objects for shallow equality.
102
+ *
103
+ * @param obj1 - First state object
104
+ * @param obj2 - Second state object
105
+ * @returns True if objects are equal, false otherwise
106
+ */
60
107
  private isPropertyEqual;
61
108
  /**
62
- * If any child widgets are registered in the widget. Then without any other changes to the contents and state
63
- * this loadChildWidgets will be called which will help the child widgets be rendered to their respective positions.
109
+ * Mounts all registered child widgets to their designated parent elements.
64
110
  */
65
111
  loadChildWidgets(): void;
66
112
  /**
67
- * This is the main function that adds the html of the component to the element.
68
- * The element is the mounted widget
113
+ * Re-renders the widget by updating the DOM with current HTML template.
114
+ * Also triggers child widget loading and after_render hook.
69
115
  */
70
116
  render(): void;
117
+ /**
118
+ * Finds all elements with a specific class name within this widget.
119
+ *
120
+ * @param identifier - Class name to search for (without '.' prefix)
121
+ * @returns NodeList of matching elements
122
+ */
71
123
  getElementByClassName(identifier: string): never[] | NodeListOf<Element>;
72
124
  /**
73
- * This is the function that needs to be called.
125
+ * Lifecycle hook for mounting child widgets.
126
+ * Override this method to define custom child mounting logic.
74
127
  */
75
128
  mount_child(): void;
76
129
  /**
130
+ * Mounts the widget to a parent DOM element and initializes lifecycle.
131
+ *
132
+ * Creates a wrapper div, assigns unique ID, renders HTML, and executes
133
+ * lifecycle hooks in sequence.
77
134
  *
78
- * @param parent This is the function that creates a new div and then mounts the html element to the parent.
135
+ * @param parent - The parent HTML element to mount this widget into
79
136
  */
80
137
  mount(parent: HTMLElement): Promise<void>;
81
138
  /**
82
- * This function will be called after the component mounts.
139
+ * Lifecycle hook called before rendering.
140
+ * Override for initialization logic. Default implementation calls render().
83
141
  */
84
142
  before_render(): void;
85
143
  /**
86
- * This is called after the render function has been called. So this is used for the user functions to be added
87
- * for the widget and its html element. User can add any logic here.
144
+ * Lifecycle hook called after rendering.
145
+ * Override to add event listeners or post-render logic.
88
146
  */
89
147
  after_render(): void;
90
148
  /**
91
- * render child widgets
149
+ * Recursively renders all child widgets in the hierarchy.
92
150
  */
93
151
  renderChildWidgets(): void;
94
152
  /**
95
- * save widget state data as key and value pair.
153
+ * Sets shared state data and propagates to all child widgets recursively.
154
+ *
155
+ * @param key - State property key
156
+ * @param value - State value to set
96
157
  */
97
158
  setWidgetState(key: string, value: any): void;
98
159
  /**
99
- * get the saved widget state from stateful widget
160
+ * Retrieves shared state data by key.
161
+ *
162
+ * @param key - State property key to retrieve
163
+ * @param defaultValue - Default value if key doesn't exist
164
+ * @returns The state value or default value
100
165
  */
101
166
  getWidgetState(key: string, defaultValue: any): object;
102
167
  }
@@ -1,4 +1,45 @@
1
+ /**
2
+ * Fetches and builds widget data from the backend by widget ID.
3
+ *
4
+ * Retrieves complete widget structure including concepts, connections, and metadata.
5
+ * Uses caching to prevent duplicate requests for the same widget.
6
+ *
7
+ * @param id - The widget ID to fetch
8
+ * @returns Promise resolving to formatted widget data
9
+ */
1
10
  export declare function BuildWidgetFromId(id: number): Promise<any>;
11
+ /**
12
+ * Builds widget data from local cache instead of making API request.
13
+ *
14
+ * @param id - The widget ID to fetch from cache
15
+ * @returns Promise resolving to widget data object with mainId
16
+ */
2
17
  export declare function BuildWidgetFromCache(id: number): Promise<any>;
18
+ /**
19
+ * Fetches the latest published version of a widget by origin ID.
20
+ *
21
+ * Retrieves the most recent version of a widget, useful for always displaying
22
+ * updated content. Uses separate cache from standard widget requests.
23
+ *
24
+ * @param id - The origin widget ID to fetch latest version for
25
+ * @returns Promise resolving to object with widget data and mainId
26
+ */
3
27
  export declare function BuildWidgetFromIdForLatest(id: number): Promise<any>;
28
+ /**
29
+ * Fetches the recent published version of a widget by origin ID.
30
+ *
31
+ * Retrieves the most recent version of a widget, useful for always displaying
32
+ * updated content. Uses separate cache from standard widget requests.
33
+ *
34
+ * @param id - The origin widget ID to fetch latest version for
35
+ * @returns Promise resolving to object with widget data and mainId
36
+ */
37
+ export declare function BuildWidgetFromIdForRecent(id: number): Promise<any>;
38
+ /**
39
+ * Finds and returns a specific widget from bulk widget data by ID.
40
+ *
41
+ * @param data - Array of widget data objects
42
+ * @param id - The widget ID to find
43
+ * @returns The matching widget object or undefined
44
+ */
4
45
  export declare function GetWidgetForTree(data: any, id: number): any;
@@ -1,29 +1,60 @@
1
1
  import { TAssistant, TCustomFunction, TMainLibrary } from "../DataStructures/TypeLibrary";
2
2
  import { BuilderStatefulWidget } from "./BuilderStatefulWidget";
3
+ /**
4
+ * Hierarchical widget tree structure for nested widget composition.
5
+ *
6
+ * Represents a widget and its complete metadata including HTML, styles, scripts,
7
+ * lifecycle hooks, and child widgets. Used for building complex widget hierarchies.
8
+ */
3
9
  export declare class WidgetTree {
10
+ /** Unique widget identifier */
4
11
  id: number;
12
+ /** Widget display name */
5
13
  name: string;
14
+ /** HTML template string */
6
15
  html: string;
16
+ /** CSS styles string */
7
17
  css: string;
18
+ /** JavaScript code string */
8
19
  js: string;
20
+ /** External CSS and JS library dependencies */
9
21
  library: TMainLibrary;
22
+ /** AI assistant configuration for the widget */
10
23
  assistant: TAssistant;
24
+ /** Creation/update timestamp */
11
25
  timestamp: string;
26
+ /** Widget ID reference */
12
27
  widgetId: number;
28
+ /** Widget type identifier (e.g., "the_element_name") */
13
29
  type: string;
30
+ /** Clean/sanitized version of the widget */
14
31
  clean: string;
32
+ /** Code to execute after widget renders */
15
33
  after_render: string;
34
+ /** Code to execute before widget renders */
16
35
  before_render: string;
36
+ /** Array of custom function definitions */
17
37
  custom_functions: TCustomFunction[];
38
+ /** Code to execute on widget update */
18
39
  update: string;
40
+ /** Origin widget ID for versioning */
19
41
  origin: number;
42
+ /** Version number of this widget */
20
43
  version: number;
44
+ /** Code to execute when mounting child widgets */
21
45
  mount_child: string;
46
+ /** Array of child widget trees */
22
47
  children: WidgetTree[];
48
+ /** ID of the wrapper element for this widget */
23
49
  wrapper: string;
50
+ /** The instantiated widget object */
24
51
  widget: BuilderStatefulWidget;
52
+ /** Child widget ID reference */
25
53
  sChildId?: number;
54
+ /** Whether the widget is published */
26
55
  isPublished?: boolean;
56
+ /** Whether to use the latest version of this widget */
27
57
  useLatest?: boolean;
58
+ /** Widget dependency code string */
28
59
  dependency: string;
29
60
  }
@@ -1,6 +1,27 @@
1
+ /**
2
+ * Base view class for page-level components.
3
+ *
4
+ * Provides basic page functionality including title management and HTML generation.
5
+ */
1
6
  export default class {
7
+ /** Parameters passed to the view */
2
8
  params: any;
9
+ /**
10
+ * Creates a new view instance.
11
+ *
12
+ * @param params - Configuration parameters for the view
13
+ */
3
14
  constructor(params: any);
15
+ /**
16
+ * Sets the browser document title.
17
+ *
18
+ * @param title - The new document title
19
+ */
4
20
  setTitle(title: string): void;
21
+ /**
22
+ * Generates the HTML content for this view.
23
+ *
24
+ * @returns HTML string for the view
25
+ */
5
26
  getHtml(): Promise<string>;
6
27
  }
@@ -1,73 +1,94 @@
1
1
  /**
2
- * This is the class that helps us observe anything that the function is doing
3
- * This wrapper will allow all the concepts and connections to be tracked inside of the called function
4
- * This function helps us manage state using the concept connection system.
2
+ * Base observable class that tracks concepts and connections for reactive state management.
3
+ * Implements the observer pattern to notify subscribers when tracked data changes.
5
4
  */
6
5
  export declare class DependencyObserver {
6
+ /** List of subscriber callbacks */
7
7
  subscribers: any[];
8
+ /** Primary concept ID being observed */
8
9
  mainConcept: number;
10
+ /** List of composition IDs */
9
11
  compositionIds: number[];
12
+ /** List of concept IDs */
10
13
  conceptIds: number[];
14
+ /** List of internal connection IDs */
11
15
  internalConnections: number[];
16
+ /** List of reverse connection IDs */
12
17
  reverse: number[];
18
+ /** List of linker connection IDs */
13
19
  linkers: number[];
20
+ /** List of newly added IDs */
14
21
  newIds: number[];
22
+ /** List of dependency IDs */
15
23
  dependency: number[];
24
+ /** Whether initial data has been loaded */
16
25
  isDataLoaded: boolean;
26
+ /** Whether an update is currently in progress */
17
27
  isUpdating: boolean;
28
+ /** The observable data to be returned */
18
29
  data: any;
30
+ /** Whether data has been fetched */
19
31
  fetched: boolean;
32
+ /** Output format (NORMAL, DATAID, JUSTDATA, etc.) */
20
33
  format: number;
34
+ /** Map of concept IDs to their event handlers */
21
35
  eventHandlers: {
22
36
  [key: number]: (event: Event) => void;
23
37
  };
24
38
  /**
25
- * This function will be called when there is a need to listen to a certain type of concept that will update
26
- * the ui.
27
- * @param id this is the type id which needs to be tracked
39
+ * Listens to changes for a specific concept type and updates subscribers when new concepts of that type are created.
40
+ * @param id - The type concept ID to track
28
41
  */
29
42
  listenToEventType(id: number): void;
30
43
  /**
31
- * This is the of the concept id that needs to be listened . If this is called. All the connections that are
32
- * created with of the concepts id with this passed id then the event is fired.
33
- *
34
- * @param id Of the concept id that needs to be listened.
44
+ * Listens to connection changes for a specific concept and updates subscribers when connections are modified.
45
+ * @param id - The concept ID to track
35
46
  */
36
47
  listenToEvent(id: number): void;
48
+ /**
49
+ * Removes an event listener for a specific concept ID.
50
+ * @param id - The concept ID to stop tracking
51
+ */
37
52
  removeListenToEvent(id: number): void;
38
53
  /**
39
- * This is the of the concept id that needs to be listened . If this is called. All the connections that are
40
- * created with of the concepts id with this passed id then the event is fired.
41
- *
42
- * @param id Of the concept id that needs to be listened.
43
- */
54
+ * Listens to connection changes filtered by connection type for a specific concept.
55
+ * @param id - The concept ID to track
56
+ * @param connectionType - The connection type ID to filter by
57
+ */
44
58
  listenToEventConnectionType(id: number, connectionType: number): void;
45
59
  /**
46
- * This function will bind the actual data to the widget or the function.
60
+ * Binds and refreshes the observable data. Override in subclasses to implement specific data fetching logic.
61
+ * @returns The bound data
47
62
  */
48
63
  bind(): Promise<void>;
64
+ /**
65
+ * Executes the observable without subscribing. Override in subclasses for non-reactive data fetching.
66
+ * @returns The executed data
67
+ */
49
68
  run(): Promise<void>;
69
+ /**
70
+ * Forces a data refresh and notifies all subscribers.
71
+ */
50
72
  update(): Promise<void>;
51
73
  /**
52
- *
53
- * @param callback the function that needs to be called with the data.
54
- * @returns returns the callback with this data as the state.
74
+ * Subscribes a callback to receive data updates whenever tracked concepts/connections change.
75
+ * @param callback - Function to call with (data, observer) when updates occur
76
+ * @returns Result of calling the callback with current data
55
77
  */
56
78
  subscribe(callback: any): Promise<any>;
57
79
  /**
58
- *
59
- *
60
- * @returns data
61
- */
80
+ * Executes the observable once without subscribing to updates.
81
+ * @returns The executed data
82
+ */
62
83
  execute(): Promise<void>;
63
84
  /**
64
- *
65
- * @param callback function that you need to remove from the subscribers list.
66
- * @returns
85
+ * Removes a callback from the subscriber list.
86
+ * @param callback - The callback function to remove
87
+ * @returns Number of remaining subscribers
67
88
  */
68
89
  unsubscribe(callback: any): number;
69
90
  /**
70
- * This function will call all the subscribers that are registered in this wrapper.
91
+ * Notifies all subscribers with the current data.
71
92
  */
72
93
  notify(): void;
73
94
  }