Skip to content

Commit

Permalink
Release 1.15.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-courtney-pieces committed Jun 12, 2024
1 parent df89fed commit 233c72f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 20 deletions.
62 changes: 44 additions & 18 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -65486,6 +65486,10 @@ var require_QGPTComponentBuilder = __commonJS({
var _b2;
(0, view_1.copyToClipboard)((_b2 = snippetData.textContent) !== null && _b2 !== void 0 ? _b2 : "");
(0, view_1.track)(CopilotAnalytics_enum_1.CopilotAnalytics.COPY_CODE_BUTTON);
copyButton.innerHTML = "✓";
setTimeout(() => {
copyButton.innerHTML = const_1.Constants.COPY_SVG;
}, 1e3);
});
similarityPromise.then((similarity) => {
var _b2;
Expand Down Expand Up @@ -88151,7 +88155,7 @@ ${QGPTView_1.default.relevant.text}
original.appendChild(updatedChildren[i]);
} else if (!updatedChildren[i]) {
original.removeChild(origChildren[i]);
} else if (updatedChildren[i].nodeType !== origChildren[i].nodeType || updatedChildren[i].nodeName !== origChildren[i].nodeName || updatedChild instanceof HTMLElement && originalChild instanceof HTMLElement && originalChild.className !== updatedChild.className) {
} else if (updatedChildren[i].nodeType !== origChildren[i].nodeType || updatedChildren[i].nodeName !== origChildren[i].nodeName || updatedChild instanceof HTMLElement && originalChild instanceof HTMLElement && originalChild.className !== updatedChild.className || updatedChild instanceof HTMLElement && originalChild instanceof HTMLElement && !this.attributesEqual(updatedChild, originalChild)) {
original.replaceChild(updatedChildren[i], origChildren[i]);
} else if (updatedChildren[i].nodeType === Node.TEXT_NODE && updatedChildren[i].textContent !== origChildren[i].textContent) {
origChildren[i].textContent = updatedChildren[i].textContent;
Expand All @@ -88160,6 +88164,19 @@ ${QGPTView_1.default.relevant.text}
}
}
}
attributesEqual(one, two) {
if (one.attributes.length !== two.attributes.length) {
return false;
}
for (let i = 0; i < one.attributes.length; i++) {
const attrOne = one.attributes[i];
const attrTwo = two.attributes.getNamedItem(attrOne.name);
if (!attrTwo || attrOne.value !== attrTwo.value) {
return false;
}
}
return true;
}
static getInstance() {
var _a;
return (_a = CopilotStreamController.instance) !== null && _a !== void 0 ? _a : CopilotStreamController.instance = new CopilotStreamController();
Expand Down Expand Up @@ -90576,6 +90593,15 @@ var require_ConversationBuilder = __commonJS({
if (identifier.deleted) {
delete ConversationBuilder.mappedConversations[id];
delete ConversationBuilder.favoritedConversations[id];
ConversationBuilder.conversationIdentifiers.delete(id);
for (const key in ConversationBuilder.conversationToIndex) {
if (key === id)
continue;
if (ConversationBuilder.conversationToIndex[key] > ConversationBuilder.conversationToIndex[id]) {
ConversationBuilder.conversationToIndex[key] -= 1;
}
}
delete ConversationBuilder.conversationToIndex[id];
if (!Object.keys(ConversationBuilder.favoritedConversations).length) {
(_c = document.getElementById("pinned-conversation-container")) === null || _c === void 0 ? void 0 : _c.classList.add("hidden");
}
Expand Down Expand Up @@ -90613,6 +90639,9 @@ var require_ConversationBuilder = __commonJS({
}
});
}
if (ConversationBuilder.conversationToIndex[conversation.id] === void 0) {
ConversationBuilder.conversationToIndex[conversation.id] = ConversationBuilder.conversationIdentifiers.size;
}
ConversationBuilder.conversationIdentifiers.add(conversation.id);
if (ConversationList_1.inSearch)
return;
Expand All @@ -90628,21 +90657,22 @@ var require_ConversationBuilder = __commonJS({
* @param conversationToInsert the conversation for which the index we should find
* @param conversations the list of conversations to insert into
*/
findCreatedIndex(conversationToInsert, conversations) {
let index = 0;
for (const converstion of conversations) {
if (conversationToInsert.created.value < converstion.created.value) {
index++;
}
findCreatedIndex(conversationToInsert, favorite = false) {
if (favorite) {
return Object.values(ConversationBuilder.favoritedConversations).reduce((acc, el) => {
if (conversationToInsert.created.value < el.created.value)
acc += 1;
return acc;
}, 0);
}
return index;
return ConversationBuilder.conversationIdentifiers.size - 1 - ConversationBuilder.conversationToIndex[conversationToInsert.id];
}
/**
* This will create a conversation element
* @param id the id of the conversation
* @param findIndex whether or not we need to find the sorted index to place the conversation in (used while unpinning a conversation)
*/
createConversationEl(conversation, findIndex = false) {
createConversationEl(conversation, findIndex = true) {
var _a, _b, _c, _d, _e, _f;
let editingTitle = false;
const container = conversation.favorited ? document.getElementById("pinned-conversations-list") : document.getElementById("conversation-list-container");
Expand Down Expand Up @@ -90843,14 +90873,9 @@ var require_ConversationBuilder = __commonJS({
deleteConversation.title = "Cancel edits";
});
if (!findIndex)
container.prepend(conversationEl);
container.append(conversationEl);
else {
let index;
if (conversation.favorited) {
index = this.findCreatedIndex(conversation, Object.values(ConversationBuilder.favoritedConversations));
} else {
index = this.findCreatedIndex(conversation, Object.values(ConversationBuilder.mappedConversations).filter((conversation2) => !conversation2.favorited));
}
const index = this.findCreatedIndex(conversation, !!conversation.favorited);
const adjacentConversation = container.children[index];
if (adjacentConversation)
adjacentConversation.insertAdjacentElement("beforebegin", conversationEl);
Expand Down Expand Up @@ -90944,6 +90969,7 @@ var require_ConversationBuilder = __commonJS({
ConversationBuilder.mappedConversations = {};
ConversationBuilder.favoritedConversations = {};
ConversationBuilder.conversationIdentifiers = /* @__PURE__ */ new Set();
ConversationBuilder.conversationToIndex = {};
exports.default = ConversationBuilder;
}
});
Expand Down Expand Up @@ -93906,7 +93932,7 @@ var require_view = __commonJS({
(0, semver_1.lt)(version2, MinVersion) && // their pieces os version is lower than the latest supported
exports.platform !== pieces_os_client_2.PlatformEnum.Linux) {
successfulUpdate = yield PiecesOSUpdating_1.default.getInstance().performUpdate();
} else if (!versionValid2 && connectionState.connected === connected && connectionState.versionValid === versionValid2) {
} else if (!versionValid2 && (connectionState.connected !== connected || connectionState.versionValid !== versionValid2)) {
connectionState = { versionValid: versionValid2, connected };
(0, ErrorView_1.showErorrView)(title);
}
Expand Down Expand Up @@ -111896,7 +111922,7 @@ var WellKnownApi = class extends BaseAPI {
};

// package.json
var version = "1.15.0";
var version = "1.15.1";

// src/connection/notification_handler.ts
var import_NotificationParameters = __toESM(require_NotificationParameters());
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "pieces-for-developers",
"name": "Pieces for Developers",
"version": "1.15.0",
"version": "1.15.1",
"minAppVersion": "0.15.0",
"description": "Streamline your coding workflow in Obsidian with the Pieces For Developers plugin, offering powerful features for capturing, managing, translating, and enhancing code snippets. (Closed Source) ",
"author": "Pieces For Developers",
Expand Down
18 changes: 17 additions & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,13 @@
padding-bottom: 4px;
}

.gpt-response,
.gpt-query {
-webkit-user-select: text;
-moz-user-select: text;
user-select: text;
}

.svg-box > svg {
height: 100% !important;
width: auto !important;
Expand Down Expand Up @@ -392,6 +399,10 @@ body.pieces {
display: none;
}

.scrollbar-hide {
scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
display: none;
}
Expand Down Expand Up @@ -1649,6 +1660,11 @@ body {
counter-reset: katexEqnNo mmlEqnNo;
}

.gpt-text-response ul,
.gpt-text-response ol {
white-space: normal;
}

*, ::before, ::after {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
Expand Down Expand Up @@ -3863,7 +3879,7 @@ input[id='radio-2']:checked ~ .glider {
.ask-input {
width: 100%;
word-wrap: break-word;
word-break: break-all;
word-break: break-word;
}

.ask-selection {
Expand Down

0 comments on commit 233c72f

Please sign in to comment.