@marvalt/dstyler 0.1.21 → 0.1.23
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/components/AutoBlock.d.ts.map +1 -1
- package/dist/engine/detectSections.d.ts +1 -1
- package/dist/engine/detectSections.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +179 -451
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +179 -451
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,431 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
|
|
5
|
-
var jsxRuntime = {exports: {}};
|
|
6
|
-
|
|
7
|
-
var reactJsxRuntime_production = {};
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
var hasRequiredReactJsxRuntime_production;
|
|
20
|
-
|
|
21
|
-
function requireReactJsxRuntime_production () {
|
|
22
|
-
if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
|
|
23
|
-
hasRequiredReactJsxRuntime_production = 1;
|
|
24
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
25
|
-
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
26
|
-
function jsxProd(type, config, maybeKey) {
|
|
27
|
-
var key = null;
|
|
28
|
-
void 0 !== maybeKey && (key = "" + maybeKey);
|
|
29
|
-
void 0 !== config.key && (key = "" + config.key);
|
|
30
|
-
if ("key" in config) {
|
|
31
|
-
maybeKey = {};
|
|
32
|
-
for (var propName in config)
|
|
33
|
-
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
34
|
-
} else maybeKey = config;
|
|
35
|
-
config = maybeKey.ref;
|
|
36
|
-
return {
|
|
37
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
38
|
-
type: type,
|
|
39
|
-
key: key,
|
|
40
|
-
ref: void 0 !== config ? config : null,
|
|
41
|
-
props: maybeKey
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
45
|
-
reactJsxRuntime_production.jsx = jsxProd;
|
|
46
|
-
reactJsxRuntime_production.jsxs = jsxProd;
|
|
47
|
-
return reactJsxRuntime_production;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
var reactJsxRuntime_development = {};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @license React
|
|
54
|
-
* react-jsx-runtime.development.js
|
|
55
|
-
*
|
|
56
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
57
|
-
*
|
|
58
|
-
* This source code is licensed under the MIT license found in the
|
|
59
|
-
* LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
var hasRequiredReactJsxRuntime_development;
|
|
63
|
-
|
|
64
|
-
function requireReactJsxRuntime_development () {
|
|
65
|
-
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
66
|
-
hasRequiredReactJsxRuntime_development = 1;
|
|
67
|
-
"production" !== process.env.NODE_ENV &&
|
|
68
|
-
(function () {
|
|
69
|
-
function getComponentNameFromType(type) {
|
|
70
|
-
if (null == type) return null;
|
|
71
|
-
if ("function" === typeof type)
|
|
72
|
-
return type.$$typeof === REACT_CLIENT_REFERENCE
|
|
73
|
-
? null
|
|
74
|
-
: type.displayName || type.name || null;
|
|
75
|
-
if ("string" === typeof type) return type;
|
|
76
|
-
switch (type) {
|
|
77
|
-
case REACT_FRAGMENT_TYPE:
|
|
78
|
-
return "Fragment";
|
|
79
|
-
case REACT_PROFILER_TYPE:
|
|
80
|
-
return "Profiler";
|
|
81
|
-
case REACT_STRICT_MODE_TYPE:
|
|
82
|
-
return "StrictMode";
|
|
83
|
-
case REACT_SUSPENSE_TYPE:
|
|
84
|
-
return "Suspense";
|
|
85
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
86
|
-
return "SuspenseList";
|
|
87
|
-
case REACT_ACTIVITY_TYPE:
|
|
88
|
-
return "Activity";
|
|
89
|
-
}
|
|
90
|
-
if ("object" === typeof type)
|
|
91
|
-
switch (
|
|
92
|
-
("number" === typeof type.tag &&
|
|
93
|
-
console.error(
|
|
94
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
95
|
-
),
|
|
96
|
-
type.$$typeof)
|
|
97
|
-
) {
|
|
98
|
-
case REACT_PORTAL_TYPE:
|
|
99
|
-
return "Portal";
|
|
100
|
-
case REACT_CONTEXT_TYPE:
|
|
101
|
-
return type.displayName || "Context";
|
|
102
|
-
case REACT_CONSUMER_TYPE:
|
|
103
|
-
return (type._context.displayName || "Context") + ".Consumer";
|
|
104
|
-
case REACT_FORWARD_REF_TYPE:
|
|
105
|
-
var innerType = type.render;
|
|
106
|
-
type = type.displayName;
|
|
107
|
-
type ||
|
|
108
|
-
((type = innerType.displayName || innerType.name || ""),
|
|
109
|
-
(type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
|
|
110
|
-
return type;
|
|
111
|
-
case REACT_MEMO_TYPE:
|
|
112
|
-
return (
|
|
113
|
-
(innerType = type.displayName || null),
|
|
114
|
-
null !== innerType
|
|
115
|
-
? innerType
|
|
116
|
-
: getComponentNameFromType(type.type) || "Memo"
|
|
117
|
-
);
|
|
118
|
-
case REACT_LAZY_TYPE:
|
|
119
|
-
innerType = type._payload;
|
|
120
|
-
type = type._init;
|
|
121
|
-
try {
|
|
122
|
-
return getComponentNameFromType(type(innerType));
|
|
123
|
-
} catch (x) {}
|
|
124
|
-
}
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
function testStringCoercion(value) {
|
|
128
|
-
return "" + value;
|
|
129
|
-
}
|
|
130
|
-
function checkKeyStringCoercion(value) {
|
|
131
|
-
try {
|
|
132
|
-
testStringCoercion(value);
|
|
133
|
-
var JSCompiler_inline_result = !1;
|
|
134
|
-
} catch (e) {
|
|
135
|
-
JSCompiler_inline_result = true;
|
|
136
|
-
}
|
|
137
|
-
if (JSCompiler_inline_result) {
|
|
138
|
-
JSCompiler_inline_result = console;
|
|
139
|
-
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
140
|
-
var JSCompiler_inline_result$jscomp$0 =
|
|
141
|
-
("function" === typeof Symbol &&
|
|
142
|
-
Symbol.toStringTag &&
|
|
143
|
-
value[Symbol.toStringTag]) ||
|
|
144
|
-
value.constructor.name ||
|
|
145
|
-
"Object";
|
|
146
|
-
JSCompiler_temp_const.call(
|
|
147
|
-
JSCompiler_inline_result,
|
|
148
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
149
|
-
JSCompiler_inline_result$jscomp$0
|
|
150
|
-
);
|
|
151
|
-
return testStringCoercion(value);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
function getTaskName(type) {
|
|
155
|
-
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
156
|
-
if (
|
|
157
|
-
"object" === typeof type &&
|
|
158
|
-
null !== type &&
|
|
159
|
-
type.$$typeof === REACT_LAZY_TYPE
|
|
160
|
-
)
|
|
161
|
-
return "<...>";
|
|
162
|
-
try {
|
|
163
|
-
var name = getComponentNameFromType(type);
|
|
164
|
-
return name ? "<" + name + ">" : "<...>";
|
|
165
|
-
} catch (x) {
|
|
166
|
-
return "<...>";
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
function getOwner() {
|
|
170
|
-
var dispatcher = ReactSharedInternals.A;
|
|
171
|
-
return null === dispatcher ? null : dispatcher.getOwner();
|
|
172
|
-
}
|
|
173
|
-
function UnknownOwner() {
|
|
174
|
-
return Error("react-stack-top-frame");
|
|
175
|
-
}
|
|
176
|
-
function hasValidKey(config) {
|
|
177
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
178
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
179
|
-
if (getter && getter.isReactWarning) return false;
|
|
180
|
-
}
|
|
181
|
-
return void 0 !== config.key;
|
|
182
|
-
}
|
|
183
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
184
|
-
function warnAboutAccessingKey() {
|
|
185
|
-
specialPropKeyWarningShown ||
|
|
186
|
-
((specialPropKeyWarningShown = true),
|
|
187
|
-
console.error(
|
|
188
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
189
|
-
displayName
|
|
190
|
-
));
|
|
191
|
-
}
|
|
192
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
193
|
-
Object.defineProperty(props, "key", {
|
|
194
|
-
get: warnAboutAccessingKey,
|
|
195
|
-
configurable: true
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
function elementRefGetterWithDeprecationWarning() {
|
|
199
|
-
var componentName = getComponentNameFromType(this.type);
|
|
200
|
-
didWarnAboutElementRef[componentName] ||
|
|
201
|
-
((didWarnAboutElementRef[componentName] = true),
|
|
202
|
-
console.error(
|
|
203
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
204
|
-
));
|
|
205
|
-
componentName = this.props.ref;
|
|
206
|
-
return void 0 !== componentName ? componentName : null;
|
|
207
|
-
}
|
|
208
|
-
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
209
|
-
var refProp = props.ref;
|
|
210
|
-
type = {
|
|
211
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
212
|
-
type: type,
|
|
213
|
-
key: key,
|
|
214
|
-
props: props,
|
|
215
|
-
_owner: owner
|
|
216
|
-
};
|
|
217
|
-
null !== (void 0 !== refProp ? refProp : null)
|
|
218
|
-
? Object.defineProperty(type, "ref", {
|
|
219
|
-
enumerable: false,
|
|
220
|
-
get: elementRefGetterWithDeprecationWarning
|
|
221
|
-
})
|
|
222
|
-
: Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
223
|
-
type._store = {};
|
|
224
|
-
Object.defineProperty(type._store, "validated", {
|
|
225
|
-
configurable: false,
|
|
226
|
-
enumerable: false,
|
|
227
|
-
writable: true,
|
|
228
|
-
value: 0
|
|
229
|
-
});
|
|
230
|
-
Object.defineProperty(type, "_debugInfo", {
|
|
231
|
-
configurable: false,
|
|
232
|
-
enumerable: false,
|
|
233
|
-
writable: true,
|
|
234
|
-
value: null
|
|
235
|
-
});
|
|
236
|
-
Object.defineProperty(type, "_debugStack", {
|
|
237
|
-
configurable: false,
|
|
238
|
-
enumerable: false,
|
|
239
|
-
writable: true,
|
|
240
|
-
value: debugStack
|
|
241
|
-
});
|
|
242
|
-
Object.defineProperty(type, "_debugTask", {
|
|
243
|
-
configurable: false,
|
|
244
|
-
enumerable: false,
|
|
245
|
-
writable: true,
|
|
246
|
-
value: debugTask
|
|
247
|
-
});
|
|
248
|
-
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
249
|
-
return type;
|
|
250
|
-
}
|
|
251
|
-
function jsxDEVImpl(
|
|
252
|
-
type,
|
|
253
|
-
config,
|
|
254
|
-
maybeKey,
|
|
255
|
-
isStaticChildren,
|
|
256
|
-
debugStack,
|
|
257
|
-
debugTask
|
|
258
|
-
) {
|
|
259
|
-
var children = config.children;
|
|
260
|
-
if (void 0 !== children)
|
|
261
|
-
if (isStaticChildren)
|
|
262
|
-
if (isArrayImpl(children)) {
|
|
263
|
-
for (
|
|
264
|
-
isStaticChildren = 0;
|
|
265
|
-
isStaticChildren < children.length;
|
|
266
|
-
isStaticChildren++
|
|
267
|
-
)
|
|
268
|
-
validateChildKeys(children[isStaticChildren]);
|
|
269
|
-
Object.freeze && Object.freeze(children);
|
|
270
|
-
} else
|
|
271
|
-
console.error(
|
|
272
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
273
|
-
);
|
|
274
|
-
else validateChildKeys(children);
|
|
275
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
276
|
-
children = getComponentNameFromType(type);
|
|
277
|
-
var keys = Object.keys(config).filter(function (k) {
|
|
278
|
-
return "key" !== k;
|
|
279
|
-
});
|
|
280
|
-
isStaticChildren =
|
|
281
|
-
0 < keys.length
|
|
282
|
-
? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
|
|
283
|
-
: "{key: someKey}";
|
|
284
|
-
didWarnAboutKeySpread[children + isStaticChildren] ||
|
|
285
|
-
((keys =
|
|
286
|
-
0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
|
|
287
|
-
console.error(
|
|
288
|
-
'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
|
|
289
|
-
isStaticChildren,
|
|
290
|
-
children,
|
|
291
|
-
keys,
|
|
292
|
-
children
|
|
293
|
-
),
|
|
294
|
-
(didWarnAboutKeySpread[children + isStaticChildren] = true));
|
|
295
|
-
}
|
|
296
|
-
children = null;
|
|
297
|
-
void 0 !== maybeKey &&
|
|
298
|
-
(checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
|
|
299
|
-
hasValidKey(config) &&
|
|
300
|
-
(checkKeyStringCoercion(config.key), (children = "" + config.key));
|
|
301
|
-
if ("key" in config) {
|
|
302
|
-
maybeKey = {};
|
|
303
|
-
for (var propName in config)
|
|
304
|
-
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
305
|
-
} else maybeKey = config;
|
|
306
|
-
children &&
|
|
307
|
-
defineKeyPropWarningGetter(
|
|
308
|
-
maybeKey,
|
|
309
|
-
"function" === typeof type
|
|
310
|
-
? type.displayName || type.name || "Unknown"
|
|
311
|
-
: type
|
|
312
|
-
);
|
|
313
|
-
return ReactElement(
|
|
314
|
-
type,
|
|
315
|
-
children,
|
|
316
|
-
maybeKey,
|
|
317
|
-
getOwner(),
|
|
318
|
-
debugStack,
|
|
319
|
-
debugTask
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
function validateChildKeys(node) {
|
|
323
|
-
isValidElement(node)
|
|
324
|
-
? node._store && (node._store.validated = 1)
|
|
325
|
-
: "object" === typeof node &&
|
|
326
|
-
null !== node &&
|
|
327
|
-
node.$$typeof === REACT_LAZY_TYPE &&
|
|
328
|
-
("fulfilled" === node._payload.status
|
|
329
|
-
? isValidElement(node._payload.value) &&
|
|
330
|
-
node._payload.value._store &&
|
|
331
|
-
(node._payload.value._store.validated = 1)
|
|
332
|
-
: node._store && (node._store.validated = 1));
|
|
333
|
-
}
|
|
334
|
-
function isValidElement(object) {
|
|
335
|
-
return (
|
|
336
|
-
"object" === typeof object &&
|
|
337
|
-
null !== object &&
|
|
338
|
-
object.$$typeof === REACT_ELEMENT_TYPE
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
var React$1 = React,
|
|
342
|
-
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
343
|
-
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
344
|
-
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
345
|
-
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
346
|
-
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
347
|
-
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
348
|
-
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
349
|
-
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
350
|
-
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
351
|
-
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
352
|
-
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
353
|
-
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
354
|
-
REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
|
|
355
|
-
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
|
|
356
|
-
ReactSharedInternals =
|
|
357
|
-
React$1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
|
358
|
-
hasOwnProperty = Object.prototype.hasOwnProperty,
|
|
359
|
-
isArrayImpl = Array.isArray,
|
|
360
|
-
createTask = console.createTask
|
|
361
|
-
? console.createTask
|
|
362
|
-
: function () {
|
|
363
|
-
return null;
|
|
364
|
-
};
|
|
365
|
-
React$1 = {
|
|
366
|
-
react_stack_bottom_frame: function (callStackForError) {
|
|
367
|
-
return callStackForError();
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
var specialPropKeyWarningShown;
|
|
371
|
-
var didWarnAboutElementRef = {};
|
|
372
|
-
var unknownOwnerDebugStack = React$1.react_stack_bottom_frame.bind(
|
|
373
|
-
React$1,
|
|
374
|
-
UnknownOwner
|
|
375
|
-
)();
|
|
376
|
-
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
377
|
-
var didWarnAboutKeySpread = {};
|
|
378
|
-
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
379
|
-
reactJsxRuntime_development.jsx = function (type, config, maybeKey) {
|
|
380
|
-
var trackActualOwner =
|
|
381
|
-
1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
382
|
-
return jsxDEVImpl(
|
|
383
|
-
type,
|
|
384
|
-
config,
|
|
385
|
-
maybeKey,
|
|
386
|
-
false,
|
|
387
|
-
trackActualOwner
|
|
388
|
-
? Error("react-stack-top-frame")
|
|
389
|
-
: unknownOwnerDebugStack,
|
|
390
|
-
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
391
|
-
);
|
|
392
|
-
};
|
|
393
|
-
reactJsxRuntime_development.jsxs = function (type, config, maybeKey) {
|
|
394
|
-
var trackActualOwner =
|
|
395
|
-
1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
396
|
-
return jsxDEVImpl(
|
|
397
|
-
type,
|
|
398
|
-
config,
|
|
399
|
-
maybeKey,
|
|
400
|
-
true,
|
|
401
|
-
trackActualOwner
|
|
402
|
-
? Error("react-stack-top-frame")
|
|
403
|
-
: unknownOwnerDebugStack,
|
|
404
|
-
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
405
|
-
);
|
|
406
|
-
};
|
|
407
|
-
})();
|
|
408
|
-
return reactJsxRuntime_development;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
if (process.env.NODE_ENV === 'production') {
|
|
412
|
-
jsxRuntime.exports = requireReactJsxRuntime_production();
|
|
413
|
-
} else {
|
|
414
|
-
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
var jsxRuntimeExports = jsxRuntime.exports;
|
|
418
|
-
|
|
419
5
|
/**
|
|
420
6
|
* Detect sections from WordPress blocks
|
|
421
7
|
* Sections are defined by core/group blocks (with or without alignment)
|
|
422
|
-
*
|
|
8
|
+
* Blocks that aren't in groups are wrapped in implicit sections
|
|
423
9
|
*/
|
|
424
10
|
function detectSections(blocks) {
|
|
425
11
|
const sections = [];
|
|
426
12
|
let sectionIndex = 0;
|
|
13
|
+
let currentNonGroupBlocks = [];
|
|
427
14
|
for (const block of blocks) {
|
|
428
15
|
// core/group blocks are sections
|
|
429
16
|
if (block.name === 'core/group') {
|
|
17
|
+
// If we have accumulated non-group blocks, create a section for them first
|
|
18
|
+
if (currentNonGroupBlocks.length > 0) {
|
|
19
|
+
sections.push({
|
|
20
|
+
id: `section-${sectionIndex}`,
|
|
21
|
+
type: 'section',
|
|
22
|
+
block: {
|
|
23
|
+
name: 'core/group',
|
|
24
|
+
attributes: {},
|
|
25
|
+
innerBlocks: currentNonGroupBlocks,
|
|
26
|
+
},
|
|
27
|
+
blocks: currentNonGroupBlocks,
|
|
28
|
+
index: sectionIndex,
|
|
29
|
+
});
|
|
30
|
+
sectionIndex++;
|
|
31
|
+
currentNonGroupBlocks = [];
|
|
32
|
+
}
|
|
33
|
+
// Create section for this group
|
|
430
34
|
const attrs = block.attributes || {};
|
|
431
35
|
const className = attrs.className;
|
|
432
36
|
const customId = attrs.id;
|
|
@@ -443,6 +47,39 @@ function detectSections(blocks) {
|
|
|
443
47
|
});
|
|
444
48
|
sectionIndex++;
|
|
445
49
|
}
|
|
50
|
+
else {
|
|
51
|
+
// Accumulate non-group blocks to wrap in a section later
|
|
52
|
+
currentNonGroupBlocks.push(block);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// If there are remaining non-group blocks, create a section for them
|
|
56
|
+
if (currentNonGroupBlocks.length > 0) {
|
|
57
|
+
sections.push({
|
|
58
|
+
id: `section-${sectionIndex}`,
|
|
59
|
+
type: 'section',
|
|
60
|
+
block: {
|
|
61
|
+
name: 'core/group',
|
|
62
|
+
attributes: {},
|
|
63
|
+
innerBlocks: currentNonGroupBlocks,
|
|
64
|
+
},
|
|
65
|
+
blocks: currentNonGroupBlocks,
|
|
66
|
+
index: sectionIndex,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// If no sections were created (no groups and no other blocks), create an empty section
|
|
70
|
+
// This shouldn't happen, but handle it gracefully
|
|
71
|
+
if (sections.length === 0 && blocks.length === 0) {
|
|
72
|
+
sections.push({
|
|
73
|
+
id: 'section-0',
|
|
74
|
+
type: 'section',
|
|
75
|
+
block: {
|
|
76
|
+
name: 'core/group',
|
|
77
|
+
attributes: {},
|
|
78
|
+
innerBlocks: [],
|
|
79
|
+
},
|
|
80
|
+
blocks: [],
|
|
81
|
+
index: 0,
|
|
82
|
+
});
|
|
446
83
|
}
|
|
447
84
|
return sections;
|
|
448
85
|
}
|
|
@@ -534,6 +171,12 @@ function selectBlockRenderer(block) {
|
|
|
534
171
|
}
|
|
535
172
|
}
|
|
536
173
|
|
|
174
|
+
/**
|
|
175
|
+
* @license GPL-3.0-or-later
|
|
176
|
+
*
|
|
177
|
+
* This file is part of the MarVAlt Open SDK.
|
|
178
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
179
|
+
*/
|
|
537
180
|
const BlockText = ({ block, className }) => {
|
|
538
181
|
const attrs = block.attributes || {};
|
|
539
182
|
const content = (attrs.content || attrs.text || '');
|
|
@@ -551,9 +194,15 @@ const BlockText = ({ block, className }) => {
|
|
|
551
194
|
style.fontSize = `calc(1rem * var(--dstyler-font-scale) * ${attrs.level || 2})`;
|
|
552
195
|
style.fontWeight = 'bold';
|
|
553
196
|
}
|
|
554
|
-
return (
|
|
197
|
+
return (React.createElement(Tag, { className: className, style: style, dangerouslySetInnerHTML: { __html: content } }));
|
|
555
198
|
};
|
|
556
199
|
|
|
200
|
+
/**
|
|
201
|
+
* @license GPL-3.0-or-later
|
|
202
|
+
*
|
|
203
|
+
* This file is part of the MarVAlt Open SDK.
|
|
204
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
205
|
+
*/
|
|
557
206
|
const BlockImage = ({ block, className }) => {
|
|
558
207
|
const attrs = block.attributes || {};
|
|
559
208
|
const url = (attrs.url || attrs.sourceUrl || '');
|
|
@@ -562,7 +211,7 @@ const BlockImage = ({ block, className }) => {
|
|
|
562
211
|
const height = attrs.height;
|
|
563
212
|
if (!url)
|
|
564
213
|
return null;
|
|
565
|
-
return (
|
|
214
|
+
return (React.createElement("img", { src: url, alt: alt, width: width, height: height, className: className, style: {
|
|
566
215
|
maxWidth: '100%',
|
|
567
216
|
height: 'auto',
|
|
568
217
|
marginBottom: 'var(--dstyler-spacing-md)',
|
|
@@ -570,6 +219,12 @@ const BlockImage = ({ block, className }) => {
|
|
|
570
219
|
}, loading: "lazy" }));
|
|
571
220
|
};
|
|
572
221
|
|
|
222
|
+
/**
|
|
223
|
+
* @license GPL-3.0-or-later
|
|
224
|
+
*
|
|
225
|
+
* This file is part of the MarVAlt Open SDK.
|
|
226
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
227
|
+
*/
|
|
573
228
|
const BlockButton = ({ block, className }) => {
|
|
574
229
|
const attrs = block.attributes || {};
|
|
575
230
|
const text = (attrs.text || attrs.label || 'Button');
|
|
@@ -577,7 +232,7 @@ const BlockButton = ({ block, className }) => {
|
|
|
577
232
|
const isExternal = typeof window !== 'undefined'
|
|
578
233
|
? url.startsWith('http') && !url.includes(window.location.hostname)
|
|
579
234
|
: url.startsWith('http');
|
|
580
|
-
return (
|
|
235
|
+
return (React.createElement("a", { href: url, target: isExternal ? '_blank' : undefined, rel: isExternal ? 'noopener noreferrer' : undefined, className: className, style: {
|
|
581
236
|
display: 'inline-block',
|
|
582
237
|
padding: 'var(--dstyler-spacing-md) var(--dstyler-spacing-lg)',
|
|
583
238
|
backgroundColor: 'var(--dstyler-color-primary)',
|
|
@@ -591,19 +246,31 @@ const BlockButton = ({ block, className }) => {
|
|
|
591
246
|
e.currentTarget.style.opacity = '0.9';
|
|
592
247
|
}, onMouseLeave: (e) => {
|
|
593
248
|
e.currentTarget.style.opacity = '1';
|
|
594
|
-
},
|
|
249
|
+
} }, text));
|
|
595
250
|
};
|
|
596
251
|
|
|
252
|
+
/**
|
|
253
|
+
* @license GPL-3.0-or-later
|
|
254
|
+
*
|
|
255
|
+
* This file is part of the MarVAlt Open SDK.
|
|
256
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
257
|
+
*/
|
|
597
258
|
const BlockForm = ({ block, className }) => {
|
|
598
259
|
const attrs = block.attributes || {};
|
|
599
260
|
const content = (attrs.content || attrs.html || '');
|
|
600
261
|
// For now, just render the HTML content
|
|
601
262
|
// In the future, this could parse and render using Gravity Forms or Mautic components
|
|
602
|
-
return (
|
|
263
|
+
return (React.createElement("div", { className: className, style: {
|
|
603
264
|
marginBottom: 'var(--dstyler-spacing-lg)',
|
|
604
265
|
}, dangerouslySetInnerHTML: { __html: content } }));
|
|
605
266
|
};
|
|
606
267
|
|
|
268
|
+
/**
|
|
269
|
+
* @license GPL-3.0-or-later
|
|
270
|
+
*
|
|
271
|
+
* This file is part of the MarVAlt Open SDK.
|
|
272
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
273
|
+
*/
|
|
607
274
|
/**
|
|
608
275
|
* AutoBlock - Automatically selects and renders the appropriate block renderer
|
|
609
276
|
*
|
|
@@ -612,28 +279,51 @@ const BlockForm = ({ block, className }) => {
|
|
|
612
279
|
* 2. Use dstyler's built-in block renderers
|
|
613
280
|
*/
|
|
614
281
|
const AutoBlock = ({ block, registry, className }) => {
|
|
282
|
+
// Recursively render innerBlocks if they exist
|
|
283
|
+
const renderInnerBlocks = () => {
|
|
284
|
+
if (!block.innerBlocks || block.innerBlocks.length === 0) {
|
|
285
|
+
return undefined;
|
|
286
|
+
}
|
|
287
|
+
if (registry) {
|
|
288
|
+
// Use registry to render innerBlocks recursively
|
|
289
|
+
return block.innerBlocks.map((innerBlock, index) => (React.createElement(AutoBlock, { key: `${innerBlock.name}-${index}`, block: innerBlock, registry: registry })));
|
|
290
|
+
}
|
|
291
|
+
// Fallback: use dstyler's renderers
|
|
292
|
+
return block.innerBlocks.map((innerBlock, index) => (React.createElement(AutoBlock, { key: `${innerBlock.name}-${index}`, block: innerBlock })));
|
|
293
|
+
};
|
|
294
|
+
const children = renderInnerBlocks();
|
|
615
295
|
// If registry is provided, use it for rendering (integrates with wparser)
|
|
616
296
|
if (registry && registry.renderers[block.name]) {
|
|
617
297
|
const Renderer = registry.renderers[block.name];
|
|
618
|
-
return
|
|
298
|
+
return React.createElement(Renderer, { block: block, children: children, context: { registry } });
|
|
619
299
|
}
|
|
620
300
|
// Otherwise, use dstyler's block renderers
|
|
621
301
|
const rendererName = selectBlockRenderer(block);
|
|
622
302
|
switch (rendererName) {
|
|
623
303
|
case 'BlockText':
|
|
624
|
-
return
|
|
304
|
+
return React.createElement(BlockText, { block: block, className: className });
|
|
625
305
|
case 'BlockImage':
|
|
626
|
-
return
|
|
306
|
+
return React.createElement(BlockImage, { block: block, className: className });
|
|
627
307
|
case 'BlockButton':
|
|
628
|
-
return
|
|
308
|
+
return React.createElement(BlockButton, { block: block, className: className });
|
|
629
309
|
case 'BlockForm':
|
|
630
|
-
return
|
|
310
|
+
return React.createElement(BlockForm, { block: block, className: className });
|
|
631
311
|
default:
|
|
632
312
|
// Fallback: render block name or content
|
|
633
|
-
return (
|
|
313
|
+
return (React.createElement("div", { style: { marginBottom: 'var(--dstyler-spacing-md)' } },
|
|
314
|
+
React.createElement("pre", { style: { fontSize: '0.875rem', color: '#666' } },
|
|
315
|
+
block.name,
|
|
316
|
+
": ",
|
|
317
|
+
JSON.stringify(block.attributes, null, 2))));
|
|
634
318
|
}
|
|
635
319
|
};
|
|
636
320
|
|
|
321
|
+
/**
|
|
322
|
+
* @license GPL-3.0-or-later
|
|
323
|
+
*
|
|
324
|
+
* This file is part of the MarVAlt Open SDK.
|
|
325
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
326
|
+
*/
|
|
637
327
|
const SectionBase = ({ section, children }) => {
|
|
638
328
|
const style = section.style || 'default';
|
|
639
329
|
const bgColor = `var(--dstyler-color-${style})`;
|
|
@@ -642,15 +332,22 @@ const SectionBase = ({ section, children }) => {
|
|
|
642
332
|
`dstyler-section-${style}`,
|
|
643
333
|
section.customClass,
|
|
644
334
|
].filter(Boolean).join(' ');
|
|
645
|
-
return (
|
|
335
|
+
return (React.createElement("section", { className: className, id: section.customId, style: {
|
|
646
336
|
backgroundColor: bgColor,
|
|
647
337
|
padding: 'var(--dstyler-spacing-xl) var(--dstyler-spacing-md)',
|
|
648
|
-
}
|
|
338
|
+
} },
|
|
339
|
+
React.createElement("div", { style: {
|
|
649
340
|
maxWidth: 'var(--dstyler-container-max-width, 1200px)',
|
|
650
341
|
margin: '0 auto',
|
|
651
|
-
}, children
|
|
342
|
+
} }, children)));
|
|
652
343
|
};
|
|
653
344
|
|
|
345
|
+
/**
|
|
346
|
+
* @license GPL-3.0-or-later
|
|
347
|
+
*
|
|
348
|
+
* This file is part of the MarVAlt Open SDK.
|
|
349
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
350
|
+
*/
|
|
654
351
|
const SectionWave = ({ section, children, waveTop = true, waveBottom = true, }) => {
|
|
655
352
|
const style = section.style || 'default';
|
|
656
353
|
const bgColor = `var(--dstyler-color-${style})`;
|
|
@@ -661,23 +358,34 @@ const SectionWave = ({ section, children, waveTop = true, waveBottom = true, })
|
|
|
661
358
|
section.customClass,
|
|
662
359
|
].filter(Boolean).join(' ');
|
|
663
360
|
// Wave SVG
|
|
664
|
-
const waveSvg = (
|
|
361
|
+
const waveSvg = (React.createElement("svg", { viewBox: "0 0 1440 120", preserveAspectRatio: "none", style: {
|
|
665
362
|
width: '100%',
|
|
666
363
|
height: '60px',
|
|
667
364
|
display: 'block',
|
|
668
365
|
fill: bgColor,
|
|
669
|
-
}
|
|
670
|
-
|
|
366
|
+
} },
|
|
367
|
+
React.createElement("path", { d: "M0,60 C240,0 480,120 720,60 C960,0 1200,120 1440,60 L1440,120 L0,120 Z" })));
|
|
368
|
+
return (React.createElement("section", { className: className, id: section.customId, style: {
|
|
671
369
|
backgroundColor: bgColor,
|
|
672
370
|
position: 'relative',
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
371
|
+
} },
|
|
372
|
+
waveTop && React.createElement("div", { style: { marginTop: '-1px' } }, waveSvg),
|
|
373
|
+
React.createElement("div", { style: {
|
|
374
|
+
padding: 'var(--dstyler-spacing-xl) var(--dstyler-spacing-md)',
|
|
375
|
+
} },
|
|
376
|
+
React.createElement("div", { style: {
|
|
377
|
+
maxWidth: 'var(--dstyler-container-max-width, 1200px)',
|
|
378
|
+
margin: '0 auto',
|
|
379
|
+
} }, children)),
|
|
380
|
+
waveBottom && (React.createElement("div", { style: { marginBottom: '-1px', transform: 'rotate(180deg)' } }, waveSvg))));
|
|
679
381
|
};
|
|
680
382
|
|
|
383
|
+
/**
|
|
384
|
+
* @license GPL-3.0-or-later
|
|
385
|
+
*
|
|
386
|
+
* This file is part of the MarVAlt Open SDK.
|
|
387
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
388
|
+
*/
|
|
681
389
|
const HeroDefault = ({ section, children }) => {
|
|
682
390
|
const style = section.style || 'default';
|
|
683
391
|
const bgColor = `var(--dstyler-color-${style})`;
|
|
@@ -687,20 +395,27 @@ const HeroDefault = ({ section, children }) => {
|
|
|
687
395
|
`dstyler-hero-${style}`,
|
|
688
396
|
section.customClass,
|
|
689
397
|
].filter(Boolean).join(' ');
|
|
690
|
-
return (
|
|
398
|
+
return (React.createElement("section", { className: className, id: section.customId, style: {
|
|
691
399
|
backgroundColor: bgColor,
|
|
692
400
|
padding: 'var(--dstyler-spacing-xl) var(--dstyler-spacing-md)',
|
|
693
401
|
minHeight: '50vh',
|
|
694
402
|
display: 'flex',
|
|
695
403
|
alignItems: 'center',
|
|
696
404
|
justifyContent: 'center',
|
|
697
|
-
}
|
|
405
|
+
} },
|
|
406
|
+
React.createElement("div", { style: {
|
|
698
407
|
maxWidth: 'var(--dstyler-container-max-width, 1200px)',
|
|
699
408
|
margin: '0 auto',
|
|
700
409
|
textAlign: 'center',
|
|
701
|
-
}, children
|
|
410
|
+
} }, children)));
|
|
702
411
|
};
|
|
703
412
|
|
|
413
|
+
/**
|
|
414
|
+
* @license GPL-3.0-or-later
|
|
415
|
+
*
|
|
416
|
+
* This file is part of the MarVAlt Open SDK.
|
|
417
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
418
|
+
*/
|
|
704
419
|
const FooterMinimal = ({ section, children }) => {
|
|
705
420
|
const style = section.style || 'default';
|
|
706
421
|
const bgColor = `var(--dstyler-color-${style})`;
|
|
@@ -710,19 +425,26 @@ const FooterMinimal = ({ section, children }) => {
|
|
|
710
425
|
`dstyler-footer-${style}`,
|
|
711
426
|
section.customClass,
|
|
712
427
|
].filter(Boolean).join(' ');
|
|
713
|
-
return (
|
|
428
|
+
return (React.createElement("footer", { className: className, id: section.customId, style: {
|
|
714
429
|
backgroundColor: bgColor,
|
|
715
430
|
padding: 'var(--dstyler-spacing-lg) var(--dstyler-spacing-md)',
|
|
716
431
|
borderTop: '1px solid var(--dstyler-color-alternate)',
|
|
717
|
-
}
|
|
432
|
+
} },
|
|
433
|
+
React.createElement("div", { style: {
|
|
718
434
|
maxWidth: 'var(--dstyler-container-max-width, 1200px)',
|
|
719
435
|
margin: '0 auto',
|
|
720
436
|
textAlign: 'center',
|
|
721
437
|
fontSize: '0.875rem',
|
|
722
438
|
color: 'var(--dstyler-color-text)',
|
|
723
|
-
}, children
|
|
439
|
+
} }, children)));
|
|
724
440
|
};
|
|
725
441
|
|
|
442
|
+
/**
|
|
443
|
+
* @license GPL-3.0-or-later
|
|
444
|
+
*
|
|
445
|
+
* This file is part of the MarVAlt Open SDK.
|
|
446
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
447
|
+
*/
|
|
726
448
|
/**
|
|
727
449
|
* AutoSection - Automatically selects and renders the appropriate section template
|
|
728
450
|
*/
|
|
@@ -732,10 +454,10 @@ const AutoSection = ({ section, registry }) => {
|
|
|
732
454
|
const renderBlocks = () => {
|
|
733
455
|
if (registry) {
|
|
734
456
|
// Use registry for block rendering (integrates with wparser)
|
|
735
|
-
return section.blocks.map((block, index) => (
|
|
457
|
+
return section.blocks.map((block, index) => (React.createElement(AutoBlock, { key: `${block.name}-${index}`, block: block, registry: registry })));
|
|
736
458
|
}
|
|
737
459
|
// Fallback to simple block rendering
|
|
738
|
-
return section.blocks.map((block, index) => (
|
|
460
|
+
return section.blocks.map((block, index) => (React.createElement(AutoBlock, { key: `${block.name}-${index}`, block: block })));
|
|
739
461
|
};
|
|
740
462
|
// Select template component
|
|
741
463
|
switch (templateName) {
|
|
@@ -743,17 +465,23 @@ const AutoSection = ({ section, registry }) => {
|
|
|
743
465
|
const className = section.customClass?.toLowerCase() || '';
|
|
744
466
|
const waveTop = className.includes('wave-top') || !className.includes('wave-bottom');
|
|
745
467
|
const waveBottom = className.includes('wave-bottom') || !className.includes('wave-top');
|
|
746
|
-
return (
|
|
468
|
+
return (React.createElement(SectionWave, { section: section, waveTop: waveTop, waveBottom: waveBottom }, renderBlocks()));
|
|
747
469
|
}
|
|
748
470
|
case 'HeroDefault':
|
|
749
|
-
return
|
|
471
|
+
return React.createElement(HeroDefault, { section: section }, renderBlocks());
|
|
750
472
|
case 'FooterMinimal':
|
|
751
|
-
return
|
|
473
|
+
return React.createElement(FooterMinimal, { section: section }, renderBlocks());
|
|
752
474
|
default:
|
|
753
|
-
return
|
|
475
|
+
return React.createElement(SectionBase, { section: section }, renderBlocks());
|
|
754
476
|
}
|
|
755
477
|
};
|
|
756
478
|
|
|
479
|
+
/**
|
|
480
|
+
* @license GPL-3.0-or-later
|
|
481
|
+
*
|
|
482
|
+
* This file is part of the MarVAlt Open SDK.
|
|
483
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
484
|
+
*/
|
|
757
485
|
/**
|
|
758
486
|
* StyledPage - Main entry point for dstyler
|
|
759
487
|
*
|
|
@@ -774,7 +502,7 @@ const StyledPage = ({ page, registry }) => {
|
|
|
774
502
|
style,
|
|
775
503
|
};
|
|
776
504
|
});
|
|
777
|
-
return (
|
|
505
|
+
return (React.createElement(React.Fragment, null, styledSections.map((section) => (React.createElement(AutoSection, { key: section.id, section: section, registry: registry })))));
|
|
778
506
|
};
|
|
779
507
|
|
|
780
508
|
const defaultTokens = {
|