2020-03-13 06:03:26 +08:00
|
|
|
import Item from "../item.js";
|
|
|
|
import * as html from "../html.js";
|
2020-03-14 06:01:16 +08:00
|
|
|
import * as format from "../format.js";
|
2020-03-13 06:03:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
export default class Path extends Item {
|
|
|
|
constructor(data) {
|
|
|
|
super();
|
2020-03-13 23:52:24 +08:00
|
|
|
this._data = data;
|
2020-03-14 06:01:16 +08:00
|
|
|
this._isDirectory = ("directory" in this._data);
|
2020-03-13 06:03:26 +08:00
|
|
|
}
|
2020-03-14 06:01:16 +08:00
|
|
|
|
|
|
|
get file() { return (this._isDirectory ? this._data["directory"] : this._data["file"]); }
|
|
|
|
|
2020-03-13 06:03:26 +08:00
|
|
|
connectedCallback() {
|
2020-03-14 06:01:16 +08:00
|
|
|
this.appendChild(html.icon(this._isDirectory ? "folder" : "music"));
|
|
|
|
this._buildTitle(format.fileName(this.file));
|
2020-03-13 06:03:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
customElements.define("cyp-path", Path);
|