@ni/ok-components 0.1.3 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22247,6 +22247,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
22247
22247
|
@cancel="${(x, c) => x.cancelHandler(c.event)}"
|
|
22248
22248
|
@close="${(x, c) => x.closeHandler(c.event)}"
|
|
22249
22249
|
aria-labelledby="header"
|
|
22250
|
+
closedby="${x => (x.preventDismiss ? 'none' : 'closerequest')}"
|
|
22250
22251
|
>
|
|
22251
22252
|
<header id="header">
|
|
22252
22253
|
<div class="title">
|
|
@@ -22541,6 +22542,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
22541
22542
|
aria-label="${x => x.ariaLabel}"
|
|
22542
22543
|
@cancel="${(x, c) => x.cancelHandler(c.event)}"
|
|
22543
22544
|
@close="${(x, c) => x.closeHandler(c.event)}"
|
|
22545
|
+
closedby="${x => (x.preventDismiss ? 'none' : 'closerequest')}"
|
|
22544
22546
|
>
|
|
22545
22547
|
<div class="dialog-contents">
|
|
22546
22548
|
<slot></slot>
|
|
@@ -41440,6 +41442,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
41440
41442
|
setMeta: () => setMeta,
|
|
41441
41443
|
setNode: () => setNode,
|
|
41442
41444
|
setNodeSelection: () => setNodeSelection,
|
|
41445
|
+
setTextDirection: () => setTextDirection,
|
|
41443
41446
|
setTextSelection: () => setTextSelection,
|
|
41444
41447
|
sinkListItem: () => sinkListItem,
|
|
41445
41448
|
splitBlock: () => splitBlock,
|
|
@@ -41451,6 +41454,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
41451
41454
|
undoInputRule: () => undoInputRule,
|
|
41452
41455
|
unsetAllMarks: () => unsetAllMarks,
|
|
41453
41456
|
unsetMark: () => unsetMark,
|
|
41457
|
+
unsetTextDirection: () => unsetTextDirection,
|
|
41454
41458
|
updateAttributes: () => updateAttributes,
|
|
41455
41459
|
wrapIn: () => wrapIn,
|
|
41456
41460
|
wrapInList: () => wrapInList
|
|
@@ -42226,23 +42230,28 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42226
42230
|
if (schemaType === "mark") {
|
|
42227
42231
|
markType = getMarkType(typeOrName, state.schema);
|
|
42228
42232
|
}
|
|
42229
|
-
|
|
42230
|
-
|
|
42231
|
-
|
|
42232
|
-
|
|
42233
|
+
let canReset = false;
|
|
42234
|
+
tr.selection.ranges.forEach((range) => {
|
|
42235
|
+
state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {
|
|
42236
|
+
if (nodeType && nodeType === node.type) {
|
|
42237
|
+
canReset = true;
|
|
42238
|
+
if (dispatch) {
|
|
42233
42239
|
tr.setNodeMarkup(pos, void 0, deleteProps(node.attrs, attributes));
|
|
42234
42240
|
}
|
|
42235
|
-
|
|
42236
|
-
|
|
42237
|
-
|
|
42241
|
+
}
|
|
42242
|
+
if (markType && node.marks.length) {
|
|
42243
|
+
node.marks.forEach((mark) => {
|
|
42244
|
+
if (markType === mark.type) {
|
|
42245
|
+
canReset = true;
|
|
42246
|
+
if (dispatch) {
|
|
42238
42247
|
tr.addMark(pos, pos + node.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));
|
|
42239
42248
|
}
|
|
42240
|
-
}
|
|
42241
|
-
}
|
|
42242
|
-
}
|
|
42249
|
+
}
|
|
42250
|
+
});
|
|
42251
|
+
}
|
|
42243
42252
|
});
|
|
42244
|
-
}
|
|
42245
|
-
return
|
|
42253
|
+
});
|
|
42254
|
+
return canReset;
|
|
42246
42255
|
};
|
|
42247
42256
|
|
|
42248
42257
|
// src/commands/scrollIntoView.ts
|
|
@@ -42638,12 +42647,12 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42638
42647
|
);
|
|
42639
42648
|
}
|
|
42640
42649
|
function buildAttributeSpec(extensionAttribute) {
|
|
42641
|
-
var _a, _b
|
|
42650
|
+
var _a, _b;
|
|
42642
42651
|
const spec = {};
|
|
42643
|
-
if (!((_a = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _a.isRequired) && ((
|
|
42652
|
+
if (!((_a = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _a.isRequired) && "default" in ((extensionAttribute == null ? void 0 : extensionAttribute.attribute) || {})) {
|
|
42644
42653
|
spec.default = extensionAttribute.attribute.default;
|
|
42645
42654
|
}
|
|
42646
|
-
if (((
|
|
42655
|
+
if (((_b = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _b.validate) !== void 0) {
|
|
42647
42656
|
spec.validate = extensionAttribute.attribute.validate;
|
|
42648
42657
|
}
|
|
42649
42658
|
return [extensionAttribute.name, spec];
|
|
@@ -43281,6 +43290,35 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43281
43290
|
}
|
|
43282
43291
|
return true;
|
|
43283
43292
|
};
|
|
43293
|
+
|
|
43294
|
+
// src/commands/setTextDirection.ts
|
|
43295
|
+
var setTextDirection = (direction, position) => ({ tr, state, dispatch }) => {
|
|
43296
|
+
const { selection } = state;
|
|
43297
|
+
let from;
|
|
43298
|
+
let to;
|
|
43299
|
+
if (typeof position === "number") {
|
|
43300
|
+
from = position;
|
|
43301
|
+
to = position;
|
|
43302
|
+
} else if (position && "from" in position && "to" in position) {
|
|
43303
|
+
from = position.from;
|
|
43304
|
+
to = position.to;
|
|
43305
|
+
} else {
|
|
43306
|
+
from = selection.from;
|
|
43307
|
+
to = selection.to;
|
|
43308
|
+
}
|
|
43309
|
+
if (dispatch) {
|
|
43310
|
+
tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
43311
|
+
if (node.isText) {
|
|
43312
|
+
return;
|
|
43313
|
+
}
|
|
43314
|
+
tr.setNodeMarkup(pos, void 0, {
|
|
43315
|
+
...node.attrs,
|
|
43316
|
+
dir: direction
|
|
43317
|
+
});
|
|
43318
|
+
});
|
|
43319
|
+
}
|
|
43320
|
+
return true;
|
|
43321
|
+
};
|
|
43284
43322
|
var setTextSelection = (position) => ({ tr, dispatch }) => {
|
|
43285
43323
|
if (dispatch) {
|
|
43286
43324
|
const { doc } = tr;
|
|
@@ -43627,6 +43665,34 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43627
43665
|
return true;
|
|
43628
43666
|
};
|
|
43629
43667
|
|
|
43668
|
+
// src/commands/unsetTextDirection.ts
|
|
43669
|
+
var unsetTextDirection = (position) => ({ tr, state, dispatch }) => {
|
|
43670
|
+
const { selection } = state;
|
|
43671
|
+
let from;
|
|
43672
|
+
let to;
|
|
43673
|
+
if (typeof position === "number") {
|
|
43674
|
+
from = position;
|
|
43675
|
+
to = position;
|
|
43676
|
+
} else if (position && "from" in position && "to" in position) {
|
|
43677
|
+
from = position.from;
|
|
43678
|
+
to = position.to;
|
|
43679
|
+
} else {
|
|
43680
|
+
from = selection.from;
|
|
43681
|
+
to = selection.to;
|
|
43682
|
+
}
|
|
43683
|
+
if (dispatch) {
|
|
43684
|
+
tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
43685
|
+
if (node.isText) {
|
|
43686
|
+
return;
|
|
43687
|
+
}
|
|
43688
|
+
const newAttrs = { ...node.attrs };
|
|
43689
|
+
delete newAttrs.dir;
|
|
43690
|
+
tr.setNodeMarkup(pos, void 0, newAttrs);
|
|
43691
|
+
});
|
|
43692
|
+
}
|
|
43693
|
+
return true;
|
|
43694
|
+
};
|
|
43695
|
+
|
|
43630
43696
|
// src/commands/updateAttributes.ts
|
|
43631
43697
|
var updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
43632
43698
|
let nodeType = null;
|
|
@@ -43644,41 +43710,48 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43644
43710
|
if (schemaType === "mark") {
|
|
43645
43711
|
markType = getMarkType(typeOrName, state.schema);
|
|
43646
43712
|
}
|
|
43647
|
-
|
|
43648
|
-
|
|
43649
|
-
|
|
43650
|
-
|
|
43651
|
-
|
|
43652
|
-
|
|
43653
|
-
|
|
43654
|
-
|
|
43655
|
-
|
|
43656
|
-
|
|
43713
|
+
let canUpdate = false;
|
|
43714
|
+
tr.selection.ranges.forEach((range) => {
|
|
43715
|
+
const from = range.$from.pos;
|
|
43716
|
+
const to = range.$to.pos;
|
|
43717
|
+
let lastPos;
|
|
43718
|
+
let lastNode;
|
|
43719
|
+
let trimmedFrom;
|
|
43720
|
+
let trimmedTo;
|
|
43721
|
+
if (tr.selection.empty) {
|
|
43722
|
+
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
43723
|
+
if (nodeType && nodeType === node.type) {
|
|
43724
|
+
canUpdate = true;
|
|
43725
|
+
trimmedFrom = Math.max(pos, from);
|
|
43726
|
+
trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
43727
|
+
lastPos = pos;
|
|
43728
|
+
lastNode = node;
|
|
43729
|
+
}
|
|
43730
|
+
});
|
|
43731
|
+
} else {
|
|
43732
|
+
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
43733
|
+
if (pos < from && nodeType && nodeType === node.type) {
|
|
43734
|
+
canUpdate = true;
|
|
43735
|
+
trimmedFrom = Math.max(pos, from);
|
|
43736
|
+
trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
43737
|
+
lastPos = pos;
|
|
43738
|
+
lastNode = node;
|
|
43739
|
+
}
|
|
43740
|
+
if (pos >= from && pos <= to) {
|
|
43657
43741
|
if (nodeType && nodeType === node.type) {
|
|
43658
|
-
|
|
43659
|
-
|
|
43660
|
-
lastPos = pos;
|
|
43661
|
-
lastNode = node;
|
|
43662
|
-
}
|
|
43663
|
-
});
|
|
43664
|
-
} else {
|
|
43665
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
43666
|
-
if (pos < from && nodeType && nodeType === node.type) {
|
|
43667
|
-
trimmedFrom = Math.max(pos, from);
|
|
43668
|
-
trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
43669
|
-
lastPos = pos;
|
|
43670
|
-
lastNode = node;
|
|
43671
|
-
}
|
|
43672
|
-
if (pos >= from && pos <= to) {
|
|
43673
|
-
if (nodeType && nodeType === node.type) {
|
|
43742
|
+
canUpdate = true;
|
|
43743
|
+
if (dispatch) {
|
|
43674
43744
|
tr.setNodeMarkup(pos, void 0, {
|
|
43675
43745
|
...node.attrs,
|
|
43676
43746
|
...attributes
|
|
43677
43747
|
});
|
|
43678
43748
|
}
|
|
43679
|
-
|
|
43680
|
-
|
|
43681
|
-
|
|
43749
|
+
}
|
|
43750
|
+
if (markType && node.marks.length) {
|
|
43751
|
+
node.marks.forEach((mark) => {
|
|
43752
|
+
if (markType === mark.type) {
|
|
43753
|
+
canUpdate = true;
|
|
43754
|
+
if (dispatch) {
|
|
43682
43755
|
const trimmedFrom2 = Math.max(pos, from);
|
|
43683
43756
|
const trimmedTo2 = Math.min(pos + node.nodeSize, to);
|
|
43684
43757
|
tr.addMark(
|
|
@@ -43690,36 +43763,36 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43690
43763
|
})
|
|
43691
43764
|
);
|
|
43692
43765
|
}
|
|
43693
|
-
}
|
|
43694
|
-
}
|
|
43766
|
+
}
|
|
43767
|
+
});
|
|
43695
43768
|
}
|
|
43769
|
+
}
|
|
43770
|
+
});
|
|
43771
|
+
}
|
|
43772
|
+
if (lastNode) {
|
|
43773
|
+
if (lastPos !== void 0 && dispatch) {
|
|
43774
|
+
tr.setNodeMarkup(lastPos, void 0, {
|
|
43775
|
+
...lastNode.attrs,
|
|
43776
|
+
...attributes
|
|
43696
43777
|
});
|
|
43697
43778
|
}
|
|
43698
|
-
if (lastNode) {
|
|
43699
|
-
|
|
43700
|
-
|
|
43701
|
-
|
|
43702
|
-
|
|
43703
|
-
|
|
43704
|
-
|
|
43705
|
-
|
|
43706
|
-
|
|
43707
|
-
|
|
43708
|
-
|
|
43709
|
-
|
|
43710
|
-
|
|
43711
|
-
markType.create({
|
|
43712
|
-
...mark.attrs,
|
|
43713
|
-
...attributes
|
|
43714
|
-
})
|
|
43715
|
-
);
|
|
43716
|
-
}
|
|
43717
|
-
});
|
|
43718
|
-
}
|
|
43779
|
+
if (markType && lastNode.marks.length) {
|
|
43780
|
+
lastNode.marks.forEach((mark) => {
|
|
43781
|
+
if (markType === mark.type && dispatch) {
|
|
43782
|
+
tr.addMark(
|
|
43783
|
+
trimmedFrom,
|
|
43784
|
+
trimmedTo,
|
|
43785
|
+
markType.create({
|
|
43786
|
+
...mark.attrs,
|
|
43787
|
+
...attributes
|
|
43788
|
+
})
|
|
43789
|
+
);
|
|
43790
|
+
}
|
|
43791
|
+
});
|
|
43719
43792
|
}
|
|
43720
|
-
}
|
|
43721
|
-
}
|
|
43722
|
-
return
|
|
43793
|
+
}
|
|
43794
|
+
});
|
|
43795
|
+
return canUpdate;
|
|
43723
43796
|
};
|
|
43724
43797
|
var wrapIn = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
43725
43798
|
const type = getNodeType(typeOrName, state.schema);
|
|
@@ -44575,6 +44648,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44575
44648
|
Keymap: () => Keymap,
|
|
44576
44649
|
Paste: () => Paste,
|
|
44577
44650
|
Tabindex: () => Tabindex,
|
|
44651
|
+
TextDirection: () => TextDirection,
|
|
44578
44652
|
focusEventsPluginKey: () => focusEventsPluginKey
|
|
44579
44653
|
});
|
|
44580
44654
|
|
|
@@ -44919,6 +44993,63 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44919
44993
|
];
|
|
44920
44994
|
}
|
|
44921
44995
|
});
|
|
44996
|
+
var TextDirection = Extension.create({
|
|
44997
|
+
name: "textDirection",
|
|
44998
|
+
addOptions() {
|
|
44999
|
+
return {
|
|
45000
|
+
direction: void 0
|
|
45001
|
+
};
|
|
45002
|
+
},
|
|
45003
|
+
addGlobalAttributes() {
|
|
45004
|
+
if (!this.options.direction) {
|
|
45005
|
+
return [];
|
|
45006
|
+
}
|
|
45007
|
+
const { nodeExtensions } = splitExtensions(this.extensions);
|
|
45008
|
+
return [
|
|
45009
|
+
{
|
|
45010
|
+
types: nodeExtensions.filter((extension) => extension.name !== "text").map((extension) => extension.name),
|
|
45011
|
+
attributes: {
|
|
45012
|
+
dir: {
|
|
45013
|
+
default: this.options.direction,
|
|
45014
|
+
parseHTML: (element) => {
|
|
45015
|
+
const dir = element.getAttribute("dir");
|
|
45016
|
+
if (dir && (dir === "ltr" || dir === "rtl" || dir === "auto")) {
|
|
45017
|
+
return dir;
|
|
45018
|
+
}
|
|
45019
|
+
return this.options.direction;
|
|
45020
|
+
},
|
|
45021
|
+
renderHTML: (attributes) => {
|
|
45022
|
+
if (!attributes.dir) {
|
|
45023
|
+
return {};
|
|
45024
|
+
}
|
|
45025
|
+
return {
|
|
45026
|
+
dir: attributes.dir
|
|
45027
|
+
};
|
|
45028
|
+
}
|
|
45029
|
+
}
|
|
45030
|
+
}
|
|
45031
|
+
}
|
|
45032
|
+
];
|
|
45033
|
+
},
|
|
45034
|
+
addProseMirrorPlugins() {
|
|
45035
|
+
return [
|
|
45036
|
+
new Plugin({
|
|
45037
|
+
key: new PluginKey("textDirection"),
|
|
45038
|
+
props: {
|
|
45039
|
+
attributes: () => {
|
|
45040
|
+
const direction = this.options.direction;
|
|
45041
|
+
if (!direction) {
|
|
45042
|
+
return {};
|
|
45043
|
+
}
|
|
45044
|
+
return {
|
|
45045
|
+
dir: direction
|
|
45046
|
+
};
|
|
45047
|
+
}
|
|
45048
|
+
}
|
|
45049
|
+
})
|
|
45050
|
+
];
|
|
45051
|
+
}
|
|
45052
|
+
});
|
|
44922
45053
|
|
|
44923
45054
|
// src/NodePos.ts
|
|
44924
45055
|
var NodePos = class _NodePos {
|
|
@@ -45211,6 +45342,7 @@ img.ProseMirror-separator {
|
|
|
45211
45342
|
extensions: [],
|
|
45212
45343
|
autofocus: false,
|
|
45213
45344
|
editable: true,
|
|
45345
|
+
textDirection: void 0,
|
|
45214
45346
|
editorProps: {},
|
|
45215
45347
|
parseOptions: {},
|
|
45216
45348
|
coreExtensionOptions: {},
|
|
@@ -45488,7 +45620,10 @@ img.ProseMirror-separator {
|
|
|
45488
45620
|
Tabindex,
|
|
45489
45621
|
Drop,
|
|
45490
45622
|
Paste,
|
|
45491
|
-
Delete
|
|
45623
|
+
Delete,
|
|
45624
|
+
TextDirection.configure({
|
|
45625
|
+
direction: this.options.textDirection
|
|
45626
|
+
})
|
|
45492
45627
|
].filter((ext) => {
|
|
45493
45628
|
if (typeof this.options.enableCoreExtensions === "object") {
|
|
45494
45629
|
return this.options.enableCoreExtensions[ext.name] !== false;
|
|
@@ -46215,6 +46350,8 @@ ${renderedContent}
|
|
|
46215
46350
|
break;
|
|
46216
46351
|
} else if (currentLine.trim() === "") {
|
|
46217
46352
|
i += 1;
|
|
46353
|
+
totalRaw = `${totalRaw}${currentLine}
|
|
46354
|
+
`;
|
|
46218
46355
|
continue;
|
|
46219
46356
|
} else {
|
|
46220
46357
|
return void 0;
|
|
@@ -46275,7 +46412,7 @@ ${renderedContent}
|
|
|
46275
46412
|
}
|
|
46276
46413
|
return {
|
|
46277
46414
|
items,
|
|
46278
|
-
raw: totalRaw
|
|
46415
|
+
raw: totalRaw
|
|
46279
46416
|
};
|
|
46280
46417
|
}
|
|
46281
46418
|
|
|
@@ -62323,7 +62460,7 @@ ${nextLine.slice(indentLevel + 2)}`;
|
|
|
62323
62460
|
addProseMirrorPlugins() {
|
|
62324
62461
|
var _a;
|
|
62325
62462
|
const plugin = new PluginKey(this.name);
|
|
62326
|
-
const defaultNode = ((_a = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : _a.name) ||
|
|
62463
|
+
const defaultNode = this.options.node || ((_a = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : _a.name) || "paragraph";
|
|
62327
62464
|
const disabledNodes = Object.entries(this.editor.schema.nodes).map(([, value]) => value).filter((node) => (this.options.notAfter || []).concat(defaultNode).includes(node.name));
|
|
62328
62465
|
return [
|
|
62329
62466
|
new Plugin({
|