Changeset 0.31.0 (#203)
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit is contained in:
@@ -245,6 +245,27 @@ const FileTree = {
|
||||
FileTree._register(pfx, instance);
|
||||
return instance;
|
||||
},
|
||||
|
||||
// v0.31.0: Self-mount — creates DOM + binds in one call.
|
||||
mount(container, opts) {
|
||||
const pfx = opts.id || 'ft';
|
||||
const el = document.createElement('div');
|
||||
el.className = 'file-tree';
|
||||
el.id = pfx + 'FileTree';
|
||||
el.innerHTML =
|
||||
'<div class="file-tree-header" id="' + pfx + 'TreeHeader">' +
|
||||
'<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="var(--accent)" stroke-width="2"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg>' +
|
||||
'<span class="file-tree-title">Files</span>' +
|
||||
'<button class="icon-btn" id="' + pfx + 'TreeNewFile" title="New file">' +
|
||||
'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>' +
|
||||
'</button>' +
|
||||
'</div>' +
|
||||
'<div class="file-tree-items" id="' + pfx + 'TreeItems"></div>';
|
||||
container.appendChild(el);
|
||||
const instance = this.create(opts);
|
||||
instance.bind();
|
||||
return instance;
|
||||
},
|
||||
};
|
||||
|
||||
// ── Helpers ─────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user