@ni/spright-components 1.0.4 → 1.0.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.
|
@@ -7541,41 +7541,6 @@
|
|
|
7541
7541
|
let Card$1 = class Card extends FoundationElement {
|
|
7542
7542
|
};
|
|
7543
7543
|
|
|
7544
|
-
/**
|
|
7545
|
-
* The template for the {@link @microsoft/fast-foundation#(Checkbox:class)} component.
|
|
7546
|
-
* @public
|
|
7547
|
-
*/
|
|
7548
|
-
const checkboxTemplate = (context, definition) => html `
|
|
7549
|
-
<template
|
|
7550
|
-
role="checkbox"
|
|
7551
|
-
aria-checked="${x => x.checked}"
|
|
7552
|
-
aria-required="${x => x.required}"
|
|
7553
|
-
aria-disabled="${x => x.disabled}"
|
|
7554
|
-
aria-readonly="${x => x.readOnly}"
|
|
7555
|
-
tabindex="${x => (x.disabled ? null : 0)}"
|
|
7556
|
-
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
7557
|
-
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
7558
|
-
class="${x => (x.readOnly ? "readonly" : "")} ${x => x.checked ? "checked" : ""} ${x => (x.indeterminate ? "indeterminate" : "")}"
|
|
7559
|
-
>
|
|
7560
|
-
<div part="control" class="control">
|
|
7561
|
-
<slot name="checked-indicator">
|
|
7562
|
-
${definition.checkedIndicator || ""}
|
|
7563
|
-
</slot>
|
|
7564
|
-
<slot name="indeterminate-indicator">
|
|
7565
|
-
${definition.indeterminateIndicator || ""}
|
|
7566
|
-
</slot>
|
|
7567
|
-
</div>
|
|
7568
|
-
<label
|
|
7569
|
-
part="label"
|
|
7570
|
-
class="${x => x.defaultSlottedNodes && x.defaultSlottedNodes.length
|
|
7571
|
-
? "label"
|
|
7572
|
-
: "label label__hidden"}"
|
|
7573
|
-
>
|
|
7574
|
-
<slot ${slotted("defaultSlottedNodes")}></slot>
|
|
7575
|
-
</label>
|
|
7576
|
-
</template>
|
|
7577
|
-
`;
|
|
7578
|
-
|
|
7579
7544
|
class _Checkbox extends FoundationElement {
|
|
7580
7545
|
}
|
|
7581
7546
|
/**
|
|
@@ -16339,7 +16304,7 @@
|
|
|
16339
16304
|
|
|
16340
16305
|
/**
|
|
16341
16306
|
* Do not edit directly
|
|
16342
|
-
* Generated on
|
|
16307
|
+
* Generated on Wed, 22 May 2024 18:18:46 GMT
|
|
16343
16308
|
*/
|
|
16344
16309
|
|
|
16345
16310
|
const Information100DarkUi = "#a46eff";
|
|
@@ -16770,7 +16735,7 @@
|
|
|
16770
16735
|
return `${prefix}${uniqueIdCounter++}`;
|
|
16771
16736
|
}
|
|
16772
16737
|
|
|
16773
|
-
const template$
|
|
16738
|
+
const template$I = html `<slot></slot>`;
|
|
16774
16739
|
|
|
16775
16740
|
const styles$10 = css `
|
|
16776
16741
|
${display$1('contents')}
|
|
@@ -16888,7 +16853,7 @@
|
|
|
16888
16853
|
const nimbleDesignSystemProvider = ThemeProvider.compose({
|
|
16889
16854
|
baseName: 'theme-provider',
|
|
16890
16855
|
styles: styles$10,
|
|
16891
|
-
template: template$
|
|
16856
|
+
template: template$I
|
|
16892
16857
|
});
|
|
16893
16858
|
DesignSystem.getOrCreate()
|
|
16894
16859
|
.withPrefix('nimble')
|
|
@@ -16964,9 +16929,9 @@
|
|
|
16964
16929
|
const [subtitlePlus1Font, subtitlePlus1FontColor, subtitlePlus1DisabledFontColor, subtitlePlus1FontFamily, subtitlePlus1FontWeight, subtitlePlus1FontSize, subtitlePlus1FontLineHeight] = createFontTokens(tokenNames.subtitlePlus1Font, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), Subtitle2Family, Subtitle2Weight, Subtitle2Size, Subtitle2LineHeight);
|
|
16965
16930
|
const [subtitleFont, subtitleFontColor, subtitleDisabledFontColor, subtitleFontFamily, subtitleFontWeight, subtitleFontSize, subtitleFontLineHeight] = createFontTokens(tokenNames.subtitleFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), Subtitle1Family, Subtitle1Weight, Subtitle1Size, Subtitle1LineHeight);
|
|
16966
16931
|
const [linkFont, linkFontColor, linkDisabledFontColor, linkFontFamily, linkFontWeight, linkFontSize, linkFontLineHeight] = createFontTokens(tokenNames.linkFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), LinkLightUiFamily, LinkLightUiWeight, LinkLightUiSize, LinkLineHeight);
|
|
16967
|
-
const [linkActiveFont, linkActiveFontColor, linkActiveDisabledFontColor, linkActiveFontFamily, linkActiveFontWeight, linkActiveFontSize, linkActiveFontLineHeight] = createFontTokens(tokenNames.linkActiveFont, (element) => getColorForTheme(element, DigitalGreenLight, DigitalGreenLight, hexToRgbaCssColor(White, 0.
|
|
16968
|
-
const [linkProminentFont, linkProminentFontColor, linkProminentDisabledFontColor, linkProminentFontFamily, linkProminentFontWeight, linkProminentFontSize, linkProminentFontLineHeight] = createFontTokens(tokenNames.linkProminentFont, (element) => getColorForTheme(element, DigitalGreenDark105, PowerGreen,
|
|
16969
|
-
const [linkActiveProminentFont, linkActiveProminentFontColor, linkActiveProminentDisabledFontColor, linkActiveProminentFontFamily, linkActiveProminentFontWeight, linkActiveProminentFontSize, linkActiveProminentFontLineHeight] = createFontTokens(tokenNames.linkActiveProminentFont, (element) => getColorForTheme(element, DigitalGreenLight, DigitalGreenLight, hexToRgbaCssColor(White, 0.
|
|
16932
|
+
const [linkActiveFont, linkActiveFontColor, linkActiveDisabledFontColor, linkActiveFontFamily, linkActiveFontWeight, linkActiveFontSize, linkActiveFontLineHeight] = createFontTokens(tokenNames.linkActiveFont, (element) => getColorForTheme(element, DigitalGreenLight, DigitalGreenLight, hexToRgbaCssColor(White, 0.75)), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), LinkLightUiFamily, LinkLightUiWeight, LinkLightUiSize, LinkLineHeight);
|
|
16933
|
+
const [linkProminentFont, linkProminentFontColor, linkProminentDisabledFontColor, linkProminentFontFamily, linkProminentFontWeight, linkProminentFontSize, linkProminentFontLineHeight] = createFontTokens(tokenNames.linkProminentFont, (element) => getColorForTheme(element, DigitalGreenDark105, PowerGreen, White), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), LinkLightUiFamily, LinkLightUiWeight, LinkLightUiSize, LinkLineHeight);
|
|
16934
|
+
const [linkActiveProminentFont, linkActiveProminentFontColor, linkActiveProminentDisabledFontColor, linkActiveProminentFontFamily, linkActiveProminentFontWeight, linkActiveProminentFontSize, linkActiveProminentFontLineHeight] = createFontTokens(tokenNames.linkActiveProminentFont, (element) => getColorForTheme(element, DigitalGreenLight, DigitalGreenLight, hexToRgbaCssColor(White, 0.75)), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), LinkLightUiFamily, LinkLightUiWeight, LinkLightUiSize, LinkLineHeight);
|
|
16970
16935
|
const [placeholderFont, placeholderFontColor, placeholderDisabledFontColor, placeholderFontFamily, placeholderFontWeight, placeholderFontSize, placeholderFontLineHeight] = createFontTokens(tokenNames.placeholderFont, (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.6), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), PlaceholderFamily, PlaceholderWeight, PlaceholderSize, PlaceholderLineHeight);
|
|
16971
16936
|
const [bodyFont, bodyFontColor, bodyDisabledFontColor, bodyFontFamily, bodyFontWeight, bodyFontSize, bodyFontLineHeight] = createFontTokens(tokenNames.bodyFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), BodyFamily, BodyWeight, BodySize, BodyLineHeight);
|
|
16972
16937
|
const [bodyEmphasizedFont, bodyEmphasizedFontColor, bodyEmphasizedDisabledFontColor, bodyEmphasizedFontFamily, bodyEmphasizedFontWeight, bodyEmphasizedFontSize, bodyEmphasizedFontLineHeight] = createFontTokens(tokenNames.bodyEmphasizedFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), BodyEmphasizedFamily, BodyEmphasizedWeight, BodyEmphasizedSize, BodyEmphasizedLineHeight);
|
|
@@ -17125,6 +17090,7 @@
|
|
|
17125
17090
|
outline: none;
|
|
17126
17091
|
box-shadow: inset 0px -1px;
|
|
17127
17092
|
text-decoration: underline;
|
|
17093
|
+
color: ${borderHoverColor};
|
|
17128
17094
|
}
|
|
17129
17095
|
}
|
|
17130
17096
|
|
|
@@ -17152,7 +17118,7 @@
|
|
|
17152
17118
|
`;
|
|
17153
17119
|
|
|
17154
17120
|
// prettier-ignore
|
|
17155
|
-
const template$
|
|
17121
|
+
const template$H = (_context, definition) => html `${
|
|
17156
17122
|
/* top-container div is necessary because setting contenteditable directly on the native anchor instead
|
|
17157
17123
|
leaves it focusable, unlike the behavior you get when the anchor is _within_ a contenteditable element.
|
|
17158
17124
|
*/ ''}<div
|
|
@@ -17169,6 +17135,7 @@
|
|
|
17169
17135
|
rel="${x => x.rel}"
|
|
17170
17136
|
target="${x => x.target}"
|
|
17171
17137
|
type="${x => x.type}"
|
|
17138
|
+
tabindex="${x => x.tabIndex}"
|
|
17172
17139
|
aria-atomic="${x => x.ariaAtomic}"
|
|
17173
17140
|
aria-busy="${x => x.ariaBusy}"
|
|
17174
17141
|
aria-controls="${x => x.ariaControls}"
|
|
@@ -17244,6 +17211,9 @@
|
|
|
17244
17211
|
__decorate$1([
|
|
17245
17212
|
attr
|
|
17246
17213
|
], Anchor.prototype, "appearance", void 0);
|
|
17214
|
+
__decorate$1([
|
|
17215
|
+
attr({ attribute: 'tabindex', converter: nullableNumberConverter })
|
|
17216
|
+
], Anchor.prototype, "tabIndex", void 0);
|
|
17247
17217
|
__decorate$1([
|
|
17248
17218
|
attr({ attribute: 'contenteditable' })
|
|
17249
17219
|
], Anchor.prototype, "contentEditable", void 0);
|
|
@@ -17251,7 +17221,7 @@
|
|
|
17251
17221
|
const nimbleAnchor = Anchor.compose({
|
|
17252
17222
|
baseName: 'anchor',
|
|
17253
17223
|
baseClass: Anchor$1,
|
|
17254
|
-
template: template$
|
|
17224
|
+
template: template$H,
|
|
17255
17225
|
styles: styles$$,
|
|
17256
17226
|
shadowOptions: {
|
|
17257
17227
|
delegatesFocus: true
|
|
@@ -17654,7 +17624,7 @@
|
|
|
17654
17624
|
}
|
|
17655
17625
|
`;
|
|
17656
17626
|
|
|
17657
|
-
const template$
|
|
17627
|
+
const template$G = (context, definition) => html `
|
|
17658
17628
|
<a
|
|
17659
17629
|
class="control"
|
|
17660
17630
|
part="control"
|
|
@@ -17736,7 +17706,7 @@
|
|
|
17736
17706
|
], AnchorButton.prototype, "disabled", void 0);
|
|
17737
17707
|
const nimbleAnchorButton = AnchorButton.compose({
|
|
17738
17708
|
baseName: 'anchor-button',
|
|
17739
|
-
template: template$
|
|
17709
|
+
template: template$G,
|
|
17740
17710
|
styles: styles$Z,
|
|
17741
17711
|
shadowOptions: {
|
|
17742
17712
|
delegatesFocus: true
|
|
@@ -17829,7 +17799,7 @@
|
|
|
17829
17799
|
}
|
|
17830
17800
|
`;
|
|
17831
17801
|
|
|
17832
|
-
const template$
|
|
17802
|
+
const template$F = (context, definition) => html `
|
|
17833
17803
|
<template
|
|
17834
17804
|
role="menuitem"
|
|
17835
17805
|
class="${x => (typeof x.startColumnCount === 'number'
|
|
@@ -17930,7 +17900,7 @@
|
|
|
17930
17900
|
// FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
|
|
17931
17901
|
const nimbleAnchorMenuItem = AnchorMenuItem.compose({
|
|
17932
17902
|
baseName: 'anchor-menu-item',
|
|
17933
|
-
template: template$
|
|
17903
|
+
template: template$F,
|
|
17934
17904
|
styles: styles$Y,
|
|
17935
17905
|
shadowOptions: {
|
|
17936
17906
|
delegatesFocus: true
|
|
@@ -18058,7 +18028,7 @@
|
|
|
18058
18028
|
}
|
|
18059
18029
|
`;
|
|
18060
18030
|
|
|
18061
|
-
const template$
|
|
18031
|
+
const template$E = (context, definition) => html `
|
|
18062
18032
|
<template slot="anchortab" role="tab" aria-disabled="${x => x.disabled}">
|
|
18063
18033
|
<a
|
|
18064
18034
|
download="${x => x.download}"
|
|
@@ -18110,7 +18080,7 @@
|
|
|
18110
18080
|
// FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
|
|
18111
18081
|
const nimbleAnchorTab = AnchorTab.compose({
|
|
18112
18082
|
baseName: 'anchor-tab',
|
|
18113
|
-
template: template$
|
|
18083
|
+
template: template$E,
|
|
18114
18084
|
styles: styles$X,
|
|
18115
18085
|
shadowOptions: {
|
|
18116
18086
|
delegatesFocus: true
|
|
@@ -18140,7 +18110,7 @@
|
|
|
18140
18110
|
}
|
|
18141
18111
|
`;
|
|
18142
18112
|
|
|
18143
|
-
const template$
|
|
18113
|
+
const template$D = (context, definition) => html `
|
|
18144
18114
|
${startSlotTemplate(context, definition)}
|
|
18145
18115
|
<div ${ref('tablist')} class="tablist" part="tablist" role="tablist">
|
|
18146
18116
|
<slot name="anchortab" ${slotted('tabs')}></slot>
|
|
@@ -18346,7 +18316,7 @@
|
|
|
18346
18316
|
applyMixins(AnchorTabs, StartEnd);
|
|
18347
18317
|
const nimbleAnchorTabs = AnchorTabs.compose({
|
|
18348
18318
|
baseName: 'anchor-tabs',
|
|
18349
|
-
template: template$
|
|
18319
|
+
template: template$D,
|
|
18350
18320
|
styles: styles$W,
|
|
18351
18321
|
shadowOptions: {
|
|
18352
18322
|
delegatesFocus: false
|
|
@@ -18469,7 +18439,7 @@
|
|
|
18469
18439
|
}
|
|
18470
18440
|
`;
|
|
18471
18441
|
|
|
18472
|
-
const template$
|
|
18442
|
+
const template$C = (context, definition) => html `
|
|
18473
18443
|
<template
|
|
18474
18444
|
role="treeitem"
|
|
18475
18445
|
slot="${x => (x.isNestedItem() ? 'item' : null)}"
|
|
@@ -18606,7 +18576,7 @@
|
|
|
18606
18576
|
// FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
|
|
18607
18577
|
const nimbleAnchorTreeItem = AnchorTreeItem.compose({
|
|
18608
18578
|
baseName: 'anchor-tree-item',
|
|
18609
|
-
template: template$
|
|
18579
|
+
template: template$C,
|
|
18610
18580
|
styles: styles$V,
|
|
18611
18581
|
shadowOptions: {
|
|
18612
18582
|
delegatesFocus: true
|
|
@@ -18882,6 +18852,53 @@
|
|
|
18882
18852
|
${buttonAppearanceVariantStyles}
|
|
18883
18853
|
`;
|
|
18884
18854
|
|
|
18855
|
+
const template$B = (context, definition) => html `
|
|
18856
|
+
<button
|
|
18857
|
+
class="control"
|
|
18858
|
+
part="control"
|
|
18859
|
+
?autofocus="${x => x.autofocus}"
|
|
18860
|
+
?disabled="${x => x.disabled}"
|
|
18861
|
+
form="${x => x.formId}"
|
|
18862
|
+
formaction="${x => x.formaction}"
|
|
18863
|
+
formenctype="${x => x.formenctype}"
|
|
18864
|
+
formmethod="${x => x.formmethod}"
|
|
18865
|
+
formnovalidate="${x => x.formnovalidate}"
|
|
18866
|
+
formtarget="${x => x.formtarget}"
|
|
18867
|
+
name="${x => x.name}"
|
|
18868
|
+
type="${x => x.type}"
|
|
18869
|
+
value="${x => x.value}"
|
|
18870
|
+
tabindex="${x => x.tabIndex}"
|
|
18871
|
+
aria-atomic="${x => x.ariaAtomic}"
|
|
18872
|
+
aria-busy="${x => x.ariaBusy}"
|
|
18873
|
+
aria-controls="${x => x.ariaControls}"
|
|
18874
|
+
aria-current="${x => x.ariaCurrent}"
|
|
18875
|
+
aria-describedby="${x => x.ariaDescribedby}"
|
|
18876
|
+
aria-details="${x => x.ariaDetails}"
|
|
18877
|
+
aria-disabled="${x => x.ariaDisabled}"
|
|
18878
|
+
aria-errormessage="${x => x.ariaErrormessage}"
|
|
18879
|
+
aria-expanded="${x => x.ariaExpanded}"
|
|
18880
|
+
aria-flowto="${x => x.ariaFlowto}"
|
|
18881
|
+
aria-haspopup="${x => x.ariaHaspopup}"
|
|
18882
|
+
aria-hidden="${x => x.ariaHidden}"
|
|
18883
|
+
aria-invalid="${x => x.ariaInvalid}"
|
|
18884
|
+
aria-keyshortcuts="${x => x.ariaKeyshortcuts}"
|
|
18885
|
+
aria-label="${x => x.ariaLabel}"
|
|
18886
|
+
aria-labelledby="${x => x.ariaLabelledby}"
|
|
18887
|
+
aria-live="${x => x.ariaLive}"
|
|
18888
|
+
aria-owns="${x => x.ariaOwns}"
|
|
18889
|
+
aria-pressed="${x => x.ariaPressed}"
|
|
18890
|
+
aria-relevant="${x => x.ariaRelevant}"
|
|
18891
|
+
aria-roledescription="${x => x.ariaRoledescription}"
|
|
18892
|
+
${ref('control')}
|
|
18893
|
+
>
|
|
18894
|
+
${startSlotTemplate(context, definition)}
|
|
18895
|
+
<span class="content" part="content">
|
|
18896
|
+
<slot ${slotted('defaultSlottedContent')}></slot>
|
|
18897
|
+
</span>
|
|
18898
|
+
${endSlotTemplate(context, definition)}
|
|
18899
|
+
</button>
|
|
18900
|
+
`;
|
|
18901
|
+
|
|
18885
18902
|
/**
|
|
18886
18903
|
* A nimble-styled HTML button
|
|
18887
18904
|
*/
|
|
@@ -18911,6 +18928,9 @@
|
|
|
18911
18928
|
__decorate$1([
|
|
18912
18929
|
attr({ attribute: 'content-hidden', mode: 'boolean' })
|
|
18913
18930
|
], Button.prototype, "contentHidden", void 0);
|
|
18931
|
+
__decorate$1([
|
|
18932
|
+
attr({ attribute: 'tabindex', converter: nullableNumberConverter })
|
|
18933
|
+
], Button.prototype, "tabIndex", void 0);
|
|
18914
18934
|
/**
|
|
18915
18935
|
* A function that returns a nimble-button registration for configuring the component with a DesignSystem.
|
|
18916
18936
|
* Implements {@link @microsoft/fast-foundation#buttonTemplate}
|
|
@@ -18923,7 +18943,7 @@
|
|
|
18923
18943
|
const nimbleButton = Button.compose({
|
|
18924
18944
|
baseName: 'button',
|
|
18925
18945
|
baseClass: Button$1,
|
|
18926
|
-
template:
|
|
18946
|
+
template: template$B,
|
|
18927
18947
|
styles: styles$S,
|
|
18928
18948
|
shadowOptions: {
|
|
18929
18949
|
delegatesFocus: true
|
|
@@ -19675,7 +19695,7 @@
|
|
|
19675
19695
|
};
|
|
19676
19696
|
|
|
19677
19697
|
// Avoiding any whitespace in the template because this is an inline element
|
|
19678
|
-
const template$
|
|
19698
|
+
const template$A = html `<div
|
|
19679
19699
|
class="icon"
|
|
19680
19700
|
aria-hidden="true"
|
|
19681
19701
|
:innerHTML=${x => x.icon.data}
|
|
@@ -19734,7 +19754,7 @@
|
|
|
19734
19754
|
const registerIcon = (baseName, iconClass) => {
|
|
19735
19755
|
const composedIcon = iconClass.compose({
|
|
19736
19756
|
baseName,
|
|
19737
|
-
template: template$
|
|
19757
|
+
template: template$A,
|
|
19738
19758
|
styles: styles$R
|
|
19739
19759
|
});
|
|
19740
19760
|
DesignSystem.getOrCreate().withPrefix('nimble').register(composedIcon());
|
|
@@ -19848,7 +19868,7 @@
|
|
|
19848
19868
|
}).withDefault(coreLabelDefaults.filterNoResultsLabel);
|
|
19849
19869
|
|
|
19850
19870
|
// prettier-ignore
|
|
19851
|
-
const template$
|
|
19871
|
+
const template$z = html `
|
|
19852
19872
|
<div class="container"
|
|
19853
19873
|
role="status"
|
|
19854
19874
|
aria-atomic="${x => x.ariaAtomic}"
|
|
@@ -19964,7 +19984,7 @@
|
|
|
19964
19984
|
applyMixins(Banner, ARIAGlobalStatesAndProperties);
|
|
19965
19985
|
const nimbleBanner = Banner.compose({
|
|
19966
19986
|
baseName: 'banner',
|
|
19967
|
-
template: template$
|
|
19987
|
+
template: template$z,
|
|
19968
19988
|
styles: styles$T
|
|
19969
19989
|
});
|
|
19970
19990
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleBanner());
|
|
@@ -20123,7 +20143,7 @@
|
|
|
20123
20143
|
}
|
|
20124
20144
|
`;
|
|
20125
20145
|
|
|
20126
|
-
const template$
|
|
20146
|
+
const template$y = html `
|
|
20127
20147
|
<section aria-labelledby="title-slot">
|
|
20128
20148
|
<span id="title-slot"><slot name="title"></slot></span>
|
|
20129
20149
|
<slot></slot>
|
|
@@ -20138,7 +20158,7 @@
|
|
|
20138
20158
|
const nimbleCard = Card.compose({
|
|
20139
20159
|
baseName: 'card',
|
|
20140
20160
|
baseClass: Card$1,
|
|
20141
|
-
template: template$
|
|
20161
|
+
template: template$y,
|
|
20142
20162
|
styles: styles$O
|
|
20143
20163
|
});
|
|
20144
20164
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleCard());
|
|
@@ -20418,15 +20438,56 @@
|
|
|
20418
20438
|
}
|
|
20419
20439
|
`;
|
|
20420
20440
|
|
|
20441
|
+
const template$x = (_context, definition) => html `
|
|
20442
|
+
<template
|
|
20443
|
+
role="checkbox"
|
|
20444
|
+
aria-checked="${x => x.checked}"
|
|
20445
|
+
aria-required="${x => x.required}"
|
|
20446
|
+
aria-disabled="${x => x.disabled}"
|
|
20447
|
+
aria-readonly="${x => x.readOnly}"
|
|
20448
|
+
tabindex="${x => x.resolvedTabindex}"
|
|
20449
|
+
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
20450
|
+
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
20451
|
+
class="${x => (x.readOnly ? 'readonly' : '')} ${x => (x.checked ? 'checked' : '')} ${x => (x.indeterminate ? 'indeterminate' : '')}"
|
|
20452
|
+
>
|
|
20453
|
+
<div part="control" class="control">
|
|
20454
|
+
<slot name="checked-indicator">
|
|
20455
|
+
${definition.checkedIndicator || ''}
|
|
20456
|
+
</slot>
|
|
20457
|
+
<slot name="indeterminate-indicator">
|
|
20458
|
+
${definition.indeterminateIndicator || ''}
|
|
20459
|
+
</slot>
|
|
20460
|
+
</div>
|
|
20461
|
+
<label
|
|
20462
|
+
part="label"
|
|
20463
|
+
class="${x => (x.defaultSlottedNodes?.length
|
|
20464
|
+
? 'label'
|
|
20465
|
+
: 'label label__hidden')}"
|
|
20466
|
+
>
|
|
20467
|
+
<slot ${slotted('defaultSlottedNodes')}></slot>
|
|
20468
|
+
</label>
|
|
20469
|
+
</template>
|
|
20470
|
+
`;
|
|
20471
|
+
|
|
20421
20472
|
/**
|
|
20422
20473
|
* A nimble-styled checkbox control.
|
|
20423
20474
|
*/
|
|
20424
20475
|
class Checkbox extends Checkbox$1 {
|
|
20476
|
+
/**
|
|
20477
|
+
* @internal
|
|
20478
|
+
*/
|
|
20479
|
+
get resolvedTabindex() {
|
|
20480
|
+
const tabIndex = this.tabIndex ?? 0;
|
|
20481
|
+
return this.disabled ? undefined : `${tabIndex}`;
|
|
20482
|
+
}
|
|
20425
20483
|
}
|
|
20484
|
+
__decorate$1([
|
|
20485
|
+
attr({ attribute: 'tabindex', converter: nullableNumberConverter })
|
|
20486
|
+
], Checkbox.prototype, "tabIndex", void 0);
|
|
20426
20487
|
const nimbleCheckbox = Checkbox.compose({
|
|
20427
20488
|
baseName: 'checkbox',
|
|
20428
20489
|
baseClass: Checkbox$1,
|
|
20429
|
-
template:
|
|
20490
|
+
template: template$x,
|
|
20430
20491
|
styles: styles$M,
|
|
20431
20492
|
checkedIndicator: check16X16.data,
|
|
20432
20493
|
indeterminateIndicator: minus16X16.data
|
|
@@ -20482,23 +20543,32 @@
|
|
|
20482
20543
|
}
|
|
20483
20544
|
`));
|
|
20484
20545
|
|
|
20546
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
20547
|
+
// prettier-ignore
|
|
20485
20548
|
const template$w = (context, definition) => html `
|
|
20486
20549
|
<div
|
|
20487
20550
|
role="button"
|
|
20488
20551
|
part="control"
|
|
20489
|
-
tabindex="${x =>
|
|
20552
|
+
tabindex="${x => x.resolvedTabindex}"
|
|
20490
20553
|
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
20491
20554
|
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
20492
20555
|
class="control ${x => (x.checked ? 'checked' : '')}"
|
|
20493
|
-
|
|
20494
|
-
|
|
20495
|
-
|
|
20496
|
-
|
|
20556
|
+
${''
|
|
20557
|
+
/**
|
|
20558
|
+
* Configure aria-disabled, aria-readonly, and aria-pressed based on the
|
|
20559
|
+
* toggle button's state to keep the ARIA attributes consistent with the component's
|
|
20560
|
+
* state without a client having to configure ARIA attributes directly
|
|
20561
|
+
*/
|
|
20562
|
+
}
|
|
20497
20563
|
aria-disabled="${x => x.disabled}"
|
|
20498
20564
|
aria-readonly="${x => x.readOnly}"
|
|
20499
20565
|
aria-pressed="${x => x.checked}"
|
|
20500
|
-
${''
|
|
20501
|
-
|
|
20566
|
+
${''
|
|
20567
|
+
/**
|
|
20568
|
+
* Configure all other ARIA attributes based on the aria attributes
|
|
20569
|
+
* configured on the toggle button
|
|
20570
|
+
*/
|
|
20571
|
+
}
|
|
20502
20572
|
aria-atomic="${x => x.ariaAtomic}"
|
|
20503
20573
|
aria-busy="${x => x.ariaBusy}"
|
|
20504
20574
|
aria-controls="${x => x.ariaControls}"
|
|
@@ -20527,6 +20597,7 @@
|
|
|
20527
20597
|
${endSlotTemplate(context, definition)}
|
|
20528
20598
|
</div>
|
|
20529
20599
|
`;
|
|
20600
|
+
/* eslint-enable @typescript-eslint/indent */
|
|
20530
20601
|
|
|
20531
20602
|
/**
|
|
20532
20603
|
* A nimble-styled toggle button control.
|
|
@@ -20547,6 +20618,13 @@
|
|
|
20547
20618
|
*/
|
|
20548
20619
|
this.contentHidden = false;
|
|
20549
20620
|
}
|
|
20621
|
+
/**
|
|
20622
|
+
* @internal
|
|
20623
|
+
*/
|
|
20624
|
+
get resolvedTabindex() {
|
|
20625
|
+
const tabIndex = this.tabIndex ?? 0;
|
|
20626
|
+
return this.disabled ? undefined : `${tabIndex}`;
|
|
20627
|
+
}
|
|
20550
20628
|
}
|
|
20551
20629
|
__decorate$1([
|
|
20552
20630
|
attr
|
|
@@ -20557,6 +20635,9 @@
|
|
|
20557
20635
|
__decorate$1([
|
|
20558
20636
|
attr({ attribute: 'content-hidden', mode: 'boolean' })
|
|
20559
20637
|
], ToggleButton.prototype, "contentHidden", void 0);
|
|
20638
|
+
__decorate$1([
|
|
20639
|
+
attr({ attribute: 'tabindex', converter: nullableNumberConverter })
|
|
20640
|
+
], ToggleButton.prototype, "tabIndex", void 0);
|
|
20560
20641
|
applyMixins(ToggleButton, StartEnd, DelegatesARIAButton);
|
|
20561
20642
|
const nimbleToggleButton = ToggleButton.compose({
|
|
20562
20643
|
baseName: 'toggle-button',
|
|
@@ -25206,6 +25287,7 @@
|
|
|
25206
25287
|
?content-hidden="${x => x.contentHidden}"
|
|
25207
25288
|
?checked="${x => x.open}"
|
|
25208
25289
|
?disabled="${x => x.disabled}"
|
|
25290
|
+
tabindex="${x => x.tabIndex}"
|
|
25209
25291
|
aria-haspopup="true"
|
|
25210
25292
|
aria-expanded="${x => x.open}"
|
|
25211
25293
|
@change="${(x, c) => x.toggleButtonCheckedChangeHandler(c.event)}"
|
|
@@ -25423,6 +25505,9 @@
|
|
|
25423
25505
|
__decorate$1([
|
|
25424
25506
|
attr({ attribute: 'content-hidden', mode: 'boolean' })
|
|
25425
25507
|
], MenuButton.prototype, "contentHidden", void 0);
|
|
25508
|
+
__decorate$1([
|
|
25509
|
+
attr({ attribute: 'tabindex', converter: nullableNumberConverter })
|
|
25510
|
+
], MenuButton.prototype, "tabIndex", void 0);
|
|
25426
25511
|
__decorate$1([
|
|
25427
25512
|
attr({ mode: 'boolean' })
|
|
25428
25513
|
], MenuButton.prototype, "open", void 0);
|
|
@@ -28455,6 +28540,12 @@
|
|
|
28455
28540
|
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
28456
28541
|
*/
|
|
28457
28542
|
constructor(spec) {
|
|
28543
|
+
/**
|
|
28544
|
+
The [linebreak
|
|
28545
|
+
replacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement) node defined
|
|
28546
|
+
in this schema, if any.
|
|
28547
|
+
*/
|
|
28548
|
+
this.linebreakReplacement = null;
|
|
28458
28549
|
/**
|
|
28459
28550
|
An object for storing whatever values modules may want to
|
|
28460
28551
|
compute and cache per schema. (If you want to store something
|
|
@@ -28476,6 +28567,13 @@
|
|
|
28476
28567
|
type.contentMatch = contentExprCache[contentExpr] ||
|
|
28477
28568
|
(contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
|
|
28478
28569
|
type.inlineContent = type.contentMatch.inlineContent;
|
|
28570
|
+
if (type.spec.linebreakReplacement) {
|
|
28571
|
+
if (this.linebreakReplacement)
|
|
28572
|
+
throw new RangeError("Multiple linebreak nodes defined");
|
|
28573
|
+
if (!type.isInline || !type.isLeaf)
|
|
28574
|
+
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
28575
|
+
this.linebreakReplacement = type;
|
|
28576
|
+
}
|
|
28479
28577
|
type.markSet = markExpr == "_" ? null :
|
|
28480
28578
|
markExpr ? gatherMarks(this, markExpr.split(" ")) :
|
|
28481
28579
|
markExpr == "" || !type.inlineContent ? [] : null;
|
|
@@ -30325,7 +30423,8 @@
|
|
|
30325
30423
|
}
|
|
30326
30424
|
map(mapping) {
|
|
30327
30425
|
let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
30328
|
-
let gapFrom =
|
|
30426
|
+
let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);
|
|
30427
|
+
let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
|
|
30329
30428
|
if ((from.deletedAcross && to.deletedAcross) || gapFrom < from.pos || gapTo > to.pos)
|
|
30330
30429
|
return null;
|
|
30331
30430
|
return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
|
|
@@ -30437,7 +30536,7 @@
|
|
|
30437
30536
|
});
|
|
30438
30537
|
matched.forEach(m => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));
|
|
30439
30538
|
}
|
|
30440
|
-
function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch) {
|
|
30539
|
+
function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {
|
|
30441
30540
|
let node = tr.doc.nodeAt(pos);
|
|
30442
30541
|
let replSteps = [], cur = pos + 1;
|
|
30443
30542
|
for (let i = 0; i < node.childCount; i++) {
|
|
@@ -30451,7 +30550,7 @@
|
|
|
30451
30550
|
for (let j = 0; j < child.marks.length; j++)
|
|
30452
30551
|
if (!parentType.allowsMarkType(child.marks[j].type))
|
|
30453
30552
|
tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
|
|
30454
|
-
if (child.isText &&
|
|
30553
|
+
if (clearNewlines && child.isText && parentType.whitespace != "pre") {
|
|
30455
30554
|
let m, newline = /\r?\n|\r/g, slice;
|
|
30456
30555
|
while (m = newline.exec(child.text)) {
|
|
30457
30556
|
if (!slice)
|
|
@@ -30576,15 +30675,46 @@
|
|
|
30576
30675
|
let mapFrom = tr.steps.length;
|
|
30577
30676
|
tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
30578
30677
|
if (node.isTextblock && !node.hasMarkup(type, attrs) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {
|
|
30678
|
+
let convertNewlines = null;
|
|
30679
|
+
if (type.schema.linebreakReplacement) {
|
|
30680
|
+
let pre = type.whitespace == "pre", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);
|
|
30681
|
+
if (pre && !supportLinebreak)
|
|
30682
|
+
convertNewlines = false;
|
|
30683
|
+
else if (!pre && supportLinebreak)
|
|
30684
|
+
convertNewlines = true;
|
|
30685
|
+
}
|
|
30579
30686
|
// Ensure all markup that isn't allowed in the new node type is cleared
|
|
30580
|
-
|
|
30687
|
+
if (convertNewlines === false)
|
|
30688
|
+
replaceLinebreaks(tr, node, pos, mapFrom);
|
|
30689
|
+
clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, undefined, convertNewlines === null);
|
|
30581
30690
|
let mapping = tr.mapping.slice(mapFrom);
|
|
30582
30691
|
let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
|
|
30583
30692
|
tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrs, null, node.marks)), 0, 0), 1, true));
|
|
30693
|
+
if (convertNewlines === true)
|
|
30694
|
+
replaceNewlines(tr, node, pos, mapFrom);
|
|
30584
30695
|
return false;
|
|
30585
30696
|
}
|
|
30586
30697
|
});
|
|
30587
30698
|
}
|
|
30699
|
+
function replaceNewlines(tr, node, pos, mapFrom) {
|
|
30700
|
+
node.forEach((child, offset) => {
|
|
30701
|
+
if (child.isText) {
|
|
30702
|
+
let m, newline = /\r?\n|\r/g;
|
|
30703
|
+
while (m = newline.exec(child.text)) {
|
|
30704
|
+
let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);
|
|
30705
|
+
tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
|
|
30706
|
+
}
|
|
30707
|
+
}
|
|
30708
|
+
});
|
|
30709
|
+
}
|
|
30710
|
+
function replaceLinebreaks(tr, node, pos, mapFrom) {
|
|
30711
|
+
node.forEach((child, offset) => {
|
|
30712
|
+
if (child.type == child.type.schema.linebreakReplacement) {
|
|
30713
|
+
let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);
|
|
30714
|
+
tr.replaceWith(start, start + 1, node.type.schema.text("\n"));
|
|
30715
|
+
}
|
|
30716
|
+
});
|
|
30717
|
+
}
|
|
30588
30718
|
function canChangeType(doc, pos, type) {
|
|
30589
30719
|
let $pos = doc.resolve(pos), index = $pos.index();
|
|
30590
30720
|
return $pos.parent.canReplaceWith(index, index + 1, type);
|
|
@@ -39183,6 +39313,11 @@
|
|
|
39183
39313
|
};
|
|
39184
39314
|
}
|
|
39185
39315
|
|
|
39316
|
+
/**
|
|
39317
|
+
* Takes a Transaction & Editor State and turns it into a chainable state object
|
|
39318
|
+
* @param config The transaction and state to create the chainable state from
|
|
39319
|
+
* @returns A chainable Editor state object
|
|
39320
|
+
*/
|
|
39186
39321
|
function createChainableState(config) {
|
|
39187
39322
|
const { state, transaction } = config;
|
|
39188
39323
|
let { selection } = transaction;
|
|
@@ -39349,6 +39484,13 @@
|
|
|
39349
39484
|
}
|
|
39350
39485
|
}
|
|
39351
39486
|
|
|
39487
|
+
/**
|
|
39488
|
+
* Returns a field from an extension
|
|
39489
|
+
* @param extension The Tiptap extension
|
|
39490
|
+
* @param field The field, for example `renderHTML` or `priority`
|
|
39491
|
+
* @param context The context object that should be passed as `this` into the function
|
|
39492
|
+
* @returns The field value
|
|
39493
|
+
*/
|
|
39352
39494
|
function getExtensionField(extension, field, context) {
|
|
39353
39495
|
if (extension.config[field] === undefined && extension.parent) {
|
|
39354
39496
|
return getExtensionField(extension.parent, field, context);
|
|
@@ -39593,6 +39735,12 @@
|
|
|
39593
39735
|
return value !== null && value !== undefined;
|
|
39594
39736
|
}));
|
|
39595
39737
|
}
|
|
39738
|
+
/**
|
|
39739
|
+
* Creates a new Prosemirror schema based on the given extensions.
|
|
39740
|
+
* @param extensions An array of Tiptap extensions
|
|
39741
|
+
* @param editor The editor instance
|
|
39742
|
+
* @returns A Prosemirror schema
|
|
39743
|
+
*/
|
|
39596
39744
|
function getSchemaByResolvedExtensions(extensions, editor) {
|
|
39597
39745
|
var _a;
|
|
39598
39746
|
const allAttributes = getAttributesFromExtensions(extensions);
|
|
@@ -39694,6 +39842,12 @@
|
|
|
39694
39842
|
});
|
|
39695
39843
|
}
|
|
39696
39844
|
|
|
39845
|
+
/**
|
|
39846
|
+
* Tries to get a node or mark type by its name.
|
|
39847
|
+
* @param name The name of the node or mark type
|
|
39848
|
+
* @param schema The Prosemiror schema to search in
|
|
39849
|
+
* @returns The node or mark type, or null if it doesn't exist
|
|
39850
|
+
*/
|
|
39697
39851
|
function getSchemaTypeByName(name, schema) {
|
|
39698
39852
|
return schema.nodes[name] || schema.marks[name] || null;
|
|
39699
39853
|
}
|
|
@@ -39710,6 +39864,12 @@
|
|
|
39710
39864
|
return enabled;
|
|
39711
39865
|
}
|
|
39712
39866
|
|
|
39867
|
+
/**
|
|
39868
|
+
* Returns the text content of a resolved prosemirror position
|
|
39869
|
+
* @param $from The resolved position to get the text content from
|
|
39870
|
+
* @param maxMatch The maximum number of characters to match
|
|
39871
|
+
* @returns The text content
|
|
39872
|
+
*/
|
|
39713
39873
|
const getTextContentFromNodes = ($from, maxMatch = 500) => {
|
|
39714
39874
|
let textBefore = '';
|
|
39715
39875
|
const sliceEndPos = $from.parentOffset;
|
|
@@ -39917,6 +40077,10 @@
|
|
|
39917
40077
|
return typeof value === 'number';
|
|
39918
40078
|
}
|
|
39919
40079
|
|
|
40080
|
+
/**
|
|
40081
|
+
* Paste rules are used to react to pasted content.
|
|
40082
|
+
* @see https://tiptap.dev/guide/custom-extensions/#paste-rules
|
|
40083
|
+
*/
|
|
39920
40084
|
class PasteRule {
|
|
39921
40085
|
constructor(config) {
|
|
39922
40086
|
this.find = config.find;
|
|
@@ -40115,57 +40279,14 @@
|
|
|
40115
40279
|
this.editor = editor;
|
|
40116
40280
|
this.extensions = ExtensionManager.resolve(extensions);
|
|
40117
40281
|
this.schema = getSchemaByResolvedExtensions(this.extensions, editor);
|
|
40118
|
-
this.
|
|
40119
|
-
var _a;
|
|
40120
|
-
// store extension storage in editor
|
|
40121
|
-
this.editor.extensionStorage[extension.name] = extension.storage;
|
|
40122
|
-
const context = {
|
|
40123
|
-
name: extension.name,
|
|
40124
|
-
options: extension.options,
|
|
40125
|
-
storage: extension.storage,
|
|
40126
|
-
editor: this.editor,
|
|
40127
|
-
type: getSchemaTypeByName(extension.name, this.schema),
|
|
40128
|
-
};
|
|
40129
|
-
if (extension.type === 'mark') {
|
|
40130
|
-
const keepOnSplit = (_a = callOrReturn(getExtensionField(extension, 'keepOnSplit', context))) !== null && _a !== void 0 ? _a : true;
|
|
40131
|
-
if (keepOnSplit) {
|
|
40132
|
-
this.splittableMarks.push(extension.name);
|
|
40133
|
-
}
|
|
40134
|
-
}
|
|
40135
|
-
const onBeforeCreate = getExtensionField(extension, 'onBeforeCreate', context);
|
|
40136
|
-
if (onBeforeCreate) {
|
|
40137
|
-
this.editor.on('beforeCreate', onBeforeCreate);
|
|
40138
|
-
}
|
|
40139
|
-
const onCreate = getExtensionField(extension, 'onCreate', context);
|
|
40140
|
-
if (onCreate) {
|
|
40141
|
-
this.editor.on('create', onCreate);
|
|
40142
|
-
}
|
|
40143
|
-
const onUpdate = getExtensionField(extension, 'onUpdate', context);
|
|
40144
|
-
if (onUpdate) {
|
|
40145
|
-
this.editor.on('update', onUpdate);
|
|
40146
|
-
}
|
|
40147
|
-
const onSelectionUpdate = getExtensionField(extension, 'onSelectionUpdate', context);
|
|
40148
|
-
if (onSelectionUpdate) {
|
|
40149
|
-
this.editor.on('selectionUpdate', onSelectionUpdate);
|
|
40150
|
-
}
|
|
40151
|
-
const onTransaction = getExtensionField(extension, 'onTransaction', context);
|
|
40152
|
-
if (onTransaction) {
|
|
40153
|
-
this.editor.on('transaction', onTransaction);
|
|
40154
|
-
}
|
|
40155
|
-
const onFocus = getExtensionField(extension, 'onFocus', context);
|
|
40156
|
-
if (onFocus) {
|
|
40157
|
-
this.editor.on('focus', onFocus);
|
|
40158
|
-
}
|
|
40159
|
-
const onBlur = getExtensionField(extension, 'onBlur', context);
|
|
40160
|
-
if (onBlur) {
|
|
40161
|
-
this.editor.on('blur', onBlur);
|
|
40162
|
-
}
|
|
40163
|
-
const onDestroy = getExtensionField(extension, 'onDestroy', context);
|
|
40164
|
-
if (onDestroy) {
|
|
40165
|
-
this.editor.on('destroy', onDestroy);
|
|
40166
|
-
}
|
|
40167
|
-
});
|
|
40282
|
+
this.setupExtensions();
|
|
40168
40283
|
}
|
|
40284
|
+
/**
|
|
40285
|
+
* Returns a flattened and sorted extension list while
|
|
40286
|
+
* also checking for duplicated extensions and warns the user.
|
|
40287
|
+
* @param extensions An array of Tiptap extensions
|
|
40288
|
+
* @returns An flattened and sorted array of Tiptap extensions
|
|
40289
|
+
*/
|
|
40169
40290
|
static resolve(extensions) {
|
|
40170
40291
|
const resolvedExtensions = ExtensionManager.sort(ExtensionManager.flatten(extensions));
|
|
40171
40292
|
const duplicatedNames = findDuplicates(resolvedExtensions.map(extension => extension.name));
|
|
@@ -40176,6 +40297,11 @@
|
|
|
40176
40297
|
}
|
|
40177
40298
|
return resolvedExtensions;
|
|
40178
40299
|
}
|
|
40300
|
+
/**
|
|
40301
|
+
* Create a flattened array of extensions by traversing the `addExtensions` field.
|
|
40302
|
+
* @param extensions An array of Tiptap extensions
|
|
40303
|
+
* @returns A flattened array of Tiptap extensions
|
|
40304
|
+
*/
|
|
40179
40305
|
static flatten(extensions) {
|
|
40180
40306
|
return (extensions
|
|
40181
40307
|
.map(extension => {
|
|
@@ -40193,6 +40319,11 @@
|
|
|
40193
40319
|
// `Infinity` will break TypeScript so we set a number that is probably high enough
|
|
40194
40320
|
.flat(10));
|
|
40195
40321
|
}
|
|
40322
|
+
/**
|
|
40323
|
+
* Sort extensions by priority.
|
|
40324
|
+
* @param extensions An array of Tiptap extensions
|
|
40325
|
+
* @returns A sorted array of Tiptap extensions by priority
|
|
40326
|
+
*/
|
|
40196
40327
|
static sort(extensions) {
|
|
40197
40328
|
const defaultPriority = 100;
|
|
40198
40329
|
return extensions.sort((a, b) => {
|
|
@@ -40207,6 +40338,10 @@
|
|
|
40207
40338
|
return 0;
|
|
40208
40339
|
});
|
|
40209
40340
|
}
|
|
40341
|
+
/**
|
|
40342
|
+
* Get all commands from the extensions.
|
|
40343
|
+
* @returns An object with all commands where the key is the command name and the value is the command function
|
|
40344
|
+
*/
|
|
40210
40345
|
get commands() {
|
|
40211
40346
|
return this.extensions.reduce((commands, extension) => {
|
|
40212
40347
|
const context = {
|
|
@@ -40226,6 +40361,10 @@
|
|
|
40226
40361
|
};
|
|
40227
40362
|
}, {});
|
|
40228
40363
|
}
|
|
40364
|
+
/**
|
|
40365
|
+
* Get all registered Prosemirror plugins from the extensions.
|
|
40366
|
+
* @returns An array of Prosemirror plugins
|
|
40367
|
+
*/
|
|
40229
40368
|
get plugins() {
|
|
40230
40369
|
const { editor } = this;
|
|
40231
40370
|
// With ProseMirror, first plugins within an array are executed first.
|
|
@@ -40288,9 +40427,17 @@
|
|
|
40288
40427
|
...allPlugins,
|
|
40289
40428
|
];
|
|
40290
40429
|
}
|
|
40430
|
+
/**
|
|
40431
|
+
* Get all attributes from the extensions.
|
|
40432
|
+
* @returns An array of attributes
|
|
40433
|
+
*/
|
|
40291
40434
|
get attributes() {
|
|
40292
40435
|
return getAttributesFromExtensions(this.extensions);
|
|
40293
40436
|
}
|
|
40437
|
+
/**
|
|
40438
|
+
* Get all node views from the extensions.
|
|
40439
|
+
* @returns An object with all node views where the key is the node name and the value is the node view function
|
|
40440
|
+
*/
|
|
40294
40441
|
get nodeViews() {
|
|
40295
40442
|
const { editor } = this;
|
|
40296
40443
|
const { nodeExtensions } = splitExtensions(this.extensions);
|
|
@@ -40323,6 +40470,62 @@
|
|
|
40323
40470
|
return [extension.name, nodeview];
|
|
40324
40471
|
}));
|
|
40325
40472
|
}
|
|
40473
|
+
/**
|
|
40474
|
+
* Go through all extensions, create extension storages & setup marks
|
|
40475
|
+
* & bind editor event listener.
|
|
40476
|
+
*/
|
|
40477
|
+
setupExtensions() {
|
|
40478
|
+
this.extensions.forEach(extension => {
|
|
40479
|
+
var _a;
|
|
40480
|
+
// store extension storage in editor
|
|
40481
|
+
this.editor.extensionStorage[extension.name] = extension.storage;
|
|
40482
|
+
const context = {
|
|
40483
|
+
name: extension.name,
|
|
40484
|
+
options: extension.options,
|
|
40485
|
+
storage: extension.storage,
|
|
40486
|
+
editor: this.editor,
|
|
40487
|
+
type: getSchemaTypeByName(extension.name, this.schema),
|
|
40488
|
+
};
|
|
40489
|
+
if (extension.type === 'mark') {
|
|
40490
|
+
const keepOnSplit = (_a = callOrReturn(getExtensionField(extension, 'keepOnSplit', context))) !== null && _a !== void 0 ? _a : true;
|
|
40491
|
+
if (keepOnSplit) {
|
|
40492
|
+
this.splittableMarks.push(extension.name);
|
|
40493
|
+
}
|
|
40494
|
+
}
|
|
40495
|
+
const onBeforeCreate = getExtensionField(extension, 'onBeforeCreate', context);
|
|
40496
|
+
const onCreate = getExtensionField(extension, 'onCreate', context);
|
|
40497
|
+
const onUpdate = getExtensionField(extension, 'onUpdate', context);
|
|
40498
|
+
const onSelectionUpdate = getExtensionField(extension, 'onSelectionUpdate', context);
|
|
40499
|
+
const onTransaction = getExtensionField(extension, 'onTransaction', context);
|
|
40500
|
+
const onFocus = getExtensionField(extension, 'onFocus', context);
|
|
40501
|
+
const onBlur = getExtensionField(extension, 'onBlur', context);
|
|
40502
|
+
const onDestroy = getExtensionField(extension, 'onDestroy', context);
|
|
40503
|
+
if (onBeforeCreate) {
|
|
40504
|
+
this.editor.on('beforeCreate', onBeforeCreate);
|
|
40505
|
+
}
|
|
40506
|
+
if (onCreate) {
|
|
40507
|
+
this.editor.on('create', onCreate);
|
|
40508
|
+
}
|
|
40509
|
+
if (onUpdate) {
|
|
40510
|
+
this.editor.on('update', onUpdate);
|
|
40511
|
+
}
|
|
40512
|
+
if (onSelectionUpdate) {
|
|
40513
|
+
this.editor.on('selectionUpdate', onSelectionUpdate);
|
|
40514
|
+
}
|
|
40515
|
+
if (onTransaction) {
|
|
40516
|
+
this.editor.on('transaction', onTransaction);
|
|
40517
|
+
}
|
|
40518
|
+
if (onFocus) {
|
|
40519
|
+
this.editor.on('focus', onFocus);
|
|
40520
|
+
}
|
|
40521
|
+
if (onBlur) {
|
|
40522
|
+
this.editor.on('blur', onBlur);
|
|
40523
|
+
}
|
|
40524
|
+
if (onDestroy) {
|
|
40525
|
+
this.editor.on('destroy', onDestroy);
|
|
40526
|
+
}
|
|
40527
|
+
});
|
|
40528
|
+
}
|
|
40326
40529
|
}
|
|
40327
40530
|
|
|
40328
40531
|
// see: https://github.com/mesqueeb/is-what/blob/88d6e4ca92fb2baab6003c54e02eedf4e729e5ab/src/index.ts
|
|
@@ -40356,6 +40559,10 @@
|
|
|
40356
40559
|
return output;
|
|
40357
40560
|
}
|
|
40358
40561
|
|
|
40562
|
+
/**
|
|
40563
|
+
* The Extension class is the base class for all extensions.
|
|
40564
|
+
* @see https://tiptap.dev/api/extensions#create-a-new-extension
|
|
40565
|
+
*/
|
|
40359
40566
|
class Extension {
|
|
40360
40567
|
constructor(config = {}) {
|
|
40361
40568
|
this.type = 'extension';
|
|
@@ -40393,6 +40600,7 @@
|
|
|
40393
40600
|
// return a new instance so we can use the same extension
|
|
40394
40601
|
// with different calls of `configure`
|
|
40395
40602
|
const extension = this.extend();
|
|
40603
|
+
extension.parent = this.parent;
|
|
40396
40604
|
extension.options = mergeDeep(this.options, options);
|
|
40397
40605
|
extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
|
|
40398
40606
|
name: extension.name,
|
|
@@ -40419,19 +40627,25 @@
|
|
|
40419
40627
|
}
|
|
40420
40628
|
}
|
|
40421
40629
|
|
|
40630
|
+
/**
|
|
40631
|
+
* Gets the text between two positions in a Prosemirror node
|
|
40632
|
+
* and serializes it using the given text serializers and block separator (see getText)
|
|
40633
|
+
* @param startNode The Prosemirror node to start from
|
|
40634
|
+
* @param range The range of the text to get
|
|
40635
|
+
* @param options Options for the text serializer & block separator
|
|
40636
|
+
* @returns The text between the two positions
|
|
40637
|
+
*/
|
|
40422
40638
|
function getTextBetween(startNode, range, options) {
|
|
40423
40639
|
const { from, to } = range;
|
|
40424
40640
|
const { blockSeparator = '\n\n', textSerializers = {} } = options || {};
|
|
40425
40641
|
let text = '';
|
|
40426
|
-
let separated = true;
|
|
40427
40642
|
startNode.nodesBetween(from, to, (node, pos, parent, index) => {
|
|
40428
40643
|
var _a;
|
|
40644
|
+
if (node.isBlock && pos > from) {
|
|
40645
|
+
text += blockSeparator;
|
|
40646
|
+
}
|
|
40429
40647
|
const textSerializer = textSerializers === null || textSerializers === void 0 ? void 0 : textSerializers[node.type.name];
|
|
40430
40648
|
if (textSerializer) {
|
|
40431
|
-
if (node.isBlock && !separated) {
|
|
40432
|
-
text += blockSeparator;
|
|
40433
|
-
separated = true;
|
|
40434
|
-
}
|
|
40435
40649
|
if (parent) {
|
|
40436
40650
|
text += textSerializer({
|
|
40437
40651
|
node,
|
|
@@ -40446,16 +40660,16 @@
|
|
|
40446
40660
|
}
|
|
40447
40661
|
if (node.isText) {
|
|
40448
40662
|
text += (_a = node === null || node === void 0 ? void 0 : node.text) === null || _a === void 0 ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos); // eslint-disable-line
|
|
40449
|
-
separated = false;
|
|
40450
|
-
}
|
|
40451
|
-
else if (node.isBlock && !separated) {
|
|
40452
|
-
text += blockSeparator;
|
|
40453
|
-
separated = true;
|
|
40454
40663
|
}
|
|
40455
40664
|
});
|
|
40456
40665
|
return text;
|
|
40457
40666
|
}
|
|
40458
40667
|
|
|
40668
|
+
/**
|
|
40669
|
+
* Find text serializers `toText` in a Prosemirror schema
|
|
40670
|
+
* @param schema The Prosemirror schema to search in
|
|
40671
|
+
* @returns A record of text serializers by node name
|
|
40672
|
+
*/
|
|
40459
40673
|
function getTextSerializersFromSchema(schema) {
|
|
40460
40674
|
return Object.fromEntries(Object.entries(schema.nodes)
|
|
40461
40675
|
.filter(([, node]) => node.spec.toText)
|
|
@@ -40838,15 +41052,26 @@
|
|
|
40838
41052
|
return removeWhitespaces(html);
|
|
40839
41053
|
}
|
|
40840
41054
|
|
|
41055
|
+
/**
|
|
41056
|
+
* Takes a JSON or HTML content and creates a Prosemirror node or fragment from it.
|
|
41057
|
+
* @param content The JSON or HTML content to create the node from
|
|
41058
|
+
* @param schema The Prosemirror schema to use for the node
|
|
41059
|
+
* @param options Options for the parser
|
|
41060
|
+
* @returns The created Prosemirror node or fragment
|
|
41061
|
+
*/
|
|
40841
41062
|
function createNodeFromContent(content, schema, options) {
|
|
40842
41063
|
options = {
|
|
40843
41064
|
slice: true,
|
|
40844
41065
|
parseOptions: {},
|
|
40845
41066
|
...options,
|
|
40846
41067
|
};
|
|
40847
|
-
|
|
41068
|
+
const isJSONContent = typeof content === 'object' && content !== null;
|
|
41069
|
+
const isTextContent = typeof content === 'string';
|
|
41070
|
+
if (isJSONContent) {
|
|
40848
41071
|
try {
|
|
40849
|
-
|
|
41072
|
+
const isArrayContent = Array.isArray(content) && content.length > 0;
|
|
41073
|
+
// if the JSON Content is an array of nodes, create a fragment for each node
|
|
41074
|
+
if (isArrayContent) {
|
|
40850
41075
|
return Fragment.fromArray(content.map(item => schema.nodeFromJSON(item)));
|
|
40851
41076
|
}
|
|
40852
41077
|
return schema.nodeFromJSON(content);
|
|
@@ -40856,7 +41081,7 @@
|
|
|
40856
41081
|
return createNodeFromContent('', schema, options);
|
|
40857
41082
|
}
|
|
40858
41083
|
}
|
|
40859
|
-
if (
|
|
41084
|
+
if (isTextContent) {
|
|
40860
41085
|
const parser = DOMParser.fromSchema(schema);
|
|
40861
41086
|
return options.slice
|
|
40862
41087
|
? parser.parseSlice(elementFromString(content), options.parseOptions).content
|
|
@@ -41156,6 +41381,12 @@
|
|
|
41156
41381
|
return newlineInCode$1(state, dispatch);
|
|
41157
41382
|
};
|
|
41158
41383
|
|
|
41384
|
+
/**
|
|
41385
|
+
* Get the type of a schema item by its name.
|
|
41386
|
+
* @param name The name of the schema item
|
|
41387
|
+
* @param schema The Prosemiror schema to search in
|
|
41388
|
+
* @returns The type of the schema item (`node` or `mark`), or null if it doesn't exist
|
|
41389
|
+
*/
|
|
41159
41390
|
function getSchemaTypeNameByName(name, schema) {
|
|
41160
41391
|
if (schema.nodes[name]) {
|
|
41161
41392
|
return 'node';
|
|
@@ -41253,6 +41484,13 @@
|
|
|
41253
41484
|
return selectTextblockStart$1(state, dispatch);
|
|
41254
41485
|
};
|
|
41255
41486
|
|
|
41487
|
+
/**
|
|
41488
|
+
* Create a new Prosemirror document node from content.
|
|
41489
|
+
* @param content The JSON or HTML content to create the document from
|
|
41490
|
+
* @param schema The Prosemirror schema to use for the document
|
|
41491
|
+
* @param parseOptions Options for the parser
|
|
41492
|
+
* @returns The created Prosemirror document node
|
|
41493
|
+
*/
|
|
41256
41494
|
function createDocument(content, schema, parseOptions = {}) {
|
|
41257
41495
|
return createNodeFromContent(content, schema, { slice: false, parseOptions });
|
|
41258
41496
|
}
|
|
@@ -41290,6 +41528,9 @@
|
|
|
41290
41528
|
|
|
41291
41529
|
/**
|
|
41292
41530
|
* Returns a new `Transform` based on all steps of the passed transactions.
|
|
41531
|
+
* @param oldDoc The Prosemirror node to start from
|
|
41532
|
+
* @param transactions The transactions to combine
|
|
41533
|
+
* @returns A new `Transform` with all steps of the passed transactions
|
|
41293
41534
|
*/
|
|
41294
41535
|
function combineTransactionSteps(oldDoc, transactions) {
|
|
41295
41536
|
const transform = new Transform$1(oldDoc);
|
|
@@ -41301,6 +41542,11 @@
|
|
|
41301
41542
|
return transform;
|
|
41302
41543
|
}
|
|
41303
41544
|
|
|
41545
|
+
/**
|
|
41546
|
+
* Gets the default block type at a given match
|
|
41547
|
+
* @param match The content match to get the default block type from
|
|
41548
|
+
* @returns The default block type or null
|
|
41549
|
+
*/
|
|
41304
41550
|
function defaultBlockAt(match) {
|
|
41305
41551
|
for (let i = 0; i < match.edgeCount; i += 1) {
|
|
41306
41552
|
const { type } = match.edge(i);
|
|
@@ -41313,6 +41559,10 @@
|
|
|
41313
41559
|
|
|
41314
41560
|
/**
|
|
41315
41561
|
* Same as `findChildren` but searches only within a `range`.
|
|
41562
|
+
* @param node The Prosemirror node to search in
|
|
41563
|
+
* @param range The range to search in
|
|
41564
|
+
* @param predicate The predicate to match
|
|
41565
|
+
* @returns An array of nodes with their positions
|
|
41316
41566
|
*/
|
|
41317
41567
|
function findChildrenInRange(node, range, predicate) {
|
|
41318
41568
|
const nodesWithPos = [];
|
|
@@ -41336,6 +41586,15 @@
|
|
|
41336
41586
|
return nodesWithPos;
|
|
41337
41587
|
}
|
|
41338
41588
|
|
|
41589
|
+
/**
|
|
41590
|
+
* Finds the closest parent node to a resolved position that matches a predicate.
|
|
41591
|
+
* @param $pos The resolved position to search from
|
|
41592
|
+
* @param predicate The predicate to match
|
|
41593
|
+
* @returns The closest parent node to the resolved position that matches the predicate
|
|
41594
|
+
* @example ```js
|
|
41595
|
+
* findParentNodeClosestToPos($from, node => node.type.name === 'paragraph')
|
|
41596
|
+
* ```
|
|
41597
|
+
*/
|
|
41339
41598
|
function findParentNodeClosestToPos($pos, predicate) {
|
|
41340
41599
|
for (let i = $pos.depth; i > 0; i -= 1) {
|
|
41341
41600
|
const node = $pos.node(i);
|
|
@@ -41350,6 +41609,14 @@
|
|
|
41350
41609
|
}
|
|
41351
41610
|
}
|
|
41352
41611
|
|
|
41612
|
+
/**
|
|
41613
|
+
* Finds the closest parent node to the current selection that matches a predicate.
|
|
41614
|
+
* @param predicate The predicate to match
|
|
41615
|
+
* @returns A command that finds the closest parent node to the current selection that matches the predicate
|
|
41616
|
+
* @example ```js
|
|
41617
|
+
* findParentNode(node => node.type.name === 'paragraph')
|
|
41618
|
+
* ```
|
|
41619
|
+
*/
|
|
41353
41620
|
function findParentNode(predicate) {
|
|
41354
41621
|
return (selection) => findParentNodeClosestToPos(selection.$from, predicate);
|
|
41355
41622
|
}
|
|
@@ -41362,6 +41629,15 @@
|
|
|
41362
41629
|
return container.innerHTML;
|
|
41363
41630
|
}
|
|
41364
41631
|
|
|
41632
|
+
/**
|
|
41633
|
+
* Gets the text of a Prosemirror node
|
|
41634
|
+
* @param node The Prosemirror node
|
|
41635
|
+
* @param options Options for the text serializer & block separator
|
|
41636
|
+
* @returns The text of the node
|
|
41637
|
+
* @example ```js
|
|
41638
|
+
* const text = getText(node, { blockSeparator: '\n' })
|
|
41639
|
+
* ```
|
|
41640
|
+
*/
|
|
41365
41641
|
function getText(node, options) {
|
|
41366
41642
|
const range = {
|
|
41367
41643
|
from: 0,
|
|
@@ -41384,6 +41660,12 @@
|
|
|
41384
41660
|
return { ...node.attrs };
|
|
41385
41661
|
}
|
|
41386
41662
|
|
|
41663
|
+
/**
|
|
41664
|
+
* Get node or mark attributes by type or name on the current editor state
|
|
41665
|
+
* @param state The current editor state
|
|
41666
|
+
* @param typeOrName The node or mark type or name
|
|
41667
|
+
* @returns The attributes of the node or mark or an empty object
|
|
41668
|
+
*/
|
|
41387
41669
|
function getAttributes(state, typeOrName) {
|
|
41388
41670
|
const schemaType = getSchemaTypeNameByName(typeof typeOrName === 'string' ? typeOrName : typeOrName.name, state.schema);
|
|
41389
41671
|
if (schemaType === 'node') {
|
|
@@ -41505,6 +41787,13 @@
|
|
|
41505
41787
|
return marks;
|
|
41506
41788
|
}
|
|
41507
41789
|
|
|
41790
|
+
/**
|
|
41791
|
+
* Return attributes of an extension that should be splitted by keepOnSplit flag
|
|
41792
|
+
* @param extensionAttributes Array of extension attributes
|
|
41793
|
+
* @param typeName The type of the extension
|
|
41794
|
+
* @param attributes The attributes of the extension
|
|
41795
|
+
* @returns The splitted attributes
|
|
41796
|
+
*/
|
|
41508
41797
|
function getSplittedAttributes(extensionAttributes, typeName, attributes) {
|
|
41509
41798
|
return Object.fromEntries(Object
|
|
41510
41799
|
.entries(attributes)
|
|
@@ -42293,7 +42582,12 @@
|
|
|
42293
42582
|
const isAtStart = (parentIsIsolating && $parentPos.parent.childCount === 1)
|
|
42294
42583
|
? parentPos === $anchor.pos
|
|
42295
42584
|
: Selection$2.atStart(doc).from === pos;
|
|
42296
|
-
if (!empty
|
|
42585
|
+
if (!empty
|
|
42586
|
+
|| !parent.type.isTextblock
|
|
42587
|
+
|| parent.textContent.length
|
|
42588
|
+
|| !isAtStart
|
|
42589
|
+
|| (isAtStart && $anchor.parent.type.name === 'paragraph') // prevent clearNodes when no nodes to clear, otherwise history stack is appended
|
|
42590
|
+
) {
|
|
42297
42591
|
return false;
|
|
42298
42592
|
}
|
|
42299
42593
|
return commands.clearNodes();
|
|
@@ -42545,28 +42839,30 @@
|
|
|
42545
42839
|
}
|
|
42546
42840
|
querySelectorAll(selector, attributes = {}, firstItemOnly = false) {
|
|
42547
42841
|
let nodes = [];
|
|
42548
|
-
// iterate through children recursively finding all nodes which match the selector with the node name
|
|
42549
42842
|
if (!this.children || this.children.length === 0) {
|
|
42550
42843
|
return nodes;
|
|
42551
42844
|
}
|
|
42845
|
+
const attrKeys = Object.keys(attributes);
|
|
42846
|
+
/**
|
|
42847
|
+
* Finds all children recursively that match the selector and attributes
|
|
42848
|
+
* If firstItemOnly is true, it will return the first item found
|
|
42849
|
+
*/
|
|
42552
42850
|
this.children.forEach(childPos => {
|
|
42851
|
+
// If we already found a node and we only want the first item, we dont need to keep going
|
|
42852
|
+
if (firstItemOnly && nodes.length > 0) {
|
|
42853
|
+
return;
|
|
42854
|
+
}
|
|
42553
42855
|
if (childPos.node.type.name === selector) {
|
|
42554
|
-
|
|
42555
|
-
|
|
42556
|
-
|
|
42557
|
-
for (let index = 0; index < attrKeys.length; index += 1) {
|
|
42558
|
-
const key = attrKeys[index];
|
|
42559
|
-
if (nodeAttributes[key] !== attributes[key]) {
|
|
42560
|
-
return;
|
|
42561
|
-
}
|
|
42562
|
-
}
|
|
42563
|
-
}
|
|
42564
|
-
nodes.push(childPos);
|
|
42565
|
-
if (firstItemOnly) {
|
|
42566
|
-
return;
|
|
42856
|
+
const doesAllAttributesMatch = attrKeys.every(key => attributes[key] === childPos.node.attrs[key]);
|
|
42857
|
+
if (doesAllAttributesMatch) {
|
|
42858
|
+
nodes.push(childPos);
|
|
42567
42859
|
}
|
|
42568
42860
|
}
|
|
42569
|
-
|
|
42861
|
+
// If we already found a node and we only want the first item, we can stop here and skip the recursion
|
|
42862
|
+
if (firstItemOnly && nodes.length > 0) {
|
|
42863
|
+
return;
|
|
42864
|
+
}
|
|
42865
|
+
nodes = nodes.concat(childPos.querySelectorAll(selector, attributes, firstItemOnly));
|
|
42570
42866
|
});
|
|
42571
42867
|
return nodes;
|
|
42572
42868
|
}
|
|
@@ -43053,6 +43349,7 @@ img.ProseMirror-separator {
|
|
|
43053
43349
|
/**
|
|
43054
43350
|
* Build an input rule that adds a mark when the
|
|
43055
43351
|
* matched text is typed into it.
|
|
43352
|
+
* @see https://tiptap.dev/guide/custom-extensions/#input-rules
|
|
43056
43353
|
*/
|
|
43057
43354
|
function markInputRule(config) {
|
|
43058
43355
|
return new InputRule({
|
|
@@ -43106,6 +43403,7 @@ img.ProseMirror-separator {
|
|
|
43106
43403
|
* two nodes. You can pass a join predicate, which takes a regular
|
|
43107
43404
|
* expression match and the node before the wrapped node, and can
|
|
43108
43405
|
* return a boolean to indicate whether a join should happen.
|
|
43406
|
+
* @see https://tiptap.dev/guide/custom-extensions/#input-rules
|
|
43109
43407
|
*/
|
|
43110
43408
|
function wrappingInputRule(config) {
|
|
43111
43409
|
return new InputRule({
|
|
@@ -43145,6 +43443,10 @@ img.ProseMirror-separator {
|
|
|
43145
43443
|
});
|
|
43146
43444
|
}
|
|
43147
43445
|
|
|
43446
|
+
/**
|
|
43447
|
+
* The Mark class is used to create custom mark extensions.
|
|
43448
|
+
* @see https://tiptap.dev/api/extensions#create-a-new-extension
|
|
43449
|
+
*/
|
|
43148
43450
|
class Mark {
|
|
43149
43451
|
constructor(config = {}) {
|
|
43150
43452
|
this.type = 'mark';
|
|
@@ -43228,6 +43530,10 @@ img.ProseMirror-separator {
|
|
|
43228
43530
|
}
|
|
43229
43531
|
}
|
|
43230
43532
|
|
|
43533
|
+
/**
|
|
43534
|
+
* The Node class is used to create custom node extensions.
|
|
43535
|
+
* @see https://tiptap.dev/api/extensions#create-a-new-extension
|
|
43536
|
+
*/
|
|
43231
43537
|
let Node$1 = class Node {
|
|
43232
43538
|
constructor(config = {}) {
|
|
43233
43539
|
this.type = 'node';
|
|
@@ -43294,6 +43600,7 @@ img.ProseMirror-separator {
|
|
|
43294
43600
|
/**
|
|
43295
43601
|
* Build an paste rule that adds a mark when the
|
|
43296
43602
|
* matched text is pasted into it.
|
|
43603
|
+
* @see https://tiptap.dev/guide/custom-extensions/#paste-rules
|
|
43297
43604
|
*/
|
|
43298
43605
|
function markPasteRule(config) {
|
|
43299
43606
|
return new PasteRule({
|
|
@@ -43340,6 +43647,10 @@ img.ProseMirror-separator {
|
|
|
43340
43647
|
return string.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
43341
43648
|
}
|
|
43342
43649
|
|
|
43650
|
+
/**
|
|
43651
|
+
* This extension allows you to insert hard breaks.
|
|
43652
|
+
* @see https://www.tiptap.dev/api/nodes/hard-break
|
|
43653
|
+
*/
|
|
43343
43654
|
const HardBreak = Node$1.create({
|
|
43344
43655
|
name: 'hardBreak',
|
|
43345
43656
|
addOptions() {
|
|
@@ -54023,10 +54334,26 @@ img.ProseMirror-separator {
|
|
|
54023
54334
|
observable
|
|
54024
54335
|
], RichText.prototype, "configuration", void 0);
|
|
54025
54336
|
|
|
54337
|
+
/**
|
|
54338
|
+
* Matches bold text via `**` as input.
|
|
54339
|
+
*/
|
|
54026
54340
|
const starInputRegex$1 = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
|
|
54341
|
+
/**
|
|
54342
|
+
* Matches bold text via `**` while pasting.
|
|
54343
|
+
*/
|
|
54027
54344
|
const starPasteRegex$1 = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
|
|
54345
|
+
/**
|
|
54346
|
+
* Matches bold text via `__` as input.
|
|
54347
|
+
*/
|
|
54028
54348
|
const underscoreInputRegex$1 = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
|
|
54349
|
+
/**
|
|
54350
|
+
* Matches bold text via `__` while pasting.
|
|
54351
|
+
*/
|
|
54029
54352
|
const underscorePasteRegex$1 = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
|
|
54353
|
+
/**
|
|
54354
|
+
* This extension allows you to mark text as bold.
|
|
54355
|
+
* @see https://tiptap.dev/api/marks/bold
|
|
54356
|
+
*/
|
|
54030
54357
|
const Bold = Mark.create({
|
|
54031
54358
|
name: 'bold',
|
|
54032
54359
|
addOptions() {
|
|
@@ -54097,6 +54424,10 @@ img.ProseMirror-separator {
|
|
|
54097
54424
|
},
|
|
54098
54425
|
});
|
|
54099
54426
|
|
|
54427
|
+
/**
|
|
54428
|
+
* This extension allows you to create list items.
|
|
54429
|
+
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
54430
|
+
*/
|
|
54100
54431
|
const ListItem$2 = Node$1.create({
|
|
54101
54432
|
name: 'listItem',
|
|
54102
54433
|
addOptions() {
|
|
@@ -54127,6 +54458,11 @@ img.ProseMirror-separator {
|
|
|
54127
54458
|
},
|
|
54128
54459
|
});
|
|
54129
54460
|
|
|
54461
|
+
/**
|
|
54462
|
+
* This extension allows you to create text styles. It is required by default
|
|
54463
|
+
* for the `textColor` and `backgroundColor` extensions.
|
|
54464
|
+
* @see https://www.tiptap.dev/api/marks/text-style
|
|
54465
|
+
*/
|
|
54130
54466
|
const TextStyle$1 = Mark.create({
|
|
54131
54467
|
name: 'textStyle',
|
|
54132
54468
|
addOptions() {
|
|
@@ -54165,7 +54501,16 @@ img.ProseMirror-separator {
|
|
|
54165
54501
|
},
|
|
54166
54502
|
});
|
|
54167
54503
|
|
|
54504
|
+
/**
|
|
54505
|
+
* Matches a bullet list to a dash or asterisk.
|
|
54506
|
+
*/
|
|
54168
54507
|
const inputRegex$1 = /^\s*([-+*])\s$/;
|
|
54508
|
+
/**
|
|
54509
|
+
* This extension allows you to create bullet lists.
|
|
54510
|
+
* This requires the ListItem extension
|
|
54511
|
+
* @see https://tiptap.dev/api/nodes/bullet-list
|
|
54512
|
+
* @see https://tiptap.dev/api/nodes/list-item.
|
|
54513
|
+
*/
|
|
54169
54514
|
const BulletList = Node$1.create({
|
|
54170
54515
|
name: 'bulletList',
|
|
54171
54516
|
addOptions() {
|
|
@@ -54224,6 +54569,10 @@ img.ProseMirror-separator {
|
|
|
54224
54569
|
},
|
|
54225
54570
|
});
|
|
54226
54571
|
|
|
54572
|
+
/**
|
|
54573
|
+
* The default document node which represents the top level node of the editor.
|
|
54574
|
+
* @see https://tiptap.dev/api/nodes/document
|
|
54575
|
+
*/
|
|
54227
54576
|
const Document$1 = Node$1.create({
|
|
54228
54577
|
name: 'doc',
|
|
54229
54578
|
topNode: true,
|
|
@@ -54844,6 +55193,15 @@ img.ProseMirror-separator {
|
|
|
54844
55193
|
*/
|
|
54845
55194
|
const redo = buildCommand(true, true);
|
|
54846
55195
|
|
|
55196
|
+
/**
|
|
55197
|
+
* This extension allows you to undo and redo recent changes.
|
|
55198
|
+
* @see https://www.tiptap.dev/api/extensions/history
|
|
55199
|
+
*
|
|
55200
|
+
* **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove
|
|
55201
|
+
* the `history` extension, as it is not compatible with the `collaboration` extension.
|
|
55202
|
+
*
|
|
55203
|
+
* `@tiptap/extension-collaboration` uses its own history implementation.
|
|
55204
|
+
*/
|
|
54847
55205
|
const History = Extension.create({
|
|
54848
55206
|
name: 'history',
|
|
54849
55207
|
addOptions() {
|
|
@@ -54879,10 +55237,26 @@ img.ProseMirror-separator {
|
|
|
54879
55237
|
},
|
|
54880
55238
|
});
|
|
54881
55239
|
|
|
55240
|
+
/**
|
|
55241
|
+
* Matches an italic to a *italic* on input.
|
|
55242
|
+
*/
|
|
54882
55243
|
const starInputRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/;
|
|
55244
|
+
/**
|
|
55245
|
+
* Matches an italic to a *italic* on paste.
|
|
55246
|
+
*/
|
|
54883
55247
|
const starPasteRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g;
|
|
55248
|
+
/**
|
|
55249
|
+
* Matches an italic to a _italic_ on input.
|
|
55250
|
+
*/
|
|
54884
55251
|
const underscoreInputRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/;
|
|
55252
|
+
/**
|
|
55253
|
+
* Matches an italic to a _italic_ on paste.
|
|
55254
|
+
*/
|
|
54885
55255
|
const underscorePasteRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g;
|
|
55256
|
+
/**
|
|
55257
|
+
* This extension allows you to create italic text.
|
|
55258
|
+
* @see https://www.tiptap.dev/api/marks/italic
|
|
55259
|
+
*/
|
|
54886
55260
|
const Italic = Mark.create({
|
|
54887
55261
|
name: 'italic',
|
|
54888
55262
|
addOptions() {
|
|
@@ -56717,12 +57091,27 @@ img.ProseMirror-separator {
|
|
|
56717
57091
|
}
|
|
56718
57092
|
return false;
|
|
56719
57093
|
}
|
|
57094
|
+
/**
|
|
57095
|
+
* This plugin allows you to automatically add links to your editor.
|
|
57096
|
+
* @param options The plugin options
|
|
57097
|
+
* @returns The plugin instance
|
|
57098
|
+
*/
|
|
56720
57099
|
function autolink(options) {
|
|
56721
57100
|
return new Plugin({
|
|
56722
57101
|
key: new PluginKey('autolink'),
|
|
56723
57102
|
appendTransaction: (transactions, oldState, newState) => {
|
|
57103
|
+
/**
|
|
57104
|
+
* Does the transaction change the document?
|
|
57105
|
+
*/
|
|
56724
57106
|
const docChanges = transactions.some(transaction => transaction.docChanged) && !oldState.doc.eq(newState.doc);
|
|
57107
|
+
/**
|
|
57108
|
+
* Prevent autolink if the transaction is not a document change or if the transaction has the meta `preventAutolink`.
|
|
57109
|
+
*/
|
|
56725
57110
|
const preventAutolink = transactions.some(transaction => transaction.getMeta('preventAutolink'));
|
|
57111
|
+
/**
|
|
57112
|
+
* Prevent autolink if the transaction is not a document change
|
|
57113
|
+
* or if the transaction has the meta `preventAutolink`.
|
|
57114
|
+
*/
|
|
56726
57115
|
if (!docChanges || preventAutolink) {
|
|
56727
57116
|
return;
|
|
56728
57117
|
}
|
|
@@ -56862,6 +57251,10 @@ img.ProseMirror-separator {
|
|
|
56862
57251
|
},
|
|
56863
57252
|
});
|
|
56864
57253
|
}
|
|
57254
|
+
/**
|
|
57255
|
+
* This extension allows you to create links.
|
|
57256
|
+
* @see https://www.tiptap.dev/api/marks/link
|
|
57257
|
+
*/
|
|
56865
57258
|
const Link = Mark.create({
|
|
56866
57259
|
name: 'link',
|
|
56867
57260
|
priority: 1000,
|
|
@@ -56996,6 +57389,10 @@ img.ProseMirror-separator {
|
|
|
56996
57389
|
},
|
|
56997
57390
|
});
|
|
56998
57391
|
|
|
57392
|
+
/**
|
|
57393
|
+
* This extension allows you to create list items.
|
|
57394
|
+
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
57395
|
+
*/
|
|
56999
57396
|
const ListItem$1 = Node$1.create({
|
|
57000
57397
|
name: 'listItem',
|
|
57001
57398
|
addOptions() {
|
|
@@ -57026,6 +57423,10 @@ img.ProseMirror-separator {
|
|
|
57026
57423
|
},
|
|
57027
57424
|
});
|
|
57028
57425
|
|
|
57426
|
+
/**
|
|
57427
|
+
* This extension allows you to create list items.
|
|
57428
|
+
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
57429
|
+
*/
|
|
57029
57430
|
const ListItem = Node$1.create({
|
|
57030
57431
|
name: 'listItem',
|
|
57031
57432
|
addOptions() {
|
|
@@ -57056,6 +57457,11 @@ img.ProseMirror-separator {
|
|
|
57056
57457
|
},
|
|
57057
57458
|
});
|
|
57058
57459
|
|
|
57460
|
+
/**
|
|
57461
|
+
* This extension allows you to create text styles. It is required by default
|
|
57462
|
+
* for the `textColor` and `backgroundColor` extensions.
|
|
57463
|
+
* @see https://www.tiptap.dev/api/marks/text-style
|
|
57464
|
+
*/
|
|
57059
57465
|
const TextStyle = Mark.create({
|
|
57060
57466
|
name: 'textStyle',
|
|
57061
57467
|
addOptions() {
|
|
@@ -57094,7 +57500,16 @@ img.ProseMirror-separator {
|
|
|
57094
57500
|
},
|
|
57095
57501
|
});
|
|
57096
57502
|
|
|
57503
|
+
/**
|
|
57504
|
+
* Matches an ordered list to a 1. on input (or any number followed by a dot).
|
|
57505
|
+
*/
|
|
57097
57506
|
const inputRegex = /^(\d+)\.\s$/;
|
|
57507
|
+
/**
|
|
57508
|
+
* This extension allows you to create ordered lists.
|
|
57509
|
+
* This requires the ListItem extension
|
|
57510
|
+
* @see https://www.tiptap.dev/api/nodes/ordered-list
|
|
57511
|
+
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
57512
|
+
*/
|
|
57098
57513
|
const OrderedList = Node$1.create({
|
|
57099
57514
|
name: 'orderedList',
|
|
57100
57515
|
addOptions() {
|
|
@@ -57173,6 +57588,10 @@ img.ProseMirror-separator {
|
|
|
57173
57588
|
},
|
|
57174
57589
|
});
|
|
57175
57590
|
|
|
57591
|
+
/**
|
|
57592
|
+
* This extension allows you to create paragraphs.
|
|
57593
|
+
* @see https://www.tiptap.dev/api/nodes/paragraph
|
|
57594
|
+
*/
|
|
57176
57595
|
const Paragraph = Node$1.create({
|
|
57177
57596
|
name: 'paragraph',
|
|
57178
57597
|
priority: 1000,
|
|
@@ -57205,6 +57624,11 @@ img.ProseMirror-separator {
|
|
|
57205
57624
|
},
|
|
57206
57625
|
});
|
|
57207
57626
|
|
|
57627
|
+
/**
|
|
57628
|
+
* This extension allows you to add a placeholder to your editor.
|
|
57629
|
+
* A placeholder is a text that appears when the editor or a node is empty.
|
|
57630
|
+
* @see https://www.tiptap.dev/api/extensions/placeholder
|
|
57631
|
+
*/
|
|
57208
57632
|
const Placeholder = Extension.create({
|
|
57209
57633
|
name: 'placeholder',
|
|
57210
57634
|
addOptions() {
|
|
@@ -57273,6 +57697,10 @@ img.ProseMirror-separator {
|
|
|
57273
57697
|
},
|
|
57274
57698
|
});
|
|
57275
57699
|
|
|
57700
|
+
/**
|
|
57701
|
+
* This extension allows you to create text nodes.
|
|
57702
|
+
* @see https://www.tiptap.dev/api/nodes/text
|
|
57703
|
+
*/
|
|
57276
57704
|
const Text = Node$1.create({
|
|
57277
57705
|
name: 'text',
|
|
57278
57706
|
group: 'inline',
|
|
@@ -57327,6 +57755,10 @@ img.ProseMirror-separator {
|
|
|
57327
57755
|
}
|
|
57328
57756
|
|
|
57329
57757
|
const SuggestionPluginKey = new PluginKey('suggestion');
|
|
57758
|
+
/**
|
|
57759
|
+
* This utility allows you to create suggestions.
|
|
57760
|
+
* @see https://tiptap.dev/api/utilities/suggestion
|
|
57761
|
+
*/
|
|
57330
57762
|
function Suggestion({ pluginKey = SuggestionPluginKey, editor, char = '@', allowSpaces = false, allowedPrefixes = [' '], startOfLine = false, decorationTag = 'span', decorationClass = 'suggestion', command = () => null, items = () => [], render = () => ({}), allow = () => true, findSuggestionMatch: findSuggestionMatch$1 = findSuggestionMatch, }) {
|
|
57331
57763
|
let props;
|
|
57332
57764
|
const renderer = render === null || render === void 0 ? void 0 : render();
|
|
@@ -57503,7 +57935,15 @@ img.ProseMirror-separator {
|
|
|
57503
57935
|
return plugin;
|
|
57504
57936
|
}
|
|
57505
57937
|
|
|
57938
|
+
/**
|
|
57939
|
+
* The plugin key for the mention plugin.
|
|
57940
|
+
* @default 'mention'
|
|
57941
|
+
*/
|
|
57506
57942
|
const MentionPluginKey = new PluginKey('mention');
|
|
57943
|
+
/**
|
|
57944
|
+
* This extension allows you to insert mentions into the editor.
|
|
57945
|
+
* @see https://www.tiptap.dev/api/extensions/mention
|
|
57946
|
+
*/
|
|
57507
57947
|
const Mention = Node$1.create({
|
|
57508
57948
|
name: 'mention',
|
|
57509
57949
|
addOptions() {
|