@mrakomor/core 0.0.10 → 0.0.12
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/blockChrome.mjs +2 -2
- package/dist/blockInsertMenu.mjs +1 -1
- package/dist/chunk-2C6UDFD4.mjs +1 -0
- package/dist/chunk-5HWTMPF4.mjs +2 -0
- package/dist/chunk-6CG6EGQM.mjs +2 -0
- package/dist/{chunk-K2DMHAUD.mjs → chunk-7CJLTNHZ.mjs} +1 -1
- package/dist/chunk-ERNLRJPB.mjs +1 -0
- package/dist/chunk-EXDY5TZH.mjs +1 -0
- package/dist/chunk-FAXIFXQK.mjs +4 -0
- package/dist/chunk-GDDVUIEH.mjs +1 -0
- package/dist/{chunk-GDID5DFL.mjs → chunk-JVQ2YGII.mjs} +1 -1
- package/dist/chunk-P7TUN2KD.mjs +1 -0
- package/dist/chunk-S2W6LYHT.mjs +1 -0
- package/dist/chunk-TL5BHWDU.mjs +2 -0
- package/dist/chunk-ZHOZPQZH.mjs +1 -0
- package/dist/clipboard.cjs +4 -4
- package/dist/clipboard.mjs +3 -3
- package/dist/footer.cjs +4 -1
- package/dist/footer.mjs +2 -2
- package/dist/headline.cjs +3 -2
- package/dist/headline.mjs +1 -1
- package/dist/help.mjs +2 -2
- package/dist/index.cjs +6 -5
- package/dist/index.mjs +4 -4
- package/dist/link.cjs +3 -3
- package/dist/link.mjs +2 -2
- package/dist/list.cjs +3 -3
- package/dist/list.mjs +1 -1
- package/dist/paragraph.cjs +3 -2
- package/dist/paragraph.mjs +1 -1
- package/dist/slashCommand.cjs +2 -2
- package/dist/slashCommand.mjs +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.mjs +2 -2
- package/dist/tts.cjs +8 -8
- package/dist/tts.mjs +3 -3
- package/dist/types/Mrakomor.d.mts +230 -0
- package/dist/types/component/AbstractComponent.d.mts +69 -0
- package/dist/types/component/Editor.d.mts +8 -0
- package/dist/types/component/block/BlockComponent.d.mts +105 -0
- package/dist/types/component/block/BlockRegister.d.mts +29 -0
- package/dist/types/component/block/ExternalComponent.d.mts +42 -0
- package/dist/types/component/block/UnknownComponent.d.mts +3 -0
- package/dist/types/component/block/blockItemEquals.d.mts +6 -0
- package/dist/types/component/block/helpers.d.mts +319 -0
- package/dist/types/component/editorContext.d.mts +4 -0
- package/dist/types/component/entityRange/EntityRangeElement.d.mts +15 -0
- package/dist/types/component/inlineStyle/Bold.d.mts +4 -0
- package/dist/types/component/inlineStyle/InlineElement.d.mts +10 -0
- package/dist/types/component/inlineStyle/Italic.d.mts +4 -0
- package/dist/types/component/inlineStyle/Subscript.d.mts +4 -0
- package/dist/types/component/inlineStyle/Superscript.d.mts +4 -0
- package/dist/types/component/inlineStyle/Underline.d.mts +4 -0
- package/dist/types/component/inlineStyle/index.d.mts +5 -0
- package/dist/types/component/overlayMount.d.mts +46 -0
- package/dist/types/dom.d.mts +161 -0
- package/dist/types/emitter.d.mts +38 -0
- package/dist/types/index.d.mts +7 -0
- package/dist/types/namespaces.d.mts +17 -0
- package/dist/types/plugin/blockChrome/BlockChrome.d.mts +11 -0
- package/dist/types/plugin/blockChrome/index.d.mts +1 -0
- package/dist/types/plugin/blockInsertMenu/BlockInsertMenu.d.mts +6 -0
- package/dist/types/plugin/blockInsertMenu/index.d.mts +1 -0
- package/dist/types/plugin/clipboard/clipboardHelpers.d.mts +151 -0
- package/dist/types/plugin/clipboard/clipboardPlugin.d.mts +6 -0
- package/dist/types/plugin/clipboard/index.d.mts +1 -0
- package/dist/types/plugin/default/defaultMrakomorPlugin.d.mts +21 -0
- package/dist/types/plugin/dialog/Dialog.d.mts +23 -0
- package/dist/types/plugin/footer/footerPlugin.d.mts +7 -0
- package/dist/types/plugin/footer/index.d.mts +1 -0
- package/dist/types/plugin/headline/Headline.d.mts +29 -0
- package/dist/types/plugin/headline/index.d.mts +1 -0
- package/dist/types/plugin/help/HelpRegister.d.mts +15 -0
- package/dist/types/plugin/help/helpPlugin.d.mts +26 -0
- package/dist/types/plugin/help/helpSchema.d.mts +11 -0
- package/dist/types/plugin/help/index.d.mts +1 -0
- package/dist/types/plugin/linkEntity/LinkEntity.d.mts +37 -0
- package/dist/types/plugin/linkEntity/index.d.mts +1 -0
- package/dist/types/plugin/list/List.d.mts +61 -0
- package/dist/types/plugin/list/index.d.mts +1 -0
- package/dist/types/plugin/list/listHelpers.d.mts +166 -0
- package/dist/types/plugin/menu/Menu.d.mts +22 -0
- package/dist/types/plugin/menu/menuPlugin.d.mts +6 -0
- package/dist/types/plugin/paragraph/Paragraph.d.mts +16 -0
- package/dist/types/plugin/paragraph/index.d.mts +1 -0
- package/dist/types/plugin/slashCommand/SlashActionRegister.d.mts +12 -0
- package/dist/types/plugin/slashCommand/index.d.mts +1 -0
- package/dist/types/plugin/slashCommand/slashActionSchema.d.mts +29 -0
- package/dist/types/plugin/slashCommand/slashCommandHelpers.d.mts +77 -0
- package/dist/types/plugin/slashCommand/slashCommandPlugin.d.mts +11 -0
- package/dist/types/plugin/slashCommand/slashHelp.d.mts +12 -0
- package/dist/types/plugin/tooltip/Tooltip.d.mts +16 -0
- package/dist/types/plugin/tooltip/index.d.mts +1 -0
- package/dist/types/plugin/tts/TtsHeadline.d.mts +27 -0
- package/dist/types/plugin/tts/TtsList.d.mts +19 -0
- package/dist/types/plugin/tts/TtsParagraph.d.mts +9 -0
- package/dist/types/plugin/tts/TtsVoice.d.mts +52 -0
- package/dist/types/plugin/tts/index.d.mts +4 -0
- package/dist/types/register/Register.d.mts +50 -0
- package/dist/types/register/sortRegisterEntries.d.mts +7 -0
- package/dist/types/schema/blockContent.d.mts +34 -0
- package/dist/types/schema/blockRegister.d.mts +14 -0
- package/dist/types/schema/config.d.mts +6 -0
- package/dist/types/types.d.mts +636 -0
- package/package.json +35 -23
- package/dist/chunk-5VPYPKGA.mjs +0 -1
- package/dist/chunk-G2QV4GOO.mjs +0 -1
- package/dist/chunk-N4I2WZWF.mjs +0 -1
- package/dist/chunk-Q7RMVYZR.mjs +0 -1
- package/dist/chunk-T7OO472O.mjs +0 -1
- package/dist/chunk-TX4RCFPO.mjs +0 -3
- package/dist/chunk-U3MSKB3R.mjs +0 -2
- package/dist/chunk-UC7W4JIH.mjs +0 -2
- package/dist/chunk-WBTDWVEC.mjs +0 -3
- package/dist/chunk-WQWE5UCN.mjs +0 -1
- package/dist/chunk-YHWQV2DB.mjs +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrakomor/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*.mjs": "./src/*.mjs",
|
|
@@ -8,56 +8,70 @@
|
|
|
8
8
|
},
|
|
9
9
|
"main": "./dist/index.cjs",
|
|
10
10
|
"module": "./dist/index.mjs",
|
|
11
|
+
"types": "./dist/types/index.d.mts",
|
|
11
12
|
"exports": {
|
|
12
13
|
".": {
|
|
14
|
+
"types": "./dist/types/index.d.mts",
|
|
13
15
|
"import": "./dist/index.mjs",
|
|
14
16
|
"require": "./dist/index.cjs"
|
|
15
17
|
},
|
|
16
18
|
"./paragraph": {
|
|
19
|
+
"types": "./dist/types/plugin/paragraph/index.d.mts",
|
|
17
20
|
"import": "./dist/paragraph.mjs",
|
|
18
21
|
"require": "./dist/paragraph.cjs"
|
|
19
22
|
},
|
|
20
23
|
"./headline": {
|
|
24
|
+
"types": "./dist/types/plugin/headline/index.d.mts",
|
|
21
25
|
"import": "./dist/headline.mjs",
|
|
22
26
|
"require": "./dist/headline.cjs"
|
|
23
27
|
},
|
|
24
28
|
"./list": {
|
|
29
|
+
"types": "./dist/types/plugin/list/index.d.mts",
|
|
25
30
|
"import": "./dist/list.mjs",
|
|
26
31
|
"require": "./dist/list.cjs"
|
|
27
32
|
},
|
|
28
33
|
"./link": {
|
|
34
|
+
"types": "./dist/types/plugin/linkEntity/index.d.mts",
|
|
29
35
|
"import": "./dist/link.mjs",
|
|
30
36
|
"require": "./dist/link.cjs"
|
|
31
37
|
},
|
|
32
38
|
"./tooltip": {
|
|
39
|
+
"types": "./dist/types/plugin/tooltip/index.d.mts",
|
|
33
40
|
"import": "./dist/tooltip.mjs",
|
|
34
41
|
"require": "./dist/tooltip.cjs"
|
|
35
42
|
},
|
|
36
43
|
"./blockChrome": {
|
|
44
|
+
"types": "./dist/types/plugin/blockChrome/index.d.mts",
|
|
37
45
|
"import": "./dist/blockChrome.mjs",
|
|
38
46
|
"require": "./dist/blockChrome.cjs"
|
|
39
47
|
},
|
|
40
48
|
"./blockInsertMenu": {
|
|
49
|
+
"types": "./dist/types/plugin/blockInsertMenu/index.d.mts",
|
|
41
50
|
"import": "./dist/blockInsertMenu.mjs",
|
|
42
51
|
"require": "./dist/blockInsertMenu.cjs"
|
|
43
52
|
},
|
|
44
53
|
"./slashCommand": {
|
|
54
|
+
"types": "./dist/types/plugin/slashCommand/index.d.mts",
|
|
45
55
|
"import": "./dist/slashCommand.mjs",
|
|
46
56
|
"require": "./dist/slashCommand.cjs"
|
|
47
57
|
},
|
|
48
58
|
"./clipboard": {
|
|
59
|
+
"types": "./dist/types/plugin/clipboard/index.d.mts",
|
|
49
60
|
"import": "./dist/clipboard.mjs",
|
|
50
61
|
"require": "./dist/clipboard.cjs"
|
|
51
62
|
},
|
|
52
63
|
"./footer": {
|
|
64
|
+
"types": "./dist/types/plugin/footer/index.d.mts",
|
|
53
65
|
"import": "./dist/footer.mjs",
|
|
54
66
|
"require": "./dist/footer.cjs"
|
|
55
67
|
},
|
|
56
68
|
"./help": {
|
|
69
|
+
"types": "./dist/types/plugin/help/index.d.mts",
|
|
57
70
|
"import": "./dist/help.mjs",
|
|
58
71
|
"require": "./dist/help.cjs"
|
|
59
72
|
},
|
|
60
73
|
"./tts": {
|
|
74
|
+
"types": "./dist/types/plugin/tts/index.d.mts",
|
|
61
75
|
"import": "./dist/tts.mjs",
|
|
62
76
|
"require": "./dist/tts.cjs"
|
|
63
77
|
}
|
|
@@ -67,21 +81,21 @@
|
|
|
67
81
|
],
|
|
68
82
|
"sideEffects": [
|
|
69
83
|
"**/*.css",
|
|
70
|
-
"./dist/chunk-
|
|
84
|
+
"./dist/chunk-2C6UDFD4.mjs",
|
|
85
|
+
"./dist/chunk-5HWTMPF4.mjs",
|
|
86
|
+
"./dist/chunk-6CG6EGQM.mjs",
|
|
87
|
+
"./dist/chunk-7CJLTNHZ.mjs",
|
|
71
88
|
"./dist/chunk-B6JJAATK.mjs",
|
|
72
|
-
"./dist/chunk-
|
|
73
|
-
"./dist/chunk-
|
|
74
|
-
"./dist/chunk-
|
|
75
|
-
"./dist/chunk-
|
|
89
|
+
"./dist/chunk-ERNLRJPB.mjs",
|
|
90
|
+
"./dist/chunk-EXDY5TZH.mjs",
|
|
91
|
+
"./dist/chunk-FAXIFXQK.mjs",
|
|
92
|
+
"./dist/chunk-GDDVUIEH.mjs",
|
|
93
|
+
"./dist/chunk-JVQ2YGII.mjs",
|
|
76
94
|
"./dist/chunk-P7IKAZYZ.mjs",
|
|
77
|
-
"./dist/chunk-
|
|
78
|
-
"./dist/chunk-
|
|
79
|
-
"./dist/chunk-
|
|
80
|
-
"./dist/chunk-
|
|
81
|
-
"./dist/chunk-UC7W4JIH.mjs",
|
|
82
|
-
"./dist/chunk-WBTDWVEC.mjs",
|
|
83
|
-
"./dist/chunk-WQWE5UCN.mjs",
|
|
84
|
-
"./dist/chunk-YHWQV2DB.mjs"
|
|
95
|
+
"./dist/chunk-P7TUN2KD.mjs",
|
|
96
|
+
"./dist/chunk-S2W6LYHT.mjs",
|
|
97
|
+
"./dist/chunk-TL5BHWDU.mjs",
|
|
98
|
+
"./dist/chunk-ZHOZPQZH.mjs"
|
|
85
99
|
],
|
|
86
100
|
"scripts": {
|
|
87
101
|
"preversion": "npm run build && npm run lint && npm test && npm run types",
|
|
@@ -92,11 +106,13 @@
|
|
|
92
106
|
"test:size": "npm run build && node scripts/check-bundle-size.mjs && node scripts/check-esmj-size.mjs",
|
|
93
107
|
"test:e2e": "playwright test",
|
|
94
108
|
"test:performance": "playwright test --project=performance",
|
|
109
|
+
"bot:bugfinder": "node --import ./bot/registerCssLoader.mjs bot/cli.mjs",
|
|
95
110
|
"lint": "biome check --no-errors-on-unmatched",
|
|
96
111
|
"lint:fix": "biome check --write --unsafe --no-errors-on-unmatched",
|
|
97
112
|
"types": "tsc -p tsconfig.types.json",
|
|
113
|
+
"build:types": "rm -rf dist/types && tsc -p tsconfig.dts.json",
|
|
98
114
|
"dev": "merkur dev",
|
|
99
|
-
"build": "tsup && node scripts/syncSideEffects.mjs",
|
|
115
|
+
"build": "tsup && node scripts/syncSideEffects.mjs && npm run build:types",
|
|
100
116
|
"start": "merkur start"
|
|
101
117
|
},
|
|
102
118
|
"author": "Miroslav Jancarik",
|
|
@@ -111,20 +127,16 @@
|
|
|
111
127
|
"dependencies": {
|
|
112
128
|
"@esmj/dom": "^0.4.1",
|
|
113
129
|
"@esmj/emitter": "^0.4.3",
|
|
114
|
-
"@esmj/observable": "^0.
|
|
130
|
+
"@esmj/observable": "^0.4.0",
|
|
115
131
|
"@esmj/schema": "^0.9.2"
|
|
116
132
|
},
|
|
117
133
|
"devDependencies": {
|
|
118
134
|
"@biomejs/biome": "^2.5.10",
|
|
119
135
|
"@esmj/size": "^0.9.1",
|
|
120
|
-
"@merkur/cli": "
|
|
136
|
+
"@merkur/cli": "2.0.1",
|
|
121
137
|
"@merkur/core": "1.0.3",
|
|
122
|
-
"@merkur/integration": "1.0
|
|
123
|
-
"@merkur/integration-custom-element": "^1.0
|
|
124
|
-
"@merkur/plugin-component": "1.0.3",
|
|
125
|
-
"@merkur/plugin-error": "1.0.3",
|
|
126
|
-
"@merkur/plugin-event-emitter": "1.0.3",
|
|
127
|
-
"@merkur/tools": "1.0.3",
|
|
138
|
+
"@merkur/integration": "1.1.0",
|
|
139
|
+
"@merkur/integration-custom-element": "^1.2.0",
|
|
128
140
|
"@playwright/test": "^1.60.0",
|
|
129
141
|
"@testing-library/dom": "^10.4.0",
|
|
130
142
|
"axe-core": "^4.13.0",
|
package/dist/chunk-5VPYPKGA.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {r}from'./chunk-K2DMHAUD.mjs';function i(o,t,n,m){let e=o.getRoot()?.querySelector(t);if(!e)return {container:null,dispose:null};let r$1=document.createElement("div");r$1.className=n,e.append(r$1);let c=r(r$1,m);return {container:r$1,dispose:c??null}}function s(o,t,n){return i(o,".mrakomor-tools-container",t,n)}function l(o,t,n){return i(o,".mrakomor-footer-end",t,n)}export{s as a,l as b};
|
package/dist/chunk-G2QV4GOO.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-T7OO472O.mjs';import {a as a$1}from'./chunk-P7IKAZYZ.mjs';import {k,j,q}from'./chunk-TX4RCFPO.mjs';import {a as a$2}from'./chunk-B6JJAATK.mjs';import {r}from'./chunk-YHWQV2DB.mjs';import {n,p,k as k$1}from'./chunk-K2DMHAUD.mjs';var s=class extends p{state;element;mrakomor;constructor(t){super(t);let{state:e,observeDOMChanges:n=true}=t??{};this.state=e,this.element=null,this.mrakomor=k$1(a),this._stale=false,this._observer=null,this._offInputStale=null,this._onInputMarkStale=null,this._observeDOMChanges=n;}static get NAMESPACE(){return "namespace.AbstractComponent"}static getStateSchema(){return a$1.object({component:a$1.string().default(this.NAMESPACE),properties:a$1.object().default({}),settings:a$1.object().default({})}).default({})}static getPropsSchema(){return a$1.object({state:this.getStateSchema(),observeDOMChanges:a$1.boolean().default(true)}).default({})}parseFromHTML(t){return this.constructor.getStateSchema(t).parse()}getState(){if(this._stale){let t=this.element;return this.parseFromHTML(t)}return this.state.peek()}isStale(){return this._stale}#t(){this._stale=true;}onMount(){!this.element||!this._observeDOMChanges||(this._observer=new MutationObserver(()=>{this.#t();}),this._observer.observe(this.element,{subtree:true,characterData:true,characterDataOldValue:true,childList:true,attributes:true,attributeOldValue:true}),this._onInputMarkStale=t=>{let e=t.target;e instanceof Node&&this.element?.contains(e)&&this.#t();},this.mrakomor?.emitter&&(this._offInputStale=this.mrakomor.emitter.on(a$2.INPUT,this._onInputMarkStale)));}onUnmount(){this._observer&&(this._observer.disconnect(),this._observer=null),this._offInputStale?.(),this._offInputStale=null,this._onInputMarkStale=null,this._stale=false;}};var f=class extends s{static get NAMESPACE(){return "namespace.block.BlockComponent"}static get LABEL(){return ""}static get KEYWORDS(){return []}static get GROUP(){return "blocks"}isAtomic(){return false}setCursor(t){let e=()=>{if(!this.element?.isConnected)return;let n=typeof t=="number"?t:j(this.getState()?.properties?.text).length;r(this.element,n);};e(),n(e);}onKeydown(t){}getFormattingTarget(t){return null}static toExchangeState(t){return k({originComponent:this.NAMESPACE,properties:{...t?.properties,text:j(t?.properties?.text)},settings:t?.settings})}static fromExchangeState(t){return {properties:t?.properties,settings:t?.settings}}static appendExchangeState(t,e){return q(t,e)}};export{f as a};
|
package/dist/chunk-N4I2WZWF.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-T7OO472O.mjs';import {a}from'./chunk-P7IKAZYZ.mjs';import {p,k,f,o}from'./chunk-K2DMHAUD.mjs';var i=class extends p{static get nodeName(){return "span"}static get NAMESPACE(){return "namespace.EntityRangeElement"}static match(t){return t?.nodeName===this.nodeName.toUpperCase()||t?.entity?.type===this.NAMESPACE}static getStateSchema(t){return a.any()}constructor(t){super(t),this.mrakomor=k(a$1),this.element=f(null);}render(){return o(this.constructor.nodeName,{},this.props.children)}};export{i as a};
|
package/dist/chunk-Q7RMVYZR.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {k as k$1,s,j as j$1,b,a as a$1,q as q$1,o,p,m}from'./chunk-TX4RCFPO.mjs';import {a,n}from'./chunk-YHWQV2DB.mjs';function P(e){if(e?.nodeName==="OL")return "ORDERED";if(e?.nodeName==="UL")return "UNORDERED"}function T(e=[]){let n=new Set;return e.map(t=>{if(t?.componentId&&!n.has(t.componentId))return n.add(t.componentId),t;let r=a();return n.add(r),{...t,componentId:r}})}function k(e){return e?[...e.children].filter(n=>n.nodeName==="LI"):[]}function F(e,n){if(!e||!n)return null;let t=n.startContainer;for(t.nodeType===Node.TEXT_NODE&&(t=t.parentElement);t&&t!==e;){if(t.nodeName==="LI"&&e.contains(t))return t;t=t.parentElement;}return null}function _(e,n){if(!n)return -1;let t=n.getAttribute?.("data-item-index");if(t!=null&&t!==""){let r=Number(t);if(!Number.isNaN(r))return r}return k(e).indexOf(n)}function H(e,n$1){return !e||!n$1?0:n(e,n$1.startContainer,n$1.startOffset)}function j(e,n){let t=k$1({properties:{text:e.text,inlineStyleRanges:e.inlineStyleRanges,entityRanges:e.entityRanges}}),{originalLineState:r,newLineState:s$1}=s(t,n);return {before:{componentId:e.componentId,depth:e.depth??0,text:r.properties.text,inlineStyleRanges:r.properties.inlineStyleRanges??[],entityRanges:r.properties.entityRanges??[]},after:{componentId:a(),depth:e.depth??0,text:s$1.properties.text,inlineStyleRanges:s$1.properties.inlineStyleRanges??[],entityRanges:s$1.properties.entityRanges??[]}}}function q(e,{style:n="UNORDERED"}={}){let t=e?.properties?.items,r=Array.isArray(t)&&t.length?t.map(s=>({componentId:a(),depth:s?.depth??0,text:j$1(s?.text??""),inlineStyleRanges:[...s?.inlineStyleRanges??[]],entityRanges:[...s?.entityRanges??[]]})):[{componentId:a(),depth:0,text:j$1(e?.properties?.text??""),inlineStyleRanges:[...e?.properties?.inlineStyleRanges??[]],entityRanges:[...e?.properties?.entityRanges??[]]}];return {component:b,componentId:a(),properties:{items:r},settings:{style:n==="ORDERED"?"ORDERED":"UNORDERED"}}}function z(e,n,{namespace:t=a$1,Constructor:r}={}){let s=e.properties?.items??[],i=s[n];if(!i)return {blocks:[e],paragraphIndex:0};let p=s.slice(0,n),o=s.slice(n+1),l=k$1({properties:{text:i.text,inlineStyleRanges:i.inlineStyleRanges,entityRanges:i.entityRanges}}),a$1={component:t,componentId:a(),settings:{},...r?.fromExchangeState(l)??l},c=[];return p.length&&c.push({...e,properties:{...e.properties,items:p}}),c.push(a$1),o.length&&c.push({...e,componentId:p.length?a():e.componentId,properties:{...e.properties,items:o}}),{blocks:c,paragraphIndex:p.length?1:0}}function O(e){return m(e)?e.settings?.style==="ORDERED"?"ORDERED":"UNORDERED":null}function B(e,n){let t=O(e),r=O(n);return t!=null&&t===r}function G(e,n,t){if(n<0||t!==n+1||t>=e.length)return null;let r=e[n],s=e[t];if(!B(r,s))return null;let i=[...r.properties?.items??[]],p=[...s.properties?.items??[]];if(p.length===0){let m=[...e];m.splice(t,1);let u=i.length-1,f=u>=0?j$1(i[u]?.text).length:0;return {content:m,listIndex:n,cursor:f}}let[o,...l]=p,a=0;if(i.length===0)i.push(o,...l),a=0;else {let m=i.length-1,u=i[m],f=k$1({properties:{text:u.text,inlineStyleRanges:u.inlineStyleRanges,entityRanges:u.entityRanges}}),b=k$1({properties:{text:o.text,inlineStyleRanges:o.inlineStyleRanges,entityRanges:o.entityRanges}}),{state:x,cursor:C}=q$1(f,b);i[m]={...u,text:x.properties.text,inlineStyleRanges:x.properties.inlineStyleRanges,entityRanges:x.properties.entityRanges},l.length&&i.push(...l),a=C;}let c={...r,properties:{...r.properties,items:T(i)}},d=[...e];return d[n]=c,d.splice(t,1),{content:d,listIndex:n,cursor:a}}function X(e,n){let t=e.properties?.items??[],r=t.length-1;if(r<0)return null;let s=t[r],i=k$1({properties:{text:s.text,inlineStyleRanges:s.inlineStyleRanges,entityRanges:s.entityRanges}}),p=k$1({properties:n?.properties}),{state:o,cursor:l}=q$1(i,p);return {state:{...e,properties:{...e.properties,items:t.map((a,c)=>c===r?{...a,text:o.properties.text,inlineStyleRanges:o.properties.inlineStyleRanges,entityRanges:o.properties.entityRanges}:a)}},cursor:l}}function J(e,n){return o({properties:{text:e?.text??"",inlineStyleRanges:e?.inlineStyleRanges??[],entityRanges:e?.entityRanges??[]}},n)}function K(e,n){let t=Number(e.getAttribute("data-depth")??0)||0,r={properties:{text:j$1(e.innerText??e.textContent??""),inlineStyleRanges:[],entityRanges:[]}};return p(e.childNodes,r,0,n),{componentId:e.getAttribute("data-componentid")||void 0,depth:t,text:j$1(r.properties.text),inlineStyleRanges:r.properties.inlineStyleRanges,entityRanges:r.properties.entityRanges}}export{P as a,T as b,k as c,F as d,_ as e,H as f,j as g,q as h,z as i,G as j,X as k,J as l,K as m};
|
package/dist/chunk-T7OO472O.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {i}from'./chunk-K2DMHAUD.mjs';var e=i();export{e as a};
|
package/dist/chunk-TX4RCFPO.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {a as a$1,j,i,n}from'./chunk-YHWQV2DB.mjs';import {r,o}from'./chunk-K2DMHAUD.mjs';var d="molecule.paragraph.Paragraph",O="molecule.list.List",F="molecule.external.ExternalComponent",v="namespace.unknown.UnknownComponent",X="molecule.headline.H1",K="molecule.headline.H2",z="molecule.headline.H3",G="molecule.headline.H4",U="molecule.headline.H5",A="molecule.headline.";function a(t){return t===`
|
|
2
|
-
`||t===`\r
|
|
3
|
-
`?"":t??""}function Q({component:t,originComponent:e,properties:n,settings:o}={}){let r=n??{};return {...t?{component:t}:{},...e?{originComponent:e}:{},properties:{...r,text:r.text??"",inlineStyleRanges:r.inlineStyleRanges??[],entityRanges:r.entityRanges??[]},...o?{settings:o}:{}}}function N(t){let e=t?.component??"";return e===d||e.startsWith(A)}function V(t){return Array.isArray(t?.properties?.items)}function Y(t,e){return N(t)&&N(e)&&t.component===e.component}function L(t,e){let n=new Set([0,e]);for(let o of t)n.add(o.offset),n.add(o.offset+o.length);return [...n].sort((o,r)=>o-r)}function C(t,e,n){return t.filter(o=>o.offset<=e&&o.offset+o.length>=n)}function T(t,e,n,{inlineStyleComponents:o$1,entityRangeComponents:r}){let s=t;for(let i of e){let f=o$1.find(c=>c.match(i));f&&(s=o(f,{},s));}for(let i of n){let f=r.find(c=>c.match(i));f&&(s=o(f,i,s));}return s}function Z(t,{inlineStyleComponents:e,entityRangeComponents:n}){let o=document.createDocumentFragment(),r$1=a(t.properties.text),s=t.properties.inlineStyleRanges??[],i=t.properties.entityRanges??[];if(!r$1)return o;let f=L([...s,...i],r$1.length);for(let c=0;c<f.length-1;c+=1){let l=f[c],p=f[c+1];if(l>=p)continue;let g=r$1.slice(l,p),H=T(g,C(s,l,p),C(i,l,p),{inlineStyleComponents:e,entityRangeComponents:n});r(o,H);}return o}function u(t,e,n,{inlineStyleComponents:o,entityRangeComponents:r}){let s=n;for(let i of t){if(i.nodeType===Node.TEXT_NODE){s+=i.textContent.length;continue}if(i.nodeType!==Node.ELEMENT_NODE||i.nodeName==="BR")continue;let f=o.find(l=>l.match(i));if(f){let l=i.textContent.length;e.properties.inlineStyleRanges.push({style:f.style,offset:s,length:l}),s=u(i.childNodes,e,s,{inlineStyleComponents:o,entityRangeComponents:r});continue}let c=r.find(l=>l.match(i));if(c){let l=i.textContent.length;e.properties.entityRanges.push({...c.getStateSchema(i).parse(),offset:s,length:l}),s=u(i.childNodes,e,s,{inlineStyleComponents:o,entityRangeComponents:r});continue}s=u(i.childNodes,e,s,{inlineStyleComponents:o,entityRangeComponents:r});}return s}function I(t,e){let n=a(t.properties.text),o=a(e.properties.text);return {state:{...t,properties:{...e.properties,...t.properties,text:n+o,inlineStyleRanges:[...t.properties.inlineStyleRanges??[],...(e.properties.inlineStyleRanges??[]).map(r=>({...r,offset:r.offset+n.length}))],entityRanges:[...t.properties.entityRanges??[],...(e.properties.entityRanges??[]).map(r=>({...r,offset:r.offset+n.length}))]},settings:{...e.settings,...t.settings}},cursor:n.length}}function $(t,{startIndex:e,endIndex:n,startOffset:o,endOffset:r}){let s=[...t],i=s[e],f=s[n],{originalLineState:c}=y(i,o),{newLineState:l}=y(f,r),{state:p,cursor:g}=I(c,l);return s.splice(e,n-e+1,p),{content:s,cursor:g,resultIndex:e}}function P(t,e){return (t??[]).filter(n=>n.offset<e).map(n=>({...n,length:Math.min(n.length,e-n.offset)}))}function M(t,e){return (t??[]).filter(n=>n.offset+n.length>e).map(n=>({...n,offset:Math.max(0,n.offset-e),length:n.offset+n.length-Math.max(n.offset,e)}))}function y(t,e){let n=structuredClone(t),o=structuredClone(t);return n.properties.text=t.properties.text.slice(0,e),o.properties.text=t.properties.text.slice(e),n.properties.inlineStyleRanges=P(t.properties.inlineStyleRanges,e),o.properties.inlineStyleRanges=M(t.properties.inlineStyleRanges,e),n.properties.entityRanges=P(t.properties.entityRanges,e),o.properties.entityRanges=M(t.properties.entityRanges,e),o.componentId=a$1(),{originalLineState:n,newLineState:o}}function b(t,e,{namespace:n=t.constructor.NAMESPACE}={}){if(e.key!=="Enter")return false;e.preventDefault();let{originalLineState:o,newLineState:r}=y(t.getState(),j(t.element));return t.mrakomor.command.insertBlockElement({range:i(),cursor:0,newLineState:r,originalLineState:o,namespace:n}),true}function ee(t,e){if(e.key!=="Enter")return false;e.preventDefault();let n=d,o=t.mrakomor.resolveComponentConstructor(n);return t.mrakomor.command.insertBlockElement({range:i(),cursor:0,newLineState:t.mrakomor.normalizeComponentState(o.getStateSchema().parse({})),namespace:n}),true}function te(t,e){let n=t.constructor;if(!e)return n.getStateSchema(e).parse();let o=structuredClone(n.getStateSchema(e).parse());return u(e.childNodes,o,0,{inlineStyleComponents:t.getInlineStyleComponents(),entityRangeComponents:t.getEntityRangeComponents()}),o.properties.text=a(o.properties.text),o}function ne(t){return t?{element:t,read(e){return {inlineStyleRanges:e.properties?.inlineStyleRanges,entityRanges:e.properties?.entityRanges}},write(e,{inlineStyleRanges:n,entityRanges:o}){n!==void 0&&(e.properties.inlineStyleRanges=n),o!==void 0&&(e.properties.entityRanges=o);}}:null}function _(t,e){let n$1=n(t,e.startContainer,e.startOffset),o=n(t,e.endContainer,e.endOffset);return {offset:n$1,length:Math.max(0,o-n$1)}}function B(t,{style:e,offset:n,length:o}){let r=t??[],s=n+o,i=r.find(f=>f.style===e&&f.offset<=n&&f.offset+f.length>=s);return i?r.filter(f=>f!==i):[...r,{style:e,offset:n,length:o}]}function w(t,e){return t.offset<e.offset+e.length&&e.offset<t.offset+t.length}function k(t,e){let n=e.offset+e.length,o=[];for(let r of t){if(!w(r,e)){o.push(r);continue}r.offset<e.offset&&o.push({...r,length:e.offset-r.offset});let s=r.offset+r.length;s>n&&o.push({...r,offset:n,length:s-n});}return o}function D(t,e){let n=t??[],o=e?.length??0;if(o===0)return null;let r=e.offset??0,s=e.entity?.type,i=n.find(f=>f.offset===r&&f.length===o&&f.entity?.type===s);return i?n.filter(f=>f!==i):[...k(n,e),e]}function oe(t,e,{style:n,range:o}){if(!t||!e?.element||!o)return null;let r=e.read(t);if(r?.inlineStyleRanges===void 0)return null;let{offset:s,length:i}=_(e.element,o);return i===0?null:(e.write(t,{inlineStyleRanges:B(r.inlineStyleRanges??[],{style:n,offset:s,length:i})}),t)}function re(t,e,{state:n,namespace:o,range:r}){if(!t||!e?.element||!r)return null;let s=e.read(t);if(s?.entityRanges===void 0)return null;let i={...n,entity:{type:o,...n?.entity},..._(e.element,r)},f=D(s.entityRanges??[],i);return f===null?null:(e.write(t,{entityRanges:f}),t)}export{d as a,O as b,F as c,v as d,X as e,K as f,z as g,G as h,U as i,a as j,Q as k,N as l,V as m,Y as n,Z as o,u as p,I as q,$ as r,y as s,b as t,ee as u,te as v,ne as w,_ as x,oe as y,re as z};
|
package/dist/chunk-U3MSKB3R.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-G2QV4GOO.mjs';import {d,a as a$3,b}from'./chunk-GDID5DFL.mjs';import {a as a$2}from'./chunk-P7IKAZYZ.mjs';import {a as a$1,v,o,j,w,t}from'./chunk-TX4RCFPO.mjs';import {d as d$1}from'./chunk-YHWQV2DB.mjs';import {o as o$1,a as a$4}from'./chunk-K2DMHAUD.mjs';(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/paragraph/Paragraph.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(a){return a.getAttribute("data-mrakomor-css-path")===e});if(!t){var r=document.createElement("style");r.setAttribute("data-mrakomor-css",""),r.setAttribute("data-mrakomor-css-path",e),r.textContent=`.mrakomor-content p{margin-top:0}
|
|
2
|
-
`,document.head.appendChild(r);}}})();var n=class e extends a{static get NAMESPACE(){return a$1}static get LABEL(){return "P"}static get KEYWORDS(){return ["p","paragraph","text"]}getInlineStyleComponents(){return this.props?.inlineStyles?.get()??this.mrakomor.getConfig()?.inlineStyles??[]}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}static getStateSchema(t){return d(t,{component:e.NAMESPACE,properties:{entityRanges:a$2.array(b()).default([]),inlineStyleRanges:a$2.array(a$3()).default([]),text:a$2.string().default(t?.innerText??t?.textContent??"")}})}parseFromHTML(t){return v(this,t)}_buildContent(t){return o(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-");return o$1("p",{className:t,"data-componentid":this.state.peek().componentId,contentEditable:true,[d$1]:true,$ref:r=>{this.element=r;},$dangerouslySetInnerHTML:()=>{let r=this.state.get(),a=r.properties?.text??"";return j(a)?a$4(()=>this._buildContent(r)):"<br>"}})}getFormattingTarget(t){return w(this.element)}onKeydown(t$1){t(this,t$1);}};function L(){return {resolveConfig:e=>(e.blockComponents.push(n),e),resolveComponent:e=>{if(e===n.NAMESPACE)return n}}}export{n as a,L as b};
|
package/dist/chunk-UC7W4JIH.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-G2QV4GOO.mjs';import {d}from'./chunk-GDID5DFL.mjs';import {a as a$2}from'./chunk-P7IKAZYZ.mjs';import {j,t,a as a$4,e,f as f$1,g,h,i as i$2}from'./chunk-TX4RCFPO.mjs';import {d as d$1,i as i$1,f,s as s$1,r}from'./chunk-YHWQV2DB.mjs';import {o as o$1,a as a$3,n}from'./chunk-K2DMHAUD.mjs';(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/headline/Headline.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(n){return n.getAttribute("data-mrakomor-css-path")===e});if(!t){var r=document.createElement("style");r.setAttribute("data-mrakomor-css",""),r.setAttribute("data-mrakomor-css-path",e),r.textContent=`.mrakomor-content h1,.mrakomor-content h2,.mrakomor-content h3,.mrakomor-content h4,.mrakomor-content h5{margin-top:0}
|
|
2
|
-
`,document.head.appendChild(r);}}})();var o=class extends a$1{constructor(t){super(t),this._level=1;}static getStateSchema(t){return d(t,{component:this.NAMESPACE,properties:{text:a$2.string().default(t?.textContent??t?.innerText??"")}})}parseFromHTML(t){if(!t)return this.constructor.getStateSchema(t).parse();let r=structuredClone(this.constructor.getStateSchema(t).parse());return r.properties.text=j(r.properties.text),r}_buildContent(t){return t.properties?.text??""}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-");return o$1(`h${this._level}`,{className:t,"data-componentid":this.state.peek().componentId,contentEditable:true,[d$1]:true,$ref:r=>{this.element=r;},$dangerouslySetInnerHTML:()=>{let r=this.state.get(),n=r.properties?.text??"";return j(n)?a$3(()=>this._buildContent(r)):"<br>"}})}onKeydown(t$1){if(t$1.key==="Backspace"){this.#t(t$1);return}t(this,t$1,{namespace:a$4});}#t(t){if(!i$1()?.collapsed)return;let n$1=f(this.element);if(n$1?.previousElementSibling||j(this.getState()?.properties?.text))return;t.preventDefault(),this.mrakomor.command.transformBlockElement({blockElement:n$1,namespace:a$4});let l=()=>{let b=this.mrakomor.getRoot()?.querySelector(".mrakomor-content .mrakomor-block-element"),p=s$1(b);p?.isConnected&&r(p,0);};l(),n(l);}},s=class extends o{static get NAMESPACE(){return e}static get LABEL(){return "H1"}static get KEYWORDS(){return ["h1","title","heading"]}constructor(t){super(t),this._level=1;}},c=class extends o{static get NAMESPACE(){return f$1}static get LABEL(){return "H2"}static get KEYWORDS(){return ["h2","heading"]}constructor(t){super(t),this._level=2;}},i=class extends o{static get NAMESPACE(){return g}static get LABEL(){return "H3"}static get KEYWORDS(){return ["h3","heading"]}constructor(t){super(t),this._level=3;}},a=class extends o{static get NAMESPACE(){return h}static get LABEL(){return "H4"}static get KEYWORDS(){return ["h4","heading"]}constructor(t){super(t),this._level=4;}},u=class extends o{static get NAMESPACE(){return i$2}static get LABEL(){return "H5"}static get KEYWORDS(){return ["h5","heading"]}constructor(t){super(t),this._level=5;}};function w(){return {resolveConfig:e=>(e.blockComponents.push(s,c,i,a,u),e),resolveComponent:e=>{if(e===s.NAMESPACE)return s;if(e===c.NAMESPACE)return c;if(e===i.NAMESPACE)return i;if(e===a.NAMESPACE)return a;if(e===u.NAMESPACE)return u}}}export{o as a,w as b};
|
package/dist/chunk-WBTDWVEC.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {a as a$1,b as b$2,h,k as k$1,c,m,d,e,l,j as j$1,i as i$1,f as f$1,g}from'./chunk-Q7RMVYZR.mjs';import {a}from'./chunk-G2QV4GOO.mjs';import {b as b$3,a as a$7}from'./chunk-GDID5DFL.mjs';import {a as a$2}from'./chunk-P7IKAZYZ.mjs';import {b as b$1,j,k,a as a$5,l as l$1,m as m$1}from'./chunk-TX4RCFPO.mjs';import {a as a$6}from'./chunk-B6JJAATK.mjs';import {a as a$3,i,f,d as d$1,t,r}from'./chunk-YHWQV2DB.mjs';import {q,o,a as a$4,n}from'./chunk-K2DMHAUD.mjs';(function(){if(!(typeof document>"u")){var m="mrakomor/core/plugin/list/List.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(n){return n.getAttribute("data-mrakomor-css-path")===m});if(!t){var e=document.createElement("style");e.setAttribute("data-mrakomor-css",""),e.setAttribute("data-mrakomor-css-path",m),e.textContent=`.molecule-list-list{margin:0 0 1em;padding-inline-start:1.5em}.molecule-list-list li{margin:.25em 0;outline:none}.molecule-list-list li:focus{outline:none}.molecule-list-list li[data-depth="1"]{margin-inline-start:1.5em}.molecule-list-list li[data-depth="2"]{margin-inline-start:3em}.molecule-list-list li[data-depth="3"]{margin-inline-start:4.5em}
|
|
2
|
-
`,document.head.appendChild(e);}}})();var S=m=>a$2.object({componentId:a$2.string().default(()=>m?.getAttribute?.("data-componentid")||a$3()),depth:a$2.number().default(0),text:a$2.string().default(""),inlineStyleRanges:a$2.array(a$7()).default([]),entityRanges:a$2.array(b$3()).default([])}).default({}),b=class m$1 extends a{static get NAMESPACE(){return b$1}static get LABEL(){return "List"}static get GROUP(){return "lists"}getInlineStyleComponents(){return this.props?.inlineStyles?.get()??this.mrakomor.getConfig()?.inlineStyles??[]}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}static getStateSchema(t){let e=a$1(t);return a$2.object({component:a$2.string().default(m$1.NAMESPACE),componentId:a$2.string().default(t?.getAttribute("data-componentid")||a$3()),properties:a$2.object({items:a$2.array(S()).default([S().parse()]).transform(b$2)}).default({}),settings:a$2.object({style:a$2.enum(["ORDERED","UNORDERED"]).default(e??"UNORDERED")}).default({})}).default({})}static toExchangeState(t){let e=t?.properties?.items??[],n=e.map(r=>j(r?.text)).join(`
|
|
3
|
-
`),s=e.map(r=>({text:j(r?.text),inlineStyleRanges:r?.inlineStyleRanges??[],entityRanges:r?.entityRanges??[],depth:r?.depth??0}));return k({originComponent:this.NAMESPACE,properties:{text:n,items:s},settings:t?.settings})}static fromExchangeState(t){return h(t,{style:t?.settings?.style})}static appendExchangeState(t,e){return k$1(t,e)}parseFromHTML(t){if(!t)return this.constructor.getStateSchema(t).parse();let e=structuredClone(this.constructor.getStateSchema(t).parse()),n={inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()},s=c(t);if(s.length)e.properties.items=s.map(r=>S(r).parse(m(r,n)));else {let r=this.state?.peek?.()?.properties?.items;e.properties.items=r?.length?structuredClone(r):[S().parse()];}return e.settings={...e.settings,style:t.nodeName==="OL"?"ORDERED":t.nodeName==="UL"?"UNORDERED":this.state?.peek()?.settings?.style??e.settings?.style??"UNORDERED"},e}getFormattingTarget(t){let e$1=t??i(),n=d(this.element,e$1);if(!n)return null;let s=e(this.element,n);return s<0?null:{element:n,read(r){let o=r.properties?.items?.[s];return {inlineStyleRanges:o?.inlineStyleRanges,entityRanges:o?.entityRanges}},write(r,{inlineStyleRanges:o,entityRanges:i}){let a=r.properties?.items?.[s];a&&(o!==void 0&&(a.inlineStyleRanges=o),i!==void 0&&(a.entityRanges=i));}}}_commitState(t){let e=f(this.element)??this.mrakomor._getBlockElementByComponentId(t.componentId),n=this.mrakomor._getBlockElementIndex(e);if(n===-1)return;let s=this.mrakomor.getContent();s.splice(n,1,t),this.mrakomor.setContent(s);}_buildItemContent(t){return l(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-"),e=this.state.peek(),n=e.settings?.style==="ORDERED"?"ol":"ul",s=q(()=>this.state.get().properties?.items??[],(r,o)=>r.componentId??String(o),(r,o$1)=>o("li",{contentEditable:true,[d$1]:true,"data-componentid":()=>r.get().componentId,"data-item-index":()=>{let i=r.get()?.componentId,c=(this.state.get().properties?.items??[]).findIndex(u=>u.componentId===i);return String(c>=0?c:o$1)},"data-depth":()=>String(r.get()?.depth??0),$dangerouslySetInnerHTML:()=>{let i=r.get(),a=i?.text??"";return j(a)?a$4(()=>this._buildItemContent(i)):"<br>"}}),{tagName:n});return s.className=t,e.componentId&&s.setAttribute("data-componentid",e.componentId),this.element=s,s}onKeydown(t){if(t.key==="Enter"){this.#e(t);return}t.key==="Backspace"&&this.#n(t);}setCursor(t){let e=this.getState()?.properties?.items??[],n$1=e.length-1;if(n$1<0)return;let s=typeof t=="number"?t:j(e[n$1]?.text).length,r$1=()=>{let o=this.element?.querySelector(`li[data-item-index="${n$1}"]`);o?.isConnected&&r(o,s);};r$1(),n(r$1);}#t(t$1){let e=this.getState(),n$1=[...e.properties.items??[]],s=n$1[t$1];if(!s)return;if((s.depth??0)>0){n$1[t$1]={...s,depth:s.depth-1},this._commitState({...e,properties:{...e.properties,items:n$1}});let p=()=>{let g=this.element?.querySelector(`li[data-item-index="${t$1}"]`);g?.isConnected&&r(g,0);};p(),n(p);return}let r$1=f(this.element),o=this.mrakomor._getBlockElementIndex(r$1),i=r$1?.previousElementSibling??null,a=i?this.mrakomor._getBlockElementIndex(i):-1;if(t$1===0&&a>=0&&o===a+1){let p=this.mrakomor.getContent(),g=j$1(p,a,o);if(g){this.mrakomor._setContentState(g.content.map(Q=>this.mrakomor.normalizeComponentState(Q))),t(i)?.setCursor?.(g.cursor);return}}let{blocks:c,paragraphIndex:u}=i$1(e,t$1,{Constructor:this.mrakomor.register.blocks.getByNamespace(a$5)});this.mrakomor.command.replaceBlockElement({blockElement:f(this.element),blocks:c,cursor:0,cursorBlockIndex:u});}#e(t){t.preventDefault();let e$1=i(),n$1=d(this.element,e$1);if(!n$1)return;let s=e(this.element,n$1),r$1=f$1(n$1,e$1),o=this.getState(),i$1=[...o.properties.items??[]],a=i$1[s];if(!a)return;if(!j(a.text)){this.#t(s);return}let{before:c,after:u}=g(a,r$1);i$1.splice(s,1,c,u),this._commitState({...o,properties:{...o.properties,items:i$1}}),n(()=>{let p=this.element?.querySelector(`li[data-item-index="${s+1}"]`);p&&r(p,0);});}#n(t){let e$1=i();if(!e$1?.collapsed)return;let n=d(this.element,e$1);if(!n){let o=e$1.startContainer;if(!(o===this.element||this.element?.contains?.(o)))return;t.preventDefault(),this.#t(0);return}let s=e(this.element,n);f$1(n,e$1)===0&&(t.preventDefault(),this.#t(s));}};function W(m){let{mrakomor:t$1,blockElement:e$1,namespace:n}=m;if(!t$1||!e$1||!n)return;let s=t$1._getBlockElementState(e$1);if(!s||!l$1({component:n})||!m$1(s))return;m.preventDefault();let o=t(e$1)?.element,i$2=m.range??i(),a=o?d(o,i$2):null,c=e(o,a);if(c<0)return;let{blocks:u,paragraphIndex:p}=i$1(s,c,{namespace:n,Constructor:t$1.register.blocks.getByNamespace(n)});t$1.command.replaceBlockElement({blockElement:e$1,blocks:u,cursor:0,cursorBlockIndex:p});}function X(m){return {resolveConfig:t=>(t.blockComponents.push({component:m,label:"UL",keywords:["ul","unordered","bullet"],order:100,settings:{style:"UNORDERED"}},{component:m,label:"OL",keywords:["ol","ordered","number"],order:101,settings:{style:"ORDERED"}}),t),resolveComponent:t=>{if(t===m.NAMESPACE)return m},registerCommands(t){t.emitter.on(a$6.TRANSFORM_BLOCK_ELEMENT,W);}}}function lt(){return X(b)}export{b as a,X as b,lt as c};
|
package/dist/chunk-WQWE5UCN.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-P7IKAZYZ.mjs';var u=class{#r=new Set;pipe(...t){return c(...t)(this)}next(...t){Array.from(this.#r).forEach(r=>{typeof r=="function"?r(...t):r.next(...t);});}error(...t){Array.from(this.#r).forEach(r=>{r?.error?.(...t),this.unsubscribe(r);});}complete(...t){Array.from(this.#r).forEach(r=>{r?.complete?.(...t),this.unsubscribe(r);});}subscribe(t){return this.#r.add(t),{unsubscribe:()=>{this.unsubscribe(t);}}}unsubscribe(t){this.#r.delete(t);}};function c(...t){return r=>Array.from(t).reduce((e,s)=>s(e),r)}function a(t){return t.map((r,e)=>({entry:r,index:e})).sort((r,e)=>{let s=r.entry.order??r.index,i=e.entry.order??e.index;return s!==i?s-i:r.index-e.index}).map(({entry:r})=>r)}var h=class extends u{mrakomor;#r=new Map;#t=null;#s=0;#n;constructor(r,e={}){super(),this.mrakomor=r,this.#n=e.sort??a;}normalize(r,e){throw new Error("Register subclass must implement normalize")}#e(){this.#t=null,this.next(this.list());}#i(r,e=this.#s++){let s=this.normalize(r,e);return s?(this.#r.set(s.id,s),s):null}add(r){if(Array.isArray(r)){let s=[];for(let i of r){let o=this.#i(i,this.#s++);o&&s.push(o);}return s.length&&this.#e(),s}let e=this.#i(r);return e&&this.#e(),e}get(r){return this.#r.get(r)}has(r){return this.#r.has(r)}remove(r){let e=this.#r.delete(r);return e&&this.#e(),e}list(){return this.#t??=this.#n([...this.#r.values()]),this.#t}};function l(){return a$1.object({id:a$1.string(),group:a$1.string().default("general"),description:a$1.string().default(""),commands:a$1.array(a$1.string()).default([]),shortcuts:a$1.array(a$1.string()).default([])}).default({})}function g(t){try{return l().parse(t)}catch{return null}}export{h as a,l as b,g as c};
|
package/dist/chunk-YHWQV2DB.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {g as g$1}from'./chunk-K2DMHAUD.mjs';var g=m(),C=m(),R=m(),k=Array.from({length:256},(t,e)=>(e<=15?"0":"")+e.toString(16));function m(){return Math.floor(Math.random()*16777215)}function I(){return C=(C+1)%16777215,C}function H(){let t=Math.floor(Date.now()/1e3);t=parseInt(t,10)%4294967295;let e=I(),n=String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255,g>>16&255,g>>8&255,g&255,R>>8&255,R&255,e>>16&255,e>>8&255,e&255),o="";for(let l=0;l<n.length;l++)o+=k[n.charCodeAt(l)];return o}var E=Symbol("block-element"),M=Symbol("block-element-body"),O=Symbol("selectable-element");function h(t,e){let n=t;for(n?.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n[e]===void 0;)n=n.parentElement;return n??null}function T(t){return t?h(t.startContainer,E):null}function b(t){return h(t,E)}function y(t){return t?h(t.startContainer,O):null}function B(t){return h(t,O)}function x(){return window.getSelection()}function N(){let t=x();return t.rangeCount>0?t.getRangeAt(0).cloneRange():null}function X(){let t=N();if(!t)return 0;t.collapse(true);let e=y(t),n=T(t),o=e??s(n);return d(o,t.startContainer,t.startOffset)}var f=null;function v(){f=A();}function _(){f&&D(f);}function W(){f&&(f={start:f.end,end:f.end,element:f.element},_());}function w(t,e){let n=y(e);return n||(s(t)??t?.childNodes?.[0]??null)}function d(t,e,n){if(!t)return 0;if(e===t){if(e.nodeType===Node.TEXT_NODE)return n;let c=0,u=t.childNodes,a=Math.min(n,u.length);for(let i=0;i<a;i++)c+=u[i].textContent.length;return c}if(e.nodeType===Node.ELEMENT_NODE&&!t.contains(e))return 0;let o=0,l=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),r=l.nextNode();for(;r;){if(r===e)return o+n;o+=r.textContent.length,r=l.nextNode();}return o}function A(){let t=N();if(!t)return null;let e=T(t),n=w(e,t);return {start:d(n,t.startContainer,t.startOffset),end:d(n,t.endContainer,t.endOffset),element:e,selectableElement:n}}function j(t=N()){if(!t||t.collapsed)return null;let e=b(t.startContainer),n=b(t.endContainer);if(!e||!n)return null;let o=B(t.startContainer)??s(e),l=B(t.endContainer)??s(n);return {startBlock:e,endBlock:n,startOffset:d(o,t.startContainer,t.startOffset),endOffset:d(l,t.endContainer,t.endOffset)}}function D(t){if(!t)return;let{start:e,end:n,element:o,selectableElement:l}=t,r=l?.isConnected&&l||s(o)||o?.childNodes?.[0];if(!r)return;let c=S(r,e),u=S(r,n),a=document.createRange();a.setStart(c.startContainer,c.startOffset),a.setEnd(u.endContainer,u.endOffset);let i=x();i.removeAllRanges(),i.addRange(a);}function S(t,e){let n=document.createRange();if(!t)return n;if(e<=0)return n.setStart(t,0),n.collapse(true),n;let o=0,l=[t];for(;l.length>0;){let r=l.pop();if(r.nodeType===Node.TEXT_NODE){let c=r.textContent.length;if(o+c>=e)return n.setEnd(r,e-o),n.setStart(r,e-o),n;o+=c;}else if(r.childNodes&&r.childNodes.length>0)for(let c=r.childNodes.length-1;c>=0;c--)l.push(r.childNodes[c]);}return n.setEnd(t,t.childNodes.length),n.setStart(t,t.childNodes.length),n}function K(t,e){let n=S(t,e),o=x();o.removeAllRanges(),o.addRange(n);}function s(t){if(!t)return null;let e=L(t);return e?.firstElementChild??e?.firstChild}function F(t){if(!t?.[E])return null;let e=s(t);return e?g$1(e)?.classInstance:null}function L(t){if(!t)return null;for(let e of t.children)if(e[M])return e;return null}function Y(t,e,n,o=12){let l=t.getBoundingClientRect(),r=typeof e?.getBoundingClientRect=="function"?e.getBoundingClientRect():e??{left:0,top:0},c=n?.offsetHeight??40;return {x:r.left-l.left,y:r.top-l.top-c-o}}function q(t,e){let n=t.getBoundingClientRect(),o=e?.offsetWidth??420,l=e?.offsetHeight??320,r=16;return {x:Math.max(r,(n.width-o)/2),y:Math.max(r,(n.height-l)/2)}}export{H as a,E as b,M as c,O as d,T as e,b as f,y as g,B as h,N as i,X as j,v as k,_ as l,W as m,d as n,A as o,j as p,D as q,K as r,s,F as t,L as u,Y as v,q as w};
|