@dooherceg/tiptap-controlled-editor-with-table 0.0.9 → 0.0.11

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.
Files changed (125) hide show
  1. package/dist/Combination-CO0ZtURs.js +1333 -0
  2. package/dist/assets/{components/tiptap-ui-primitive/badge/badge-colors.css → badge.css} +1 -1
  3. package/dist/assets/{components/tiptap-ui-primitive/button/button-colors.css → button.css} +1 -1
  4. package/dist/assets/simple-editor.css +1 -0
  5. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js +58 -6
  6. package/dist/components/tiptap-node/image-upload-node/image-upload-node.js +4 -5
  7. package/dist/components/tiptap-templates/simple/simple-editor.d.ts +3 -1
  8. package/dist/components/tiptap-templates/simple/simple-editor.js +1970 -201
  9. package/dist/components/tiptap-templates/simple/theme-toggle.js +7 -7
  10. package/dist/components/tiptap-ui/blockquote-button/blockquote-button.js +10 -10
  11. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.js +5 -6
  12. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.js +1 -1
  13. package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.js +16 -16
  14. package/dist/components/tiptap-ui/heading-button/heading-button.js +9 -9
  15. package/dist/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.js +37 -29
  16. package/dist/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.js +14 -13
  17. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.js +16 -16
  18. package/dist/components/tiptap-ui/insert-table-button/insert-table-button.js +9 -9
  19. package/dist/components/tiptap-ui/link-popover/link-popover.js +13 -13
  20. package/dist/components/tiptap-ui/list-button/list-button.js +7 -7
  21. package/dist/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.js +24 -20
  22. package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.js +6 -5
  23. package/dist/components/tiptap-ui/table-actions-toolbar/table-actions-toolbar.js +28 -28
  24. package/dist/components/tiptap-ui-primitive/badge/badge.js +16 -19
  25. package/dist/components/tiptap-ui-primitive/button/button.js +19 -22
  26. package/dist/components/tiptap-ui-primitive/card/card.js +12 -13
  27. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.js +1012 -39
  28. package/dist/components/tiptap-ui-primitive/input/input.js +6 -7
  29. package/dist/components/tiptap-ui-primitive/popover/popover.js +233 -24
  30. package/dist/components/tiptap-ui-primitive/separator/separator.js +8 -9
  31. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.js +7 -8
  32. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.js +1330 -84
  33. package/dist/floating-ui.react-dom-DgOuULHo.js +1334 -0
  34. package/dist/hooks/use-throttled-callback.js +108 -13
  35. package/dist/{node_modules/react-hotkeys-hook/packages/react-hotkeys-hook/dist/index.js → index-Bqw9S4qP.js} +55 -57
  36. package/package.json +1 -1
  37. package/dist/_virtual/_commonjsHelpers.js +0 -8
  38. package/dist/_virtual/index.js +0 -7
  39. package/dist/assets/components/tiptap-node/blockquote-node/blockquote-node.css +0 -1
  40. package/dist/assets/components/tiptap-node/code-block-node/code-block-node.css +0 -1
  41. package/dist/assets/components/tiptap-node/heading-node/heading-node.css +0 -1
  42. package/dist/assets/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.css +0 -1
  43. package/dist/assets/components/tiptap-node/image-node/image-node.css +0 -1
  44. package/dist/assets/components/tiptap-node/list-node/list-node.css +0 -1
  45. package/dist/assets/components/tiptap-node/paragraph-node/paragraph-node.css +0 -1
  46. package/dist/assets/components/tiptap-templates/simple/simple-editor.css +0 -1
  47. package/dist/assets/components/tiptap-ui-primitive/badge/badge-group.css +0 -1
  48. package/dist/assets/components/tiptap-ui-primitive/badge/badge.css +0 -1
  49. package/dist/assets/components/tiptap-ui-primitive/button/button-group.css +0 -1
  50. package/dist/assets/components/tiptap-ui-primitive/button/button.css +0 -1
  51. package/dist/assets/styles/_keyframe-animations.css +0 -1
  52. package/dist/assets/styles/_variables.css +0 -1
  53. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -527
  54. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -402
  55. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.js +0 -932
  56. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +0 -185
  57. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -208
  58. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -136
  59. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -130
  60. package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -9
  61. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +0 -24
  62. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +0 -48
  63. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -29
  64. package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -53
  65. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +0 -10
  66. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -127
  67. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +0 -221
  68. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -17
  69. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -136
  70. package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -13
  71. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +0 -636
  72. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +0 -239
  73. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +0 -219
  74. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -15
  75. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -70
  76. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -36
  77. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +0 -183
  78. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -49
  79. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -10
  80. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -52
  81. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -14
  82. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -6
  83. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +0 -27
  84. package/dist/node_modules/@tiptap/extension-highlight/dist/index.js +0 -84
  85. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +0 -57
  86. package/dist/node_modules/@tiptap/extension-image/dist/index.js +0 -128
  87. package/dist/node_modules/@tiptap/extension-list/dist/index.js +0 -713
  88. package/dist/node_modules/@tiptap/extension-subscript/dist/index.js +0 -40
  89. package/dist/node_modules/@tiptap/extension-superscript/dist/index.js +0 -40
  90. package/dist/node_modules/@tiptap/extension-table/dist/index.js +0 -380
  91. package/dist/node_modules/@tiptap/extension-text-align/dist/index.js +0 -46
  92. package/dist/node_modules/@tiptap/extension-typography/dist/index.js +0 -125
  93. package/dist/node_modules/@tiptap/extensions/dist/index.js +0 -288
  94. package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -52
  95. package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -7
  96. package/dist/node_modules/lodash.throttle/index.js +0 -95
  97. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -11
  98. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -112
  99. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -31
  100. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -16
  101. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -68
  102. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
  103. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
  104. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -71
  105. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -7
  106. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -25
  107. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -11
  108. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -15
  109. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -30
  110. package/dist/node_modules/tabbable/dist/index.esm.js +0 -197
  111. package/dist/node_modules/tslib/tslib.es6.js +0 -27
  112. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -6
  113. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -26
  114. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -25
  115. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -18
  116. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -67
  117. /package/dist/assets/{components/tiptap-ui-primitive/card/card.css → card.css} +0 -0
  118. /package/dist/assets/{components/tiptap-ui/color-highlight-button/color-highlight-button.css → color-highlight-button.css} +0 -0
  119. /package/dist/assets/{components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.css → dropdown-menu.css} +0 -0
  120. /package/dist/assets/{components/tiptap-node/image-upload-node/image-upload-node.css → image-upload-node.css} +0 -0
  121. /package/dist/assets/{components/tiptap-ui-primitive/input/input.css → input.css} +0 -0
  122. /package/dist/assets/{components/tiptap-ui-primitive/popover/popover.css → popover.css} +0 -0
  123. /package/dist/assets/{components/tiptap-ui-primitive/separator/separator.css → separator.css} +0 -0
  124. /package/dist/assets/{components/tiptap-ui-primitive/toolbar/toolbar.css → toolbar.css} +0 -0
  125. /package/dist/assets/{components/tiptap-ui-primitive/tooltip/tooltip.css → tooltip.css} +0 -0
