@measured/puck 0.14.2-canary.e6e01c6 → 0.14.3-canary.9a1cc7c
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/README.md +1 -1
- package/dist/index.css +0 -3
- package/dist/index.d.ts +4 -1
- package/dist/index.js +47 -11
- package/package.json +5 -3
package/README.md
CHANGED
@@ -108,7 +108,7 @@ Available recipes include:
|
|
108
108
|
|
109
109
|
Puck is developed and maintained by **Measured**, a small group of industry veterans with decades of experience helping companies solve hard UI problems. We offer consultancy and development services for scale-ups, SMEs and enterprises.
|
110
110
|
|
111
|
-
If you need support integrating Puck or creating a beautiful component library, please reach out via [
|
111
|
+
If you need support integrating Puck or creating a beautiful component library, please reach out via the [Measured](https://measured.co) website.
|
112
112
|
|
113
113
|
## License
|
114
114
|
|
package/dist/index.css
CHANGED
package/dist/index.d.ts
CHANGED
@@ -229,7 +229,7 @@ type IframeConfig = {
|
|
229
229
|
enabled?: boolean;
|
230
230
|
};
|
231
231
|
|
232
|
-
declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, }: {
|
232
|
+
declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, dnd, }: {
|
233
233
|
children?: ReactNode;
|
234
234
|
config: UserConfig;
|
235
235
|
data: Data;
|
@@ -251,6 +251,9 @@ declare function Puck<UserConfig extends Config = Config>({ children, config, da
|
|
251
251
|
headerPath?: string;
|
252
252
|
viewports?: Viewports;
|
253
253
|
iframe?: IframeConfig;
|
254
|
+
dnd?: {
|
255
|
+
disableAutoScroll?: boolean;
|
256
|
+
};
|
254
257
|
}): react_jsx_runtime.JSX.Element;
|
255
258
|
declare namespace Puck {
|
256
259
|
var Components: () => react_jsx_runtime.JSX.Element;
|
package/dist/index.js
CHANGED
@@ -29311,9 +29311,10 @@ var defaultViewports = [
|
|
29311
29311
|
];
|
29312
29312
|
|
29313
29313
|
// components/Puck/context.tsx
|
29314
|
+
var import_ua_parser_js = require("ua-parser-js");
|
29314
29315
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
29315
29316
|
var defaultAppState = {
|
29316
|
-
data: { content: [], root: { props: {
|
29317
|
+
data: { content: [], root: { props: {} } },
|
29317
29318
|
ui: {
|
29318
29319
|
leftSideBarVisible: true,
|
29319
29320
|
rightSideBarVisible: true,
|
@@ -29350,7 +29351,8 @@ var defaultContext = {
|
|
29350
29351
|
setZoomConfig: () => null,
|
29351
29352
|
status: "LOADING",
|
29352
29353
|
setStatus: () => null,
|
29353
|
-
iframe: {}
|
29354
|
+
iframe: {},
|
29355
|
+
safariFallbackMode: false
|
29354
29356
|
};
|
29355
29357
|
var appContext = (0, import_react3.createContext)(defaultContext);
|
29356
29358
|
var AppProvider = ({
|
@@ -29362,10 +29364,34 @@ var AppProvider = ({
|
|
29362
29364
|
(0, import_react3.useEffect)(() => {
|
29363
29365
|
setStatus("MOUNTED");
|
29364
29366
|
}, []);
|
29367
|
+
const [safariFallbackMode, setSafariFallbackMode] = (0, import_react3.useState)(false);
|
29368
|
+
(0, import_react3.useEffect)(() => {
|
29369
|
+
var _a, _b, _c;
|
29370
|
+
const ua = new import_ua_parser_js.UAParser(navigator.userAgent);
|
29371
|
+
const { browser } = ua.getResult();
|
29372
|
+
if (browser.name === "Safari" && (((_a = browser.version) == null ? void 0 : _a.indexOf("17.2.")) || ((_b = browser.version) == null ? void 0 : _b.indexOf("17.3.")) || ((_c = browser.version) == null ? void 0 : _c.indexOf("17.4.")))) {
|
29373
|
+
if (process.env.NODE_ENV !== "production" && value.iframe.enabled) {
|
29374
|
+
console.warn(
|
29375
|
+
`Detected Safari ${browser.version}, which contains a bug that prevents Puck DropZones from detecting a mouseover event within an iframe. This affects Safari versions 17.2, 17.3 and 17.4.
|
29376
|
+
|
29377
|
+
Running in compatibility mode, which may have some DropZone side-effects. Alternatively, consider disabling iframes: https://puckeditor.com/docs/integrating-puck/viewports#opting-out-of-iframes.
|
29378
|
+
|
29379
|
+
See https://github.com/measuredco/puck/issues/411 for more information. This message will not show in production.`
|
29380
|
+
);
|
29381
|
+
}
|
29382
|
+
setSafariFallbackMode(true);
|
29383
|
+
}
|
29384
|
+
}, []);
|
29365
29385
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
29366
29386
|
appContext.Provider,
|
29367
29387
|
{
|
29368
|
-
value: __spreadProps(__spreadValues({}, value), {
|
29388
|
+
value: __spreadProps(__spreadValues({}, value), {
|
29389
|
+
zoomConfig,
|
29390
|
+
setZoomConfig,
|
29391
|
+
status,
|
29392
|
+
setStatus,
|
29393
|
+
safariFallbackMode
|
29394
|
+
}),
|
29369
29395
|
children
|
29370
29396
|
}
|
29371
29397
|
);
|
@@ -30193,7 +30219,11 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30193
30219
|
let isEnabled = userWillDrag;
|
30194
30220
|
if (userIsDragging) {
|
30195
30221
|
if (draggingNewComponent) {
|
30196
|
-
|
30222
|
+
if (appContext2.safariFallbackMode) {
|
30223
|
+
isEnabled = true;
|
30224
|
+
} else {
|
30225
|
+
isEnabled = hoveringOverArea;
|
30226
|
+
}
|
30197
30227
|
} else {
|
30198
30228
|
isEnabled = draggingOverArea && hoveringOverZone;
|
30199
30229
|
}
|
@@ -31279,7 +31309,7 @@ var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
31279
31309
|
var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
|
31280
31310
|
var MenuBar = ({
|
31281
31311
|
appState,
|
31282
|
-
data = { content: [], root: {
|
31312
|
+
data = { content: [], root: {} },
|
31283
31313
|
dispatch,
|
31284
31314
|
menuOpen = false,
|
31285
31315
|
onPublish,
|
@@ -32031,7 +32061,7 @@ var RadioField = ({
|
|
32031
32061
|
onChange(e.currentTarget.value);
|
32032
32062
|
},
|
32033
32063
|
disabled: readOnly,
|
32034
|
-
|
32064
|
+
checked: value === option.value
|
32035
32065
|
}
|
32036
32066
|
),
|
32037
32067
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
|
@@ -32073,7 +32103,7 @@ var SelectField = ({
|
|
32073
32103
|
disabled: readOnly,
|
32074
32104
|
onChange: (e) => {
|
32075
32105
|
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
32076
|
-
onChange(
|
32106
|
+
onChange(JSON.parse(e.currentTarget.value));
|
32077
32107
|
return;
|
32078
32108
|
}
|
32079
32109
|
onChange(e.currentTarget.value);
|
@@ -33403,7 +33433,7 @@ var getClassName25 = get_class_name_factory_default("Puck", styles_module_defaul
|
|
33403
33433
|
function Puck({
|
33404
33434
|
children,
|
33405
33435
|
config,
|
33406
|
-
data: initialData = { content: [], root: {
|
33436
|
+
data: initialData = { content: [], root: {} },
|
33407
33437
|
ui: initialUi,
|
33408
33438
|
onChange,
|
33409
33439
|
onPublish,
|
@@ -33416,7 +33446,8 @@ function Puck({
|
|
33416
33446
|
viewports = defaultViewports,
|
33417
33447
|
iframe = {
|
33418
33448
|
enabled: true
|
33419
|
-
}
|
33449
|
+
},
|
33450
|
+
dnd
|
33420
33451
|
}) {
|
33421
33452
|
var _a;
|
33422
33453
|
const historyStore = useHistoryStore();
|
@@ -33424,7 +33455,7 @@ function Puck({
|
|
33424
33455
|
() => createReducer({ config, record: historyStore.record })
|
33425
33456
|
);
|
33426
33457
|
const [initialAppState] = (0, import_react28.useState)(() => {
|
33427
|
-
var _a2, _b, _c, _d;
|
33458
|
+
var _a2, _b, _c, _d, _e;
|
33428
33459
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
33429
33460
|
let clientUiState = {};
|
33430
33461
|
if (typeof window !== "undefined") {
|
@@ -33451,8 +33482,12 @@ function Puck({
|
|
33451
33482
|
};
|
33452
33483
|
}
|
33453
33484
|
}
|
33485
|
+
const rootProps2 = initialData.root.props || initialData.root;
|
33486
|
+
const defaultedRootProps = __spreadValues(__spreadValues({}, (_e = config.root) == null ? void 0 : _e.defaultProps), rootProps2);
|
33454
33487
|
return __spreadProps(__spreadValues({}, defaultAppState), {
|
33455
|
-
data: initialData,
|
33488
|
+
data: __spreadProps(__spreadValues({}, initialData), {
|
33489
|
+
root: defaultedRootProps
|
33490
|
+
}),
|
33456
33491
|
ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
|
33457
33492
|
// Store categories under componentList on state to allow render functions and plugins to modify
|
33458
33493
|
componentList: config.categories ? Object.entries(config.categories).reduce(
|
@@ -33616,6 +33651,7 @@ function Puck({
|
|
33616
33651
|
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33617
33652
|
DragDropContext,
|
33618
33653
|
{
|
33654
|
+
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
33619
33655
|
onDragUpdate: (update) => {
|
33620
33656
|
setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
|
33621
33657
|
onDragStartOrUpdate(update);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck",
|
3
|
-
"version": "0.14.
|
3
|
+
"version": "0.14.3-canary.9a1cc7c",
|
4
4
|
"author": "Measured Corporation Ltd <hello@measured.co>",
|
5
5
|
"repository": "measuredco/puck",
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
@@ -46,6 +46,7 @@
|
|
46
46
|
"@types/jest": "^29.5.4",
|
47
47
|
"@types/react": "^18.2.0",
|
48
48
|
"@types/react-dom": "^18.2.0",
|
49
|
+
"@types/ua-parser-js": "^0.7.39",
|
49
50
|
"css-box-model": "^1.2.1",
|
50
51
|
"eslint": "^7.32.0",
|
51
52
|
"eslint-config-custom": "*",
|
@@ -59,11 +60,12 @@
|
|
59
60
|
"typescript": "^4.5.2"
|
60
61
|
},
|
61
62
|
"dependencies": {
|
62
|
-
"@measured/auto-frame-component": "0.1.
|
63
|
-
"@measured/dnd": "16.6.0-canary.
|
63
|
+
"@measured/auto-frame-component": "0.1.7",
|
64
|
+
"@measured/dnd": "16.6.0-canary.4cba1d1",
|
64
65
|
"deep-diff": "^1.0.2",
|
65
66
|
"react-hotkeys-hook": "^4.4.1",
|
66
67
|
"react-spinners": "^0.13.8",
|
68
|
+
"ua-parser-js": "^1.0.37",
|
67
69
|
"use-debounce": "^9.0.4",
|
68
70
|
"uuid": "^9.0.1"
|
69
71
|
},
|