vault backup: 2024-04-15 19:20:46
This commit is contained in:
1 parent
30bfa6f243
commit
9d548c7912
22 files changed
+23784
-26
No files matched your search
Vendored
+4
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"showInlineTitle": true,
|
"showInlineTitle": true,
|
||||||
"useMarkdownLinks": true,
|
"useMarkdownLinks": true,
|
||||||
"promptDelete": false,
|
"promptDelete": true,
|
||||||
"showLineNumber": true,
|
"showLineNumber": true,
|
||||||
"attachmentFolderPath": "images",
|
"attachmentFolderPath": "images",
|
||||||
"pdfExportSettings": {
|
"pdfExportSettings": {
|
||||||
@@ -10,5 +10,7 @@
|
|||||||
"margin": "2",
|
"margin": "2",
|
||||||
"downscalePercent": 100
|
"downscalePercent": 100
|
||||||
},
|
},
|
||||||
"readableLineLength": false
|
"readableLineLength": false,
|
||||||
|
"alwaysUpdateLinks": true,
|
||||||
|
"newFileLocation": "current"
|
||||||
}
|
}
|
||||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"accentColor": "",
|
"accentColor": "#4f78d8",
|
||||||
"theme": "obsidian",
|
"theme": "obsidian",
|
||||||
"cssTheme": "Dracula Official",
|
"cssTheme": "Things",
|
||||||
"nativeMenus": true,
|
"nativeMenus": true,
|
||||||
"baseFontSize": 16
|
"baseFontSize": 16
|
||||||
}
|
}
|
||||||
Vendored
+3
-2
@@ -1,9 +1,10 @@
|
|||||||
[
|
[
|
||||||
"obsidian-git",
|
"obsidian-git",
|
||||||
"dataview",
|
|
||||||
"obsidian-excel-to-markdown-table",
|
"obsidian-excel-to-markdown-table",
|
||||||
"obsidian-linter",
|
"obsidian-linter",
|
||||||
"omnisearch",
|
"omnisearch",
|
||||||
"obsidian-diagrams-net",
|
"obsidian-diagrams-net",
|
||||||
"obsidian-full-calendar"
|
"obsidian-full-calendar",
|
||||||
|
"obsidian-style-settings",
|
||||||
|
"url-into-selection"
|
||||||
]
|
]
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"title@@vibrant": true,
|
||||||
|
"title@@dim-light-mode": false,
|
||||||
|
"title@@enable-mica": true,
|
||||||
|
"title@@no-top-space": false,
|
||||||
|
"title@@fab-enabled-desktop": true,
|
||||||
|
"title@@custom-page-header": true,
|
||||||
|
"title@@more-drag-desktop": false,
|
||||||
|
"title@@hide-toolbar-desktop": false,
|
||||||
|
"title@@space-above-document": true,
|
||||||
|
"title@@button-shapes-mobile": true,
|
||||||
|
"title@@win-menu": false,
|
||||||
|
"things-style@@no-kanban-styles": false,
|
||||||
|
"things-style@@fancy-highlight": true,
|
||||||
|
"things-style@@fancy-code": true,
|
||||||
|
"things-style@@active-line": true,
|
||||||
|
"things-style@@link-decoration": "None",
|
||||||
|
"things-style@@default-font-color": false
|
||||||
|
}
|
||||||
+9858
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"id": "obsidian-style-settings",
|
||||||
|
"name": "Style Settings",
|
||||||
|
"version": "1.0.8",
|
||||||
|
"minAppVersion": "0.11.5",
|
||||||
|
"description": "Offers controls for adjusting theme, plugin, and snippet CSS variables.",
|
||||||
|
"author": "mgmeyers",
|
||||||
|
"authorUrl": "https://github.com/mgmeyers/obsidian-style-settings",
|
||||||
|
"isDesktopOnly": false
|
||||||
|
}
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
.style-settings-container .pcr-app {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-container .pcr-app.visible {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pcr-app .pcr-swatches > button {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pickr .pcr-button {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.themed-color-wrapper > div {
|
||||||
|
background: var(--background-primary);
|
||||||
|
padding: 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.themed-color-wrapper > div + div {
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.themed-color-wrapper button {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.themed-color-wrapper .pickr-reset > button {
|
||||||
|
margin: 0 0 0 10px;
|
||||||
|
padding: 9px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.themed-color-wrapper .pickr-reset > button > svg {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.style-settings-heading {
|
||||||
|
cursor: pointer;
|
||||||
|
margin-bottom: 18px;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
border-bottom: 1px solid var(--background-modifier-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-heading[data-level="0"] {
|
||||||
|
margin-bottom: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-container {
|
||||||
|
padding-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-heading[data-level="0"] + .style-settings-container {
|
||||||
|
padding-left: 34px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-heading.is-collapsed {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-heading.is-collapsed + .style-settings-container {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-collapse-indicator {
|
||||||
|
color: var(--text-faint);
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 8px;
|
||||||
|
position: relative;
|
||||||
|
top: -1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-heading[data-level="0"]
|
||||||
|
+ .style-settings-container
|
||||||
|
.style-settings-collapse-indicator {
|
||||||
|
margin-left: -17px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-collapse-indicator > svg {
|
||||||
|
height: 9px;
|
||||||
|
width: 9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-heading.is-collapsed .style-settings-collapse-indicator > svg {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-filter-result-count {
|
||||||
|
color: var(--text-faint);
|
||||||
|
line-height: var(--line-height-tight);
|
||||||
|
margin-inline: var(--size-4-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-error {
|
||||||
|
font-size: 14px;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: rgba(var(--background-modifier-error-rgb), 0.2);
|
||||||
|
color: var(--text-error);
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-error-name {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-error-desc {
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-empty {
|
||||||
|
font-size: 14px;
|
||||||
|
background: var(--background-secondary);
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-empty-name {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-import-input {
|
||||||
|
width: 0.1px;
|
||||||
|
height: 0.1px;
|
||||||
|
opacity: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-import-label {
|
||||||
|
cursor: pointer;
|
||||||
|
color: var(--text-accent);
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-import-label:hover {
|
||||||
|
color: var(--text-accent-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-export,
|
||||||
|
.style-settings-import {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-copy,
|
||||||
|
.style-settings-download {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-copy:before {
|
||||||
|
color: var(--interactive-success);
|
||||||
|
content: "✓";
|
||||||
|
position: absolute;
|
||||||
|
left: -18px;
|
||||||
|
font-weight: bold;
|
||||||
|
opacity: 0;
|
||||||
|
transition: 150ms opacity ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-copy.success:before {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-style-settings {
|
||||||
|
height: 70vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-style-settings .modal-content {
|
||||||
|
flex-grow: 1;
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-style-settings textarea {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
font-family: var(--font-monospace) !important;
|
||||||
|
font-size: 12px;
|
||||||
|
white-space: pre;
|
||||||
|
overflow-wrap: normal;
|
||||||
|
overflow-x: scroll;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-style-settings .setting-item {
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-style-settings button {
|
||||||
|
margin: 10px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-import-error {
|
||||||
|
display: none;
|
||||||
|
color: var(--text-error);
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-import-error.active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.view-content .style-settings-container .setting-item:not(.setting-item-heading) {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.view-content .style-settings-container .setting-item:not(.setting-item-heading) .setting-item-control {
|
||||||
|
padding-top: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.view-content .style-settings-container .setting-item:not(.setting-item-heading) .themed-color-wrapper {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-ref {
|
||||||
|
position: absolute;
|
||||||
|
width: 0 !important;
|
||||||
|
height: 0 !important;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-info-text .style-settings-markdown :first-child {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-settings-info-text .style-settings-markdown :last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}/*! Pickr 1.8.4 MIT | https://github.com/Simonwep/pickr */
|
||||||
|
.pickr{position:relative;overflow:visible;transform:translateY(0)}.pickr *{box-sizing:border-box;outline:none;border:none;-webkit-appearance:none}.pickr .pcr-button{position:relative;height:2em;width:2em;padding:0.5em;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",Arial,sans-serif;border-radius:.15em;background:url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" stroke="%2342445A" stroke-width="5px" stroke-linecap="round"><path d="M45,45L5,5"></path><path d="M45,5L5,45"></path></svg>') no-repeat center;background-size:0;transition:all 0.3s}.pickr .pcr-button::before{position:absolute;content:'';top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><path fill="white" d="M1,0H2V1H1V0ZM0,1H1V2H0V1Z"/><path fill="gray" d="M0,0H1V1H0V0ZM1,1H2V2H1V1Z"/></svg>');background-size:.5em;border-radius:.15em;z-index:-1}.pickr .pcr-button::before{z-index:initial}.pickr .pcr-button::after{position:absolute;content:'';top:0;left:0;height:100%;width:100%;transition:background 0.3s;background:var(--pcr-color);border-radius:.15em}.pickr .pcr-button.clear{background-size:70%}.pickr .pcr-button.clear::before{opacity:0}.pickr .pcr-button.clear:focus{box-shadow:0 0 0 1px rgba(255,255,255,0.85),0 0 0 3px var(--pcr-color)}.pickr .pcr-button.disabled{cursor:not-allowed}.pickr *,.pcr-app *{box-sizing:border-box;outline:none;border:none;-webkit-appearance:none}.pickr input:focus,.pickr input.pcr-active,.pickr button:focus,.pickr button.pcr-active,.pcr-app input:focus,.pcr-app input.pcr-active,.pcr-app button:focus,.pcr-app button.pcr-active{box-shadow:0 0 0 1px rgba(255,255,255,0.85),0 0 0 3px var(--pcr-color)}.pickr .pcr-palette,.pickr .pcr-slider,.pcr-app .pcr-palette,.pcr-app .pcr-slider{transition:box-shadow 0.3s}.pickr .pcr-palette:focus,.pickr .pcr-slider:focus,.pcr-app .pcr-palette:focus,.pcr-app .pcr-slider:focus{box-shadow:0 0 0 1px rgba(255,255,255,0.85),0 0 0 3px rgba(0,0,0,0.25)}.pcr-app{position:fixed;display:flex;flex-direction:column;z-index:10000;border-radius:0.1em;background:#fff;opacity:0;visibility:hidden;transition:opacity 0.3s, visibility 0s 0.3s;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",Arial,sans-serif;box-shadow:0 0.15em 1.5em 0 rgba(0,0,0,0.1),0 0 1em 0 rgba(0,0,0,0.03);left:0;top:0}.pcr-app.visible{transition:opacity 0.3s;visibility:visible;opacity:1}.pcr-app .pcr-swatches{display:flex;flex-wrap:wrap;margin-top:0.75em}.pcr-app .pcr-swatches.pcr-last{margin:0}@supports (display: grid){.pcr-app .pcr-swatches{display:grid;align-items:center;grid-template-columns:repeat(auto-fit, 1.75em)}}.pcr-app .pcr-swatches>button{font-size:1em;position:relative;width:calc(1.75em - 5px);height:calc(1.75em - 5px);border-radius:0.15em;cursor:pointer;margin:2.5px;flex-shrink:0;justify-self:center;transition:all 0.15s;overflow:hidden;background:transparent;z-index:1}.pcr-app .pcr-swatches>button::before{position:absolute;content:'';top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><path fill="white" d="M1,0H2V1H1V0ZM0,1H1V2H0V1Z"/><path fill="gray" d="M0,0H1V1H0V0ZM1,1H2V2H1V1Z"/></svg>');background-size:6px;border-radius:.15em;z-index:-1}.pcr-app .pcr-swatches>button::after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background:var(--pcr-color);border:1px solid rgba(0,0,0,0.05);border-radius:0.15em;box-sizing:border-box}.pcr-app .pcr-swatches>button:hover{filter:brightness(1.05)}.pcr-app .pcr-swatches>button:not(.pcr-active){box-shadow:none}.pcr-app .pcr-interaction{display:flex;flex-wrap:wrap;align-items:center;margin:0 -0.2em 0 -0.2em}.pcr-app .pcr-interaction>*{margin:0 0.2em}.pcr-app .pcr-interaction input{letter-spacing:0.07em;font-size:0.75em;text-align:center;cursor:pointer;color:#75797e;background:#f1f3f4;border-radius:.15em;transition:all 0.15s;padding:0.45em 0.5em;margin-top:0.75em}.pcr-app .pcr-interaction input:hover{filter:brightness(0.975)}.pcr-app .pcr-interaction input:focus{box-shadow:0 0 0 1px rgba(255,255,255,0.85),0 0 0 3px rgba(66,133,244,0.75)}.pcr-app .pcr-interaction .pcr-result{color:#75797e;text-align:left;flex:1 1 8em;min-width:8em;transition:all 0.2s;border-radius:.15em;background:#f1f3f4;cursor:text}.pcr-app .pcr-interaction .pcr-result::-moz-selection{background:#4285f4;color:#fff}.pcr-app .pcr-interaction .pcr-result::selection{background:#4285f4;color:#fff}.pcr-app .pcr-interaction .pcr-type.active{color:#fff;background:#4285f4}.pcr-app .pcr-interaction .pcr-save,.pcr-app .pcr-interaction .pcr-cancel,.pcr-app .pcr-interaction .pcr-clear{color:#fff;width:auto}.pcr-app .pcr-interaction .pcr-save,.pcr-app .pcr-interaction .pcr-cancel,.pcr-app .pcr-interaction .pcr-clear{color:#fff}.pcr-app .pcr-interaction .pcr-save:hover,.pcr-app .pcr-interaction .pcr-cancel:hover,.pcr-app .pcr-interactioLine truncated
|
||||||
|
|
||||||
+754
@@ -0,0 +1,754 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var obsidian = require('obsidian');
|
||||||
|
|
||||||
|
/*! *****************************************************************************
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
***************************************************************************** */
|
||||||
|
/* global Reflect, Promise */
|
||||||
|
|
||||||
|
var extendStatics = function(d, b) {
|
||||||
|
extendStatics = Object.setPrototypeOf ||
|
||||||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||||
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||||
|
return extendStatics(d, b);
|
||||||
|
};
|
||||||
|
|
||||||
|
function __extends(d, b) {
|
||||||
|
if (typeof b !== "function" && b !== null)
|
||||||
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||||
|
extendStatics(d, b);
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
}
|
||||||
|
|
||||||
|
function __awaiter(thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function __generator(thisArg, body) {
|
||||||
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||||
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||||
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
|
function step(op) {
|
||||||
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
|
while (_) try {
|
||||||
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
|
switch (op[0]) {
|
||||||
|
case 0: case 1: t = op; break;
|
||||||
|
case 4: _.label++; return { value: op[1], done: false };
|
||||||
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||||
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||||
|
default:
|
||||||
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||||
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||||
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||||
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||||
|
if (t[2]) _.ops.pop();
|
||||||
|
_.trys.pop(); continue;
|
||||||
|
}
|
||||||
|
op = body.call(thisArg, _);
|
||||||
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||||
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDefaultExportFromCjs (x) {
|
||||||
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createCommonjsModule(fn, basedir, module) {
|
||||||
|
return module = {
|
||||||
|
path: basedir,
|
||||||
|
exports: {},
|
||||||
|
require: function (path, base) {
|
||||||
|
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
||||||
|
}
|
||||||
|
}, fn(module, module.exports), module.exports;
|
||||||
|
}
|
||||||
|
|
||||||
|
function commonjsRequire () {
|
||||||
|
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
||||||
|
}
|
||||||
|
|
||||||
|
var assertNever_1 = createCommonjsModule(function (module, exports) {
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
/**
|
||||||
|
* Helper function for exhaustive checks of discriminated unions.
|
||||||
|
* https://basarat.gitbooks.io/typescript/docs/types/discriminated-unions.html
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* type A = {type: 'a'};
|
||||||
|
* type B = {type: 'b'};
|
||||||
|
* type Union = A | B;
|
||||||
|
*
|
||||||
|
* function doSomething(arg: Union) {
|
||||||
|
* if (arg.type === 'a') {
|
||||||
|
* return something;
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* if (arg.type === 'b') {
|
||||||
|
* return somethingElse;
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // TS will error if there are other types in the union
|
||||||
|
* // Will throw an Error when called at runtime.
|
||||||
|
* // Use `assertNever(arg, true)` instead to fail silently.
|
||||||
|
* return assertNever(arg);
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
function assertNever(value, noThrow) {
|
||||||
|
if (noThrow) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
throw new Error("Unhandled discriminated union member: " + JSON.stringify(value));
|
||||||
|
}
|
||||||
|
exports.assertNever = assertNever;
|
||||||
|
exports.default = assertNever;
|
||||||
|
});
|
||||||
|
|
||||||
|
var assertNever = /*@__PURE__*/getDefaultExportFromCjs(assertNever_1);
|
||||||
|
|
||||||
|
// Copyright Joyent, Inc. and other Node contributors.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the
|
||||||
|
// "Software"), to deal in the Software without restriction, including
|
||||||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
// persons to whom the Software is furnished to do so, subject to the
|
||||||
|
// following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included
|
||||||
|
// in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
// resolves . and .. elements in a path array with directory names there
|
||||||
|
// must be no slashes, empty elements, or device names (c:\) in the array
|
||||||
|
// (so also no leading and trailing slashes - it does not distinguish
|
||||||
|
// relative and absolute paths)
|
||||||
|
function normalizeArray(parts, allowAboveRoot) {
|
||||||
|
// if the path tries to go above the root, `up` ends up > 0
|
||||||
|
var up = 0;
|
||||||
|
for (var i = parts.length - 1; i >= 0; i--) {
|
||||||
|
var last = parts[i];
|
||||||
|
if (last === '.') {
|
||||||
|
parts.splice(i, 1);
|
||||||
|
} else if (last === '..') {
|
||||||
|
parts.splice(i, 1);
|
||||||
|
up++;
|
||||||
|
} else if (up) {
|
||||||
|
parts.splice(i, 1);
|
||||||
|
up--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the path is allowed to go above the root, restore leading ..s
|
||||||
|
if (allowAboveRoot) {
|
||||||
|
for (; up--; up) {
|
||||||
|
parts.unshift('..');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Split a filename into [root, dir, basename, ext], unix version
|
||||||
|
// 'root' is just a slash, or nothing.
|
||||||
|
var splitPathRe =
|
||||||
|
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
||||||
|
var splitPath = function(filename) {
|
||||||
|
return splitPathRe.exec(filename).slice(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
// path.resolve([from ...], to)
|
||||||
|
// posix version
|
||||||
|
function resolve() {
|
||||||
|
var resolvedPath = '',
|
||||||
|
resolvedAbsolute = false;
|
||||||
|
|
||||||
|
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
||||||
|
var path = (i >= 0) ? arguments[i] : '/';
|
||||||
|
|
||||||
|
// Skip empty and invalid entries
|
||||||
|
if (typeof path !== 'string') {
|
||||||
|
throw new TypeError('Arguments to path.resolve must be strings');
|
||||||
|
} else if (!path) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
resolvedPath = path + '/' + resolvedPath;
|
||||||
|
resolvedAbsolute = path.charAt(0) === '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point the path should be resolved to a full absolute path, but
|
||||||
|
// handle relative paths to be safe (might happen when process.cwd() fails)
|
||||||
|
|
||||||
|
// Normalize the path
|
||||||
|
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
|
||||||
|
return !!p;
|
||||||
|
}), !resolvedAbsolute).join('/');
|
||||||
|
|
||||||
|
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
||||||
|
}
|
||||||
|
// path.normalize(path)
|
||||||
|
// posix version
|
||||||
|
function normalize(path) {
|
||||||
|
var isPathAbsolute = isAbsolute(path),
|
||||||
|
trailingSlash = substr(path, -1) === '/';
|
||||||
|
|
||||||
|
// Normalize the path
|
||||||
|
path = normalizeArray(filter(path.split('/'), function(p) {
|
||||||
|
return !!p;
|
||||||
|
}), !isPathAbsolute).join('/');
|
||||||
|
|
||||||
|
if (!path && !isPathAbsolute) {
|
||||||
|
path = '.';
|
||||||
|
}
|
||||||
|
if (path && trailingSlash) {
|
||||||
|
path += '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
return (isPathAbsolute ? '/' : '') + path;
|
||||||
|
}
|
||||||
|
// posix version
|
||||||
|
function isAbsolute(path) {
|
||||||
|
return path.charAt(0) === '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
// posix version
|
||||||
|
function join() {
|
||||||
|
var paths = Array.prototype.slice.call(arguments, 0);
|
||||||
|
return normalize(filter(paths, function(p, index) {
|
||||||
|
if (typeof p !== 'string') {
|
||||||
|
throw new TypeError('Arguments to path.join must be strings');
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}).join('/'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// path.relative(from, to)
|
||||||
|
// posix version
|
||||||
|
function relative(from, to) {
|
||||||
|
from = resolve(from).substr(1);
|
||||||
|
to = resolve(to).substr(1);
|
||||||
|
|
||||||
|
function trim(arr) {
|
||||||
|
var start = 0;
|
||||||
|
for (; start < arr.length; start++) {
|
||||||
|
if (arr[start] !== '') break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var end = arr.length - 1;
|
||||||
|
for (; end >= 0; end--) {
|
||||||
|
if (arr[end] !== '') break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (start > end) return [];
|
||||||
|
return arr.slice(start, end - start + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var fromParts = trim(from.split('/'));
|
||||||
|
var toParts = trim(to.split('/'));
|
||||||
|
|
||||||
|
var length = Math.min(fromParts.length, toParts.length);
|
||||||
|
var samePartsLength = length;
|
||||||
|
for (var i = 0; i < length; i++) {
|
||||||
|
if (fromParts[i] !== toParts[i]) {
|
||||||
|
samePartsLength = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var outputParts = [];
|
||||||
|
for (var i = samePartsLength; i < fromParts.length; i++) {
|
||||||
|
outputParts.push('..');
|
||||||
|
}
|
||||||
|
|
||||||
|
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
||||||
|
|
||||||
|
return outputParts.join('/');
|
||||||
|
}
|
||||||
|
|
||||||
|
var sep = '/';
|
||||||
|
var delimiter = ':';
|
||||||
|
|
||||||
|
function dirname(path) {
|
||||||
|
var result = splitPath(path),
|
||||||
|
root = result[0],
|
||||||
|
dir = result[1];
|
||||||
|
|
||||||
|
if (!root && !dir) {
|
||||||
|
// No dirname whatsoever
|
||||||
|
return '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dir) {
|
||||||
|
// It has a dirname, strip trailing slash
|
||||||
|
dir = dir.substr(0, dir.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return root + dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
function basename(path, ext) {
|
||||||
|
var f = splitPath(path)[2];
|
||||||
|
// TODO: make this comparison case-insensitive on windows?
|
||||||
|
if (ext && f.substr(-1 * ext.length) === ext) {
|
||||||
|
f = f.substr(0, f.length - ext.length);
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function extname(path) {
|
||||||
|
return splitPath(path)[3];
|
||||||
|
}
|
||||||
|
var path = {
|
||||||
|
extname: extname,
|
||||||
|
basename: basename,
|
||||||
|
dirname: dirname,
|
||||||
|
sep: sep,
|
||||||
|
delimiter: delimiter,
|
||||||
|
relative: relative,
|
||||||
|
join: join,
|
||||||
|
isAbsolute: isAbsolute,
|
||||||
|
normalize: normalize,
|
||||||
|
resolve: resolve
|
||||||
|
};
|
||||||
|
function filter (xs, f) {
|
||||||
|
if (xs.filter) return xs.filter(f);
|
||||||
|
var res = [];
|
||||||
|
for (var i = 0; i < xs.length; i++) {
|
||||||
|
if (f(xs[i], i, xs)) res.push(xs[i]);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// String.prototype.substr - negative index don't work in IE8
|
||||||
|
var substr = 'ab'.substr(-1) === 'b' ?
|
||||||
|
function (str, start, len) { return str.substr(start, len) } :
|
||||||
|
function (str, start, len) {
|
||||||
|
if (start < 0) start = str.length + start;
|
||||||
|
return str.substr(start, len);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
function fileUrl(filePath, options = {}) {
|
||||||
|
if (typeof filePath !== 'string') {
|
||||||
|
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const {resolve = true} = options;
|
||||||
|
|
||||||
|
let pathName = filePath;
|
||||||
|
if (resolve) {
|
||||||
|
pathName = path.resolve(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
pathName = pathName.replace(/\\/g, '/');
|
||||||
|
|
||||||
|
// Windows drive letter must be prefixed with a slash.
|
||||||
|
if (pathName[0] !== '/') {
|
||||||
|
pathName = `/${pathName}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Escape required characters for path components.
|
||||||
|
// See: https://tools.ietf.org/html/rfc3986#section-3.3
|
||||||
|
return encodeURI(`file://${pathName}`).replace(/[?#]/g, encodeURIComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s18.html
|
||||||
|
var win32Path = /^[a-z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$/i;
|
||||||
|
var unixPath = /^(?:\/[^/]+)+\/?$/i;
|
||||||
|
var testFilePath = function (url) { return win32Path.test(url) || unixPath.test(url); };
|
||||||
|
function UrlIntoSelection(editor, cb, settings) {
|
||||||
|
// skip all if nothing should be done
|
||||||
|
if (!editor.somethingSelected() && settings.nothingSelected === 0 /* doNothing */)
|
||||||
|
return;
|
||||||
|
if (typeof cb !== "string" && cb.clipboardData === null) {
|
||||||
|
console.error("empty clipboardData in ClipboardEvent");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var clipboardText = getCbText(cb);
|
||||||
|
if (clipboardText === null)
|
||||||
|
return;
|
||||||
|
var _a = getSelnRange(editor, settings), selectedText = _a.selectedText, replaceRange = _a.replaceRange;
|
||||||
|
var replaceText = getReplaceText(clipboardText, selectedText, settings);
|
||||||
|
if (replaceText === null)
|
||||||
|
return;
|
||||||
|
// apply changes
|
||||||
|
if (typeof cb !== "string")
|
||||||
|
cb.preventDefault(); // prevent default paste behavior
|
||||||
|
replace(editor, replaceText, replaceRange);
|
||||||
|
// if nothing is selected and the nothing selected behavior is to insert [](url) place the cursor between the square brackets
|
||||||
|
if ((selectedText === "") && settings.nothingSelected === 2 /* insertInline */) {
|
||||||
|
editor.setCursor({ ch: replaceRange.from.ch + 1, line: replaceRange.from.line });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function getSelnRange(editor, settings) {
|
||||||
|
var selectedText;
|
||||||
|
var replaceRange;
|
||||||
|
if (editor.somethingSelected()) {
|
||||||
|
selectedText = editor.getSelection().trim();
|
||||||
|
replaceRange = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (settings.nothingSelected) {
|
||||||
|
case 1 /* autoSelect */:
|
||||||
|
replaceRange = getWordBoundaries(editor, settings);
|
||||||
|
selectedText = editor.getRange(replaceRange.from, replaceRange.to);
|
||||||
|
break;
|
||||||
|
case 2 /* insertInline */:
|
||||||
|
case 3 /* insertBare */:
|
||||||
|
replaceRange = getCursor(editor);
|
||||||
|
selectedText = "";
|
||||||
|
break;
|
||||||
|
case 0 /* doNothing */:
|
||||||
|
throw new Error("should be skipped");
|
||||||
|
default:
|
||||||
|
assertNever(settings.nothingSelected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { selectedText: selectedText, replaceRange: replaceRange };
|
||||||
|
}
|
||||||
|
function isUrl(text, settings) {
|
||||||
|
if (text === "")
|
||||||
|
return false;
|
||||||
|
try {
|
||||||
|
// throw TypeError: Invalid URL if not valid
|
||||||
|
new URL(text);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
// settings.regex: fallback test allows url without protocol (http,file...)
|
||||||
|
return testFilePath(text) || new RegExp(settings.regex).test(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function isImgEmbed(text, settings) {
|
||||||
|
var rules = settings.listForImgEmbed
|
||||||
|
.split("\n")
|
||||||
|
.filter(function (v) { return v.length > 0; })
|
||||||
|
.map(function (v) { return new RegExp(v); });
|
||||||
|
for (var _i = 0, rules_1 = rules; _i < rules_1.length; _i++) {
|
||||||
|
var reg = rules_1[_i];
|
||||||
|
if (reg.test(text))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Validate that either the text on the clipboard or the selected text is a link, and if so return the link as
|
||||||
|
* a markdown link with the selected text as the link's text, or, if the value on the clipboard is not a link
|
||||||
|
* but the selected text is, the value of the clipboard as the link's text.
|
||||||
|
* If the link matches one of the image url regular expressions return a markdown image link.
|
||||||
|
* @param clipboardText text on the clipboard.
|
||||||
|
* @param selectedText highlighted text
|
||||||
|
* @param settings plugin settings
|
||||||
|
* @returns a mardown link or image link if the clipboard or selction value is a valid link, else null.
|
||||||
|
*/
|
||||||
|
function getReplaceText(clipboardText, selectedText, settings) {
|
||||||
|
var linktext;
|
||||||
|
var url;
|
||||||
|
if (isUrl(clipboardText, settings)) {
|
||||||
|
linktext = selectedText;
|
||||||
|
url = clipboardText;
|
||||||
|
}
|
||||||
|
else if (isUrl(selectedText, settings)) {
|
||||||
|
linktext = clipboardText;
|
||||||
|
url = selectedText;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return null; // if neither of two is an URL, the following code would be skipped.
|
||||||
|
var imgEmbedMark = isImgEmbed(clipboardText, settings) ? "!" : "";
|
||||||
|
url = processUrl(url);
|
||||||
|
if (selectedText === "" && settings.nothingSelected === 3 /* insertBare */) {
|
||||||
|
return "<".concat(url, ">");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return imgEmbedMark + "[".concat(linktext, "](").concat(url, ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** Process file url, special characters, etc */
|
||||||
|
function processUrl(src) {
|
||||||
|
var output;
|
||||||
|
if (testFilePath(src)) {
|
||||||
|
output = fileUrl(src, { resolve: false });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
output = src;
|
||||||
|
}
|
||||||
|
if (/[<>]/.test(output))
|
||||||
|
output = output.replace("<", "%3C").replace(">", "%3E");
|
||||||
|
return /[\(\) ]/.test(output) ? "<".concat(output, ">") : output;
|
||||||
|
}
|
||||||
|
function getCbText(cb) {
|
||||||
|
var clipboardText;
|
||||||
|
if (typeof cb === "string") {
|
||||||
|
clipboardText = cb;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (cb.clipboardData === null) {
|
||||||
|
console.error("empty clipboardData in ClipboardEvent");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
clipboardText = cb.clipboardData.getData("text");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return clipboardText.trim();
|
||||||
|
}
|
||||||
|
function getWordBoundaries(editor, settings) {
|
||||||
|
var cursor = editor.getCursor();
|
||||||
|
var line = editor.getLine(cursor.line);
|
||||||
|
var wordBoundaries = findWordAt(line, cursor);
|
||||||
|
// If the token the cursor is on is a url, grab the whole thing instead of just parsing it like a word
|
||||||
|
var start = wordBoundaries.from.ch;
|
||||||
|
var end = wordBoundaries.to.ch;
|
||||||
|
while (start > 0 && !/\s/.test(line.charAt(start - 1)))
|
||||||
|
--start;
|
||||||
|
while (end < line.length && !/\s/.test(line.charAt(end)))
|
||||||
|
++end;
|
||||||
|
if (isUrl(line.slice(start, end), settings)) {
|
||||||
|
wordBoundaries.from.ch = start;
|
||||||
|
wordBoundaries.to.ch = end;
|
||||||
|
}
|
||||||
|
return wordBoundaries;
|
||||||
|
}
|
||||||
|
var findWordAt = (function () {
|
||||||
|
var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
|
||||||
|
function isWordChar(char) {
|
||||||
|
return /\w/.test(char) || char > "\x80" &&
|
||||||
|
(char.toUpperCase() != char.toLowerCase() || nonASCIISingleCaseWordChar.test(char));
|
||||||
|
}
|
||||||
|
return function (line, pos) {
|
||||||
|
var check;
|
||||||
|
var start = pos.ch;
|
||||||
|
var end = pos.ch;
|
||||||
|
(end === line.length) ? --start : ++end;
|
||||||
|
var startChar = line.charAt(pos.ch);
|
||||||
|
if (isWordChar(startChar)) {
|
||||||
|
check = function (ch) { return isWordChar(ch); };
|
||||||
|
}
|
||||||
|
else if (/\s/.test(startChar)) {
|
||||||
|
check = function (ch) { return /\s/.test(ch); };
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
check = function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
|
||||||
|
}
|
||||||
|
while (start > 0 && check(line.charAt(start - 1)))
|
||||||
|
--start;
|
||||||
|
while (end < line.length && check(line.charAt(end)))
|
||||||
|
++end;
|
||||||
|
return { from: { line: pos.line, ch: start }, to: { line: pos.line, ch: end } };
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
function getCursor(editor) {
|
||||||
|
return { from: editor.getCursor(), to: editor.getCursor() };
|
||||||
|
}
|
||||||
|
function replace(editor, replaceText, replaceRange) {
|
||||||
|
if (replaceRange === void 0) { replaceRange = null; }
|
||||||
|
// replaceRange is only not null when there isn't anything selected.
|
||||||
|
if (replaceRange && replaceRange.from && replaceRange.to) {
|
||||||
|
editor.replaceRange(replaceText, replaceRange.from, replaceRange.to);
|
||||||
|
}
|
||||||
|
// if word is null or undefined
|
||||||
|
else
|
||||||
|
editor.replaceSelection(replaceText);
|
||||||
|
}
|
||||||
|
|
||||||
|
var DEFAULT_SETTINGS = {
|
||||||
|
regex: /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/
|
||||||
|
.source,
|
||||||
|
nothingSelected: 0 /* doNothing */,
|
||||||
|
listForImgEmbed: "",
|
||||||
|
};
|
||||||
|
var UrlIntoSelectionSettingsTab = /** @class */ (function (_super) {
|
||||||
|
__extends(UrlIntoSelectionSettingsTab, _super);
|
||||||
|
function UrlIntoSelectionSettingsTab() {
|
||||||
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
|
}
|
||||||
|
UrlIntoSelectionSettingsTab.prototype.display = function () {
|
||||||
|
var _this = this;
|
||||||
|
var containerEl = this.containerEl;
|
||||||
|
var plugin = this.plugin;
|
||||||
|
containerEl.empty();
|
||||||
|
containerEl.createEl("h2", { text: "URL-into-selection Settings" });
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Fallback Regular expression")
|
||||||
|
.setDesc("Regular expression used to match URLs when default match fails.")
|
||||||
|
.addText(function (text) {
|
||||||
|
return text
|
||||||
|
.setPlaceholder("Enter regular expression here..")
|
||||||
|
.setValue(plugin.settings.regex)
|
||||||
|
.onChange(function (value) { return __awaiter(_this, void 0, void 0, function () {
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
switch (_a.label) {
|
||||||
|
case 0:
|
||||||
|
if (!(value.length > 0)) return [3 /*break*/, 2];
|
||||||
|
plugin.settings.regex = value;
|
||||||
|
return [4 /*yield*/, plugin.saveSettings()];
|
||||||
|
case 1:
|
||||||
|
_a.sent();
|
||||||
|
_a.label = 2;
|
||||||
|
case 2: return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); });
|
||||||
|
});
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Behavior on pasting URL when nothing is selected")
|
||||||
|
.setDesc("Auto Select: Automatically select word surrounding the cursor.")
|
||||||
|
.addDropdown(function (dropdown) {
|
||||||
|
var options = {
|
||||||
|
0: "Do nothing",
|
||||||
|
1: "Auto Select",
|
||||||
|
2: "Insert [](url)",
|
||||||
|
3: "Insert <url>",
|
||||||
|
};
|
||||||
|
dropdown
|
||||||
|
.addOptions(options)
|
||||||
|
.setValue(plugin.settings.nothingSelected.toString())
|
||||||
|
.onChange(function (value) { return __awaiter(_this, void 0, void 0, function () {
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
switch (_a.label) {
|
||||||
|
case 0:
|
||||||
|
plugin.settings.nothingSelected = +value;
|
||||||
|
return [4 /*yield*/, plugin.saveSettings()];
|
||||||
|
case 1:
|
||||||
|
_a.sent();
|
||||||
|
this.display();
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); });
|
||||||
|
});
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Whitelist for image embed syntax")
|
||||||
|
.setDesc(createFragment(function (el) {
|
||||||
|
el.appendText(" will be used for URL that matches the following list.");
|
||||||
|
el.createEl("br");
|
||||||
|
el.appendText("Rules are regex-based, split by line break.");
|
||||||
|
}))
|
||||||
|
.addTextArea(function (text) {
|
||||||
|
text
|
||||||
|
.setPlaceholder("Example:\nyoutu.?be|vimeo")
|
||||||
|
.setValue(plugin.settings.listForImgEmbed)
|
||||||
|
.onChange(function (value) {
|
||||||
|
plugin.settings.listForImgEmbed = value;
|
||||||
|
plugin.saveData(plugin.settings);
|
||||||
|
return text;
|
||||||
|
});
|
||||||
|
text.inputEl.rows = 6;
|
||||||
|
text.inputEl.cols = 25;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return UrlIntoSelectionSettingsTab;
|
||||||
|
}(obsidian.PluginSettingTab));
|
||||||
|
|
||||||
|
var UrlIntoSel_Plugin = /** @class */ (function (_super) {
|
||||||
|
__extends(UrlIntoSel_Plugin, _super);
|
||||||
|
function UrlIntoSel_Plugin() {
|
||||||
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||||
|
// pasteHandler = (cm: CodeMirror.Editor, e: ClipboardEvent) => UrlIntoSelection(cm, e, this.settings);
|
||||||
|
_this.pasteHandler = function (evt, editor) { return UrlIntoSelection(editor, evt, _this.settings); };
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
UrlIntoSel_Plugin.prototype.onload = function () {
|
||||||
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
|
var _this = this;
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
switch (_a.label) {
|
||||||
|
case 0:
|
||||||
|
console.log("loading url-into-selection");
|
||||||
|
return [4 /*yield*/, this.loadSettings()];
|
||||||
|
case 1:
|
||||||
|
_a.sent();
|
||||||
|
this.addSettingTab(new UrlIntoSelectionSettingsTab(this.app, this));
|
||||||
|
this.addCommand({
|
||||||
|
id: "paste-url-into-selection",
|
||||||
|
name: "",
|
||||||
|
editorCallback: function (editor) { return __awaiter(_this, void 0, void 0, function () {
|
||||||
|
var clipboardText;
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
switch (_a.label) {
|
||||||
|
case 0: return [4 /*yield*/, navigator.clipboard.readText()];
|
||||||
|
case 1:
|
||||||
|
clipboardText = _a.sent();
|
||||||
|
UrlIntoSelection(editor, clipboardText, this.settings);
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); },
|
||||||
|
});
|
||||||
|
this.app.workspace.on("editor-paste", this.pasteHandler);
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
UrlIntoSel_Plugin.prototype.onunload = function () {
|
||||||
|
console.log("unloading url-into-selection");
|
||||||
|
this.app.workspace.off("editor-paste", this.pasteHandler);
|
||||||
|
};
|
||||||
|
UrlIntoSel_Plugin.prototype.loadSettings = function () {
|
||||||
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
|
var _a, _b, _c, _d;
|
||||||
|
return __generator(this, function (_e) {
|
||||||
|
switch (_e.label) {
|
||||||
|
case 0:
|
||||||
|
_a = this;
|
||||||
|
_c = (_b = Object).assign;
|
||||||
|
_d = [{}, DEFAULT_SETTINGS];
|
||||||
|
return [4 /*yield*/, this.loadData()];
|
||||||
|
case 1:
|
||||||
|
_a.settings = _c.apply(_b, _d.concat([_e.sent()]));
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
UrlIntoSel_Plugin.prototype.saveSettings = function () {
|
||||||
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
switch (_a.label) {
|
||||||
|
case 0: return [4 /*yield*/, this.saveData(this.settings)];
|
||||||
|
case 1:
|
||||||
|
_a.sent();
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return UrlIntoSel_Plugin;
|
||||||
|
}(obsidian.Plugin));
|
||||||
|
|
||||||
|
module.exports = UrlIntoSel_Plugin;
|
||||||
|
//# sourceMappingUR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ZGVmaW5lUHJvcGVydHkodGFyZ2V0LCBrZXksIHIpLCByO1xyXG59XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gX19wYXJhbShwYXJhbUluZGV4LCBkZWNvcmF0b3IpIHtcclxuICAgIHJldHVybiBmdW5jdGlvbiAodGFyZ2V0LCBrZXkpIHsgZGVjb3JhdG9yKHRhcmdldCwga2V5LCBwYXJhbUluZGV4KTsgfVxyXG59XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gX19tZXRhZGF0YShtZXRhZGF0YUtleSwgbWV0YWRhdGFWYWx1ZSkge1xyXG4gICAgaWYgKHR5cGVvZiBSZWZsZWN0ID09PSBcIm9iamVjdFwiICYmIHR5cGVvZiBSZWZsZWN0Lm1ldGFkYXRhID09PSBcImZ1bmN0aW9uXCIpIHJldHVybiBSZWZsZWN0Lm1ldGFkYXRhKG1ldGFkYXRhS2V5LCBtZXRhZGF0YVZhbHVlKTtcclxufVxyXG5cclxuZXhwb3J0IGZ1bmN0aW9uIF9fYXdhaXRlcih0aGl
Line truncated
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"id": "url-into-selection",
|
||||||
|
"name": "Paste URL into selection",
|
||||||
|
"description": "Paste URL \"into\" selected text.",
|
||||||
|
"isDesktopOnly": false,
|
||||||
|
"js": "main.js",
|
||||||
|
"version": "1.7.0"
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "AnuPpuccin",
|
||||||
|
"version": "1.4.5",
|
||||||
|
"minAppVersion": "0.16.0",
|
||||||
|
"author": "Anubis",
|
||||||
|
"authorUrl": "https://github.com/AnubisNekhet"
|
||||||
|
}
|
||||||
+8490
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "Material Flat",
|
||||||
|
"version": "1.4.0",
|
||||||
|
"minAppVersion": "0.16.0",
|
||||||
|
"author": "Threethan, Joschua",
|
||||||
|
"authorUrl": "https://github.com/Threethan/"
|
||||||
|
}
|
||||||
+2576
File diff suppressed because it is too large.
Load diff
+7
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "Things",
|
||||||
|
"version": "2.1.20",
|
||||||
|
"minAppVersion": "1.0.0",
|
||||||
|
"author": "@colineckert",
|
||||||
|
"authorUrl": "https://twitter.com/colineckert"
|
||||||
|
}
|
||||||
Vendored
+1628
File diff suppressed because it is too large.
Load diff
Vendored
+32
-20
@@ -18,8 +18,21 @@
|
|||||||
"source": false
|
"source": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "d83bb0bbeeb86eec",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "markdown",
|
||||||
|
"state": {
|
||||||
|
"file": "Semester 2/Database Systems/Trimester 2 Assignment.md",
|
||||||
|
"mode": "source",
|
||||||
|
"source": false
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"currentTab": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"direction": "vertical"
|
"direction": "vertical"
|
||||||
@@ -86,7 +99,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "backlink",
|
"type": "backlink",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Semester 2/Programming 2/Week 10 Revision/Q5.md",
|
"file": "Semester 2/Database Systems/Trimester 2 Assignment.md",
|
||||||
"collapseAll": false,
|
"collapseAll": false,
|
||||||
"extraContext": false,
|
"extraContext": false,
|
||||||
"sortOrder": "alphabetical",
|
"sortOrder": "alphabetical",
|
||||||
@@ -103,7 +116,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "outgoing-link",
|
"type": "outgoing-link",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Semester 2/Programming 2/Week 10 Revision/Q5.md",
|
"file": "Semester 2/Database Systems/Trimester 2 Assignment.md",
|
||||||
"linksCollapsed": false,
|
"linksCollapsed": false,
|
||||||
"unlinkedCollapsed": true
|
"unlinkedCollapsed": true
|
||||||
}
|
}
|
||||||
@@ -126,7 +139,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "outline",
|
"type": "outline",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Semester 2/Programming 2/Week 10 Revision/Q5.md"
|
"file": "Semester 2/Database Systems/Trimester 2 Assignment.md"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -166,8 +179,22 @@
|
|||||||
"switcher:Open quick switcher": false
|
"switcher:Open quick switcher": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"active": "671043c113c40804",
|
"active": "d83bb0bbeeb86eec",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
|
"Semester 2/Database Systems/Week 8/Week 8 Database Systems.md",
|
||||||
|
"Semester 2/Database Systems/Week 10/Week 10 Database Systems.md",
|
||||||
|
"Semester 2/Database Systems/Week 9/Week 9 Database Systems.md",
|
||||||
|
"Semester 2/Database Systems/Trimester 2 Assignment.md",
|
||||||
|
"images/Pasted image 20240415190127.png",
|
||||||
|
"images/Pasted image 20240415190010.png",
|
||||||
|
"images/Pasted image 20240415175614.png",
|
||||||
|
"images/Pasted image 20240415135455.png",
|
||||||
|
"images/Pasted image 20240415134042.png",
|
||||||
|
"Semester 2/Programming 2/Week 10 Revision/Q5.md",
|
||||||
|
"Semester 2/Programming 2/Assessment 3 Revision/Parameter Passing WS2.md",
|
||||||
|
"Semester 2/Programming 2/Assessment 3 Revision/Parameter Passing WS1.md",
|
||||||
|
"Semester 2/HCI/Week 3/Week 3 Human Computer Interfaces.md",
|
||||||
|
"Semester 2/Programming 2/Assessment 3 Revision/Parameter Passing WS3.md",
|
||||||
"Semester 2/Programming 2/Project/Part 2/package.bluej",
|
"Semester 2/Programming 2/Project/Part 2/package.bluej",
|
||||||
"Semester 2/Programming 2/Project/Part 2",
|
"Semester 2/Programming 2/Project/Part 2",
|
||||||
"Semester 2/Programming 2/Project/Part 4 Complete.zip",
|
"Semester 2/Programming 2/Project/Part 4 Complete.zip",
|
||||||
@@ -179,41 +206,26 @@
|
|||||||
"Semester 2/Programming 2/Project/Part 4 Complete/doc/package-frame.html",
|
"Semester 2/Programming 2/Project/Part 4 Complete/doc/package-frame.html",
|
||||||
"Semester 2/Programming 2/Project/Part 4 Complete/doc/logfile.txt",
|
"Semester 2/Programming 2/Project/Part 4 Complete/doc/logfile.txt",
|
||||||
"Semester 2/Programming 2/Project/Part 4 Complete/doc/index.html",
|
"Semester 2/Programming 2/Project/Part 4 Complete/doc/index.html",
|
||||||
"Semester 2/Programming 2/Project/Part 4 Complete/doc/constant-values.html",
|
|
||||||
"images/Pasted image 20240319234142.png",
|
"images/Pasted image 20240319234142.png",
|
||||||
"images/Pasted image 20240319225420.png",
|
"images/Pasted image 20240319225420.png",
|
||||||
"Semester 2/Programming 2/Week 10 Revision/Q4.md",
|
"Semester 2/Programming 2/Week 10 Revision/Q4.md",
|
||||||
"Semester 2/Programming 2/Week 10 Revision/Q5.md",
|
|
||||||
"images/Pasted image 20240319224232.png",
|
"images/Pasted image 20240319224232.png",
|
||||||
"Semester 2/Programming 2/Week 10 Revision/Q3.md",
|
"Semester 2/Programming 2/Week 10 Revision/Q3.md",
|
||||||
"Semester 2/Database Systems/Week 10/Week 10 Database Systems.md",
|
|
||||||
"images/Pasted image 20240319163053.png",
|
"images/Pasted image 20240319163053.png",
|
||||||
"images/Pasted image 20240319162824.png",
|
|
||||||
"images/Pasted image 20240319161202.png",
|
|
||||||
"images/Pasted image 20240319160609.png",
|
|
||||||
"Semester 2/Programming 2/Week 10 Revision/Q1.md",
|
"Semester 2/Programming 2/Week 10 Revision/Q1.md",
|
||||||
"Semester 2/Database Systems/Week 2/Week 2 Database Systems.md",
|
"Semester 2/Database Systems/Week 2/Week 2 Database Systems.md",
|
||||||
"Semester 2/Database Systems/Week 1/Week 1 Database Systems.md",
|
"Semester 2/Database Systems/Week 1/Week 1 Database Systems.md",
|
||||||
"Semester 1/Database Systems/Week 10/Week 10 Database Systems.md",
|
"Semester 1/Database Systems/Week 10/Week 10 Database Systems.md",
|
||||||
"Semester 2/Database Systems/Week 3/Week 3 Database Systems.md",
|
"Semester 2/Database Systems/Week 3/Week 3 Database Systems.md",
|
||||||
"Semester 2/Database Systems/Week 4/Week 4 Database Systems.md",
|
"Semester 2/Database Systems/Week 4/Week 4 Database Systems.md",
|
||||||
"Semester 2/Database Systems/Week 9/Week 9 Database Systems.md",
|
|
||||||
"images/Pasted image 20240312161933.png",
|
|
||||||
"images/Pasted image 20240312161927.png",
|
|
||||||
"Semester 2/Database Systems/Week 8/Week 8 Database Systems.md",
|
|
||||||
"Semester 2/Database Systems/Week 7/Week 7 Database Systems.md",
|
"Semester 2/Database Systems/Week 7/Week 7 Database Systems.md",
|
||||||
"Semester 2/Database Systems/Week 6/Week 6 Database Systems.md",
|
"Semester 2/Database Systems/Week 6/Week 6 Database Systems.md",
|
||||||
"Semester 2/Computer Systems Internals & Linux/Week 6/Week 6 Computer Systems Internals.md",
|
"Semester 2/Computer Systems Internals & Linux/Week 6/Week 6 Computer Systems Internals.md",
|
||||||
"Semester 2/Programming 2/Assessment 3 Revision/Parameter Passing WS3.md",
|
|
||||||
"Semester 2/Computer Systems Internals & Linux/Untitled.md",
|
"Semester 2/Computer Systems Internals & Linux/Untitled.md",
|
||||||
"Semester 2/Programming 2/Assessment 3 Revision/Parameter Passing WS2.md",
|
|
||||||
"Semester 2/Programming 2/Assessment 3 Revision/Parameter Passing WS1.md",
|
|
||||||
"Semester 2/Database Systems/Week 5/Week 5 Database Systems.md",
|
"Semester 2/Database Systems/Week 5/Week 5 Database Systems.md",
|
||||||
"Semester 2/HCI/Week 2/Week 2 Human Computer Interfaces.md",
|
"Semester 2/HCI/Week 2/Week 2 Human Computer Interfaces.md",
|
||||||
"Semester 2/HCI/Week 3/Week 3 Human Computer Interfaces.md",
|
|
||||||
"Semester 1/Database Systems/Week 11/Week 11 Database Systems.md",
|
"Semester 1/Database Systems/Week 11/Week 11 Database Systems.md",
|
||||||
"Semester 1/Database Systems/Week 5/Week 5 Database Systems.md",
|
"Semester 1/Database Systems/Week 5/Week 5 Database Systems.md",
|
||||||
"Semester 1/Database Systems/Week 3/Week 3 Database Systems.md",
|
|
||||||
"Database Systems/Untitled.canvas",
|
"Database Systems/Untitled.canvas",
|
||||||
"Untitled 1.canvas",
|
"Untitled 1.canvas",
|
||||||
"Untitled.canvas"
|
"Untitled.canvas"
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
# Q1
|
||||||
|
|
||||||
|
### a)
|
||||||
|
|
||||||
|
#### i)
|
||||||
|
|
||||||
|
1 tuple = 24 + 5 + 10 + 20 + 6 = 65b
|
||||||
|
1 block = 1024 - 24 = 1000b
|
||||||
|
1000 / 65 = 15.38, 15 tuples can be stored in 1 block
|
||||||
|
800 / 15 = 53.33, **54** blocks are needed to store all tuples in this relation.
|
||||||
|
|
||||||
|
#### ii)
|
||||||
|
|
||||||
|
65 - 20 = 45b
|
||||||
|
1000 / 45 = 22.22, 22 tuples per block
|
||||||
|
800 / 22 = 36.36, **37** blocks for this projection.
|
||||||
|
|
||||||
|
#### iii)
|
||||||
|
|
||||||
|
If the "street" attribute is unneeded, less IO operations are needed to retrieve the relevant data from disk, making the query more efficient. As a result, this also uses less disk space, and optimises memory usage for processing.
|
||||||
|
|
||||||
|
### b)
|
||||||
|
|
||||||
|
#### i)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### ii)
|
||||||
|
|
||||||
|
Root Node: $\pi$ ( factory.name )
|
||||||
|
Leaf Nodes: factory, order
|
||||||
|
|
||||||
|
#### iii)
|
||||||
|
|
||||||
|
Line-by-line:
|
||||||
|
|
||||||
|
1. This is the final attribute we want to obtain. Placing this here ensures only the necessary data is output; reduces IO operations and memory usage, as only the required data is given.
|
||||||
|
2. Exists to join the 2 tables together based on the condition that the order's factory ID = factory's ID, allowing the projection root node to have the necessary data from the factory table to obtain the factory's name.
|
||||||
|
3. There is an argument for this being above or below the theta join, however I have placed this here due to the heuristic principles of query optimisation, moving selection operations down the tree. This exists to "filter" the result on the condition that the order is urgent. By placing this selection after the theta join, we can "filter" more selectively and reduce the dataset size to optimise memory usage, similar to the adjacent selection operation.
|
||||||
|
4. This exists to "filter" the dataset on the condition that the quantity is larger than 20 units. By placing this at the start, we ensure filtering is executed earlier, as to not waste compute resources. This reduces the dataset size, allowing the following operations to be more optimised, as there is less data to be processed.
|
||||||
|
|
||||||
|
# Q2
|
||||||
|
|
||||||
|
# **a)**
|
||||||
|
|
||||||
|
*Consistency: Database should be in a consistent state, prior to a transaction and after. e.g. Following constraints, relationships, etc.
|
||||||
|
Isolation: All transactions should by fully independent from concurrently executing transactions.
|
||||||
|
Durability: When a transaction is committed, it's effect should be permanent in the database, withstanding system failures or restarts.*
|
||||||
|
|
||||||
|
*Atomicity: A transaction must be completed, or aborted. If a transaction fails, a DBMS ensures the rollback of data to allow the database to remain consistent.
|
||||||
|
Consistency: A DBMS would enforce constraints on a transaction, assuring the defined rules / relationships are followed.
|
||||||
|
Isolation: Reduces concurrency issues by restricting access to shared data until a transaction is committed.
|
||||||
|
Durability: Guarantees data is permanent once committed, preventing inconsistency after failures.*
|
||||||
|
|
||||||
|
### b)
|
||||||
|
|
||||||
|
To guarantee consistency, a DBMS handles the enforcement of atomicity, consistency, isolation and durability, along with concurrency control to prevent conflicts.
|
||||||
|
Transfer of crates:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
UPDATE warehouses
|
||||||
|
SET crates = crates - 3
|
||||||
|
WHERE wname = 'warehouse1'
|
||||||
|
|
||||||
|
UPDATE warehouses
|
||||||
|
SET crates = crates + 3
|
||||||
|
WHERE wname = 'warehouse2';
|
||||||
|
```
|
||||||
|
|
||||||
|
### c)
|
||||||
|
|
||||||
|
By allowing concurrent execution of transactions, system resources are allocated more efficiently due to multiple operations occurring simultaneously. This has an effect of being more performant, since more transactions can be processed per second.
|
||||||
|
|
||||||
|
### d)
|
||||||
|
|
||||||
|
#### i)
|
||||||
|
|
||||||
|
Transaction 1 updates multiple values while Transaction 2 is reading, as can be seen in t4, as 10 units are added to W1, so the sum would be 10 units too low.
|
||||||
|
|
||||||
|
#### ii)
|
||||||
|
|
||||||
|
Inconsistent Analysis
|
||||||
|
|
||||||
|
### e)
|
||||||
|
|
||||||
|
#### i)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### ii)
|
||||||
|
|
||||||
|
The graph is not serialisable, since there is a directed cycle in the precedence graph - the graph is cyclic.
|
||||||
|
|
||||||
|
# Q3
|
||||||
|
|
||||||
|
### a)
|
||||||
|
|
||||||
|
An exclusive lock is used when a transaction must update / write to an item to avoid conflicts.
|
||||||
|
|
||||||
|
### b)
|
||||||
|
|
||||||
|
2-phase locking consists of a growing phase and a shrinking phase. A transaction must acquire a read or write lock on an item before operation (growing phase), after which it must release all locks and acquire no more (shrinking phase). Transactions do not have to simultaneously acquire locks, but must adhere to these rules.
|
||||||
|
|
||||||
|
### c)
|
||||||
|
|
||||||
|
#### i)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### ii)
|
||||||
|
|
||||||
|
Deadlock does not occur, since there are no cycles in the graph
|
||||||
|
|
||||||
|
### d)
|
||||||
|
|
||||||
|
#### i)
|
||||||
|
|
||||||
|
The recovery manager would first identify in-progress transactions at the time of failure
|
||||||
|
|
||||||
|
# Q4
|
||||||
|
|
||||||
|
### a)
|
||||||
|
|
||||||
|
#### i)
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT partName
|
||||||
|
FROM part
|
||||||
|
WHERE partPrice > 100;
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ii)
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT
|
||||||
|
```
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Reference in new issue
Block a user