@notectl/core 1.7.1 → 1.7.3
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.
- package/dist/chunks/{AttrRegistry-Ci0qAvtS.mjs → AttrRegistry-D9Jx_RVb.mjs} +2 -2
- package/dist/chunks/{AttrRegistry-Ci0qAvtS.mjs.map → AttrRegistry-D9Jx_RVb.mjs.map} +1 -1
- package/dist/chunks/AttributedMarkCommands-BtLea72z.mjs +80 -0
- package/dist/chunks/AttributedMarkCommands-BtLea72z.mjs.map +1 -0
- package/dist/chunks/{CaretNavigation-qLfeL0So.mjs → CaretNavigation-7JYpIKbs.mjs} +3 -3
- package/dist/chunks/{CaretNavigation-qLfeL0So.mjs.map → CaretNavigation-7JYpIKbs.mjs.map} +1 -1
- package/dist/chunks/{ColorGrid-BBkN0AOb.mjs → ColorGrid--lBQ7jCK.mjs} +56 -55
- package/dist/chunks/ColorGrid--lBQ7jCK.mjs.map +1 -0
- package/dist/chunks/{ColorPickerPopup-D3ysvOH-.mjs → ColorPickerPopup-TpIRlXc8.mjs} +15 -15
- package/dist/chunks/ColorPickerPopup-TpIRlXc8.mjs.map +1 -0
- package/dist/chunks/{Document-DfZ1NOjs.mjs → Document-Brtw2jL1.mjs} +6 -6
- package/dist/chunks/Document-Brtw2jL1.mjs.map +1 -0
- package/dist/chunks/{MarkCommands-uybmkw9l.mjs → MarkCommands-6RUJ4L3r.mjs} +3 -3
- package/dist/chunks/MarkCommands-6RUJ4L3r.mjs.map +1 -0
- package/dist/chunks/{NodeResolver-CzLmmrph.mjs → NodeResolver-C2XYkeOi.mjs} +2 -2
- package/dist/chunks/{NodeResolver-CzLmmrph.mjs.map → NodeResolver-C2XYkeOi.mjs.map} +1 -1
- package/dist/chunks/NodeSpec-NZVvcCuH.mjs.map +1 -1
- package/dist/chunks/PopupPositioning-CgjgAKjp.mjs +34 -0
- package/dist/chunks/PopupPositioning-CgjgAKjp.mjs.map +1 -0
- package/dist/chunks/RangeIterator-Bh4Vl_6D.mjs +16 -0
- package/dist/chunks/{RangeIterator-Bye0UtbY.mjs.map → RangeIterator-Bh4Vl_6D.mjs.map} +1 -1
- package/dist/chunks/StyleRuntime-CP4NCwKT.mjs +235 -0
- package/dist/chunks/StyleRuntime-CP4NCwKT.mjs.map +1 -0
- package/dist/chunks/ToolbarItem-BpZggUGo.mjs.map +1 -1
- package/dist/chunks/{index-Bt_d4IqB.mjs → index--7pBhSF4.mjs} +74 -73
- package/dist/chunks/index--7pBhSF4.mjs.map +1 -0
- package/dist/chunks/{index-DayTn6Re.mjs → index-BXCkjDax.mjs} +78 -83
- package/dist/chunks/index-BXCkjDax.mjs.map +1 -0
- package/dist/chunks/{index-DGKQhSAl.mjs → index-BXtw5PNN.mjs} +2 -2
- package/dist/chunks/{index-DGKQhSAl.mjs.map → index-BXtw5PNN.mjs.map} +1 -1
- package/dist/chunks/{ToolbarPlugin-B7oJRzpl.mjs → index-BcDRT4K2.mjs} +110 -121
- package/dist/chunks/index-BcDRT4K2.mjs.map +1 -0
- package/dist/chunks/{index-DoCvDkfj.mjs → index-BjFBWBOC.mjs} +23 -25
- package/dist/chunks/index-BjFBWBOC.mjs.map +1 -0
- package/dist/chunks/{index-CrKz_IEn.mjs → index-C1opJocO.mjs} +2 -2
- package/dist/chunks/{index-CrKz_IEn.mjs.map → index-C1opJocO.mjs.map} +1 -1
- package/dist/chunks/{index-CfyS_pgH.mjs → index-CCyqQ0Dz.mjs} +32 -31
- package/dist/chunks/index-CCyqQ0Dz.mjs.map +1 -0
- package/dist/chunks/{index-E7OgN7hM.mjs → index-Cd3uJLP3.mjs} +2 -2
- package/dist/chunks/{index-E7OgN7hM.mjs.map → index-Cd3uJLP3.mjs.map} +1 -1
- package/dist/chunks/{index-yhz2qeeh.mjs → index-DSAuGP4n.mjs} +131 -127
- package/dist/chunks/index-DSAuGP4n.mjs.map +1 -0
- package/dist/chunks/{index-CH1r7DL-.mjs → index-DtRfqsq5.mjs} +211 -210
- package/dist/chunks/index-DtRfqsq5.mjs.map +1 -0
- package/dist/chunks/{index-CFPP456m.mjs → index-DxbQirny.mjs} +8 -8
- package/dist/chunks/{index-CFPP456m.mjs.map → index-DxbQirny.mjs.map} +1 -1
- package/dist/chunks/{index-DuRNETFv.mjs → index-ErZ5_a1o.mjs} +3 -3
- package/dist/chunks/{index-DuRNETFv.mjs.map → index-ErZ5_a1o.mjs.map} +1 -1
- package/dist/chunks/{index-Deag_lVi.mjs → index-WpbK_s_H.mjs} +29 -31
- package/dist/chunks/index-WpbK_s_H.mjs.map +1 -0
- package/dist/chunks/{index-DIvHQtE2.mjs → index-WrqH1wG8.mjs} +15 -14
- package/dist/chunks/index-WrqH1wG8.mjs.map +1 -0
- package/dist/chunks/{index-Dy6SllXW.mjs → index-fsVJLutn.mjs} +3 -3
- package/dist/chunks/{index-Dy6SllXW.mjs.map → index-fsVJLutn.mjs.map} +1 -1
- package/dist/chunks/{index-Ckzqtn5D.mjs → index-fx3KIap3.mjs} +15 -14
- package/dist/chunks/index-fx3KIap3.mjs.map +1 -0
- package/dist/chunks/{index-DmuuFS5D.mjs → index-oOJo-ywB.mjs} +4 -4
- package/dist/chunks/{index-DmuuFS5D.mjs.map → index-oOJo-ywB.mjs.map} +1 -1
- package/dist/chunks/{index-CFJFD4lF.mjs → index-toj88jtL.mjs} +19 -18
- package/dist/chunks/index-toj88jtL.mjs.map +1 -0
- package/dist/commands/AttributedMarkCommands.d.ts.map +1 -1
- package/dist/commands/MarkCommands.d.ts +3 -3
- package/dist/commands/MarkCommands.d.ts.map +1 -1
- package/dist/editor/CSSClassCollector.d.ts +36 -0
- package/dist/editor/CSSClassCollector.d.ts.map +1 -0
- package/dist/editor/ContentHTMLTypes.d.ts +29 -0
- package/dist/editor/ContentHTMLTypes.d.ts.map +1 -0
- package/dist/editor/ContentStyleInjector.d.ts +69 -0
- package/dist/editor/ContentStyleInjector.d.ts.map +1 -0
- package/dist/editor/DocumentParser.d.ts +9 -1
- package/dist/editor/DocumentParser.d.ts.map +1 -1
- package/dist/editor/DocumentSerializer.d.ts +6 -0
- package/dist/editor/DocumentSerializer.d.ts.map +1 -1
- package/dist/editor/EditorThemeController.d.ts +3 -0
- package/dist/editor/EditorThemeController.d.ts.map +1 -1
- package/dist/editor/MarkSerializer.d.ts +7 -0
- package/dist/editor/MarkSerializer.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +13 -3
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/PaperLayoutController.d.ts.map +1 -1
- package/dist/editor/styles/font-select.d.ts +1 -1
- package/dist/editor/styles/font-select.d.ts.map +1 -1
- package/dist/editor/styles/font-size-select.d.ts +1 -1
- package/dist/editor/styles/font-size-select.d.ts.map +1 -1
- package/dist/editor/styles/heading-select.d.ts +1 -1
- package/dist/editor/styles/heading-select.d.ts.map +1 -1
- package/dist/editor/styles/toolbar.d.ts +1 -1
- package/dist/editor/styles/toolbar.d.ts.map +1 -1
- package/dist/index.d.ts +10 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/input/LegacyHTMLNormalizer.d.ts.map +1 -1
- package/dist/model/Document.d.ts +0 -4
- package/dist/model/Document.d.ts.map +1 -1
- package/dist/model/NodeSpec.d.ts +19 -2
- package/dist/model/NodeSpec.d.ts.map +1 -1
- package/dist/notectl-core.mjs +613 -477
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +1571 -1225
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block/CodeBlockNodeView.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts +0 -1
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
- package/dist/plugins/code-block/index.d.ts +2 -1
- package/dist/plugins/code-block/index.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font/FontPlugin.d.ts +0 -1
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePlugin.d.ts +0 -2
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePopup.d.ts +3 -1
- package/dist/plugins/font-size/FontSizePopup.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/gap-cursor.mjs +6 -6
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading/HeadingBlockTypePicker.d.ts.map +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image/ImageNodeView.d.ts.map +1 -1
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print/PrintContentPreparer.d.ts.map +1 -1
- package/dist/plugins/shared/ColorGrid.d.ts.map +1 -1
- package/dist/plugins/shared/ColorPickerPopup.d.ts +2 -1
- package/dist/plugins/shared/ColorPickerPopup.d.ts.map +1 -1
- package/dist/plugins/shared/PopupManager.d.ts +12 -2
- package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
- package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/super-sub.mjs +1 -1
- package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
- package/dist/plugins/table/TableControls.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsLayout.d.ts.map +1 -1
- package/dist/plugins/table/TableNodeViews.d.ts.map +1 -1
- package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
- package/dist/plugins/table.mjs +1 -1
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
- package/dist/plugins/text-color.mjs +1 -1
- package/dist/plugins/text-formatting.mjs +1 -1
- package/dist/plugins/toolbar/ToolbarItem.d.ts +3 -2
- package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts +0 -3
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarRenderers.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarTooltip.d.ts.map +1 -1
- package/dist/plugins/toolbar.mjs +2 -2
- package/dist/presets/PresetTypes.d.ts +1 -1
- package/dist/presets/PresetTypes.d.ts.map +1 -1
- package/dist/style/StyleRuntime.d.ts +34 -0
- package/dist/style/StyleRuntime.d.ts.map +1 -0
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/AttributedMarkCommands-BETuHXj8.mjs +0 -58
- package/dist/chunks/AttributedMarkCommands-BETuHXj8.mjs.map +0 -1
- package/dist/chunks/ColorGrid-BBkN0AOb.mjs.map +0 -1
- package/dist/chunks/ColorPickerPopup-D3ysvOH-.mjs.map +0 -1
- package/dist/chunks/Document-DfZ1NOjs.mjs.map +0 -1
- package/dist/chunks/MarkCommands-uybmkw9l.mjs.map +0 -1
- package/dist/chunks/PopupPositioning-Cn6L_mO2.mjs +0 -30
- package/dist/chunks/PopupPositioning-Cn6L_mO2.mjs.map +0 -1
- package/dist/chunks/RangeIterator-Bye0UtbY.mjs +0 -16
- package/dist/chunks/ToolbarPlugin-B7oJRzpl.mjs.map +0 -1
- package/dist/chunks/index-Bt_d4IqB.mjs.map +0 -1
- package/dist/chunks/index-CFJFD4lF.mjs.map +0 -1
- package/dist/chunks/index-CH1r7DL-.mjs.map +0 -1
- package/dist/chunks/index-CfyS_pgH.mjs.map +0 -1
- package/dist/chunks/index-Ckzqtn5D.mjs.map +0 -1
- package/dist/chunks/index-DIvHQtE2.mjs.map +0 -1
- package/dist/chunks/index-DayTn6Re.mjs.map +0 -1
- package/dist/chunks/index-Deag_lVi.mjs.map +0 -1
- package/dist/chunks/index-DoCvDkfj.mjs.map +0 -1
- package/dist/chunks/index-yhz2qeeh.mjs.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime style abstraction.
|
|
3
|
+
*
|
|
4
|
+
* Writes no inline styles and instead assigns token attributes
|
|
5
|
+
* backed by dynamic CSS rules in a stylesheet.
|
|
6
|
+
* Elements outside a registered root fall back to inline styles.
|
|
7
|
+
*/
|
|
8
|
+
export interface StyleRootOptions {
|
|
9
|
+
readonly nonce?: string;
|
|
10
|
+
readonly sheet?: CSSStyleSheet | null;
|
|
11
|
+
}
|
|
12
|
+
type StyleRoot = ShadowRoot | Document;
|
|
13
|
+
/** Creates a constructable stylesheet when the environment supports it. */
|
|
14
|
+
export declare function createRuntimeStyleSheet(): CSSStyleSheet | null;
|
|
15
|
+
/** Registers styling mode for a root (shadow root or document). */
|
|
16
|
+
export declare function registerStyleRoot(root: StyleRoot, options: StyleRootOptions): void;
|
|
17
|
+
/** Unregisters root styling and tears down strict runtime state if present. */
|
|
18
|
+
export declare function unregisterStyleRoot(root: StyleRoot): void;
|
|
19
|
+
/** Sets a single style property. Empty value removes the property. */
|
|
20
|
+
export declare function setStyleProperty(el: HTMLElement, property: string, value: string): void;
|
|
21
|
+
/** Removes a single style property. */
|
|
22
|
+
export declare function removeStyleProperty(el: HTMLElement, property: string): void;
|
|
23
|
+
/** Sets multiple style properties in one call. */
|
|
24
|
+
export declare function setStyleProperties(el: HTMLElement, properties: Readonly<Record<string, string | undefined | null>>): void;
|
|
25
|
+
/** Replaces the element style text. */
|
|
26
|
+
export declare function setStyleText(el: HTMLElement, cssText: string): void;
|
|
27
|
+
/** Merges a cssText fragment into current element styles. */
|
|
28
|
+
export declare function appendStyleText(el: HTMLElement, cssText: string): void;
|
|
29
|
+
/** Returns serialized styles for an element. */
|
|
30
|
+
export declare function getStyleText(el: HTMLElement): string;
|
|
31
|
+
/** Returns the configured CSP nonce for the node's style root (if any). */
|
|
32
|
+
export declare function getStyleNonceForNode(node: Node): string | undefined;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=StyleRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StyleRuntime.d.ts","sourceRoot":"","sources":["../../src/style/StyleRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;CACtC;AAED,KAAK,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAavC,2EAA2E;AAC3E,wBAAgB,uBAAuB,IAAI,aAAa,GAAG,IAAI,CAO9D;AAED,mEAAmE;AACnE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAUlF;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAOzD;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAOvF;AAED,uCAAuC;AACvC,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAE3E;AAED,kDAAkD;AAClD,wBAAgB,kBAAkB,CACjC,EAAE,EAAE,WAAW,EACf,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC,GAC7D,IAAI,CASN;AAED,uCAAuC;AACvC,wBAAgB,YAAY,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAOnE;AAED,6DAA6D;AAC7D,wBAAgB,eAAe,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAQtE;AAED,gDAAgD;AAChD,wBAAgB,YAAY,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAIpD;AAED,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAInE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Reconciler.d.ts","sourceRoot":"","sources":["../../src/view/Reconciler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAA+B,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAClG,OAAO,EAAE,KAAK,aAAa,EAAyB,MAAM,8BAA8B,CAAC;AAEzF,OAAO,KAAK,EAAE,SAAS,EAAwB,MAAM,sBAAsB,CAAC;AAW5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"Reconciler.d.ts","sourceRoot":"","sources":["../../src/view/Reconciler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAA+B,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAClG,OAAO,EAAE,KAAK,aAAa,EAAyB,MAAM,8BAA8B,CAAC;AAEzF,OAAO,KAAK,EAAE,SAAS,EAAwB,MAAM,sBAAsB,CAAC;AAW5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4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QAAQ,CAAC,EAAE,cAAc,EACzB,WAAW,CAAC,EAAE,SAAS,gBAAgB,EAAE,GACvC,IAAI,CAyCN"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notectl/core",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "A modern and accessible rich text editor shipped as a single Web Component. Immutable state, transaction-based architecture, and a plugin system that powers every feature.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { i as t } from "./AttrRegistry-Ci0qAvtS.mjs";
|
|
2
|
-
import { g as r, h as n } from "./Document-DfZ1NOjs.mjs";
|
|
3
|
-
import { i as o, a as e, b as s, s as c } from "./Selection-BRTab5hO.mjs";
|
|
4
|
-
import { m as a } from "./TypeBrands-C09nE2qO.mjs";
|
|
5
|
-
import { f as i } from "./RangeIterator-Bye0UtbY.mjs";
|
|
6
|
-
function l(t2, n2) {
|
|
7
|
-
const l2 = t2.selection;
|
|
8
|
-
if (o(l2) || e(l2)) return null;
|
|
9
|
-
const u2 = a(n2.type);
|
|
10
|
-
if (s(l2)) {
|
|
11
|
-
const o2 = t2.getBlock(l2.anchor.blockId);
|
|
12
|
-
if (!o2) return null;
|
|
13
|
-
const e2 = [...(t2.storedMarks ?? r(o2, l2.anchor.offset)).filter((t3) => t3.type !== u2), n2];
|
|
14
|
-
return t2.transaction("command").setStoredMarks(e2, t2.storedMarks).setSelection(l2).build();
|
|
15
|
-
}
|
|
16
|
-
const f2 = c(l2, t2.getBlockOrder()), m2 = t2.transaction("command");
|
|
17
|
-
return i(t2, f2, (t3, r2, o2) => {
|
|
18
|
-
m2.removeMark(t3, r2, o2, { type: u2 }), m2.addMark(t3, r2, o2, n2);
|
|
19
|
-
}), m2.setSelection(l2), m2.build();
|
|
20
|
-
}
|
|
21
|
-
function u(t2, a2) {
|
|
22
|
-
const l2 = t2.selection;
|
|
23
|
-
if (o(l2) || e(l2)) return null;
|
|
24
|
-
if (s(l2)) {
|
|
25
|
-
const o2 = t2.getBlock(l2.anchor.blockId);
|
|
26
|
-
if (!o2) return null;
|
|
27
|
-
const e2 = t2.storedMarks ?? r(o2, l2.anchor.offset);
|
|
28
|
-
if (!n(e2, a2)) return null;
|
|
29
|
-
const s2 = e2.filter((t3) => t3.type !== a2);
|
|
30
|
-
return t2.transaction("command").setStoredMarks(s2, t2.storedMarks).setSelection(l2).build();
|
|
31
|
-
}
|
|
32
|
-
const u2 = c(l2, t2.getBlockOrder()), f2 = t2.transaction("command");
|
|
33
|
-
return i(t2, u2, (t3, r2, n2) => {
|
|
34
|
-
f2.removeMark(t3, r2, n2, { type: a2 });
|
|
35
|
-
}), f2.setSelection(l2), f2.build();
|
|
36
|
-
}
|
|
37
|
-
function f(n2, c2, a2) {
|
|
38
|
-
const i2 = n2.selection;
|
|
39
|
-
if (o(i2) || e(i2)) return null;
|
|
40
|
-
if (s(i2) && n2.storedMarks) {
|
|
41
|
-
const r2 = n2.storedMarks.find((t2) => t2.type === c2);
|
|
42
|
-
return r2 && t(r2, c2) ? a2(r2) : null;
|
|
43
|
-
}
|
|
44
|
-
const l2 = n2.getBlock(i2.anchor.blockId);
|
|
45
|
-
if (!l2) return null;
|
|
46
|
-
const u2 = r(l2, i2.anchor.offset).find((t2) => t2.type === c2);
|
|
47
|
-
return u2 && t(u2, c2) ? a2(u2) : null;
|
|
48
|
-
}
|
|
49
|
-
function m(t2, r2) {
|
|
50
|
-
return null !== f(t2, r2, () => true);
|
|
51
|
-
}
|
|
52
|
-
export {
|
|
53
|
-
l as a,
|
|
54
|
-
f as g,
|
|
55
|
-
m as i,
|
|
56
|
-
u as r
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=AttributedMarkCommands-BETuHXj8.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AttributedMarkCommands-BETuHXj8.mjs","sources":["../../src/commands/AttributedMarkCommands.ts"],"sourcesContent":["/**\n * Generic helpers for attributed marks (marks with key/value attrs).\n *\n * Unlike boolean marks (`bold`, `italic`) that toggle on/off, attributed\n * marks (`font`, `fontSize`, `textColor`, `highlight`) carry data and use\n * **replace** semantics: applying a new value removes the old one first.\n *\n * These helpers extract the duplicated collapsed-vs-range branching that\n * was previously copy-pasted across ColorMarkOperations, FontSizeOperations,\n * and FontPlugin.\n */\n\nimport { isMarkOfType } from '../model/AttrRegistry.js';\nimport type { MarkAttrRegistry } from '../model/AttrRegistry.js';\nimport type { Mark } from '../model/Document.js';\nimport { getBlockMarksAtOffset, hasMark } from '../model/Document.js';\nimport { isCollapsed, isGapCursor, isNodeSelection, selectionRange } from '../model/Selection.js';\nimport { markType } from '../model/TypeBrands.js';\nimport type { MarkTypeName } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { forEachBlockInRange } from './RangeIterator.js';\n\n/**\n * Applies an attributed mark to the current selection.\n *\n * - **Collapsed cursor**: replaces stored marks (filters out old mark of the\n * same type, appends the new one).\n * - **Range selection**: removes then re-adds the mark in every block span.\n *\n * Returns the built `Transaction`, or `null` when the selection is\n * unsupported (node-selection / gap-cursor) or the anchor block is missing.\n */\nexport function applyAttributedMark(state: EditorState, mark: Mark): Transaction | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\n\tconst typeName: MarkTypeName = markType(mark.type as string);\n\n\tif (isCollapsed(sel)) {\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks: readonly Mark[] =\n\t\t\tstate.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\tconst withoutMark: readonly Mark[] = currentMarks.filter((m) => m.type !== typeName);\n\t\tconst newMarks: readonly Mark[] = [...withoutMark, mark];\n\n\t\treturn state\n\t\t\t.transaction('command')\n\t\t\t.setStoredMarks(newMarks, state.storedMarks)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t}\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tbuilder.removeMark(blockId, from, to, { type: typeName });\n\t\tbuilder.addMark(blockId, from, to, mark);\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\n/**\n * Removes an attributed mark from the current selection.\n *\n * - **Collapsed cursor**: filters the mark out of stored marks.\n * Returns `null` when the mark was not present.\n * - **Range selection**: removes the mark across all block spans.\n *\n * Returns the built `Transaction`, or `null` when the selection is\n * unsupported or the mark is absent at a collapsed cursor.\n */\nexport function removeAttributedMark(\n\tstate: EditorState,\n\tmarkTypeName: MarkTypeName,\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\n\tif (isCollapsed(sel)) {\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks: readonly Mark[] =\n\t\t\tstate.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\tif (!hasMark(currentMarks, markTypeName)) return null;\n\n\t\tconst newMarks: readonly Mark[] = currentMarks.filter((m) => m.type !== markTypeName);\n\t\treturn state\n\t\t\t.transaction('command')\n\t\t\t.setStoredMarks(newMarks, state.storedMarks)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t}\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tbuilder.removeMark(blockId, from, to, { type: markTypeName });\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\n/**\n * Extracts a typed attribute value from the mark at the current selection.\n *\n * Looks at stored marks (collapsed w/ stored), block marks at cursor offset\n * (collapsed w/o stored), or anchor-block marks (range).\n *\n * @param extractFn — Narrows the found mark and returns the desired value,\n * or `null` when the mark's attrs don't match expectations.\n */\nexport function getMarkAttrAtSelection<K extends keyof MarkAttrRegistry, V>(\n\tstate: EditorState,\n\tmarkTypeName: K,\n\textractFn: (mark: Mark & { readonly type: K; readonly attrs: MarkAttrRegistry[K] }) => V | null,\n): V | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\n\tif (isCollapsed(sel) && state.storedMarks) {\n\t\tconst found = state.storedMarks.find((m) => (m.type as string) === markTypeName);\n\t\treturn found && isMarkOfType(found, markTypeName) ? extractFn(found) : null;\n\t}\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\tconst marks: readonly Mark[] = getBlockMarksAtOffset(block, sel.anchor.offset);\n\tconst found = marks.find((m) => (m.type as string) === markTypeName);\n\treturn found && isMarkOfType(found, markTypeName) ? extractFn(found) : null;\n}\n\n/**\n * Returns `true` when the given attributed mark type is present at the\n * current selection (collapsed or range).\n */\nexport function isAttributedMarkActive<K extends keyof MarkAttrRegistry>(\n\tstate: EditorState,\n\tmarkTypeName: K,\n): boolean {\n\treturn getMarkAttrAtSelection(state, markTypeName, () => true as const) !== null;\n}\n"],"names":["applyAttributedMark","state","mark","sel","selection","isNodeSelection","isGapCursor","typeName","markType","type","isCollapsed","anchorBlock","getBlock","anchor","blockId","newMarks","storedMarks","getBlockMarksAtOffset","offset","filter","m","transaction","setStoredMarks","setSelection","build","range","selectionRange","getBlockOrder","builder","forEachBlockInRange","from","to","removeMark","addMark","removeAttributedMark","markTypeName","currentMarks","hasMark","getMarkAttrAtSelection","extractFn","found","find","isMarkOfType","block","isAttributedMarkActive"],"mappings":";;;;;AAiCO,SAASA,EAAoBC,IAAoBC,IAAAA;AACvD,QAAMC,KAAMF,GAAMG;AAClB,MAAIC,EAAgBF,EAAAA,KAAQG,EAAYH,EAAAA,EAAM,QAAO;AAErD,QAAMI,KAAyBC,EAASN,GAAK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AUd,GAAMe,WAAAA,EAC/BO,aAAapB,EAAAA,EACbqB;EACH;AAEA,QAAMC,KAAQC,EAAevB,IAAKF,GAAM0B,cAAAA,CAAAA,GAClCC,KAAU3B,GAAMoB,YAAY,SAAA;AAOlC,SALAQ,EAAoB5B,IAAOwB,IAAO,CAACX,IAASgB,IAAMC;AACjDH,IAAAA,GAAQI,WAAWlB,IAASgB,IAAMC,IAAI,EAAEtB,MAAM0B,GAAAA,CAAAA;AAAAA,EAAAA,CAAAA,GAG/CP,GAAQL,aAAapB,EAAAA,GACdyB,GAAQJ,MAAAA;AAChB;AAWO,SAASc,EACfrC,IACAkC,IACAI;AAEA,QAAMpC,KAAMF,GAAMG;AAClB,MAAIC,EAAgBF,EAAAA,KAAQG,EAAYH,EAAAA,EAAM,QAAO;AAErD,MAAIO,EAAYP,OAAQF,GAAMe,aAAa;AAC1C,UAAMwB,KAAQvC,GAAMe,YAAYyB,KAAMrB,CAAAA,OAAOA,GAAEX,SAAoB0B,EAAAA;AACnE,WAAOK,MAASE,EAAaF,IAAOL,EAAAA,IAAgBI,GAAUC,MAAS;AAAA,EACxE;AAEA,QAAMG,KAAQ1C,GAAMW,SAAST,GAAIU,OAAOC,OAAAA;AACxC,OAAK6B,GAAO,QAAO;AACnB,QACMH,KADyBvB,EAAsB0B,IAAOxC,GAAIU,OAAOK,MAAAA,EACnDuB,KAAMrB,CAAAA,OAAOA,GAAEX,SAAoB0B,EAAAA;AACvD,SAAOK,MAASE,EAAaF,IAAOL,EAAAA,IAAgBI,GAAUC,EAAAA,IAAS;AACxE;AAMO,SAASI,EACf3C,IACAkC;AAEA,SAA4E,SAArEG,EAAuBrC,IAAOkC,IAAc,MAAA,IAAM;AAC1D;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColorGrid-BBkN0AOb.mjs","sources":["../../src/plugins/shared/ColorNames.ts","../../src/plugins/shared/ColorGrid.ts"],"sourcesContent":["/**\n * Human-readable color name lookup for accessibility.\n *\n * Provides descriptive names for color swatches so screen readers\n * announce \"Red\" instead of \"#ff0000\". Covers all default palette\n * colors with a fallback algorithm for custom hex values.\n */\n\n// ---------------------------------------------------------------------------\n// Static name map — covers every default palette color\n// ---------------------------------------------------------------------------\n\nconst COLOR_NAME_MAP: ReadonlyMap<string, string> = new Map([\n\t// ── TextColor palette (70 colors) ──────────────────────────────────────\n\n\t// Row 1 — Grays\n\t['#000000', 'Black'],\n\t['#434343', 'Dark Gray 4'],\n\t['#666666', 'Dark Gray 3'],\n\t['#999999', 'Dark Gray 2'],\n\t['#b7b7b7', 'Dark Gray 1'],\n\t['#cccccc', 'Light Gray 3'],\n\t['#d9d9d9', 'Light Gray 2'],\n\t['#efefef', 'Light Gray 1'],\n\t['#f3f3f3', 'Near White'],\n\t['#ffffff', 'White'],\n\n\t// Row 2 — Vivid\n\t['#980000', 'Dark Red Berry'],\n\t['#ff0000', 'Red'],\n\t['#ff9900', 'Orange'],\n\t['#ffff00', 'Yellow'],\n\t['#00ff00', 'Green'],\n\t['#00ffff', 'Cyan'],\n\t['#4a86e8', 'Cornflower Blue'],\n\t['#0000ff', 'Blue'],\n\t['#9900ff', 'Purple'],\n\t['#ff00ff', 'Magenta'],\n\n\t// Row 3 — Light 3 (lightest tint)\n\t['#e6b8af', 'Light Red Berry 3'],\n\t['#f4cccc', 'Light Red 3'],\n\t['#fce5cd', 'Light Orange 3'],\n\t['#fff2cc', 'Light Yellow 3'],\n\t['#d9ead3', 'Light Green 3'],\n\t['#d0e0e3', 'Light Cyan 3'],\n\t['#c9daf8', 'Light Cornflower Blue 3'],\n\t['#cfe2f3', 'Light Blue 3'],\n\t['#d9d2e9', 'Light Purple 3'],\n\t['#ead1dc', 'Light Magenta 3'],\n\n\t// Row 4 — Light 2\n\t['#dd7e6b', 'Light Red Berry 2'],\n\t['#ea9999', 'Light Red 2'],\n\t['#f9cb9c', 'Light Orange 2'],\n\t['#ffe599', 'Light Yellow 2'],\n\t['#b6d7a8', 'Light Green 2'],\n\t['#a2c4c9', 'Light Cyan 2'],\n\t['#a4c2f4', 'Light Cornflower Blue 2'],\n\t['#9fc5e8', 'Light Blue 2'],\n\t['#b4a7d6', 'Light Purple 2'],\n\t['#d5a6bd', 'Light Magenta 2'],\n\n\t// Row 5 — Light 1\n\t['#cc4125', 'Light Red Berry 1'],\n\t['#e06666', 'Light Red 1'],\n\t['#f6b26b', 'Light Orange 1'],\n\t['#ffd966', 'Light Yellow 1'],\n\t['#93c47d', 'Light Green 1'],\n\t['#76a5af', 'Light Cyan 1'],\n\t['#6d9eeb', 'Light Cornflower Blue 1'],\n\t['#6fa8dc', 'Light Blue 1'],\n\t['#8e7cc3', 'Light Purple 1'],\n\t['#c27ba0', 'Light Magenta 1'],\n\n\t// Row 6 — Dark 1\n\t['#a61c00', 'Dark Red Berry 1'],\n\t['#cc0000', 'Dark Red 1'],\n\t['#e69138', 'Dark Orange 1'],\n\t['#f1c232', 'Dark Yellow 1'],\n\t['#6aa84f', 'Dark Green 1'],\n\t['#45818e', 'Dark Cyan 1'],\n\t['#3c78d8', 'Dark Cornflower Blue 1'],\n\t['#3d85c6', 'Dark Blue 1'],\n\t['#674ea7', 'Dark Purple 1'],\n\t['#a64d79', 'Dark Magenta 1'],\n\n\t// Row 7 — Dark 2\n\t['#85200c', 'Dark Red Berry 2'],\n\t['#990000', 'Dark Red 2'],\n\t['#b45f06', 'Dark Orange 2'],\n\t['#bf9000', 'Dark Yellow 2'],\n\t['#38761d', 'Dark Green 2'],\n\t['#134f5c', 'Dark Cyan 2'],\n\t['#1155cc', 'Dark Cornflower Blue 2'],\n\t['#0b5394', 'Dark Blue 2'],\n\t['#351c75', 'Dark Purple 2'],\n\t['#741b47', 'Dark Magenta 2'],\n\n\t// ── Highlight palette (50 colors, minus duplicates) ────────────────────\n\n\t// Row 1 — Classic highlighter (bright, vivid)\n\t['#fff176', 'Bright Yellow'],\n\t['#aed581', 'Light Green'],\n\t['#4dd0e1', 'Bright Cyan'],\n\t['#64b5f6', 'Sky Blue'],\n\t['#ce93d8', 'Lavender'],\n\t['#f48fb1', 'Pink'],\n\t['#ffab91', 'Peach'],\n\t['#ff8a65', 'Coral'],\n\t['#e6ee9c', 'Lime'],\n\t['#80cbc4', 'Teal'],\n\n\t// Row 2 — Light pastels\n\t['#fff9c4', 'Pale Yellow'],\n\t['#dcedc8', 'Pale Green'],\n\t['#e0f7fa', 'Pale Cyan'],\n\t['#e3f2fd', 'Pale Blue'],\n\t['#f3e5f5', 'Pale Purple'],\n\t['#fce4ec', 'Pale Pink'],\n\t['#fff3e0', 'Pale Orange'],\n\t['#fbe9e7', 'Pale Red'],\n\t['#f9fbe7', 'Pale Lime'],\n\t['#e0f2f1', 'Pale Teal'],\n\n\t// Row 3 — Medium pastels\n\t['#fff59d', 'Soft Yellow'],\n\t['#c5e1a5', 'Soft Green'],\n\t['#80deea', 'Soft Cyan'],\n\t['#90caf9', 'Soft Blue'],\n\t['#e1bee7', 'Soft Purple'],\n\t['#f8bbd0', 'Soft Pink'],\n\t['#ffcc80', 'Soft Orange'],\n\t// #ffab91 duplicate → Peach (already mapped)\n\t// #e6ee9c duplicate → Lime (already mapped)\n\t['#a5d6a7', 'Mint'],\n\n\t// Row 4 — Bold pastels\n\t['#ffee58', 'Vivid Yellow'],\n\t['#9ccc65', 'Vivid Green'],\n\t['#26c6da', 'Vivid Cyan'],\n\t['#42a5f5', 'Vivid Blue'],\n\t['#ab47bc', 'Vivid Purple'],\n\t['#ec407a', 'Vivid Pink'],\n\t['#ffa726', 'Vivid Orange'],\n\t['#ff7043', 'Red Orange'],\n\t['#d4e157', 'Vivid Lime'],\n\t['#66bb6a', 'Emerald'],\n\n\t// Row 5 — Grays and neutral highlights\n\t// #ffffff duplicate → White (already mapped)\n\t['#fafafa', 'Almost White'],\n\t['#f5f5f5', 'Lightest Gray'],\n\t['#eeeeee', 'Very Light Gray'],\n\t['#e0e0e0', 'Silver'],\n\t['#bdbdbd', 'Medium Gray'],\n\t['#e8eaf6', 'Lavender Gray'],\n\t['#efebe9', 'Warm Gray'],\n\t['#eceff1', 'Cool Gray'],\n\t// #fafafa duplicate → Almost White (already mapped)\n]);\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Returns a human-readable name for a hex color.\n *\n * Checks the static map first, then falls back to a computed\n * description based on hue, saturation, and lightness.\n */\nexport function getColorName(hex: string): string {\n\tconst name: string | undefined = COLOR_NAME_MAP.get(hex.toLowerCase());\n\tif (name) return name;\n\treturn describeColor(hex);\n}\n\n/**\n * Determines whether a color is light enough to need a visible\n * border when rendered on a white background (WCAG 1.4.11).\n *\n * Uses a contrast-ratio threshold of 3:1 against white.\n */\nexport function isLightColor(hex: string): boolean {\n\tconst luminance: number = relativeLuminance(hex);\n\t// Contrast ratio against white: (1.05) / (L + 0.05) < 3\n\t// ⟹ L > 1.05/3 − 0.05 = 0.3\n\tconst LIGHT_THRESHOLD = 0.3;\n\treturn luminance > LIGHT_THRESHOLD;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/** Expands `#RGB` to `#RRGGBB` and lowercases. */\nfunction normalizeHex(hex: string): string {\n\tconst h: string = hex.toLowerCase();\n\tif (h.length === 4) {\n\t\treturn `#${h[1]}${h[1]}${h[2]}${h[2]}${h[3]}${h[3]}`;\n\t}\n\treturn h;\n}\n\n/** Applies sRGB linearization to a single channel value (0–1). */\nfunction linearize(channel: number): number {\n\treturn channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;\n}\n\n/** Computes WCAG relative luminance from a hex color. */\nfunction relativeLuminance(hex: string): number {\n\tconst normalized: string = normalizeHex(hex);\n\tconst r: number = linearize(Number.parseInt(normalized.slice(1, 3), 16) / 255);\n\tconst g: number = linearize(Number.parseInt(normalized.slice(3, 5), 16) / 255);\n\tconst b: number = linearize(Number.parseInt(normalized.slice(5, 7), 16) / 255);\n\treturn 0.2126 * r + 0.7152 * g + 0.0722 * b;\n}\n\n/** Hue boundary table: upper bound (degrees) → name. */\nconst HUE_NAMES: readonly (readonly [number, string])[] = [\n\t[15, 'Red'],\n\t[45, 'Orange'],\n\t[65, 'Yellow'],\n\t[150, 'Green'],\n\t[190, 'Cyan'],\n\t[250, 'Blue'],\n\t[290, 'Purple'],\n\t[330, 'Pink'],\n\t[361, 'Red'],\n];\n\n/**\n * Generates a descriptive name from a hex color using HSL analysis.\n * Produces names like \"Dark Blue\", \"Light Green\", or \"Gray\".\n */\nfunction describeColor(hex: string): string {\n\tconst normalized: string = normalizeHex(hex);\n\tconst rRaw: number = Number.parseInt(normalized.slice(1, 3), 16) / 255;\n\tconst gRaw: number = Number.parseInt(normalized.slice(3, 5), 16) / 255;\n\tconst bRaw: number = Number.parseInt(normalized.slice(5, 7), 16) / 255;\n\n\tconst max: number = Math.max(rRaw, gRaw, bRaw);\n\tconst min: number = Math.min(rRaw, gRaw, bRaw);\n\tconst lightness: number = (max + min) / 2;\n\tconst delta: number = max - min;\n\n\t// Achromatic\n\tif (delta < 0.05) {\n\t\tif (lightness < 0.15) return 'Black';\n\t\tif (lightness < 0.35) return 'Dark Gray';\n\t\tif (lightness < 0.65) return 'Gray';\n\t\tif (lightness < 0.85) return 'Light Gray';\n\t\treturn 'Near White';\n\t}\n\n\t// Compute hue in degrees\n\tlet hue = 0;\n\tif (max === rRaw) {\n\t\thue = ((gRaw - bRaw) / delta + (gRaw < bRaw ? 6 : 0)) * 60;\n\t} else if (max === gRaw) {\n\t\thue = ((bRaw - rRaw) / delta + 2) * 60;\n\t} else {\n\t\thue = ((rRaw - gRaw) / delta + 4) * 60;\n\t}\n\n\t// Look up hue name\n\tlet hueName = 'Red';\n\tfor (const [threshold, name] of HUE_NAMES) {\n\t\tif (hue < threshold) {\n\t\t\thueName = name;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Lightness modifier\n\tif (lightness < 0.25) return `Very Dark ${hueName}`;\n\tif (lightness < 0.4) return `Dark ${hueName}`;\n\tif (lightness > 0.8) return `Very Light ${hueName}`;\n\tif (lightness > 0.65) return `Light ${hueName}`;\n\treturn hueName;\n}\n","/**\n * Shared color grid rendering with WAI-ARIA grid pattern and keyboard\n * navigation. Used by ColorPickerPopup (text-color, highlight) and\n * TableBorderColor.\n */\n\nimport { applyRovingTabindex, navigateGrid } from '../toolbar/ToolbarKeyboardNav.js';\nimport { getColorName, isLightColor } from './ColorNames.js';\n\n// --- Types ---\n\nexport interface ColorGridConfig {\n\treadonly colors: readonly string[];\n\treadonly columns: number;\n\treadonly ariaLabel: string;\n\treadonly ariaLabelPrefix: string;\n\treadonly activeColor: string | null;\n\treadonly onSelect: (color: string) => void;\n\treadonly onClose: () => void;\n\t/** Optional custom label formatter for swatch aria-labels. Defaults to `${prefix} ${colorName}`. */\n\treadonly swatchLabel?: (colorName: string) => string;\n\t/** When true, swatch title shows human-readable color name instead of hex. */\n\treadonly titleAsName?: boolean;\n}\n\n// --- Constants ---\n\nconst GRID_NAV_KEYS: ReadonlySet<string> = new Set([\n\t'ArrowUp',\n\t'ArrowDown',\n\t'ArrowLeft',\n\t'ArrowRight',\n]);\nconst LIGHT_COLOR_BORDER = '1px solid #d0d0d0';\n\n// --- Rendering ---\n\n/**\n * Renders an accessible color grid into the given container.\n * Creates a `role=\"grid\"` with rows of `role=\"gridcell\"` swatch buttons.\n * Provides arrow key, Home/End, Enter/Space, and Escape keyboard navigation.\n */\nexport function renderColorGrid(container: HTMLElement, config: ColorGridConfig): void {\n\tconst columns: number = config.columns;\n\tconst totalSwatches: number = config.colors.length;\n\tconst totalRows: number = Math.ceil(totalSwatches / columns);\n\n\tconst grid: HTMLDivElement = document.createElement('div');\n\tgrid.className = 'notectl-color-picker__grid';\n\tgrid.setAttribute('role', 'grid');\n\tgrid.setAttribute('aria-label', config.ariaLabel);\n\n\tconst swatches: HTMLButtonElement[] = [];\n\tlet focusedIndex = 0;\n\n\tfor (let rowIdx = 0; rowIdx < totalRows; rowIdx++) {\n\t\tconst row: HTMLDivElement = document.createElement('div');\n\t\trow.setAttribute('role', 'row');\n\n\t\tfor (let colIdx = 0; colIdx < columns; colIdx++) {\n\t\t\tconst swatchIdx: number = rowIdx * columns + colIdx;\n\t\t\tif (swatchIdx >= totalSwatches) break;\n\n\t\t\tconst color: string = config.colors[swatchIdx] as string;\n\t\t\tconst colorName: string = getColorName(color);\n\t\t\tconst isActive: boolean =\n\t\t\t\t!!config.activeColor && config.activeColor.toLowerCase() === color.toLowerCase();\n\n\t\t\tconst swatch: HTMLButtonElement = document.createElement('button');\n\t\t\tswatch.type = 'button';\n\t\t\tswatch.className = 'notectl-color-picker__swatch';\n\t\t\tswatch.setAttribute('role', 'gridcell');\n\t\t\tconst label: string = config.swatchLabel\n\t\t\t\t? config.swatchLabel(colorName)\n\t\t\t\t: `${config.ariaLabelPrefix} ${colorName}`;\n\t\t\tswatch.setAttribute('aria-label', label);\n\t\t\tswatch.setAttribute('aria-selected', String(isActive));\n\t\t\tswatch.dataset.index = String(swatchIdx);\n\t\t\tswatch.style.backgroundColor = color;\n\t\t\tswatch.title = config.titleAsName ? colorName : color;\n\n\t\t\tif (isLightColor(color)) {\n\t\t\t\tswatch.style.border = LIGHT_COLOR_BORDER;\n\t\t\t}\n\n\t\t\tif (isActive) {\n\t\t\t\tswatch.classList.add('notectl-color-picker__swatch--active');\n\t\t\t\tfocusedIndex = swatchIdx;\n\t\t\t}\n\n\t\t\tswatch.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tconfig.onSelect(color);\n\t\t\t});\n\n\t\t\tswatches.push(swatch);\n\t\t\trow.appendChild(swatch);\n\t\t}\n\n\t\tgrid.appendChild(row);\n\t}\n\n\tapplyRovingTabindex(swatches as readonly HTMLButtonElement[], focusedIndex);\n\n\tgrid.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tconfig.onClose();\n\t\t\treturn;\n\t\t}\n\n\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tconst target = e.target as HTMLElement;\n\t\t\tconst idx: string | undefined = target.dataset.index;\n\t\t\tif (idx !== undefined) {\n\t\t\t\tconst color: string | undefined = config.colors[Number(idx)];\n\t\t\t\tif (color) {\n\t\t\t\t\tconfig.onSelect(color);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (GRID_NAV_KEYS.has(e.key)) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tconst currentRow: number = Math.floor(focusedIndex / columns) + 1;\n\t\t\tconst currentCol: number = (focusedIndex % columns) + 1;\n\n\t\t\tconst [newRow, newCol] = navigateGrid(\n\t\t\t\tcurrentRow,\n\t\t\t\tcurrentCol,\n\t\t\t\ttotalRows,\n\t\t\t\tcolumns,\n\t\t\t\te.key as 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight',\n\t\t\t);\n\n\t\t\tlet newIdx: number = (newRow - 1) * columns + (newCol - 1);\n\t\t\tif (newIdx >= totalSwatches) {\n\t\t\t\tnewIdx = totalSwatches - 1;\n\t\t\t}\n\n\t\t\tfocusedIndex = newIdx;\n\t\t\tapplyRovingTabindex(swatches as readonly HTMLButtonElement[], focusedIndex);\n\t\t\tswatches[focusedIndex]?.focus();\n\t\t\treturn;\n\t\t}\n\n\t\tif (e.key === 'Home' || e.key === 'End') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tconst currentRow: number = Math.floor(focusedIndex / columns);\n\t\t\tconst rowStart: number = currentRow * columns;\n\t\t\tconst rowEnd: number = Math.min(rowStart + columns - 1, totalSwatches - 1);\n\n\t\t\tfocusedIndex = e.key === 'Home' ? rowStart : rowEnd;\n\t\t\tapplyRovingTabindex(swatches as readonly HTMLButtonElement[], focusedIndex);\n\t\t\tswatches[focusedIndex]?.focus();\n\t\t}\n\t});\n\n\tcontainer.appendChild(grid);\n}\n"],"names":["COLOR_NAME_MAP","Map","getColorName","hex","get","toLowerCase","normalized","normalizeHex","rRaw","Number","parseInt","slice","gRaw","bRaw","max","Math","min","lightness","delta","hue","hueName","threshold","name","HUE_NAMES","isLightColor","luminance","linearize","h","length","channel","GRID_NAV_KEYS","Set","renderColorGrid","container","config","columns","totalSwatches","colors","totalRows","ceil","grid","document","createElement","className","setAttribute","ariaLabel","swatches","focusedIndex","rowIdx","row","colIdx","swatchIdx","color","colorName","isActive","activeColor","swatch","type","label","swatchLabel","ariaLabelPrefix","String","dataset","index","style","backgroundColor","title","titleAsName","border","classList","add","addEventListener","e","preventDefault","stopPropagation","onSelect","push","appendChild","applyRovingTabindex","key","onClose","idx","target","has","currentRow","floor","currentCol","newRow","newCol","navigateGrid","newIdx","focus","rowStart","rowEnd"],"mappings":";AAYA,MAAMA,wBAAkDC,IAAI,CAI3D,CAAC,WAAW,OAAA,GACZ,CAAC,WAAW,gBACZ,CAAC,WAAW,aAAA,GACZ,CAAC,WAAW,aAAA,GACZ,CAAC,WAAW,aAAA,GACZ,CAAC,WAAW,cAAA,GACZ,CAAC,WAAW,iBACZ,CAAC,WAAW,cAAA,GACZ,CAAC,WAAW,YAAA,GACZ,CAAC,WAAW,OAAA,GAGZ,CAAC,WAAW,gBAAA,GACZ,CAAC,WAAW,QACZ,CAAC,WAAW,QAAA,GACZ,CAAC,WAAW,QAAA,GACZ,CAAC,WAAW,OAAA,GACZ,CAAC,WAAW,MAAA,GACZ,CAAC,WAAW,oBACZ,CAAC,WAAW,MAAA,GACZ,CAAC,WAAW,QAAA,GACZ,CAAC,WAAW,SAAA,GAGZ,CAAC,WAAW,mBAAA,GACZ,CAAC,WAAW,aAAA,GACZ,CAAC,WAAW,gBAAA,GACZ,CAAC,WAAW,gBAAA,GACZ,CAAC,WAAW,eAAA,GACZ,CAAC,WAAW,cAAA,GACZ,CAAC,WAAW,yBAAA,GACZ,CAAC,WAAW,cAAA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,WAAIkB,IAAmB;AACtB,cAAM7B,KAA4BlB,GAAOG,OAAO5B,OAAOwE,EAAAA,CAAAA;AACnD7B,QAAAA,MACHlB,GAAOyC,SAASvB,EAAAA;AAAAA,MAElB;AACA;AAAA,IACD;AAEA,QAAItB,EAAcqD,IAAIX,GAAEO,GAAAA,GAAM;AAC7BP,MAAAA,GAAEC,eAAAA,GACFD,GAAEE,gBAAAA;AACF,YAAMU,KAAqBrE,KAAKsE,MAAMtC,IAAeZ,EAAAA,IAAW,GAC1DmD,KAAsBvC,IAAeZ,KAAW,GAAA,CAE/CoD,IAAQC,EAAAA,IAAUC,EACxBL,IACAE,IACAhD,IACAH,IACAqC,GAAEO,GAAAA;AAGH,UAAIW,MAAkBH,KAAS,KAAKpD,MAAWqD,KAAS;AAQxD,aAPIE,MAAUtD,OACbsD,KAAStD,KAAgB,IAG1BW,IAAe2C,IACfZ,EAAoBhC,GAA0CC,CAAAA,GAAAA,KAC9DD,EAASC,CAAAA,GAAe4C,MAAAA;AAAAA,IAEzB;AAEA,QAAc,WAAVnB,GAAEO,OAA4B,UAAVP,GAAEO,KAAe;AACxCP,MAAAA,GAAEC,eAAAA,GACFD,GAAEE,gBAAAA;AACF,YACMkB,KADqB7E,KAAKsE,MAAMtC,IAAeZ,EAAAA,IACfA,IAChC0D,KAAiB9E,KAAKC,IAAI4E,KAAWzD,KAAU,GAAGC,KAAgB,CAAA;AAExEW,UAAyB,WAAVyB,GAAEO,MAAiBa,KAAWC,IAC7Cf,EAAoBhC,GAA0CC,CAAAA,GAC9DD,EAASC,CAAAA,GAAe4C,MAAAA;AAAAA,IACzB;AAAA,EAAA,CAAA,GAGD1D,GAAU4C,YAAYrC,CAAAA;AACvB;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerPopup-D3ysvOH-.mjs","sources":["../../src/editor/styles/color-picker.ts","../../src/plugins/shared/ColorMarkOperations.ts","../../src/plugins/shared/ColorPickerPopup.ts"],"sourcesContent":["/** Color picker popup styles (text-color + highlight plugins). */\nexport const COLOR_PICKER_CSS = `\n/* Color Picker Popup */\n.notectl-color-picker {\n\tpadding: 8px;\n\tmin-width: 240px;\n}\n\n.notectl-color-picker__default {\n\tdisplay: block;\n\twidth: 100%;\n\tpadding: 6px 12px;\n\tmargin-bottom: 8px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-bg);\n\tcursor: pointer;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg);\n\ttext-align: center;\n}\n\n.notectl-color-picker__default:hover {\n\tbackground: var(--notectl-hover-bg);\n}\n\n.notectl-color-picker__grid {\n\tdisplay: grid;\n\tgrid-template-columns: repeat(10, 1fr);\n\tgap: 3px;\n}\n\n.notectl-color-picker__grid [role=\"row\"] {\n\tdisplay: contents;\n}\n\n.notectl-color-picker__swatch {\n\twidth: 22px;\n\theight: 22px;\n\tborder: 1px solid transparent;\n\tborder-radius: 3px;\n\tpadding: 0;\n\tcursor: pointer;\n\ttransition: transform 0.1s;\n}\n\n.notectl-color-picker__swatch:hover,\n.notectl-color-picker__swatch:focus-visible {\n\ttransform: scale(1.25);\n\tz-index: 1;\n}\n\n.notectl-color-picker__swatch:focus-visible {\n\toutline: 2px solid var(--notectl-focus-ring);\n\toutline-offset: 1px;\n}\n\n.notectl-color-picker__swatch--active {\n\tborder: 2px solid var(--notectl-primary-fg);\n\tborder-radius: 3px;\n}\n\n.notectl-toolbar-btn--textColor .notectl-toolbar-btn__color-indicator {\n\tdisplay: block;\n\twidth: 16px;\n\theight: 3px;\n\tmargin-top: 1px;\n\tborder-radius: 1px;\n}\n`;\n","/**\n * Shared color mark operations for color-based mark plugins.\n * All functions are parameterized by mark type name so they work\n * identically for TextColor, Highlight, or any future color mark.\n *\n * Delegates to the generic AttributedMarkCommands helpers for the\n * collapsed-vs-range branching logic.\n */\n\nimport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport type { MarkAttrRegistry } from '../../model/AttrRegistry.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { isValidCSSColor } from './ColorValidation.js';\n\n/** Color mark type names that have `{ color: string }` attrs. */\ntype ColorMarkType = {\n\t[K in keyof MarkAttrRegistry]: MarkAttrRegistry[K] extends { color: string } ? K : never;\n}[keyof MarkAttrRegistry];\n\n/**\n * Returns the active color value for the given mark type at the current\n * selection, or `null` if the mark is not present.\n */\nexport function getActiveColor(state: EditorState, markTypeName: ColorMarkType): string | null {\n\treturn getMarkAttrAtSelection(state, markTypeName, (m) => m.attrs.color ?? null);\n}\n\n/** Returns `true` when the given color mark is active at the current selection. */\nexport function isColorMarkActive(state: EditorState, markTypeName: ColorMarkType): boolean {\n\treturn getActiveColor(state, markTypeName) !== null;\n}\n\n/**\n * Applies the given color to the selection. For collapsed selections,\n * sets stored marks. For range selections, removes then re-adds the mark.\n */\nexport function applyColorMark(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tmarkTypeName: ColorMarkType,\n\tcolor: string,\n): boolean {\n\tif (!isValidCSSColor(color)) return false;\n\n\tconst mark = { type: markType(markTypeName), attrs: { color } };\n\tconst tr = applyAttributedMark(state, mark);\n\tif (!tr) return false;\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/**\n * Removes the given color mark from the selection.\n * Returns `false` when the mark was not present.\n */\nexport function removeColorMark(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tmarkTypeName: ColorMarkType,\n): boolean {\n\tconst tr = removeAttributedMark(state, markType(markTypeName));\n\tif (!tr) return false;\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n","/**\n * Shared color picker popup rendering with WAI-ARIA grid keyboard navigation.\n * Used by TextColorPlugin and HighlightPlugin.\n * Delegates grid rendering to the shared ColorGrid module.\n */\n\nimport type { MarkAttrRegistry } from '../../model/AttrRegistry.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { renderColorGrid } from './ColorGrid.js';\nimport { applyColorMark, getActiveColor } from './ColorMarkOperations.js';\n\n/** Color mark type names that have `{ color: string }` attrs. */\ntype ColorMarkType = {\n\t[K in keyof MarkAttrRegistry]: MarkAttrRegistry[K] extends { color: string } ? K : never;\n}[keyof MarkAttrRegistry];\n\n/** Configuration for `renderColorPickerPopup`. */\nexport interface ColorPickerConfig {\n\treadonly markType: ColorMarkType;\n\treadonly colors: readonly string[];\n\treadonly columns: number;\n\treadonly resetLabel: string;\n\treadonly resetCommand: string;\n\treadonly ariaLabelPrefix: string;\n\treadonly onClose: () => void;\n}\n\nconst COLUMNS = 10;\n\n/**\n * Renders an accessible color picker popup into `container`.\n *\n * Features:\n * - WAI-ARIA `role=\"grid\"` with row/gridcell structure\n * - Arrow key navigation (wraps around, clamps on partial last row)\n * - Enter/Space selects color and closes popup\n * - Escape closes popup\n * - Roving tabindex on swatches\n */\nexport function renderColorPickerPopup(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: ColorPickerConfig,\n): void {\n\tcontainer.classList.add('notectl-color-picker');\n\n\tconst state = context.getState();\n\tconst activeColor: string | null = getActiveColor(state, config.markType);\n\tconst columns: number = config.columns || COLUMNS;\n\n\t// --- Reset button ---\n\tconst resetBtn: HTMLButtonElement = document.createElement('button');\n\tresetBtn.type = 'button';\n\tresetBtn.className = 'notectl-color-picker__default';\n\tresetBtn.textContent = config.resetLabel;\n\tresetBtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\tcontext.executeCommand(config.resetCommand);\n\t\tconfig.onClose();\n\t});\n\tresetBtn.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\tconfig.onClose();\n\t\t}\n\t});\n\tcontainer.appendChild(resetBtn);\n\n\t// --- Color grid (delegated to shared ColorGrid) ---\n\trenderColorGrid(container, {\n\t\tcolors: config.colors,\n\t\tcolumns,\n\t\tariaLabel: `${config.ariaLabelPrefix} color picker`,\n\t\tariaLabelPrefix: config.ariaLabelPrefix,\n\t\tactiveColor,\n\t\tonSelect: (color: string) => {\n\t\t\tapplyColorMark(context, context.getState(), config.markType, color);\n\t\t\tconfig.onClose();\n\t\t},\n\t\tonClose: config.onClose,\n\t});\n}\n"],"names":["COLOR_PICKER_CSS","getActiveColor","state","markTypeName","getMarkAttrAtSelection","m","attrs","color","isColorMarkActive","removeColorMark","context","tr","removeAttributedMark","markType","dispatch","renderColorPickerPopup","container","config","classList","add","activeColor","getState","columns","resetBtn","document","createElement","type","className","textContent","resetLabel","addEventListener","e","preventDefault","stopPropagation","executeCommand","resetCommand","onClose","key","appendChild","renderColorGrid","colors","ariaLabel","ariaLabelPrefix","onSelect","isValidCSSColor","mark","applyAttributedMark"],"mappings":";;;;AACO,MAAMA,IAAmB;AC4BzB,SAASC,EAAeC,IAAoBC,IAAAA;AAClD,SAAOC,EAAuBF,IAAOC,IAAeE,CAAAA,OAAMA,GAAEC,MAAMC,SAAS,IAAA;AAC5E;AAGO,SAASC,EAAkBN,IAAoBC,IAAAA;AACrD,SAA+C,SAAxCF,EAAeC,IAAOC;AAC9B;AA0BO,SAASM,EACfC,IACAR,IACAC;AAEA,QAAMQ,KAAKC,EAAqBV,IAAOW,EAASV,EAAAA,CAAAA;AAChD,SAAA,CAAA,CAAKQ,OAELD,GAAQI,SAASH;AAElB;ACjCO,SAASI,EACfC,IACAN,IACAO,IAAAA;AAEAD,EAAAA,GAAUE,UAAUC,IAAI;AAExB,QACMC,KAA6BnB,EADrBS,GAAQW,YACmCJ,GAAOJ,QAAAA,GAC1DS,KAAkBL,GAAOK,WArBhB,IAwBTC,KAA8BC,SAASC,cAAc,QAAA;AAC3DF,EAAAA,GAASG,OAAO,UAChBH,GAASI,YAAY,iCACrBJ,GAASK,cAAcX,GAAOY,YAC9BN,GAASO,iBAAiB,aAAcC,CAAAA,OAAAA;AACvCA,IAAAA,GAAEC,kBACFD,GAAEE,gBAAAA,GACFvB,GAAQwB,eAAejB,GAAOkB,YAAAA,GAC9BlB,GAAOmB;MAERb,GAASO,iBAAiB,WAAYC,CAAAA,OAAAA;AACvB,iBAAVA,GAAEM,QACLN,GAAEC,eAAAA,GACFf,GAAOmB;MAGTpB,GAAUsB,YAAYf,KAGtBgB,EAAgBvB,IAAW,EAC1BwB,QAAQvB,GAAOuB,QACflB,SAAAA,IACAmB,WAAW,GAAGxB,GAAOyB,eAAAA,iBACrBA,iBAAiBzB,GAAOyB,iBACxBtB,iBACAuB,UAAWpC,CAAAA,OAAAA;AAAAA,MDlCN,SACNG,IACAR,IACAC,IACAI,IAAAA;AAEA,WAAKqC,EAAgBrC,EAAAA,EAAQ;AAE7B,YAAMsC,KAAO,EAAEnB,MAAMb,EAASV,EAAAA,GAAeG,OAAO,EAAEC,OAAAA,GAAAA,EAAAA,GAChDI,KAAKmC,EAAoB5C,IAAO2C,EAAAA;AACjClC,MAAAA,MAELD,GAAQI,SAASH,EAAAA;AAAAA,IAElB,GCqBkBD,IAASA,GAAQW,SAAAA,GAAYJ,GAAOJ,UAAUN,EAAAA,GAC7DU,GAAOmB;KAERA,SAASnB,GAAOmB;AAElB;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Document-DfZ1NOjs.mjs","sources":["../../src/model/Document.ts"],"sourcesContent":["/**\n * Core document model types for the Notectl editor.\n * All types are deeply readonly — mutations create new instances.\n */\n\nimport type { BlockId, InlineTypeName, MarkTypeName, NodeTypeName } from './TypeBrands.js';\n\n// --- Mark Types ---\n\n/** @deprecated Use {@link MarkTypeName} for new code. */\nexport type MarkType = MarkTypeName;\n\nexport interface Mark {\n\treadonly type: MarkTypeName;\n\treadonly attrs?: Readonly<Record<string, string | number | boolean>>;\n}\n\nexport interface BoldMark extends Mark {\n\treadonly type: MarkTypeName & 'bold';\n}\n\nexport interface ItalicMark extends Mark {\n\treadonly type: MarkTypeName & 'italic';\n}\n\nexport interface UnderlineMark extends Mark {\n\treadonly type: MarkTypeName & 'underline';\n}\n\n// --- Node Types ---\n\n/** @deprecated Use {@link NodeTypeName} for new code. */\nexport type NodeType = NodeTypeName;\n\nexport interface BlockAttrs {\n\treadonly [key: string]: string | number | boolean;\n}\n\nexport interface TextNode {\n\treadonly type: 'text';\n\treadonly text: string;\n\treadonly marks: readonly Mark[];\n}\n\n/** Atomic inline element (width 1 in offset space). */\nexport interface InlineNode {\n\treadonly type: 'inline';\n\treadonly inlineType: InlineTypeName;\n\treadonly attrs: Readonly<Record<string, string | number | boolean>>;\n}\n\n/** A child of a BlockNode: text, inline element, or nested block. */\nexport type ChildNode = TextNode | InlineNode | BlockNode;\n\nexport interface BlockNode {\n\treadonly id: BlockId;\n\treadonly type: NodeTypeName;\n\treadonly attrs?: BlockAttrs;\n\treadonly children: readonly ChildNode[];\n}\n\nexport interface Document {\n\treadonly children: readonly BlockNode[];\n}\n\n// --- Text Segment (for mark-preserving undo) ---\n\nexport interface TextSegment {\n\treadonly text: string;\n\treadonly marks: readonly Mark[];\n}\n\n/** A content segment: either text (with marks) or an inline node. */\nexport type ContentSegment =\n\t| { readonly kind: 'text'; readonly text: string; readonly marks: readonly Mark[] }\n\t| { readonly kind: 'inline'; readonly node: InlineNode };\n\n/** Extracts TextNode segments within a block for the given offset range. */\nexport function getBlockSegmentsInRange(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n): readonly TextSegment[] {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tconst segments: TextSegment[] = [];\n\tlet pos = 0;\n\n\tfor (const child of inlineChildren) {\n\t\tconst childWidth: number = isInlineNode(child) ? 1 : child.text.length;\n\t\tconst childEnd: number = pos + childWidth;\n\n\t\tif (childEnd <= from || pos >= to) {\n\t\t\tpos = childEnd;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isInlineNode(child)) {\n\t\t\t// InlineNodes are skipped for TextSegment extraction\n\t\t\tpos = childEnd;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst sliceFrom: number = Math.max(0, from - pos);\n\t\tconst sliceTo: number = Math.min(child.text.length, to - pos);\n\t\tconst text: string = child.text.slice(sliceFrom, sliceTo);\n\n\t\tif (text.length > 0) {\n\t\t\tsegments.push({ text, marks: child.marks });\n\t\t}\n\n\t\tpos = childEnd;\n\t}\n\n\treturn segments;\n}\n\n/** Returns content segments (text and inline) for a block range. */\nexport function getBlockContentSegmentsInRange(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n): readonly ContentSegment[] {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tconst segments: ContentSegment[] = [];\n\tlet pos = 0;\n\n\tfor (const child of inlineChildren) {\n\t\tconst childWidth: number = isInlineNode(child) ? 1 : child.text.length;\n\t\tconst childEnd: number = pos + childWidth;\n\n\t\tif (childEnd <= from || pos >= to) {\n\t\t\tpos = childEnd;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isInlineNode(child)) {\n\t\t\tsegments.push({ kind: 'inline', node: child });\n\t\t} else {\n\t\t\tconst sliceFrom: number = Math.max(0, from - pos);\n\t\t\tconst sliceTo: number = Math.min(child.text.length, to - pos);\n\t\t\tconst text: string = child.text.slice(sliceFrom, sliceTo);\n\t\t\tif (text.length > 0) {\n\t\t\t\tsegments.push({ kind: 'text', text, marks: child.marks });\n\t\t\t}\n\t\t}\n\n\t\tpos = childEnd;\n\t}\n\n\treturn segments;\n}\n\n// --- Type Guards ---\n\n/** Checks whether a value is a {@link TextNode}. */\nexport function isTextNode(node: unknown): node is TextNode {\n\treturn (\n\t\ttypeof node === 'object' &&\n\t\tnode !== null &&\n\t\t(node as TextNode).type === 'text' &&\n\t\ttypeof (node as TextNode).text === 'string'\n\t);\n}\n\n/** Checks whether a value is an {@link InlineNode}. */\nexport function isInlineNode(node: unknown): node is InlineNode {\n\treturn (\n\t\ttypeof node === 'object' &&\n\t\tnode !== null &&\n\t\t(node as InlineNode).type === 'inline' &&\n\t\ttypeof (node as InlineNode).inlineType === 'string'\n\t);\n}\n\n/** Checks whether a value is a {@link BlockNode}. */\nexport function isBlockNode(node: unknown): node is BlockNode {\n\treturn (\n\t\ttypeof node === 'object' &&\n\t\tnode !== null &&\n\t\ttypeof (node as BlockNode).id === 'string' &&\n\t\ttypeof (node as BlockNode).type === 'string' &&\n\t\t(node as BlockNode).type !== ('text' as string) &&\n\t\t(node as BlockNode).type !== ('inline' as string) &&\n\t\tArray.isArray((node as BlockNode).children)\n\t);\n}\n\n// --- Child Node Helpers ---\n\n/** Returns true if a block has only inline content (TextNodes and InlineNodes). */\nexport function isLeafBlock(node: BlockNode): boolean {\n\treturn node.children.every((c) => isTextNode(c) || isInlineNode(c));\n}\n\n/** Returns only the TextNode children of a block. */\nexport function getTextChildren(node: BlockNode): readonly TextNode[] {\n\treturn node.children.filter((c): c is TextNode => isTextNode(c));\n}\n\n/** Returns the inline content children (TextNode | InlineNode) of a block. */\nexport function getInlineChildren(node: BlockNode): readonly (TextNode | InlineNode)[] {\n\treturn node.children.filter((c): c is TextNode | InlineNode => isTextNode(c) || isInlineNode(c));\n}\n\n/** Returns only the BlockNode children of a block. */\nexport function getBlockChildren(node: BlockNode): readonly BlockNode[] {\n\treturn node.children.filter((c): c is BlockNode => isBlockNode(c));\n}\n\n// --- Factory Functions ---\n\n/** Generates a unique block ID using crypto.randomUUID(). */\nexport function generateBlockId(): BlockId {\n\treturn `block-${crypto.randomUUID()}` as BlockId;\n}\n\n/** Creates a new empty {@link Document} with a single empty paragraph. */\nexport function createDocument(children?: readonly BlockNode[]): Document {\n\treturn {\n\t\tchildren: children ?? [createBlockNode('paragraph' as NodeTypeName)],\n\t};\n}\n\n/** Creates a new {@link BlockNode}. */\nexport function createBlockNode(\n\ttype: NodeTypeName,\n\tchildren?: readonly ChildNode[],\n\tid?: BlockId,\n\tattrs?: BlockAttrs,\n): BlockNode {\n\treturn {\n\t\tid: id ?? generateBlockId(),\n\t\ttype,\n\t\t...(attrs ? { attrs } : {}),\n\t\tchildren: children ?? [createTextNode('')],\n\t};\n}\n\n/** Creates a new {@link TextNode}. */\nexport function createTextNode(text: string, marks?: readonly Mark[]): TextNode {\n\treturn {\n\t\ttype: 'text',\n\t\ttext,\n\t\tmarks: marks ?? [],\n\t};\n}\n\n/** Creates a new {@link InlineNode}. */\nexport function createInlineNode(\n\tinlineType: InlineTypeName,\n\tattrs?: Readonly<Record<string, string | number | boolean>>,\n): InlineNode {\n\treturn {\n\t\ttype: 'inline',\n\t\tinlineType,\n\t\tattrs: attrs ?? {},\n\t};\n}\n\n// --- Utility Functions ---\n\n/** Extracts plain text from a block (InlineNodes are skipped). */\nexport function getBlockText(block: BlockNode): string {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tlet text = '';\n\tfor (const child of inlineChildren) {\n\t\tif (isTextNode(child)) {\n\t\t\ttext += child.text;\n\t\t}\n\t}\n\treturn text;\n}\n\n/** Returns the length of a block's inline content (InlineNodes count as 1). */\nexport function getBlockLength(block: BlockNode): number {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tlet len = 0;\n\tfor (const child of inlineChildren) {\n\t\tlen += isInlineNode(child) ? 1 : child.text.length;\n\t}\n\treturn len;\n}\n\n/** Returns the marks active at the given offset (empty for InlineNode offsets). */\nexport function getBlockMarksAtOffset(block: BlockNode, offset: number): readonly Mark[] {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tlet pos = 0;\n\n\tfor (const child of inlineChildren) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (offset === pos) return [];\n\t\t\tpos += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tconst end: number = pos + child.text.length;\n\t\tif (offset >= pos && offset < end) {\n\t\t\treturn child.marks;\n\t\t}\n\t\tif (offset === pos && child.text.length === 0) {\n\t\t\treturn child.marks;\n\t\t}\n\t\tpos = end;\n\t}\n\n\t// Fall back to last text child's marks\n\tfor (let i: number = inlineChildren.length - 1; i >= 0; i--) {\n\t\tconst child: TextNode | InlineNode | undefined = inlineChildren[i];\n\t\tif (child && isTextNode(child)) {\n\t\t\treturn child.marks;\n\t\t}\n\t}\n\treturn [];\n}\n\n/** Checks whether two marks are equal by type and attrs. */\nexport function marksEqual(a: Mark, b: Mark): boolean {\n\tif (a.type !== b.type) return false;\n\tconst aAttrs = a.attrs;\n\tconst bAttrs = b.attrs;\n\tif (!aAttrs && !bAttrs) return true;\n\tif (!aAttrs || !bAttrs) return false;\n\tconst aKeys = Object.keys(aAttrs);\n\tconst bKeys = Object.keys(bAttrs);\n\tif (aKeys.length !== bKeys.length) return false;\n\treturn aKeys.every((key) => aAttrs[key] === bAttrs[key]);\n}\n\n/** Checks whether two mark arrays contain the same marks (order-independent). */\nexport function markSetsEqual(a: readonly Mark[], b: readonly Mark[]): boolean {\n\tif (a.length !== b.length) return false;\n\treturn a.every((markA) => b.some((markB) => marksEqual(markA, markB)));\n}\n\n/** Returns true if the mark set contains a mark of the given type. */\nexport function hasMark(marks: readonly Mark[], markType: MarkTypeName): boolean {\n\treturn marks.some((m) => m.type === markType);\n}\n\n/** Adds a mark to a mark set (no duplicates). */\nexport function addMarkToSet(marks: readonly Mark[], mark: Mark): readonly Mark[] {\n\tif (hasMark(marks, mark.type)) return marks;\n\treturn [...marks, mark];\n}\n\n/** Removes a mark type from a mark set. */\nexport function removeMarkFromSet(marks: readonly Mark[], markType: MarkTypeName): readonly Mark[] {\n\treturn marks.filter((m) => m.type !== markType);\n}\n\n/**\n * Normalizes text nodes within a block: merges adjacent nodes with identical marks,\n * removes empty text nodes (keeping at least one).\n */\nexport function normalizeTextNodes(nodes: readonly TextNode[]): readonly TextNode[] {\n\tif (nodes.length === 0) return [createTextNode('')];\n\n\tconst result: TextNode[] = [];\n\tfor (const node of nodes) {\n\t\tconst prev: TextNode | undefined = result[result.length - 1];\n\t\tif (prev && markSetsEqual(prev.marks, node.marks)) {\n\t\t\tresult[result.length - 1] = createTextNode(prev.text + node.text, prev.marks);\n\t\t} else if (node.text.length > 0 || result.length === 0) {\n\t\t\tresult.push(node);\n\t\t}\n\t}\n\n\treturn result.length === 0 ? [createTextNode('')] : result;\n}\n\n/**\n * Normalizes mixed inline content: merges adjacent TextNodes with same marks,\n * removes empty TextNodes adjacent to InlineNodes, preserves InlineNodes as-is.\n * Guarantees at least one TextNode exists if all text is empty.\n */\nexport function normalizeInlineContent(\n\tnodes: readonly (TextNode | InlineNode)[],\n): readonly (TextNode | InlineNode)[] {\n\tif (nodes.length === 0) return [createTextNode('')];\n\n\t// Fast path: no InlineNodes, delegate to normalizeTextNodes\n\tif (nodes.every((n): n is TextNode => isTextNode(n))) {\n\t\treturn normalizeTextNodes(nodes);\n\t}\n\n\tconst result: (TextNode | InlineNode)[] = [];\n\n\tfor (const node of nodes) {\n\t\tif (isInlineNode(node)) {\n\t\t\tresult.push(node);\n\t\t\tcontinue;\n\t\t}\n\t\t// TextNode: try to merge with previous TextNode\n\t\tconst prev: TextNode | InlineNode | undefined = result[result.length - 1];\n\t\tif (prev && isTextNode(prev) && markSetsEqual(prev.marks, node.marks)) {\n\t\t\tresult[result.length - 1] = createTextNode(prev.text + node.text, prev.marks);\n\t\t} else if (node.text.length > 0 || result.length === 0) {\n\t\t\tresult.push(node);\n\t\t}\n\t}\n\n\t// Remove empty TextNodes that are adjacent to InlineNodes\n\tconst cleaned: (TextNode | InlineNode)[] = result.filter((node, i) => {\n\t\tif (isInlineNode(node)) return true;\n\t\tif (node.text.length > 0) return true;\n\t\t// Keep if it's the only node\n\t\tif (result.length === 1) return true;\n\t\t// Remove empty TextNode if adjacent to InlineNode\n\t\tconst prev: TextNode | InlineNode | undefined = result[i - 1];\n\t\tconst next: TextNode | InlineNode | undefined = result[i + 1];\n\t\tif ((prev && isInlineNode(prev)) || (next && isInlineNode(next))) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Ensure at least one TextNode exists\n\tif (cleaned.length === 0) return [createTextNode('')];\n\tif (!cleaned.some((n) => isTextNode(n))) {\n\t\treturn [createTextNode(''), ...cleaned];\n\t}\n\n\treturn cleaned;\n}\n\n/** Yields each inline child with its offset range. InlineNodes have width 1. */\nexport function* walkInlineContent(children: readonly (TextNode | InlineNode)[]): Generator<{\n\treadonly child: TextNode | InlineNode;\n\treadonly from: number;\n\treadonly to: number;\n}> {\n\tlet pos = 0;\n\tfor (const child of children) {\n\t\tconst width: number = isInlineNode(child) ? 1 : child.text.length;\n\t\tyield { child, from: pos, to: pos + width };\n\t\tpos += width;\n\t}\n}\n\n/**\n * Converts a block-space offset to a text-space offset.\n *\n * Block-space counts InlineNodes as width 1, but `getBlockText()` skips them.\n * This function maps a block offset to the equivalent position in the\n * text-only string returned by `getBlockText()`.\n */\nexport function blockOffsetToTextOffset(block: BlockNode, blockOffset: number): number {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tlet blockPos = 0;\n\tlet textPos = 0;\n\n\tfor (const child of inlineChildren) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (blockPos >= blockOffset) return textPos;\n\t\t\tblockPos += 1;\n\t\t} else {\n\t\t\tif (blockPos + child.text.length >= blockOffset) {\n\t\t\t\treturn textPos + (blockOffset - blockPos);\n\t\t\t}\n\t\t\tblockPos += child.text.length;\n\t\t\ttextPos += child.text.length;\n\t\t}\n\t}\n\n\treturn textPos;\n}\n\n/** Returns the content at a specific offset: text char, inline node, or null. */\nexport function getContentAtOffset(\n\tblock: BlockNode,\n\toffset: number,\n):\n\t| { readonly kind: 'text'; readonly char: string; readonly marks: readonly Mark[] }\n\t| { readonly kind: 'inline'; readonly node: InlineNode }\n\t| null {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\n\tfor (const { child, from } of walkInlineContent(inlineChildren)) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (offset === from) return { kind: 'inline', node: child };\n\t\t\tcontinue;\n\t\t}\n\t\tconst localOffset: number = offset - from;\n\t\tif (localOffset >= 0 && localOffset < child.text.length) {\n\t\t\treturn {\n\t\t\t\tkind: 'text',\n\t\t\t\tchar: child.text[localOffset] ?? '',\n\t\t\t\tmarks: child.marks,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn null;\n}\n"],"names":["getBlockSegmentsInRange","block","from","to","inlineChildren","getInlineChildren","segments","pos","child","childEnd","isInlineNode","text","length","sliceFrom","Math","max","sliceTo","min","slice","push","marks","isTextNode","node","type","inlineType","isBlockNode","id","Array","isArray","children","isLeafBlock","every","c","getTextChildren","filter","getBlockChildren","generateBlockId","crypto","randomUUID","createDocument","createBlockNode","attrs","createTextNode","createInlineNode","getBlockText","getBlockLength","len","getBlockMarksAtOffset","offset","end","i","markSetsEqual","a","b","markA","some","markB","aAttrs","bAttrs","aKeys","Object","keys","bKeys","key","hasMark","markType","m","addMarkToSet","mark","removeMarkFromSet","normalizeInlineContent","nodes","n","result","prev","cleaned","next","blockOffsetToTextOffset","blockOffset","blockPos","textPos","getContentAtOffset","width","kind","localOffset","char"],"mappings":"AA8EO,SAASA,EACfC,IACAC,IACAC,IAAAA;AAEA,QAAMC,KAAqDC,EAAkBJ,EAAAA,GACvEK,KAA0B,CAAA;AAChC,MAAIC,KAAM;AAEV,aAAWC,MAASJ,IAAgB;AACnC,UACMK,KAAmBF,MADEG,EAAaF,EAAAA,IAAS,IAAIA,GAAMG,KAAKC;AAGhE,QAAIH,MAAYP,MAAQK,MAAOJ,IAAI;AAClCI,MAAAA,KAAME;AACN;AAAA,IACD;AAEA,QAAIC,EAAaF,EAAAA,GAAQ;AAExBD,MAAAA,KAAME;AACN;AAAA,IACD;AAEA,UAAMI,KAAoBC,KAAKC,IAAI,GAAGb,KAAOK,EAAAA,GACvCS,KAAkBF,KAAKG,IAAIT,GAAMG,KAAKC,QAAQT,KAAKI,EAAAA,GACnDI,KAAeH,GAAMG,KAAKO,MAAML,IAAWG,EAAAA;AAE7CL,IAAAA,G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KAAc5E,GAAMG,KAAKC,OAChD,QAAO,EACNuE,MAAM,QACNE,MAAM7E,GAAMG,KAAKyE,EAAAA,KAAgB,IACjChE,OAAOZ,GAAMY,MAAAA;AAAAA,EAGhB;AAEA,SAAO;AACR;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MarkCommands-uybmkw9l.mjs","sources":["../../src/model/Schema.ts","../../src/commands/MarkCommands.ts"],"sourcesContent":["/**\n * Schema definition for the Notectl editor.\n * Defines which node types and marks are allowed.\n */\n\nimport type { NodeSpec } from './NodeSpec.js';\nimport type { SchemaRegistry } from './SchemaRegistry.js';\n\nexport interface Schema {\n\treadonly nodeTypes: readonly string[];\n\treadonly markTypes: readonly string[];\n\t/** Looks up the full NodeSpec for a given type. Available when created via schemaFromRegistry. */\n\treadonly getNodeSpec?: (type: string) => NodeSpec | undefined;\n}\n\n/** Creates the default schema with paragraph nodes and bold/italic/underline marks. */\nexport function defaultSchema(): Schema {\n\treturn {\n\t\tnodeTypes: ['paragraph'],\n\t\tmarkTypes: ['bold', 'italic', 'underline'],\n\t\tgetNodeSpec: () => undefined,\n\t};\n}\n\n/** Derives a Schema from a SchemaRegistry's registered specs. */\nexport function schemaFromRegistry(registry: SchemaRegistry): Schema {\n\treturn {\n\t\tnodeTypes: registry.getNodeTypes(),\n\t\tmarkTypes: registry.getMarkTypes(),\n\t\tgetNodeSpec: (type: string) => registry.getNodeSpec(type),\n\t};\n}\n\n/** Checks whether the given mark type is allowed by the schema. */\nexport function isMarkAllowed(schema: Schema, markType: string): boolean {\n\treturn schema.markTypes.includes(markType);\n}\n\n/** Checks whether the given node type is allowed by the schema. */\nexport function isNodeTypeAllowed(schema: Schema, nodeType: string): boolean {\n\treturn schema.nodeTypes.includes(nodeType);\n}\n","/**\n * Mark-related commands: toggling bold/italic/underline and checking\n * whether a mark is active.\n */\n\nimport {\n\ttype BlockNode,\n\ttype Mark,\n\ttype MarkType,\n\tgetBlockLength,\n\tgetBlockMarksAtOffset,\n\tgetInlineChildren,\n\thasMark,\n\tisTextNode,\n} from '../model/Document.js';\nimport { isMarkAllowed } from '../model/Schema.js';\nimport { isCollapsed, isGapCursor, isNodeSelection, selectionRange } from '../model/Selection.js';\nimport { markType as mkType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { forEachBlockInRange } from './RangeIterator.js';\n\n// --- Feature Configuration ---\n\nexport interface FeatureConfig {\n\treadonly bold: boolean;\n\treadonly italic: boolean;\n\treadonly underline: boolean;\n}\n\nconst defaultFeatures: FeatureConfig = { bold: true, italic: true, underline: true };\n\n/**\n * Toggles a mark on the current selection.\n * If collapsed, toggles stored marks. If range, applies/removes from text.\n */\nexport function toggleMark(\n\tstate: EditorState,\n\tmarkType: MarkType,\n\tfeatures: FeatureConfig = defaultFeatures,\n): Transaction | null {\n\tif (isFeatureGated(markType, features)) return null;\n\tif (!isMarkAllowed(state.schema, markType)) return null;\n\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return null;\n\n\tconst mark: Mark = { type: markType };\n\tconst sel = state.selection;\n\n\tif (isCollapsed(sel)) {\n\t\t// Toggle stored marks\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks = state.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\tconst hasIt = hasMark(currentMarks, markType);\n\t\tconst newMarks = hasIt\n\t\t\t? currentMarks.filter((m) => m.type !== markType)\n\t\t\t: [...currentMarks, mark];\n\n\t\treturn state\n\t\t\t.transaction('command')\n\t\t\t.setStoredMarks(newMarks, state.storedMarks)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t}\n\n\t// Range selection — apply/remove mark to all blocks in range\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\t// Determine if we should add or remove\n\tconst shouldRemove = isMarkActiveInRange(state, markType);\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tif (shouldRemove) {\n\t\t\tbuilder.removeMark(blockId, from, to, mark);\n\t\t} else {\n\t\t\tbuilder.addMark(blockId, from, to, mark);\n\t\t}\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\nexport function toggleBold(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('bold'), features);\n}\n\nexport function toggleItalic(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('italic'), features);\n}\n\nexport function toggleUnderline(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('underline'), features);\n}\n\n/** Checks if a mark is active at the current selection. */\nexport function isMarkActive(state: EditorState, markType: MarkType): boolean {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\n\tif (isCollapsed(sel)) {\n\t\tif (state.storedMarks) {\n\t\t\treturn hasMark(state.storedMarks, markType);\n\t\t}\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block) return false;\n\t\tconst marks = getBlockMarksAtOffset(block, sel.anchor.offset);\n\t\treturn hasMark(marks, markType);\n\t}\n\n\treturn isMarkActiveInRange(state, markType);\n}\n\n/** Checks if a mark is active across the entire selection range. */\nfunction isMarkActiveInRange(state: EditorState, markType: MarkType): boolean {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\tconst blockOrder = state.getBlockOrder();\n\tconst range = selectionRange(sel, blockOrder);\n\n\tconst fromIdx = blockOrder.indexOf(range.from.blockId);\n\tconst toIdx = blockOrder.indexOf(range.to.blockId);\n\n\tfor (let i = fromIdx; i <= toIdx; i++) {\n\t\tconst blockId = blockOrder[i];\n\t\tif (!blockId) continue;\n\t\tconst block = state.getBlock(blockId);\n\t\tif (!block) continue;\n\t\tconst blockLen = getBlockLength(block);\n\t\tconst from = i === fromIdx ? range.from.offset : 0;\n\t\tconst to = i === toIdx ? range.to.offset : blockLen;\n\n\t\tif (!isMarkActiveInBlock(block, from, to, markType)) return false;\n\t}\n\n\treturn true;\n}\n\nfunction isMarkActiveInBlock(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n\tmarkType: MarkType,\n): boolean {\n\tif (from === to) return false;\n\tlet pos = 0;\n\tfor (const child of getInlineChildren(block)) {\n\t\tif (isTextNode(child)) {\n\t\t\tconst childEnd = pos + child.text.length;\n\t\t\tif (childEnd > from && pos < to) {\n\t\t\t\tif (!hasMark(child.marks, markType)) return false;\n\t\t\t}\n\t\t\tpos = childEnd;\n\t\t} else {\n\t\t\t// InlineNode: skip (width 1, no marks)\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction isFeatureGated(type: MarkType, features: FeatureConfig): boolean {\n\tconst key = type as string;\n\tif (key === 'bold') return !features.bold;\n\tif (key === 'italic') return !features.italic;\n\tif (key === 'underline') return !features.underline;\n\treturn false;\n}\n"],"names":["defaultSchema","nodeTypes","markTypes","getNodeSpec","schemaFromRegistry","registry","getNodeTypes","getMarkTypes","type","isMarkAllowed","schema","markType","includes","isNodeTypeAllowed","nodeType","defaultFeatures","bold","italic","underline","toggleMark","state","features","key","isNodeSelection","selection","isGapCursor","mark","sel","isCollapsed","anchorBlock","getBlock","anchor","blockId","currentMarks","storedMarks","getBlockMarksAtOffset","offset","newMarks","hasMark","filter","m","transaction","setStoredMarks","setSelection","build","range","selectionRange","getBlockOrder","builder","shouldRemove","isMarkActiveInRange","forEachBlockInRange","from","to","removeMark","addMark","toggleBold","mkType","toggleItalic","toggleUnderline","isMarkActive","block","marks","blockOrder","fromIdx","indexOf","toIdx","i","blockLen","getBlockLength","isMarkActiveInBlock","pos","child","getInlineChildren","isTextNode","childEnd","text","length"],"mappings":";;;;AAgBO,SAASA,IAAAA;AACf,SAAO,EACNC,WAAW,CAAC,WAAA,GACZC,WAAW,CAAC,QAAQ,UAAU,WAAA,GAC9BC,aAAa,MAAA;AAA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oB9B,IAAoBT,IAAAA;AAChD,QAAMgB,KAAMP,GAAMI;AAClB,MAAID,EAAgBI,EAAAA,KAAQF,EAAYE,EAAAA,EAAM;AAC9C,QAAMoC,KAAa3C,GAAM2B,cAAAA,GACnBF,KAAQC,EAAenB,IAAKoC,EAAAA,GAE5BC,KAAUD,GAAWE,QAAQpB,GAAMO,KAAKpB,UACxCkC,KAAQH,GAAWE,QAAQpB,GAAMQ,GAAGrB,OAAAA;AAE1C,WAASmC,KAAIH,IAASG,MAAKD,IAAOC,MAAK;AACtC,UAAMnC,KAAU+B,GAAWI,EAAAA;AAC3B,QAAA,CAAKnC,GAAS;AACd,UAAM6B,KAAQzC,GAAMU,SAASE,EAAAA;AAC7B,QAAA,CAAK6B,GAAO;AACZ,UAAMO,KAAWC,EAAeR,EAAAA;AAIhC,QAAA,CAAKS,EAAoBT,IAHZM,OAAMH,KAAUnB,GAAMO,KAAKhB,SAAS,GACtC+B,OAAMD,KAAQrB,GAAMQ,GAAGjB,SAASgC,IAEDzD,IAAW,QAAA;AAAA,EACtD;AAEA,SAAA;AACD;AAEA,SAAS2D,EACRT,IACAT,IACAC,IACA1C,IAAAA;AAEA,MAAIyC,OAASC,GAAI,QAAA;AACjB,MAAIkB,KAAM;AACV,aAAWC,MAASC,EAAkBZ,EAAAA,EACrC,KAAIa,EAAWF,KAAQ;AACtB,UAAMG,KAAWJ,KAAMC,GAAMI,KAAKC;AAClC,QAAIF,KAAWvB,MAAQmB,KAAMlB,MAAAA,CACvBf,EAAQkC,GAAMV,OAAOnD,EAAAA,EAAW,QAAA;AAEtC4D,IAAAA,KAAMI;AAAAA,EACP,MAECJ,CAAAA,MAAO;AAGT,SAAA;AACD;"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
function t(t2, e2, o) {
|
|
2
|
-
const s = o.offset ?? 2, f = window.innerWidth, i = window.innerHeight;
|
|
3
|
-
switch (t2.style.position = "fixed", t2.style.zIndex = "10000", o.position) {
|
|
4
|
-
case "below-start": {
|
|
5
|
-
let o2 = e2.bottom + s, n = e2.left;
|
|
6
|
-
n + t2.offsetWidth > f - 4 && (n = f - t2.offsetWidth - 4), o2 + t2.offsetHeight > i - 4 && (o2 = e2.top - t2.offsetHeight - s), n < 4 && (n = 4), o2 < 4 && (o2 = 4), t2.style.top = `${o2}px`, t2.style.left = `${n}px`;
|
|
7
|
-
break;
|
|
8
|
-
}
|
|
9
|
-
case "below-end": {
|
|
10
|
-
let o2 = e2.bottom + s;
|
|
11
|
-
const n = f - e2.right;
|
|
12
|
-
o2 + t2.offsetHeight > i - 4 && (o2 = e2.top - t2.offsetHeight - s), o2 < 4 && (o2 = 4), t2.style.top = `${o2}px`, t2.style.right = `${n}px`, t2.style.left = "auto";
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
|
-
case "right": {
|
|
16
|
-
let o2 = e2.right + s, n = e2.top;
|
|
17
|
-
o2 + t2.offsetWidth > f - 4 && (o2 = e2.left - t2.offsetWidth - s), n + t2.offsetHeight > i - 4 && (n = i - t2.offsetHeight - 4), o2 < 4 && (o2 = 4), n < 4 && (n = 4), t2.style.top = `${n}px`, t2.style.left = `${o2}px`;
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function e(t2, e2) {
|
|
23
|
-
const o = e2.getRootNode();
|
|
24
|
-
o instanceof ShadowRoot ? o.appendChild(t2) : document.body.appendChild(t2);
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
e as a,
|
|
28
|
-
t as p
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=PopupPositioning-Cn6L_mO2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PopupPositioning-Cn6L_mO2.mjs","sources":["../../src/plugins/shared/PopupPositioning.ts"],"sourcesContent":["/**\n * Shared popup positioning logic. Positions a popup element relative to an\n * anchor rectangle, clamping to the viewport. Also provides a shadow DOM-aware\n * append helper.\n */\n\n// --- Types ---\n\nexport type PopupPosition = 'below-start' | 'below-end' | 'right';\n\nexport interface PositionOptions {\n\treadonly position: PopupPosition;\n\treadonly offset?: number;\n}\n\n// --- Constants ---\n\nconst DEFAULT_OFFSET = 2;\nconst Z_INDEX = '10000';\nconst POPUP_MIN_MARGIN = 4;\n\n// --- Positioning ---\n\n/**\n * Positions a popup element relative to the given anchor rectangle.\n * Uses fixed positioning and clamps to the viewport edges.\n */\nexport function positionPopup(popup: HTMLElement, anchor: DOMRect, options: PositionOptions): void {\n\tconst offset: number = options.offset ?? DEFAULT_OFFSET;\n\tconst vpWidth: number = window.innerWidth;\n\tconst vpHeight: number = window.innerHeight;\n\n\tpopup.style.position = 'fixed';\n\tpopup.style.zIndex = Z_INDEX;\n\n\tswitch (options.position) {\n\t\tcase 'below-start': {\n\t\t\tlet top: number = anchor.bottom + offset;\n\t\t\tlet left: number = anchor.left;\n\n\t\t\tif (left + popup.offsetWidth > vpWidth - POPUP_MIN_MARGIN) {\n\t\t\t\tleft = vpWidth - popup.offsetWidth - POPUP_MIN_MARGIN;\n\t\t\t}\n\t\t\tif (top + popup.offsetHeight > vpHeight - POPUP_MIN_MARGIN) {\n\t\t\t\ttop = anchor.top - popup.offsetHeight - offset;\n\t\t\t}\n\t\t\tif (left < POPUP_MIN_MARGIN) left = POPUP_MIN_MARGIN;\n\t\t\tif (top < POPUP_MIN_MARGIN) top = POPUP_MIN_MARGIN;\n\n\t\t\tpopup.style.top = `${top}px`;\n\t\t\tpopup.style.left = `${left}px`;\n\t\t\tbreak;\n\t\t}\n\t\tcase 'below-end': {\n\t\t\tlet top: number = anchor.bottom + offset;\n\t\t\tconst rightEdge: number = vpWidth - anchor.right;\n\n\t\t\tif (top + popup.offsetHeight > vpHeight - POPUP_MIN_MARGIN) {\n\t\t\t\ttop = anchor.top - popup.offsetHeight - offset;\n\t\t\t}\n\t\t\tif (top < POPUP_MIN_MARGIN) top = POPUP_MIN_MARGIN;\n\n\t\t\tpopup.style.top = `${top}px`;\n\t\t\tpopup.style.right = `${rightEdge}px`;\n\t\t\tpopup.style.left = 'auto';\n\t\t\tbreak;\n\t\t}\n\t\tcase 'right': {\n\t\t\tlet left: number = anchor.right + offset;\n\t\t\tlet top: number = anchor.top;\n\n\t\t\tif (left + popup.offsetWidth > vpWidth - POPUP_MIN_MARGIN) {\n\t\t\t\tleft = anchor.left - popup.offsetWidth - offset;\n\t\t\t}\n\t\t\tif (top + popup.offsetHeight > vpHeight - POPUP_MIN_MARGIN) {\n\t\t\t\ttop = vpHeight - popup.offsetHeight - POPUP_MIN_MARGIN;\n\t\t\t}\n\t\t\tif (left < POPUP_MIN_MARGIN) left = POPUP_MIN_MARGIN;\n\t\t\tif (top < POPUP_MIN_MARGIN) top = POPUP_MIN_MARGIN;\n\n\t\t\tpopup.style.top = `${top}px`;\n\t\t\tpopup.style.left = `${left}px`;\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\n/**\n * Appends an element to the appropriate root: the shadow root if the\n * reference node lives inside one, otherwise `document.body`.\n */\nexport function appendToRoot(element: HTMLElement, referenceNode: Node): void {\n\tconst root: Node = referenceNode.getRootNode();\n\tif (root instanceof ShadowRoot) {\n\t\troot.appendChild(element);\n\t} else {\n\t\tdocument.body.appendChild(element);\n\t}\n}\n"],"names":["positionPopup","popup","anchor","options","offset","vpWidth","window","innerWidth","vpHeight","innerHeight","style","position","zIndex","top","bottom","left","offsetWidth","offsetHeight","rightEdge","right","appendToRoot","element","referenceNode","root","getRootNode","ShadowRoot","appendChild","document","body"],"mappings":"AA2BO,SAASA,EAAcC,IAAoBC,IAAiBC,GAAAA;AAClE,QAAMC,IAAiBD,EAAQC,UAXT,GAYhBC,IAAkBC,OAAOC,YACzBC,IAAmBF,OAAOG;AAKhC,UAHAR,GAAMS,MAAMC,WAAW,SACvBV,GAAMS,MAAME,SAfG,SAiBPT,EAAQQ;IACf,KAAK,eAAe;AACnB,UAAIE,KAAcX,GAAOY,SAASV,GAC9BW,IAAeb,GAAOa;AAEtBA,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,SAASC,KAAKF,YAAYL,EAAAA;AAE5B;"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { a as o } from "./Document-DfZ1NOjs.mjs";
|
|
2
|
-
function t(t2, f, n) {
|
|
3
|
-
const c = t2.getBlockOrder(), e = c.indexOf(f.from.blockId), s = c.indexOf(f.to.blockId);
|
|
4
|
-
for (let i = e; i <= s; i++) {
|
|
5
|
-
const r = c[i];
|
|
6
|
-
if (!r) continue;
|
|
7
|
-
const m = t2.getBlock(r);
|
|
8
|
-
if (!m) continue;
|
|
9
|
-
const d = i === e ? f.from.offset : 0, l = i === s ? f.to.offset : o(m);
|
|
10
|
-
d !== l && n(r, d, l);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
t as f
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=RangeIterator-Bye0UtbY.mjs.map
|