@puckeditor/core 0.24.1 → 0.24.2-canary.2a947536

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/bin/cli.mjs CHANGED
@@ -8,7 +8,7 @@ import path from "node:path";
8
8
 
9
9
  const require = createRequire(import.meta.url);
10
10
  const pkgPath = require.resolve("@puckeditor/cli/package.json");
11
- const { bin } = require(pkgPath);
11
+ const { bin } = require("@puckeditor/cli/package.json");
12
12
  const binPath = path.join(
13
13
  path.dirname(pkgPath),
14
14
  typeof bin === "string" ? bin : bin.puck
@@ -4294,6 +4294,15 @@ var getZoneId = (candidate) => {
4294
4294
  }
4295
4295
  return id;
4296
4296
  };
4297
+ var getPointerTargetElement = (target) => {
4298
+ if (!target) return null;
4299
+ const node = target;
4300
+ if (node.nodeType === Node.DOCUMENT_NODE) {
4301
+ return node.documentElement;
4302
+ }
4303
+ if (!node.ownerDocument) return null;
4304
+ return target;
4305
+ };
4297
4306
  var BUFFER = 6;
4298
4307
  var getPointerCollisions = (position, manager) => {
4299
4308
  const candidates = [];
@@ -4407,7 +4416,10 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
4407
4416
  }