@@ -1,288 +0,0 @@
1
- import { Extension as u, callOrReturn as w, getExtensionField as S, isNodeEmpty as P, isNodeSelection as v } from "@tiptap/core";
2
- import { Plugin as p, PluginKey as m } from "prosemirror-state";
3
- import { dropCursor as z } from "prosemirror-dropcursor";
4
- import { DecorationSet as f, Decoration as g } from "prosemirror-view";
5
- import { gapCursor as E } from "prosemirror-gapcursor";
6
- import { history as M, redo as N, undo as O } from "prosemirror-history";
7
- u.create({
8
- name: "characterCount",
9
- addOptions() {
10
- return {
11
- limit: null,
12
- mode: "textSize",
13
- textCounter: (e) => e.length,
14
- wordCounter: (e) => e.split(" ").filter((t) => t !== "").length
15
- };
16
- },
17
- addStorage() {
18
- return {
19
- characters: () => 0,
20
- words: () => 0
21
- };
22
- },
23
- onBeforeCreate() {
24
- this.storage.characters = (e) => {
25
- const t = e?.node || this.editor.state.doc;
26
- if ((e?.mode || this.options.mode) === "textSize") {
27
- const r = t.textBetween(0, t.content.size, void 0, " ");
28
- return this.options.textCounter(r);
29
- }
30
- return t.nodeSize;
31
- }, this.storage.words = (e) => {
32
- const t = e?.node || this.editor.state.doc, n = t.textBetween(0, t.content.size, " ", " ");
33
- return this.options.wordCounter(n);
34
- };
35
- },
36
- addProseMirrorPlugins() {
37
- let e = !1;
38
- return [
39
- new p({
40
- key: new m("characterCount"),
41
- appendTransaction: (t, n, r) => {
42
- if (e)
43
- return;
44
- const o = this.options.limit;
45
- if (o == null || o === 0) {
46
- e = !0;
47
- return;
48
- }
49
- const s = this.storage.characters({ node: r.doc });
50
- if (s > o) {
51
- const i = s - o, d = 0, a = i;
52
- console.warn(
53
- `[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`
54
- );
55
- const c = r.tr.deleteRange(d, a);
56
- return e = !0, c;
57
- }
58
- e = !0;
59
- },
60
- filterTransaction: (t, n) => {
61
- const r = this.options.limit;
62
- if (!t.docChanged || r === 0 || r === null || r === void 0)
63
- return !0;
64
- const o = this.storage.characters({ node: n.doc }), s = this.storage.characters({ node: t.doc });
65
- if (s <= r || o > r && s > r && s <= o)
66
- return !0;
67
- if (o > r && s > r && s > o || !t.getMeta("paste"))
68
- return !1;
69
- const d = t.selection.$head.pos, a = s - r, c = d - a, l = d;
70
- return t.deleteRange(c, l), !(this.storage.characters({ node: t.doc }) > r);
71
- }
72
- })
73
- ];
74
- }
75
- });
76
- u.create({
77
- name: "dropCursor",
78
- addOptions() {
79
- return {
80
- color: "currentColor",
81
- width: 1,
82
- class: void 0
83
- };
84
- },
85
- addProseMirrorPlugins() {
86
- return [z(this.options)];
87
- }
88
- });
89
- u.create({
90
- name: "focus",
91
- addOptions() {
92
- return {
93
- className: "has-focus",
94
- mode: "all"
95
- };
96
- },
97
- addProseMirrorPlugins() {
98
- return [
99
- new p({
100
- key: new m("focus"),
101
- props: {
102
- decorations: ({ doc: e, selection: t }) => {
103
- const { isEditable: n, isFocused: r } = this.editor, { anchor: o } = t, s = [];
104
- if (!n || !r)
105
- return f.create(e, []);
106
- let i = 0;
107
- this.options.mode === "deepest" && e.descendants((a, c) => {
108
- if (a.isText)
109
- return;
110
- if (!(o >= c && o <= c + a.nodeSize - 1))
111
- return !1;
112
- i += 1;
113
- });
114
- let d = 0;
115
- return e.descendants((a, c) => {
116
- if (a.isText || !(o >= c && o <= c + a.nodeSize - 1))
117
- return !1;
118
- if (d += 1, this.options.mode === "deepest" && i - d > 0 || this.options.mode === "shallowest" && d > 1)
119
- return this.options.mode === "deepest";
120
- s.push(
121
- g.node(c, c + a.nodeSize, {
122
- class: this.options.className
123
- })
124
- );
125
- }), f.create(e, s);
126
- }
127
- }
128
- })
129
- ];
130
- }
131
- });
132
- u.create({
133
- name: "gapCursor",
134
- addProseMirrorPlugins() {
135
- return [E()];
136
- },
137
- extendNodeSchema(e) {
138
- var t;
139
- const n = {
140
- name: e.name,
141
- options: e.options,
142
- storage: e.storage
143
- };
144
- return {
145
- allowGapCursor: (t = w(S(e, "allowGapCursor", n))) != null ? t : null
146
- };
147
- }
148
- });
149
- var k = u.create({
150
- name: "placeholder",
151
- addOptions() {
152
- return {
153
- emptyEditorClass: "is-editor-empty",
154
- emptyNodeClass: "is-empty",
155
- placeholder: "Write something …",
156
- showOnlyWhenEditable: !0,
157
- showOnlyCurrent: !0,
158
- includeChildren: !1
159
- };
160
- },
161
- addProseMirrorPlugins() {
162
- return [
163
- new p({
164
- key: new m("placeholder"),
165
- props: {
166
- decorations: ({ doc: e, selection: t }) => {
167
- const n = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: r } = t, o = [];
168
- if (!n)
169
- return null;
170
- const s = this.editor.isEmpty;
171
- return e.descendants((i, d) => {
172
- const a = r >= d && r <= d + i.nodeSize, c = !i.isLeaf && P(i);
173
- if ((a || !this.options.showOnlyCurrent) && c) {
174
- const l = [this.options.emptyNodeClass];
175
- s && l.push(this.options.emptyEditorClass);
176
- const h = g.node(d, d + i.nodeSize, {
177
- class: l.join(" "),
178
- "data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
179
- editor: this.editor,
180
- node: i,
181
- pos: d,
182
- hasAnchor: a
183
- }) : this.options.placeholder
184
- });
185
- o.push(h);
186
- }
187
- return this.options.includeChildren;
188
- }), f.create(e, o);
189
- }
190
- }
191
- })
192
- ];
193
- }
194
- }), F = u.create({
195
- name: "selection",
196
- addOptions() {
197
- return {
198
- className: "selection"
199
- };
200
- },
201
- addProseMirrorPlugins() {
202
- const { editor: e, options: t } = this;
203
- return [
204
- new p({
205
- key: new m("selection"),
206
- props: {
207
- decorations(n) {
208
- return n.selection.empty || e.isFocused || !e.isEditable || v(n.selection) || e.view.dragging ? null : f.create(n.doc, [
209
- g.inline(n.selection.from, n.selection.to, {
210
- class: t.className
211
- })
212
- ]);
213
- }
214
- }
215
- })
216
- ];
217
- }
218
- });
219
- function y({ types: e, node: t }) {
220
- return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
221
- }
222
- u.create({
223
- name: "trailingNode",
224
- addOptions() {
225
- return {
226
- node: void 0,
227
- notAfter: []
228
- };
229
- },
230
- addProseMirrorPlugins() {
231
- var e;
232
- const t = new m(this.name), n = ((e = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : e.name) || this.options.node || "paragraph", r = Object.entries(this.editor.schema.nodes).map(([, o]) => o).filter((o) => (this.options.notAfter || []).concat(n).includes(o.name));
233
- return [
234
- new p({
235
- key: t,
236
- appendTransaction: (o, s, i) => {
237
- const { doc: d, tr: a, schema: c } = i, l = t.getState(i), h = d.content.size, C = c.nodes[n];
238
- if (l)
239
- return a.insert(h, C.create());
240
- },
241
- state: {
242
- init: (o, s) => {
243
- const i = s.tr.doc.lastChild;
244
- return !y({ node: i, types: r });
245
- },
246
- apply: (o, s) => {
247
- if (!o.docChanged || o.getMeta("__uniqueIDTransaction"))
248
- return s;
249
- const i = o.doc.lastChild;
250
- return !y({ node: i, types: r });
251
- }
252
- }
253
- })
254
- ];
255
- }
256
- });
257
- u.create({
258
- name: "undoRedo",
259
- addOptions() {
260
- return {
261
- depth: 100,
262
- newGroupDelay: 500
263
- };
264
- },
265
- addCommands() {
266
- return {
267
- undo: () => ({ state: e, dispatch: t }) => O(e, t),
268
- redo: () => ({ state: e, dispatch: t }) => N(e, t)
269
- };
270
- },
271
- addProseMirrorPlugins() {
272
- return [M(this.options)];
273
- },
274
- addKeyboardShortcuts() {
275
- return {
276
- "Mod-z": () => this.editor.commands.undo(),
277
- "Shift-Mod-z": () => this.editor.commands.redo(),
278
- "Mod-y": () => this.editor.commands.redo(),
279
- // Russian keyboard layouts
280
- "Mod-я": () => this.editor.commands.undo(),
281
- "Shift-Mod-я": () => this.editor.commands.redo()
282
- };
283
- }
284
- });
285
- export {
286
- k as Placeholder,
287
- F as Selection
288
- };
@@ -1,52 +0,0 @@
1
- var S = function(r) {
2
- if (typeof document > "u")
3
- return null;
4
- var u = Array.isArray(r) ? r[0] : r;
5
- return u.ownerDocument.body;
6
- }, f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {}, h = 0, W = function(r) {
7
- return r && (r.host || W(r.parentNode));
8
- }, D = function(r, u) {
9
- return u.map(function(e) {
10
- if (r.contains(e))
11
- return e;
12
- var n = W(e);
13
- return n && r.contains(n) ? n : (console.error("aria-hidden", e, "in not contained inside", r, ". Doing nothing"), null);
14
- }).filter(function(e) {
15
- return !!e;
16
- });
17
- }, E = function(r, u, e, n) {
18
- var i = D(u, Array.isArray(r) ? r : [r]);
19
- p[e] || (p[e] = /* @__PURE__ */ new WeakMap());
20
- var s = p[e], l = [], o = /* @__PURE__ */ new Set(), b = new Set(i), y = function(t) {
21
- !t || o.has(t) || (o.add(t), y(t.parentNode));
22
- };
23
- i.forEach(y);
24
- var A = function(t) {
25
- !t || b.has(t) || Array.prototype.forEach.call(t.children, function(a) {
26
- if (o.has(a))
27
- A(a);
28
- else
29
- try {
30
- var c = a.getAttribute(n), w = c !== null && c !== "false", d = (f.get(a) || 0) + 1, M = (s.get(a) || 0) + 1;
31
- f.set(a, d), s.set(a, M), l.push(a), d === 1 && w && v.set(a, !0), M === 1 && a.setAttribute(e, "true"), w || a.setAttribute(n, "true");
32
- } catch (k) {
33
- console.error("aria-hidden: cannot operate on ", a, k);
34
- }
35
- });
36
- };
37
- return A(u), o.clear(), h++, function() {
38
- l.forEach(function(t) {
39
- var a = f.get(t) - 1, c = s.get(t) - 1;
40
- f.set(t, a), s.set(t, c), a || (v.has(t) || t.removeAttribute(n), v.delete(t)), c || t.removeAttribute(e);
41
- }), h--, h || (f = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {});
42
- };
43
- }, C = function(r, u, e) {
44
- e === void 0 && (e = "data-aria-hidden");
45
- var n = Array.from(Array.isArray(r) ? r : [r]), i = S(r);
46
- return i ? (n.push.apply(n, Array.from(i.querySelectorAll("[aria-live], script"))), E(n, i, e, "aria-hidden")) : function() {
47
- return null;
48
- };
49
- };
50
- export {
51
- C as hideOthers
52
- };
@@ -1,7 +0,0 @@
1
- var e = function() {
2
- if (typeof __webpack_nonce__ < "u")
3
- return __webpack_nonce__;
4
- };
5
- export {
6
- e as getNonce
7
- };
@@ -1,95 +0,0 @@
1
- import { commonjsGlobal as y } from "../../_virtual/_commonjsHelpers.js";
2
- var p, _;
3
- function Z() {
4
- if (_) return p;
5
- _ = 1;
6
- var x = "Expected a function", I = NaN, W = "[object Symbol]", C = /^\s+|\s+$/g, M = /^[-+]0x[0-9a-f]+$/i, N = /^0b[01]+$/i, R = /^0o[0-7]+$/i, $ = parseInt, q = typeof y == "object" && y && y.Object === Object && y, A = typeof self == "object" && self && self.Object === Object && self, B = q || A || Function("return this")(), F = Object.prototype, G = F.toString, P = Math.max, D = Math.min, h = function() {
7
- return B.Date.now();
8
- };
9
- function H(e, r, n) {
10
- var f, a, g, c, i, u, s = 0, S = !1, d = !1, j = !0;
11
- if (typeof e != "function")
12
- throw new TypeError(x);
13
- r = O(r) || 0, m(n) && (S = !!n.leading, d = "maxWait" in n, g = d ? P(O(n.maxWait) || 0, r) : g, j = "trailing" in n ? !!n.trailing : j);
14
- function v(t) {
15
- var o = f, l = a;
16
- return f = a = void 0, s = t, c = e.apply(l, o), c;
17
- }
18
- function J(t) {
19
- return s = t, i = setTimeout(b, r), S ? v(t) : c;
20
- }
21
- function K(t) {
22
- var o = t - u, l = t - s, L = r - o;
23
- return d ? D(L, g - l) : L;
24
- }
25
- function E(t) {
26
- var o = t - u, l = t - s;
27
- return u === void 0 || o >= r || o < 0 || d && l >= g;
28
- }
29
- function b() {
30
- var t = h();
31
- if (E(t))
32
- return k(t);
33
- i = setTimeout(b, K(t));
34
- }
35
- function k(t) {
36
- return i = void 0, j && f ? v(t) : (f = a = void 0, c);
37
- }
38
- function Q() {
39
- i !== void 0 && clearTimeout(i), s = 0, f = u = a = i = void 0;
40
- }
41
- function V() {
42
- return i === void 0 ? c : k(h());
43
- }
44
- function T() {
45
- var t = h(), o = E(t);
46
- if (f = arguments, a = this, u = t, o) {
47
- if (i === void 0)
48
- return J(u);
49
- if (d)
50
- return i = setTimeout(b, r), v(u);
51
- }
52
- return i === void 0 && (i = setTimeout(b, r)), c;
53
- }
54
- return T.cancel = Q, T.flush = V, T;
55
- }
56
- function U(e, r, n) {
57
- var f = !0, a = !0;
58
- if (typeof e != "function")
59
- throw new TypeError(x);
60
- return m(n) && (f = "leading" in n ? !!n.leading : f, a = "trailing" in n ? !!n.trailing : a), H(e, r, {
61
- leading: f,
62
- maxWait: r,
63
- trailing: a
64
- });
65
- }
66
- function m(e) {
67
- var r = typeof e;
68
- return !!e && (r == "object" || r == "function");
69
- }
70
- function X(e) {
71
- return !!e && typeof e == "object";
72
- }
73
- function z(e) {
74
- return typeof e == "symbol" || X(e) && G.call(e) == W;
75
- }
76
- function O(e) {
77
- if (typeof e == "number")
78
- return e;
79
- if (z(e))
80
- return I;
81
- if (m(e)) {
82
- var r = typeof e.valueOf == "function" ? e.valueOf() : e;
83
- e = m(r) ? r + "" : r;
84
- }
85
- if (typeof e != "string")
86
- return e === 0 ? e : +e;
87
- e = e.replace(C, "");
88
- var n = N.test(e);
89
- return n || R.test(e) ? $(e.slice(2), n ? 2 : 8) : M.test(e) ? I : +e;
90
- }
91
- return p = U, p;
92
- }
93
- export {
94
- Z as __require
95
- };
@@ -1,11 +0,0 @@
1
- import { __assign as m } from "../../../tslib/tslib.es6.js";
2
- import * as r from "react";
3
- import { RemoveScroll as e } from "./UI.js";
4
- import t from "./sidecar.js";
5
- var s = r.forwardRef(function(a, o) {
6
- return r.createElement(e, m({}, a, { ref: o, sideCar: t }));
7
- });
8
- s.classNames = e.classNames;
9
- export {
10
- s as default
11
- };
@@ -1,112 +0,0 @@
1
- import { __spreadArray as x } from "../../../tslib/tslib.es6.js";
2
- import * as n from "react";
3
- import { RemoveScrollBar as A } from "../../../react-remove-scroll-bar/dist/es2015/component.js";
4
- import { styleSingleton as I } from "../../../react-style-singleton/dist/es2015/component.js";
5
- import { nonPassive as s } from "./aggresiveCapture.js";
6
- import { locationCouldBeScrolled as T, handleScroll as W } from "./handleScroll.js";
7
- var b = function(t) {
8
- return "changedTouches" in t ? [t.changedTouches[0].clientX, t.changedTouches[0].clientY] : [0, 0];
9
- }, Y = function(t) {
10
- return [t.deltaX, t.deltaY];
11
- }, B = function(t) {
12
- return t && "current" in t ? t.current : t;
13
- }, F = function(t, c) {
14
- return t[0] === c[0] && t[1] === c[1];
15
- }, K = function(t) {
16
- return `
17
- .block-interactivity-`.concat(t, ` {pointer-events: none;}
18
- .allow-interactivity-`).concat(t, ` {pointer-events: all;}
19
- `);
20
- }, O = 0, f = [];
21
- function G(t) {
22
- var c = n.useRef([]), E = n.useRef([0, 0]), d = n.useRef(), h = n.useState(O++)[0], m = n.useState(I)[0], g = n.useRef(t);
23
- n.useEffect(function() {
24
- g.current = t;
25
- }, [t]), n.useEffect(function() {
26
- if (t.inert) {
27
- document.body.classList.add("block-interactivity-".concat(h));
28
- var e = x([t.lockRef.current], (t.shards || []).map(B), !0).filter(Boolean);
29
- return e.forEach(function(r) {
30
- return r.classList.add("allow-interactivity-".concat(h));
31
- }), function() {
32
- document.body.classList.remove("block-interactivity-".concat(h)), e.forEach(function(r) {
33
- return r.classList.remove("allow-interactivity-".concat(h));
34
- });
35
- };
36
- }
37
- }, [t.inert, t.lockRef.current, t.shards]);
38
- var k = n.useCallback(function(e, r) {
39
- if ("touches" in e && e.touches.length === 2 || e.type === "wheel" && e.ctrlKey)
40
- return !g.current.allowPinchZoom;
41
- var l = b(e), o = E.current, u = "deltaX" in e ? e.deltaX : o[0] - l[0], i = "deltaY" in e ? e.deltaY : o[1] - l[1], a, C = e.target, v = Math.abs(u) > Math.abs(i) ? "h" : "v";
42
- if ("touches" in e && v === "h" && C.type === "range")
43
- return !1;
44
- var y = T(v, C);
45
- if (!y)
46
- return !0;
47
- if (y ? a = v : (a = v === "v" ? "h" : "v", y = T(v, C)), !y)
48
- return !1;
49
- if (!d.current && "changedTouches" in e && (u || i) && (d.current = a), !a)
50
- return !0;
51
- var P = d.current || a;
52
- return W(P, r, e, P === "h" ? u : i);
53
- }, []), S = n.useCallback(function(e) {
54
- var r = e;
55
- if (!(!f.length || f[f.length - 1] !== m)) {
56
- var l = "deltaY" in r ? Y(r) : b(r), o = c.current.filter(function(a) {
57
- return a.name === r.type && (a.target === r.target || r.target === a.shadowParent) && F(a.delta, l);
58
- })[0];
59
- if (o && o.should) {
60
- r.cancelable && r.preventDefault();
61
- return;
62
- }
63
- if (!o) {
64
- var u = (g.current.shards || []).map(B).filter(Boolean).filter(function(a) {
65
- return a.contains(r.target);
66
- }), i = u.length > 0 ? k(r, u[0]) : !g.current.noIsolation;
67
- i && r.cancelable && r.preventDefault();
68
- }
69
- }
70
- }, []), R = n.useCallback(function(e, r, l, o) {
71
- var u = { name: e, delta: r, target: l, should: o, shadowParent: Q(l) };
72
- c.current.push(u), setTimeout(function() {
73
- c.current = c.current.filter(function(i) {
74
- return i !== u;
75
- });
76
- }, 1);
77
- }, []), w = n.useCallback(function(e) {
78
- E.current = b(e), d.current = void 0;
79
- }, []), L = n.useCallback(function(e) {
80
- R(e.type, Y(e), e.target, k(e, t.lockRef.current));
81
- }, []), M = n.useCallback(function(e) {
82
- R(e.type, b(e), e.target, k(e, t.lockRef.current));
83
- }, []);
84
- n.useEffect(function() {
85
- return f.push(m), t.setCallbacks({
86
- onScrollCapture: L,
87
- onWheelCapture: L,
88
- onTouchMoveCapture: M
89
- }), document.addEventListener("wheel", S, s), document.addEventListener("touchmove", S, s), document.addEventListener("touchstart", w, s), function() {
90
- f = f.filter(function(e) {
91
- return e !== m;
92
- }), document.removeEventListener("wheel", S, s), document.removeEventListener("touchmove", S, s), document.removeEventListener("touchstart", w, s);
93
- };
94
- }, []);
95
- var X = t.removeScrollBar, D = t.inert;
96
- return n.createElement(
97
- n.Fragment,
98
- null,
99
- D ? n.createElement(m, { styles: K(h) }) : null,
100
- X ? n.createElement(A, { noRelative: t.noRelative, gapMode: t.gapMode }) : null
101
- );
102
- }
103
- function Q(t) {
104
- for (var c = null; t !== null; )
105
- t instanceof ShadowRoot && (c = t.host, t = t.host), t = t.parentNode;
106
- return c;
107
- }
108
- export {
109
- G as RemoveScrollSideCar,
110
- Y as getDeltaXY,
111
- b as getTouchXY
112
- };
@@ -1,31 +0,0 @@
1
- import { __rest as E, __assign as r } from "../../../tslib/tslib.es6.js";
2
- import * as a from "react";
3
- import { zeroRightClassName as I, fullWidthClassName as Z } from "../../../react-remove-scroll-bar/dist/es2015/constants.js";
4
- import { effectCar as W } from "./medium.js";
5
- import { useMergeRefs as z } from "../../../use-callback-ref/dist/es2015/useMergeRef.js";
6
- var l = function() {
7
- }, m = a.forwardRef(function(e, d) {
8
- var o = a.useRef(null), n = a.useState({
9
- onScrollCapture: l,
10
- onWheelCapture: l,
11
- onTouchMoveCapture: l
12
- }), f = n[0], v = n[1], h = e.forwardProps, t = e.children, u = e.className, C = e.removeScrollBar, R = e.enabled, g = e.shards, P = e.sideCar, S = e.noRelative, b = e.noIsolation, w = e.inert, N = e.allowPinchZoom, i = e.as, M = i === void 0 ? "div" : i, _ = e.gapMode, B = E(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), k = P, s = z([o, d]), c = r(r({}, B), f);
13
- return a.createElement(
14
- a.Fragment,
15
- null,
16
- R && a.createElement(k, { sideCar: W, removeScrollBar: C, shards: g, noRelative: S, noIsolation: b, inert: w, setCallbacks: v, allowPinchZoom: !!N, lockRef: o, gapMode: _ }),
17
- h ? a.cloneElement(a.Children.only(t), r(r({}, c), { ref: s })) : a.createElement(M, r({}, c, { className: u, ref: s }), t)
18
- );
19
- });
20
- m.defaultProps = {
21
- enabled: !0,
22
- removeScrollBar: !0,
23
- inert: !1
24
- };
25
- m.classNames = {
26
- fullWidth: Z,
27
- zeroRight: I
28
- };
29
- export {
30
- m as RemoveScroll
31
- };
@@ -1,16 +0,0 @@
1
- var r = !1;
2
- if (typeof window < "u")
3
- try {
4
- var e = Object.defineProperty({}, "passive", {
5
- get: function() {
6
- return r = !0, !0;
7
- }
8
- });
9
- window.addEventListener("test", e, e), window.removeEventListener("test", e, e);
10
- } catch {
11
- r = !1;
12
- }
13
- var a = r ? { passive: !1 } : !1;
14
- export {
15
- a as nonPassive
16
- };
@@ -1,68 +0,0 @@
1
- var N = function(r) {
2
- return r.tagName === "TEXTAREA";
3
- }, b = function(r, e) {
4
- if (!(r instanceof Element))
5
- return !1;
6
- var t = window.getComputedStyle(r);
7
- return (
8
- // not-not-scrollable
9
- t[e] !== "hidden" && // contains scroll inside self
10
- !(t.overflowY === t.overflowX && !N(r) && t[e] === "visible")
11
- );
12
- }, D = function(r) {
13
- return b(r, "overflowY");
14
- }, E = function(r) {
15
- return b(r, "overflowX");
16
- }, T = function(r, e) {
17
- var t = e.ownerDocument, l = e;
18
- do {
19
- typeof ShadowRoot < "u" && l instanceof ShadowRoot && (l = l.host);
20
- var f = g(r, l);
21
- if (f) {
22
- var n = m(r, l), i = n[1], o = n[2];
23
- if (i > o)
24
- return !0;
25
- }
26
- l = l.parentNode;
27
- } while (l && l !== t.body);
28
- return !1;
29
- }, H = function(r) {
30
- var e = r.scrollTop, t = r.scrollHeight, l = r.clientHeight;
31
- return [
32
- e,
33
- t,
34
- l
35
- ];
36
- }, p = function(r) {
37
- var e = r.scrollLeft, t = r.scrollWidth, l = r.clientWidth;
38
- return [
39
- e,
40
- t,
41
- l
42
- ];
43
- }, g = function(r, e) {
44
- return r === "v" ? D(e) : E(e);
45
- }, m = function(r, e) {
46
- return r === "v" ? H(e) : p(e);
47
- }, B = function(r, e) {
48
- return r === "h" && e === "rtl" ? -1 : 1;
49
- }, V = function(r, e, t, l, f) {
50
- var n = B(r, window.getComputedStyle(e).direction), i = n * l, o = t.target, d = e.contains(o), c = !1, s = i > 0, h = 0, S = 0;
51
- do {
52
- if (!o)
53
- break;
54
- var u = m(r, o), v = u[0], C = u[1], y = u[2], w = C - y - n * v;
55
- (v || w) && g(r, o) && (h += w, S += v);
56
- var a = o.parentNode;
57
- o = a && a.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? a.host : a;
58
- } while (
59
- // portaled content
60
- !d && o !== document.body || // self content
61
- d && (e.contains(o) || e === o)
62
- );
63
- return (s && Math.abs(h) < 1 || !s && Math.abs(S) < 1) && (c = !0), c;
64
- };
65
- export {
66
- V as handleScroll,
67
- T as locationCouldBeScrolled
68
- };
@@ -1,5 +0,0 @@
1
- import { createSidecarMedium as e } from "../../../use-sidecar/dist/es2015/medium.js";
2
- var a = e();
3
- export {
4
- a as effectCar
5
- };