<%-- JS_Tree_Debug_Node (Internal component for JS_Tree_Debug_Component) Renders a single expandable node in the debug tree. Not intended for direct use - use JS_Tree_Debug_Component instead. $data - The object or array to render $expand_depth - How many levels deep to expand $label - Optional key/index label for this node $show_class_names - If true, display class names for named object instances --%> <% const class_name = this.args.show_class_names ? JS_Tree_Debug_Node.get_class_name(this.args.data) : null; const relationships = JS_Tree_Debug_Node.get_object_relationships(this.args.data); %> <% if (this.args.label !== null && this.args.label !== undefined) { %> <%= this.args.label %>: <% } %> <%= Array.isArray(this.args.data) ? '[' : '{' %> <% if (class_name) { %> <%= class_name %><% if (this.args.data && this.args.data.id !== undefined) { %>(<%= this.args.data.id %>)<% } %> <% } %> <%= JS_Tree_Debug_Node.get_preview(this.args.data, JS_Tree_Debug_Node.get_type(this.args.data)) %>
<%-- Regular data entries --%> <% for (const [key, value] of JS_Tree_Debug_Node.get_entries(this.args.data, JS_Tree_Debug_Node.get_type(this.args.data))) { const val_type = JS_Tree_Debug_Node.get_type(value); const is_expandable = val_type === 'object' || val_type === 'array'; %> <% if (is_expandable) { %> <% } else { %>
<%= key %>: <%= JS_Tree_Debug_Node.format_value(value, val_type) %>
<% } %> <% } %> <%-- Relationship nodes (lazy-loaded) --%> <% for (const rel_name of relationships) { %>
<% this.handler_toggle_rel = () => this.toggle_relationship(rel_name); %> <%= rel_name %>(): ...
<% } %>
<%= Array.isArray(this.args.data) ? ']' : '}' %>