1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 10:49:36 +02:00

Libs updates and new version with option to pin videos on channel

This commit is contained in:
Daniel Neto 2024-08-05 11:37:04 -03:00
parent e1f2188de0
commit 1beab3b1c0
8565 changed files with 149805 additions and 165674 deletions

View file

@ -1,3 +1,33 @@
## 6.8.1 (2024-06-19)
### Bug fixes
Make lint markers non-inclusive again, since having them that way causes more issues than it solves.
## 6.8.0 (2024-05-23)
### New features
The new `autoPanel` option can be used to make the panel automatically appear when diagnostics are added and close when no diagnostics are left.
## 6.7.1 (2024-05-15)
### Bug fixes
Don't perform an additional superfluous timed lint run after `forceLinting` has been called.
## 6.7.0 (2024-04-30)
### New features
The `renderMessage` function is now called with the editor view as first argument.
## 6.6.0 (2024-04-29)
### New features
The new `hideOn` configuration option can be used to control in what circumstances lint tooltips get hidden by state changes.
## 6.5.0 (2024-01-30)
### Bug fixes

View file

@ -32,8 +32,7 @@ class LintState {
}).range(d.from)
: view.Decoration.mark({
attributes: { class: "cm-lintRange cm-lintRange-" + d.severity + (d.markClass ? " " + d.markClass : "") },
diagnostic: d,
inclusive: true
diagnostic: d
}).range(d.from, d.to);
}), true);
return new LintState(ranges, panel, findDiagnostic(ranges));
@ -50,8 +49,12 @@ function findDiagnostic(diagnostics, diagnostic = null, after = 0) {
return found;
}
function hideTooltip(tr, tooltip) {
let from = tooltip.pos, to = tooltip.end || from;
let result = tr.state.facet(lintConfig).hideOn(tr, from, to);
if (result != null)
return result;
let line = tr.startState.doc.lineAt(tooltip.pos);
return !!(tr.effects.some(e => e.is(setDiagnosticsEffect)) || tr.changes.touchesRange(line.from, line.to));
return !!(tr.effects.some(e => e.is(setDiagnosticsEffect)) || tr.changes.touchesRange(line.from, Math.max(line.to, to)));
}
function maybeEnableLint(state$1, effects) {
return state$1.field(lintState, false) ? effects : effects.concat(state.StateEffect.appendConfig.of(lintExtensions));
@ -78,17 +81,20 @@ const lintState = state.StateField.define({
return new LintState(view.Decoration.none, null, null);
},
update(value, tr) {
if (tr.docChanged) {
let mapped = value.diagnostics.map(tr.changes), selected = null;
if (tr.docChanged && value.diagnostics.size) {
let mapped = value.diagnostics.map(tr.changes), selected = null, panel = value.panel;
if (value.selected) {
let selPos = tr.changes.mapPos(value.selected.from, 1);
selected = findDiagnostic(mapped, value.selected.diagnostic, selPos) || findDiagnostic(mapped, null, selPos);
}
value = new LintState(mapped, value.panel, selected);
if (!mapped.size && panel && tr.state.facet(lintConfig).autoPanel)
panel = null;
value = new LintState(mapped, panel, selected);
}
for (let effect of tr.effects) {
if (effect.is(setDiagnosticsEffect)) {
value = LintState.init(effect.value, value.panel, tr.state);
let panel = !tr.state.facet(lintConfig).autoPanel ? value.panel : effect.value.length ? LintPanel.open : null;
value = LintState.init(effect.value, panel, tr.state);
}
else if (effect.is(togglePanel)) {
value = new LintState(value.diagnostics, effect.value ? LintPanel.open : null, value.selected);
@ -109,7 +115,7 @@ function diagnosticCount(state) {
let lint = state.field(lintState, false);
return lint ? lint.diagnostics.size : 0;
}
const activeMark = view.Decoration.mark({ class: "cm-lintRange cm-lintRange-active", inclusive: true });
const activeMark = view.Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });
function lintTooltip(view, pos, side) {
let { diagnostics } = view.state.field(lintState);
let found = [], stackStart = 2e8, stackEnd = 0;
@ -221,6 +227,7 @@ const lintPlugin = view.ViewPlugin.fromClass(class {
this.timeout = setTimeout(this.run, delay);
}
run() {
clearTimeout(this.timeout);
let now = Date.now();
if (now < this.lintTime - 10) {
this.timeout = setTimeout(this.run, this.lintTime - now);
@ -263,7 +270,8 @@ const lintConfig = state.Facet.define({
delay: 750,
markerFilter: null,
tooltipFilter: null,
needsRefresh: null
needsRefresh: null,
hideOn: () => null,
}, {
needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u)
}));
@ -309,7 +317,7 @@ function assignKeys(actions) {
function renderDiagnostic(view, diagnostic, inPanel) {
var _a;
let keys = inPanel ? assignKeys(diagnostic.actions) : [];
return elt("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, elt("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage() : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {
return elt("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, elt("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage(view) : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {
let fired = false, click = (e) => {
e.preventDefault();
if (fired)

View file

@ -1,5 +1,5 @@
import * as _codemirror_state from '@codemirror/state';
import { EditorState, TransactionSpec, Extension } from '@codemirror/state';
import { EditorState, TransactionSpec, Extension, Transaction } from '@codemirror/state';
import { EditorView, Command, KeyBinding, ViewUpdate } from '@codemirror/view';
type Severity = "hint" | "info" | "warning" | "error";
@ -40,7 +40,7 @@ interface Diagnostic {
An optional custom rendering function that displays the message
as a DOM node.
*/
renderMessage?: () => Node;
renderMessage?: (view: EditorView) => Node;
/**
An optional array of actions that can be taken on this
diagnostic.
@ -85,6 +85,20 @@ interface LintConfig {
tooltip will appear if the empty set is returned.
*/
tooltipFilter?: null | DiagnosticFilter;
/**
Can be used to control what kind of transactions cause lint
hover tooltips associated with the given document range to be
hidden. By default any transactions that changes the line
around the range will hide it. Returning null falls back to this
behavior.
*/
hideOn?: (tr: Transaction, from: number, to: number) => boolean | null;
/**
When enabled (defaults to off), this will cause the lint panel
to automatically open when diagnostics are found, and close when
all diagnostics are resolved or removed.
*/
autoPanel?: boolean;
}
interface LintGutterConfig {
/**

View file

@ -1,5 +1,5 @@
import * as _codemirror_state from '@codemirror/state';
import { EditorState, TransactionSpec, Extension } from '@codemirror/state';
import { EditorState, TransactionSpec, Extension, Transaction } from '@codemirror/state';
import { EditorView, Command, KeyBinding, ViewUpdate } from '@codemirror/view';
type Severity = "hint" | "info" | "warning" | "error";
@ -40,7 +40,7 @@ interface Diagnostic {
An optional custom rendering function that displays the message
as a DOM node.
*/
renderMessage?: () => Node;
renderMessage?: (view: EditorView) => Node;
/**
An optional array of actions that can be taken on this
diagnostic.
@ -85,6 +85,20 @@ interface LintConfig {
tooltip will appear if the empty set is returned.
*/
tooltipFilter?: null | DiagnosticFilter;
/**
Can be used to control what kind of transactions cause lint
hover tooltips associated with the given document range to be
hidden. By default any transactions that changes the line
around the range will hide it. Returning null falls back to this
behavior.
*/
hideOn?: (tr: Transaction, from: number, to: number) => boolean | null;
/**
When enabled (defaults to off), this will cause the lint panel
to automatically open when diagnostics are found, and close when
all diagnostics are resolved or removed.
*/
autoPanel?: boolean;
}
interface LintGutterConfig {
/**

View file

@ -30,8 +30,7 @@ class LintState {
}).range(d.from)
: Decoration.mark({
attributes: { class: "cm-lintRange cm-lintRange-" + d.severity + (d.markClass ? " " + d.markClass : "") },
diagnostic: d,
inclusive: true
diagnostic: d
}).range(d.from, d.to);
}), true);
return new LintState(ranges, panel, findDiagnostic(ranges));
@ -48,8 +47,12 @@ function findDiagnostic(diagnostics, diagnostic = null, after = 0) {
return found;
}
function hideTooltip(tr, tooltip) {
let from = tooltip.pos, to = tooltip.end || from;
let result = tr.state.facet(lintConfig).hideOn(tr, from, to);
if (result != null)
return result;
let line = tr.startState.doc.lineAt(tooltip.pos);
return !!(tr.effects.some(e => e.is(setDiagnosticsEffect)) || tr.changes.touchesRange(line.from, line.to));
return !!(tr.effects.some(e => e.is(setDiagnosticsEffect)) || tr.changes.touchesRange(line.from, Math.max(line.to, to)));
}
function maybeEnableLint(state, effects) {
return state.field(lintState, false) ? effects : effects.concat(StateEffect.appendConfig.of(lintExtensions));
@ -76,17 +79,20 @@ const lintState = /*@__PURE__*/StateField.define({
return new LintState(Decoration.none, null, null);
},
update(value, tr) {
if (tr.docChanged) {
let mapped = value.diagnostics.map(tr.changes), selected = null;
if (tr.docChanged && value.diagnostics.size) {
let mapped = value.diagnostics.map(tr.changes), selected = null, panel = value.panel;
if (value.selected) {
let selPos = tr.changes.mapPos(value.selected.from, 1);
selected = findDiagnostic(mapped, value.selected.diagnostic, selPos) || findDiagnostic(mapped, null, selPos);
}
value = new LintState(mapped, value.panel, selected);
if (!mapped.size && panel && tr.state.facet(lintConfig).autoPanel)
panel = null;
value = new LintState(mapped, panel, selected);
}
for (let effect of tr.effects) {
if (effect.is(setDiagnosticsEffect)) {
value = LintState.init(effect.value, value.panel, tr.state);
let panel = !tr.state.facet(lintConfig).autoPanel ? value.panel : effect.value.length ? LintPanel.open : null;
value = LintState.init(effect.value, panel, tr.state);
}
else if (effect.is(togglePanel)) {
value = new LintState(value.diagnostics, effect.value ? LintPanel.open : null, value.selected);
@ -107,7 +113,7 @@ function diagnosticCount(state) {
let lint = state.field(lintState, false);
return lint ? lint.diagnostics.size : 0;
}
const activeMark = /*@__PURE__*/Decoration.mark({ class: "cm-lintRange cm-lintRange-active", inclusive: true });
const activeMark = /*@__PURE__*/Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });
function lintTooltip(view, pos, side) {
let { diagnostics } = view.state.field(lintState);
let found = [], stackStart = 2e8, stackEnd = 0;
@ -219,6 +225,7 @@ const lintPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
this.timeout = setTimeout(this.run, delay);
}
run() {
clearTimeout(this.timeout);
let now = Date.now();
if (now < this.lintTime - 10) {
this.timeout = setTimeout(this.run, this.lintTime - now);
@ -261,7 +268,8 @@ const lintConfig = /*@__PURE__*/Facet.define({
delay: 750,
markerFilter: null,
tooltipFilter: null,
needsRefresh: null
needsRefresh: null,
hideOn: () => null,
}, {
needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u)
}));
@ -307,7 +315,7 @@ function assignKeys(actions) {
function renderDiagnostic(view, diagnostic, inPanel) {
var _a;
let keys = inPanel ? assignKeys(diagnostic.actions) : [];
return elt("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, elt("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage() : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {
return elt("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, elt("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage(view) : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {
let fired = false, click = (e) => {
e.preventDefault();
if (fired)

View file

@ -1,6 +1,6 @@
{
"name": "@codemirror/lint",
"version": "6.5.0",
"version": "6.8.1",
"description": "Linting support for the CodeMirror code editor",
"scripts": {
"test": "cm-runtests",