4408
4417
  this.registerEffect(() => {
4409
4418
  const handleMove = (event) => {
4410
- const target = event instanceof BubbledPointerEvent ? event.originalTarget || event.target : event.target;
4419
+ const target = getPointerTargetElement(
4420
+ event instanceof BubbledPointerEvent ? event.originalTarget || event.target : event.target
4421
+ );
4422
+ if (!target) return;
4411
4423
  const position = new GlobalPosition(target, {
4412
4424
  x: event.clientX,
4413
4425
  y: event.clientY
@@ -9169,7 +9181,7 @@ import { useEffect as useEffect26, useInsertionEffect } from "react";
9169
9181
 
9170
9182
  // puck-runtime-css:puck-runtime-css
9171
9183
  init_react_import();
9172
- var defaultUiStyles = `@import "https://rsms.me/inter/inter.css";
9184
+ var defaultUiStyles = `@import "https://cdn.puck.run/editor/inter.css";
9173
9185
 
9174
9186
  /* styles/color.css */
9175
9187
  @layer puck-tokens {
@@ -12996,7 +13008,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
12996
13008
  "data-puck-preview": true,
12997
13009
  onClick: (e) => {
12998
13010
  const el = e.target;
12999
- if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
13011
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone") && !el.hasAttribute("data-puck-overlay-portal") && !el.closest("[data-puck-viewport-controls]")) {
13000
13012
  dispatch({ type: "setUi", ui: { itemSelector: null } });
13001
13013
  }
13002
13014
  },
@@ -13540,6 +13552,7 @@ var ViewportControls = ({
13540
13552
  {
13541
13553
  className: getClassName41({ isExpanded, fullScreen }),
13542
13554
  suppressHydrationWarning: true,
13555
+ "data-puck-viewport-controls": true,
13543
13556
  children: [
13544
13557
  /* @__PURE__ */ jsx66("div", { className: getClassName41("actions"), children: /* @__PURE__ */ jsxs29("div", { className: getClassName41("actionsInner"), children: [
13545
13558
  viewports.map((viewport, i) => /* @__PURE__ */ jsx66(
@@ -13560,8 +13573,7 @@ var ViewportControls = ({
13560
13573
  {
13561
13574
  title: zoomOutLabel,
13562
13575
  disabled: zoom <= ((_a = zoomOptions[0]) == null ? void 0 : _a.value),
13563
- onClick: (e) => {
13564
- e.stopPropagation();
13576
+ onClick: () => {
13565
13577
  onZoom(
13566
13578
  zoomOptions[Math.max(
13567
13579
  zoomOptions.findIndex((option) => option.value === zoom) - 1,
@@ -13577,8 +13589,7 @@ var ViewportControls = ({
13577
13589
  {
13578
13590
  title: zoomInLabel,
13579
13591
  disabled: zoom >= ((_b = zoomOptions[zoomOptions.length - 1]) == null ? void 0 : _b.value),
13580
- onClick: (e) => {
13581
- e.stopPropagation();
13592
+ onClick: () => {
13582
13593
  onZoom(
13583
13594
  zoomOptions[Math.min(
13584
13595
  zoomOptions.findIndex((option) => option.value === zoom) + 1,
@@ -13596,9 +13607,6 @@ var ViewportControls = ({
13596
13607
  {
13597
13608
  className: getClassName41("zoomSelect"),
13598
13609
  value: zoom.toString(),
13599
- onClick: (e) => {
13600
- e.stopPropagation();
13601
- },
13602
13610
  onChange: (e) => {
13603
13611
  onZoom(parseFloat(e.currentTarget.value));
13604
13612
  },
@@ -13832,7 +13840,7 @@ var Canvas = () => {
13832
13840
  }),
13833
13841
  onClick: (e) => {
13834
13842
  const el = e.target;
13835
- if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
13843
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone") && !el.hasAttribute("data-puck-overlay-portal") && !el.closest("[data-puck-viewport-controls]")) {
13836
13844
  dispatch({
13837
13845
  type: "setUi",
13838
13846
  ui: { itemSelector: null },
package/dist/index.css CHANGED
@@ -1,4 +1,4 @@
1
- @import "https://rsms.me/inter/inter.css";
1
+ @import "https://cdn.puck.run/editor/inter.css";
2
2
 
3
3
  /* styles/color.css */
4
4
  @layer puck-tokens {
package/dist/index.js CHANGED
@@ -9079,6 +9079,15 @@ var getZoneId2 = (candidate) => {
9079
9079
  }
9080
9080
  return id;
9081
9081
  };
9082
+ var getPointerTargetElement = (target) => {
9083
+ if (!target) return null;
9084
+ const node = target;
9085
+ if (node.nodeType === Node.DOCUMENT_NODE) {
9086
+ return node.documentElement;
9087
+ }
9088
+ if (!node.ownerDocument) return null;
9089
+ return target;
9090
+ };
9082
9091
  var BUFFER = 6;
9083
9092
  var getPointerCollisions = (position, manager) => {
9084
9093
  const candidates = [];
@@ -9192,7 +9201,10 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
9192
9201
  }
9193
9202
  this.registerEffect(() => {
9194
9203
  const handleMove = (event) => {
9195
- const target = event instanceof BubbledPointerEvent ? event.originalTarget || event.target : event.target;
9204
+ const target = getPointerTargetElement(
9205
+ event instanceof BubbledPointerEvent ? event.originalTarget || event.target : event.target
9206
+ );
9207
+ if (!target) return;
9196
9208
  const position = new GlobalPosition(target, {
9197
9209
  x: event.clientX,
9198
9210
  y: event.clientY
@@ -13829,7 +13841,7 @@ var import_react87 = require("react");
13829
13841
 
13830
13842
  // puck-runtime-css:puck-runtime-css
13831
13843
  init_react_import();
13832
- var defaultUiStyles = `@import "https://rsms.me/inter/inter.css";
13844
+ var defaultUiStyles = `@import "https://cdn.puck.run/editor/inter.css";
13833
13845
 
13834
13846
  /* styles/color.css */
13835
13847
  @layer puck-tokens {
@@ -17661,7 +17673,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
17661
17673
  "data-puck-preview": true,
17662
17674
  onClick: (e) => {
17663
17675
  const el = e.target;
17664
- if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
17676
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone") && !el.hasAttribute("data-puck-overlay-portal") && !el.closest("[data-puck-viewport-controls]")) {
17665
17677
  dispatch({ type: "setUi", ui: { itemSelector: null } });
17666
17678
  }
17667
17679
  },
@@ -19854,6 +19866,7 @@ var ViewportControls = ({
19854
19866
  {
19855
19867
  className: getClassName47({ isExpanded, fullScreen }),
19856
19868
  suppressHydrationWarning: true,
19869
+ "data-puck-viewport-controls": true,
19857
19870
  children: [
19858
19871
  /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: getClassName47("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: getClassName47("actionsInner"), children: [
19859
19872
  viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
@@ -19874,8 +19887,7 @@ var ViewportControls = ({
19874
19887
  {
19875
19888
  title: zoomOutLabel,
19876
19889
  disabled: zoom <= ((_a = zoomOptions[0]) == null ? void 0 : _a.value),
19877
- onClick: (e) => {
19878
- e.stopPropagation();
19890
+ onClick: () => {
19879
19891
  onZoom(
19880
19892
  zoomOptions[Math.max(
19881
19893
  zoomOptions.findIndex((option) => option.value === zoom) - 1,
@@ -19891,8 +19903,7 @@ var ViewportControls = ({
19891
19903
  {
19892
19904
  title: zoomInLabel,
19893
19905
  disabled: zoom >= ((_b = zoomOptions[zoomOptions.length - 1]) == null ? void 0 : _b.value),
19894
- onClick: (e) => {
19895
- e.stopPropagation();
19906
+ onClick: () => {
19896
19907
  onZoom(
19897
19908
  zoomOptions[Math.min(
19898
19909
  zoomOptions.findIndex((option) => option.value === zoom) + 1,
@@ -19910,9 +19921,6 @@ var ViewportControls = ({
19910
19921
  {
19911
19922
  className: getClassName47("zoomSelect"),
19912
19923
  value: zoom.toString(),
19913
- onClick: (e) => {
19914
- e.stopPropagation();
19915
- },
19916
19924
  onChange: (e) => {
19917
19925
  onZoom(parseFloat(e.currentTarget.value));
19918
19926
  },
@@ -20144,7 +20152,7 @@ var Canvas = () => {
20144
20152
  }),
20145
20153
  onClick: (e) => {
20146
20154
  const el = e.target;
20147
- if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
20155
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone") && !el.hasAttribute("data-puck-overlay-portal") && !el.closest("[data-puck-viewport-controls]")) {
20148
20156
  dispatch({
20149
20157
  type: "setUi",
20150
20158
  ui: { itemSelector: null },
package/dist/index.mjs CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  setDeep,
21
21
  useGetPuck,
22
22
  usePuck
23
- } from "./chunk-T2XFCN6B.mjs";
23
+ } from "./chunk-IJ7PCMDV.mjs";
24
24
  import "./chunk-UIJZMSVU.mjs";
25
25
  import {
26
26
  migrate,
@@ -9079,6 +9079,15 @@ var getZoneId2 = (candidate) => {
9079
9079
  }
9080
9080
  return id;
9081
9081
  };
9082
+ var getPointerTargetElement = (target) => {
9083
+ if (!target) return null;
9084
+ const node = target;
9085
+ if (node.nodeType === Node.DOCUMENT_NODE) {
9086
+ return node.documentElement;
9087
+ }
9088
+ if (!node.ownerDocument) return null;
9089
+ return target;
9090
+ };
9082
9091
  var BUFFER = 6;
9083
9092
  var getPointerCollisions = (position, manager) => {
9084
9093
  const candidates = [];
@@ -9192,7 +9201,10 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
9192
9201
  }
9193
9202
  this.registerEffect(() => {
9194
9203
  const handleMove = (event) => {
9195
- const target = event instanceof BubbledPointerEvent ? event.originalTarget || event.target : event.target;
9204
+ const target = getPointerTargetElement(
9205
+ event instanceof BubbledPointerEvent ? event.originalTarget || event.target : event.target
9206
+ );
9207
+ if (!target) return;
9196
9208
  const position = new GlobalPosition(target, {
9197
9209
  x: event.clientX,
9198
9210
  y: event.clientY
@@ -13829,7 +13841,7 @@ var import_react87 = require("react");
13829
13841
 
13830
13842
  // puck-runtime-css:puck-runtime-css
13831
13843
  init_react_import();
13832
- var defaultUiStyles = `@import "https://rsms.me/inter/inter.css";
13844
+ var defaultUiStyles = `@import "https://cdn.puck.run/editor/inter.css";
13833
13845
 
13834
13846
  /* styles/color.css */
13835
13847
  @layer puck-tokens {
@@ -17661,7 +17673,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
17661
17673
  "data-puck-preview": true,
17662
17674
  onClick: (e) => {
17663
17675
  const el = e.target;
17664
- if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
17676
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone") && !el.hasAttribute("data-puck-overlay-portal") && !el.closest("[data-puck-viewport-controls]")) {
17665
17677
  dispatch({ type: "setUi", ui: { itemSelector: null } });
17666
17678
  }
17667
17679
  },
@@ -19854,6 +19866,7 @@ var ViewportControls = ({
19854
19866
  {
19855
19867
  className: getClassName47({ isExpanded, fullScreen }),
19856
19868
  suppressHydrationWarning: true,
19869
+ "data-puck-viewport-controls": true,
19857
19870
  children: [
19858
19871
  /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: getClassName47("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: getClassName47("actionsInner"), children: [
19859
19872
  viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
@@ -19874,8 +19887,7 @@ var ViewportControls = ({
19874
19887
  {
19875
19888
  title: zoomOutLabel,
19876
19889
  disabled: zoom <= ((_a = zoomOptions[0]) == null ? void 0 : _a.value),
19877
- onClick: (e) => {
19878
- e.stopPropagation();
19890
+ onClick: () => {
19879
19891
  onZoom(
19880
19892
  zoomOptions[Math.max(
19881
19893
  zoomOptions.findIndex((option) => option.value === zoom) - 1,
@@ -19891,8 +19903,7 @@ var ViewportControls = ({
19891
19903
  {
19892
19904
  title: zoomInLabel,
19893
19905
  disabled: zoom >= ((_b = zoomOptions[zoomOptions.length - 1]) == null ? void 0 : _b.value),
19894
- onClick: (e) => {
19895
- e.stopPropagation();
19906
+ onClick: () => {
19896
19907
  onZoom(
19897
19908
  zoomOptions[Math.min(
19898
19909
  zoomOptions.findIndex((option) => option.value === zoom) + 1,
@@ -19910,9 +19921,6 @@ var ViewportControls = ({
19910
19921
  {
19911
19922
  className: getClassName47("zoomSelect"),
19912
19923
  value: zoom.toString(),
19913
- onClick: (e) => {
19914
- e.stopPropagation();
19915
- },
19916
19924
  onChange: (e) => {
19917
19925
  onZoom(parseFloat(e.currentTarget.value));
19918
19926
  },
@@ -20144,7 +20152,7 @@ var Canvas = () => {
20144
20152
  }),
20145
20153
  onClick: (e) => {
20146
20154
  const el = e.target;
20147
- if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
20155
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone") && !el.hasAttribute("data-puck-overlay-portal") && !el.closest("[data-puck-viewport-controls]")) {
20148
20156
  dispatch({
20149
20157
  type: "setUi",
20150
20158
  ui: { itemSelector: null },
@@ -20,7 +20,7 @@ import {
20
20
  setDeep,
21
21
  useGetPuck,
22
22
  usePuck
23
- } from "./chunk-T2XFCN6B.mjs";
23
+ } from "./chunk-IJ7PCMDV.mjs";
24
24
  import "./chunk-UIJZMSVU.mjs";
25
25
  import {
26
26
  migrate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puckeditor/core",
3
- "version": "0.24.1",
3
+ "version": "0.24.2-canary.2a947536",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": {