@webstudio-is/react-sdk 0.218.0 → 0.220.0
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/lib/index.js +82 -463
- package/lib/runtime.js +9 -2
- package/lib/types/__generated__/standard-attributes.d.ts +2 -0
- package/lib/types/component-generator.d.ts +14 -3
- package/lib/types/index.d.ts +1 -0
- package/lib/types/page-settings-meta.d.ts +2 -1
- package/lib/types/props.d.ts +0 -1
- package/package.json +8 -8
- package/lib/types/standard-attributes.d.ts +0 -7
package/lib/index.js
CHANGED
|
@@ -155,7 +155,6 @@ var componentAttribute = "data-ws-component";
|
|
|
155
155
|
var showAttribute = "data-ws-show";
|
|
156
156
|
var collapsedAttribute = "data-ws-collapsed";
|
|
157
157
|
var textContentAttribute = "data-ws-text-content";
|
|
158
|
-
var animationCanPlayOnCanvasAttribute = "data-ws-animation-can-play-on-canvas";
|
|
159
158
|
var attributeNameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
160
159
|
var attributeNameChar = attributeNameStartChar + ":\\-0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
161
160
|
var validAttributeNameRegex = new RegExp(
|
|
@@ -194,505 +193,111 @@ import {
|
|
|
194
193
|
} from "@webstudio-is/sdk";
|
|
195
194
|
import { indexProperty, tagProperty } from "@webstudio-is/sdk/runtime";
|
|
196
195
|
|
|
197
|
-
// src/standard-attributes.ts
|
|
196
|
+
// src/__generated__/standard-attributes.ts
|
|
198
197
|
var standardAttributesToReactProps = {
|
|
199
|
-
// HTML
|
|
200
|
-
accept: "accept",
|
|
201
|
-
acceptcharset: "acceptCharset",
|
|
202
198
|
"accept-charset": "acceptCharset",
|
|
203
199
|
accesskey: "accessKey",
|
|
204
|
-
action: "action",
|
|
205
200
|
allowfullscreen: "allowFullScreen",
|
|
206
|
-
alt: "alt",
|
|
207
|
-
as: "as",
|
|
208
|
-
async: "async",
|
|
209
201
|
autocapitalize: "autoCapitalize",
|
|
210
202
|
autocomplete: "autoComplete",
|
|
211
203
|
autocorrect: "autoCorrect",
|
|
212
204
|
autofocus: "autoFocus",
|
|
213
205
|
autoplay: "autoPlay",
|
|
214
|
-
autosave: "autoSave",
|
|
215
|
-
capture: "capture",
|
|
216
|
-
cellpadding: "cellPadding",
|
|
217
|
-
cellspacing: "cellSpacing",
|
|
218
|
-
challenge: "challenge",
|
|
219
206
|
charset: "charSet",
|
|
220
|
-
checked: "checked",
|
|
221
|
-
children: "children",
|
|
222
|
-
cite: "cite",
|
|
223
207
|
class: "className",
|
|
224
|
-
classid: "classID",
|
|
225
|
-
classname: "className",
|
|
226
|
-
cols: "cols",
|
|
227
208
|
colspan: "colSpan",
|
|
228
|
-
content: "content",
|
|
229
209
|
contenteditable: "contentEditable",
|
|
230
|
-
contextmenu: "contextMenu",
|
|
231
|
-
controls: "controls",
|
|
232
|
-
controlslist: "controlsList",
|
|
233
|
-
coords: "coords",
|
|
234
210
|
crossorigin: "crossOrigin",
|
|
235
|
-
dangerouslysetinnerhtml: "dangerouslySetInnerHTML",
|
|
236
|
-
data: "data",
|
|
237
211
|
datetime: "dateTime",
|
|
238
|
-
default: "default",
|
|
239
|
-
defaultchecked: "defaultChecked",
|
|
240
|
-
defaultvalue: "defaultValue",
|
|
241
|
-
defer: "defer",
|
|
242
|
-
dir: "dir",
|
|
243
|
-
disabled: "disabled",
|
|
244
|
-
disablepictureinpicture: "disablePictureInPicture",
|
|
245
|
-
disableremoteplayback: "disableRemotePlayback",
|
|
246
|
-
download: "download",
|
|
247
|
-
draggable: "draggable",
|
|
248
212
|
enctype: "encType",
|
|
249
213
|
enterkeyhint: "enterKeyHint",
|
|
250
214
|
fetchpriority: "fetchPriority",
|
|
251
215
|
for: "htmlFor",
|
|
252
|
-
form: "form",
|
|
253
216
|
formmethod: "formMethod",
|
|
254
217
|
formaction: "formAction",
|
|
255
218
|
formenctype: "formEncType",
|
|
256
219
|
formnovalidate: "formNoValidate",
|
|
257
220
|
formtarget: "formTarget",
|
|
258
|
-
frameborder: "frameBorder",
|
|
259
|
-
headers: "headers",
|
|
260
|
-
height: "height",
|
|
261
|
-
hidden: "hidden",
|
|
262
|
-
high: "high",
|
|
263
|
-
href: "href",
|
|
264
221
|
hreflang: "hrefLang",
|
|
265
|
-
htmlfor: "htmlFor",
|
|
266
|
-
httpequiv: "httpEquiv",
|
|
267
222
|
"http-equiv": "httpEquiv",
|
|
268
|
-
icon: "icon",
|
|
269
|
-
id: "id",
|
|
270
223
|
imagesizes: "imageSizes",
|
|
271
224
|
imagesrcset: "imageSrcSet",
|
|
272
|
-
inert: "inert",
|
|
273
|
-
innerhtml: "innerHTML",
|
|
274
225
|
inputmode: "inputMode",
|
|
275
|
-
integrity: "integrity",
|
|
276
|
-
is: "is",
|
|
277
226
|
itemid: "itemID",
|
|
278
227
|
itemprop: "itemProp",
|
|
279
228
|
itemref: "itemRef",
|
|
280
229
|
itemscope: "itemScope",
|
|
281
230
|
itemtype: "itemType",
|
|
282
|
-
keyparams: "keyParams",
|
|
283
|
-
keytype: "keyType",
|
|
284
|
-
kind: "kind",
|
|
285
|
-
label: "label",
|
|
286
|
-
lang: "lang",
|
|
287
|
-
list: "list",
|
|
288
|
-
loop: "loop",
|
|
289
|
-
low: "low",
|
|
290
|
-
manifest: "manifest",
|
|
291
|
-
marginwidth: "marginWidth",
|
|
292
|
-
marginheight: "marginHeight",
|
|
293
|
-
max: "max",
|
|
294
231
|
maxlength: "maxLength",
|
|
295
|
-
media: "media",
|
|
296
|
-
mediagroup: "mediaGroup",
|
|
297
|
-
method: "method",
|
|
298
|
-
min: "min",
|
|
299
232
|
minlength: "minLength",
|
|
300
|
-
multiple: "multiple",
|
|
301
|
-
muted: "muted",
|
|
302
|
-
name: "name",
|
|
303
233
|
nomodule: "noModule",
|
|
304
|
-
nonce: "nonce",
|
|
305
234
|
novalidate: "noValidate",
|
|
306
|
-
open: "open",
|
|
307
|
-
optimum: "optimum",
|
|
308
|
-
pattern: "pattern",
|
|
309
|
-
placeholder: "placeholder",
|
|
310
235
|
playsinline: "playsInline",
|
|
311
|
-
poster: "poster",
|
|
312
|
-
preload: "preload",
|
|
313
|
-
profile: "profile",
|
|
314
|
-
radiogroup: "radioGroup",
|
|
315
236
|
readonly: "readOnly",
|
|
316
237
|
referrerpolicy: "referrerPolicy",
|
|
317
|
-
rel: "rel",
|
|
318
|
-
required: "required",
|
|
319
|
-
reversed: "reversed",
|
|
320
|
-
role: "role",
|
|
321
|
-
rows: "rows",
|
|
322
238
|
rowspan: "rowSpan",
|
|
323
|
-
sandbox: "sandbox",
|
|
324
|
-
scope: "scope",
|
|
325
|
-
scoped: "scoped",
|
|
326
|
-
scrolling: "scrolling",
|
|
327
|
-
seamless: "seamless",
|
|
328
|
-
selected: "selected",
|
|
329
|
-
shape: "shape",
|
|
330
|
-
size: "size",
|
|
331
|
-
sizes: "sizes",
|
|
332
|
-
span: "span",
|
|
333
239
|
spellcheck: "spellCheck",
|
|
334
|
-
src: "src",
|
|
335
240
|
srcdoc: "srcDoc",
|
|
336
241
|
srclang: "srcLang",
|
|
337
242
|
srcset: "srcSet",
|
|
338
|
-
start: "start",
|
|
339
|
-
step: "step",
|
|
340
|
-
style: "style",
|
|
341
|
-
summary: "summary",
|
|
342
243
|
tabindex: "tabIndex",
|
|
343
|
-
target: "target",
|
|
344
|
-
title: "title",
|
|
345
|
-
type: "type",
|
|
346
244
|
usemap: "useMap",
|
|
347
|
-
value: "value",
|
|
348
|
-
width: "width",
|
|
349
|
-
wmode: "wmode",
|
|
350
|
-
wrap: "wrap",
|
|
351
|
-
// SVG
|
|
352
|
-
about: "about",
|
|
353
|
-
accentheight: "accentHeight",
|
|
354
|
-
"accent-height": "accentHeight",
|
|
355
|
-
accumulate: "accumulate",
|
|
356
|
-
additive: "additive",
|
|
357
|
-
alignmentbaseline: "alignmentBaseline",
|
|
358
|
-
"alignment-baseline": "alignmentBaseline",
|
|
359
|
-
allowreorder: "allowReorder",
|
|
360
|
-
alphabetic: "alphabetic",
|
|
361
|
-
amplitude: "amplitude",
|
|
362
|
-
arabicform: "arabicForm",
|
|
363
|
-
"arabic-form": "arabicForm",
|
|
364
|
-
ascent: "ascent",
|
|
365
|
-
attributename: "attributeName",
|
|
366
|
-
attributetype: "attributeType",
|
|
367
|
-
autoreverse: "autoReverse",
|
|
368
|
-
azimuth: "azimuth",
|
|
369
|
-
basefrequency: "baseFrequency",
|
|
370
|
-
baselineshift: "baselineShift",
|
|
371
|
-
"baseline-shift": "baselineShift",
|
|
372
|
-
baseprofile: "baseProfile",
|
|
373
|
-
bbox: "bbox",
|
|
374
|
-
begin: "begin",
|
|
375
|
-
bias: "bias",
|
|
376
|
-
by: "by",
|
|
377
|
-
calcmode: "calcMode",
|
|
378
|
-
capheight: "capHeight",
|
|
379
|
-
"cap-height": "capHeight",
|
|
380
|
-
clip: "clip",
|
|
381
|
-
clippath: "clipPath",
|
|
382
|
-
"clip-path": "clipPath",
|
|
383
|
-
clippathunits: "clipPathUnits",
|
|
384
|
-
cliprule: "clipRule",
|
|
385
|
-
"clip-rule": "clipRule",
|
|
386
|
-
color: "color",
|
|
387
|
-
colorinterpolation: "colorInterpolation",
|
|
388
|
-
"color-interpolation": "colorInterpolation",
|
|
389
|
-
colorinterpolationfilters: "colorInterpolationFilters",
|
|
390
|
-
"color-interpolation-filters": "colorInterpolationFilters",
|
|
391
|
-
colorprofile: "colorProfile",
|
|
392
|
-
"color-profile": "colorProfile",
|
|
393
|
-
colorrendering: "colorRendering",
|
|
394
|
-
"color-rendering": "colorRendering",
|
|
395
|
-
contentscripttype: "contentScriptType",
|
|
396
|
-
contentstyletype: "contentStyleType",
|
|
397
|
-
cursor: "cursor",
|
|
398
|
-
cx: "cx",
|
|
399
|
-
cy: "cy",
|
|
400
|
-
d: "d",
|
|
401
|
-
datatype: "datatype",
|
|
402
|
-
decelerate: "decelerate",
|
|
403
|
-
descent: "descent",
|
|
404
|
-
diffuseconstant: "diffuseConstant",
|
|
405
|
-
direction: "direction",
|
|
406
|
-
display: "display",
|
|
407
|
-
divisor: "divisor",
|
|
408
|
-
dominantbaseline: "dominantBaseline",
|
|
409
|
-
"dominant-baseline": "dominantBaseline",
|
|
410
|
-
dur: "dur",
|
|
411
|
-
dx: "dx",
|
|
412
|
-
dy: "dy",
|
|
413
|
-
edgemode: "edgeMode",
|
|
414
|
-
elevation: "elevation",
|
|
415
|
-
enablebackground: "enableBackground",
|
|
416
|
-
"enable-background": "enableBackground",
|
|
417
|
-
end: "end",
|
|
418
|
-
exponent: "exponent",
|
|
419
|
-
externalresourcesrequired: "externalResourcesRequired",
|
|
420
|
-
fill: "fill",
|
|
421
|
-
fillopacity: "fillOpacity",
|
|
422
|
-
"fill-opacity": "fillOpacity",
|
|
423
|
-
fillrule: "fillRule",
|
|
424
|
-
"fill-rule": "fillRule",
|
|
425
|
-
filter: "filter",
|
|
426
|
-
filterres: "filterRes",
|
|
427
|
-
filterunits: "filterUnits",
|
|
428
|
-
floodopacity: "floodOpacity",
|
|
429
|
-
"flood-opacity": "floodOpacity",
|
|
430
|
-
floodcolor: "floodColor",
|
|
431
|
-
"flood-color": "floodColor",
|
|
432
|
-
focusable: "focusable",
|
|
433
|
-
fontfamily: "fontFamily",
|
|
434
|
-
"font-family": "fontFamily",
|
|
435
|
-
fontsize: "fontSize",
|
|
436
|
-
"font-size": "fontSize",
|
|
437
|
-
fontsizeadjust: "fontSizeAdjust",
|
|
438
|
-
"font-size-adjust": "fontSizeAdjust",
|
|
439
|
-
fontstretch: "fontStretch",
|
|
440
|
-
"font-stretch": "fontStretch",
|
|
441
|
-
fontstyle: "fontStyle",
|
|
442
|
-
"font-style": "fontStyle",
|
|
443
|
-
fontvariant: "fontVariant",
|
|
444
|
-
"font-variant": "fontVariant",
|
|
445
|
-
fontweight: "fontWeight",
|
|
446
|
-
"font-weight": "fontWeight",
|
|
447
|
-
format: "format",
|
|
448
|
-
from: "from",
|
|
449
|
-
fx: "fx",
|
|
450
|
-
fy: "fy",
|
|
451
|
-
g1: "g1",
|
|
452
|
-
g2: "g2",
|
|
453
|
-
glyphname: "glyphName",
|
|
454
|
-
"glyph-name": "glyphName",
|
|
455
|
-
glyphorientationhorizontal: "glyphOrientationHorizontal",
|
|
456
|
-
"glyph-orientation-horizontal": "glyphOrientationHorizontal",
|
|
457
|
-
glyphorientationvertical: "glyphOrientationVertical",
|
|
458
|
-
"glyph-orientation-vertical": "glyphOrientationVertical",
|
|
459
|
-
glyphref: "glyphRef",
|
|
460
|
-
gradienttransform: "gradientTransform",
|
|
461
|
-
gradientunits: "gradientUnits",
|
|
462
|
-
hanging: "hanging",
|
|
463
|
-
horizadvx: "horizAdvX",
|
|
464
|
-
"horiz-adv-x": "horizAdvX",
|
|
465
|
-
horizoriginx: "horizOriginX",
|
|
466
|
-
"horiz-origin-x": "horizOriginX",
|
|
467
|
-
ideographic: "ideographic",
|
|
468
|
-
imagerendering: "imageRendering",
|
|
469
|
-
"image-rendering": "imageRendering",
|
|
470
|
-
in2: "in2",
|
|
471
|
-
in: "in",
|
|
472
|
-
inlist: "inlist",
|
|
473
|
-
intercept: "intercept",
|
|
474
|
-
k1: "k1",
|
|
475
|
-
k2: "k2",
|
|
476
|
-
k3: "k3",
|
|
477
|
-
k4: "k4",
|
|
478
|
-
k: "k",
|
|
479
|
-
kernelmatrix: "kernelMatrix",
|
|
480
|
-
kernelunitlength: "kernelUnitLength",
|
|
481
|
-
kerning: "kerning",
|
|
482
|
-
keypoints: "keyPoints",
|
|
483
|
-
keysplines: "keySplines",
|
|
484
|
-
keytimes: "keyTimes",
|
|
485
|
-
lengthadjust: "lengthAdjust",
|
|
486
|
-
letterspacing: "letterSpacing",
|
|
487
|
-
"letter-spacing": "letterSpacing",
|
|
488
|
-
lightingcolor: "lightingColor",
|
|
489
|
-
"lighting-color": "lightingColor",
|
|
490
|
-
limitingconeangle: "limitingConeAngle",
|
|
491
|
-
local: "local",
|
|
492
|
-
markerend: "markerEnd",
|
|
493
|
-
"marker-end": "markerEnd",
|
|
494
|
-
markerheight: "markerHeight",
|
|
495
|
-
markermid: "markerMid",
|
|
496
|
-
"marker-mid": "markerMid",
|
|
497
|
-
markerstart: "markerStart",
|
|
498
|
-
"marker-start": "markerStart",
|
|
499
|
-
markerunits: "markerUnits",
|
|
500
|
-
markerwidth: "markerWidth",
|
|
501
|
-
mask: "mask",
|
|
502
|
-
maskcontentunits: "maskContentUnits",
|
|
503
|
-
maskunits: "maskUnits",
|
|
504
|
-
mathematical: "mathematical",
|
|
505
|
-
mode: "mode",
|
|
506
|
-
numoctaves: "numOctaves",
|
|
507
|
-
offset: "offset",
|
|
508
|
-
opacity: "opacity",
|
|
509
|
-
operator: "operator",
|
|
510
|
-
order: "order",
|
|
511
|
-
orient: "orient",
|
|
512
|
-
orientation: "orientation",
|
|
513
|
-
origin: "origin",
|
|
514
|
-
overflow: "overflow",
|
|
515
|
-
overlineposition: "overlinePosition",
|
|
516
|
-
"overline-position": "overlinePosition",
|
|
517
|
-
overlinethickness: "overlineThickness",
|
|
518
|
-
"overline-thickness": "overlineThickness",
|
|
519
|
-
paintorder: "paintOrder",
|
|
520
|
-
"paint-order": "paintOrder",
|
|
521
|
-
panose1: "panose1",
|
|
522
|
-
"panose-1": "panose1",
|
|
523
|
-
pathlength: "pathLength",
|
|
524
|
-
patterncontentunits: "patternContentUnits",
|
|
525
|
-
patterntransform: "patternTransform",
|
|
526
|
-
patternunits: "patternUnits",
|
|
527
|
-
pointerevents: "pointerEvents",
|
|
528
|
-
"pointer-events": "pointerEvents",
|
|
529
|
-
points: "points",
|
|
530
|
-
pointsatx: "pointsAtX",
|
|
531
|
-
pointsaty: "pointsAtY",
|
|
532
|
-
pointsatz: "pointsAtZ",
|
|
533
|
-
popover: "popover",
|
|
534
245
|
popovertarget: "popoverTarget",
|
|
535
246
|
popovertargetaction: "popoverTargetAction",
|
|
536
|
-
prefix: "prefix",
|
|
537
|
-
preservealpha: "preserveAlpha",
|
|
538
|
-
preserveaspectratio: "preserveAspectRatio",
|
|
539
|
-
primitiveunits: "primitiveUnits",
|
|
540
|
-
property: "property",
|
|
541
|
-
r: "r",
|
|
542
|
-
radius: "radius",
|
|
543
|
-
refx: "refX",
|
|
544
|
-
refy: "refY",
|
|
545
|
-
renderingintent: "renderingIntent",
|
|
546
|
-
"rendering-intent": "renderingIntent",
|
|
547
|
-
repeatcount: "repeatCount",
|
|
548
|
-
repeatdur: "repeatDur",
|
|
549
|
-
requiredextensions: "requiredExtensions",
|
|
550
|
-
requiredfeatures: "requiredFeatures",
|
|
551
|
-
resource: "resource",
|
|
552
|
-
restart: "restart",
|
|
553
|
-
result: "result",
|
|
554
|
-
results: "results",
|
|
555
|
-
rotate: "rotate",
|
|
556
|
-
rx: "rx",
|
|
557
|
-
ry: "ry",
|
|
558
|
-
scale: "scale",
|
|
559
|
-
security: "security",
|
|
560
|
-
seed: "seed",
|
|
561
|
-
shaperendering: "shapeRendering",
|
|
562
|
-
"shape-rendering": "shapeRendering",
|
|
563
|
-
slope: "slope",
|
|
564
|
-
spacing: "spacing",
|
|
565
|
-
specularconstant: "specularConstant",
|
|
566
|
-
specularexponent: "specularExponent",
|
|
567
|
-
speed: "speed",
|
|
568
|
-
spreadmethod: "spreadMethod",
|
|
569
|
-
startoffset: "startOffset",
|
|
570
|
-
stddeviation: "stdDeviation",
|
|
571
|
-
stemh: "stemh",
|
|
572
|
-
stemv: "stemv",
|
|
573
|
-
stitchtiles: "stitchTiles",
|
|
574
|
-
stopcolor: "stopColor",
|
|
575
|
-
"stop-color": "stopColor",
|
|
576
|
-
stopopacity: "stopOpacity",
|
|
577
|
-
"stop-opacity": "stopOpacity",
|
|
578
|
-
strikethroughposition: "strikethroughPosition",
|
|
579
|
-
"strikethrough-position": "strikethroughPosition",
|
|
580
|
-
strikethroughthickness: "strikethroughThickness",
|
|
581
|
-
"strikethrough-thickness": "strikethroughThickness",
|
|
582
|
-
string: "string",
|
|
583
|
-
stroke: "stroke",
|
|
584
|
-
strokedasharray: "strokeDasharray",
|
|
585
|
-
"stroke-dasharray": "strokeDasharray",
|
|
586
|
-
strokedashoffset: "strokeDashoffset",
|
|
587
|
-
"stroke-dashoffset": "strokeDashoffset",
|
|
588
|
-
strokelinecap: "strokeLinecap",
|
|
589
|
-
"stroke-linecap": "strokeLinecap",
|
|
590
|
-
strokelinejoin: "strokeLinejoin",
|
|
591
|
-
"stroke-linejoin": "strokeLinejoin",
|
|
592
|
-
strokemiterlimit: "strokeMiterlimit",
|
|
593
|
-
"stroke-miterlimit": "strokeMiterlimit",
|
|
594
|
-
strokewidth: "strokeWidth",
|
|
595
|
-
"stroke-width": "strokeWidth",
|
|
596
|
-
strokeopacity: "strokeOpacity",
|
|
597
|
-
"stroke-opacity": "strokeOpacity",
|
|
598
|
-
suppresscontenteditablewarning: "suppressContentEditableWarning",
|
|
599
|
-
suppresshydrationwarning: "suppressHydrationWarning",
|
|
600
|
-
surfacescale: "surfaceScale",
|
|
601
|
-
systemlanguage: "systemLanguage",
|
|
602
|
-
tablevalues: "tableValues",
|
|
603
|
-
targetx: "targetX",
|
|
604
|
-
targety: "targetY",
|
|
605
|
-
textanchor: "textAnchor",
|
|
606
|
-
"text-anchor": "textAnchor",
|
|
607
|
-
textdecoration: "textDecoration",
|
|
608
|
-
"text-decoration": "textDecoration",
|
|
609
|
-
textlength: "textLength",
|
|
610
|
-
textrendering: "textRendering",
|
|
611
|
-
"text-rendering": "textRendering",
|
|
612
|
-
to: "to",
|
|
613
|
-
transform: "transform",
|
|
614
|
-
transformorigin: "transformOrigin",
|
|
615
|
-
"transform-origin": "transformOrigin",
|
|
616
|
-
typeof: "typeof",
|
|
617
|
-
u1: "u1",
|
|
618
|
-
u2: "u2",
|
|
619
|
-
underlineposition: "underlinePosition",
|
|
620
|
-
"underline-position": "underlinePosition",
|
|
621
|
-
underlinethickness: "underlineThickness",
|
|
622
|
-
"underline-thickness": "underlineThickness",
|
|
623
|
-
unicode: "unicode",
|
|
624
|
-
unicodebidi: "unicodeBidi",
|
|
625
|
-
"unicode-bidi": "unicodeBidi",
|
|
626
|
-
unicoderange: "unicodeRange",
|
|
627
|
-
"unicode-range": "unicodeRange",
|
|
628
|
-
unitsperem: "unitsPerEm",
|
|
629
|
-
"units-per-em": "unitsPerEm",
|
|
630
|
-
unselectable: "unselectable",
|
|
631
|
-
valphabetic: "vAlphabetic",
|
|
632
|
-
"v-alphabetic": "vAlphabetic",
|
|
633
|
-
values: "values",
|
|
634
|
-
vectoreffect: "vectorEffect",
|
|
635
|
-
"vector-effect": "vectorEffect",
|
|
636
|
-
version: "version",
|
|
637
|
-
vertadvy: "vertAdvY",
|
|
638
|
-
"vert-adv-y": "vertAdvY",
|
|
639
|
-
vertoriginx: "vertOriginX",
|
|
640
|
-
"vert-origin-x": "vertOriginX",
|
|
641
|
-
vertoriginy: "vertOriginY",
|
|
642
|
-
"vert-origin-y": "vertOriginY",
|
|
643
|
-
vhanging: "vHanging",
|
|
644
|
-
"v-hanging": "vHanging",
|
|
645
|
-
videographic: "vIdeographic",
|
|
646
|
-
"v-ideographic": "vIdeographic",
|
|
647
|
-
viewbox: "viewBox",
|
|
648
|
-
viewtarget: "viewTarget",
|
|
649
|
-
visibility: "visibility",
|
|
650
|
-
vmathematical: "vMathematical",
|
|
651
|
-
"v-mathematical": "vMathematical",
|
|
652
|
-
vocab: "vocab",
|
|
653
|
-
widths: "widths",
|
|
654
|
-
wordspacing: "wordSpacing",
|
|
655
|
-
"word-spacing": "wordSpacing",
|
|
656
|
-
writingmode: "writingMode",
|
|
657
|
-
"writing-mode": "writingMode",
|
|
658
|
-
x1: "x1",
|
|
659
|
-
x2: "x2",
|
|
660
|
-
x: "x",
|
|
661
|
-
xchannelselector: "xChannelSelector",
|
|
662
|
-
xheight: "xHeight",
|
|
663
|
-
"x-height": "xHeight",
|
|
664
|
-
xlinkactuate: "xlinkActuate",
|
|
665
|
-
"xlink:actuate": "xlinkActuate",
|
|
666
|
-
xlinkarcrole: "xlinkArcrole",
|
|
667
|
-
"xlink:arcrole": "xlinkArcrole",
|
|
668
|
-
xlinkhref: "xlinkHref",
|
|
669
|
-
"xlink:href": "xlinkHref",
|
|
670
|
-
xlinkrole: "xlinkRole",
|
|
671
|
-
"xlink:role": "xlinkRole",
|
|
672
|
-
xlinkshow: "xlinkShow",
|
|
673
|
-
"xlink:show": "xlinkShow",
|
|
674
|
-
xlinktitle: "xlinkTitle",
|
|
675
|
-
"xlink:title": "xlinkTitle",
|
|
676
|
-
xlinktype: "xlinkType",
|
|
677
|
-
"xlink:type": "xlinkType",
|
|
678
|
-
xmlbase: "xmlBase",
|
|
679
|
-
"xml:base": "xmlBase",
|
|
680
|
-
xmllang: "xmlLang",
|
|
681
|
-
"xml:lang": "xmlLang",
|
|
682
|
-
xmlns: "xmlns",
|
|
683
|
-
"xml:space": "xmlSpace",
|
|
684
|
-
xmlnsxlink: "xmlnsXlink",
|
|
685
|
-
"xmlns:xlink": "xmlnsXlink",
|
|
686
|
-
xmlspace: "xmlSpace",
|
|
687
|
-
y1: "y1",
|
|
688
|
-
y2: "y2",
|
|
689
|
-
y: "y",
|
|
690
|
-
ychannelselector: "yChannelSelector",
|
|
691
|
-
z: "z",
|
|
692
|
-
zoomandpan: "zoomAndPan",
|
|
693
|
-
// added by us
|
|
694
247
|
dirname: "dirName"
|
|
695
248
|
};
|
|
249
|
+
var reactPropsToStandardAttributes = {
|
|
250
|
+
acceptCharset: "accept-charset",
|
|
251
|
+
accessKey: "accesskey",
|
|
252
|
+
allowFullScreen: "allowfullscreen",
|
|
253
|
+
autoCapitalize: "autocapitalize",
|
|
254
|
+
autoComplete: "autocomplete",
|
|
255
|
+
autoCorrect: "autocorrect",
|
|
256
|
+
autoFocus: "autofocus",
|
|
257
|
+
autoPlay: "autoplay",
|
|
258
|
+
charSet: "charset",
|
|
259
|
+
className: "class",
|
|
260
|
+
colSpan: "colspan",
|
|
261
|
+
contentEditable: "contenteditable",
|
|
262
|
+
crossOrigin: "crossorigin",
|
|
263
|
+
dateTime: "datetime",
|
|
264
|
+
encType: "enctype",
|
|
265
|
+
enterKeyHint: "enterkeyhint",
|
|
266
|
+
fetchPriority: "fetchpriority",
|
|
267
|
+
htmlFor: "for",
|
|
268
|
+
formMethod: "formmethod",
|
|
269
|
+
formAction: "formaction",
|
|
270
|
+
formEncType: "formenctype",
|
|
271
|
+
formNoValidate: "formnovalidate",
|
|
272
|
+
formTarget: "formtarget",
|
|
273
|
+
hrefLang: "hreflang",
|
|
274
|
+
httpEquiv: "http-equiv",
|
|
275
|
+
imageSizes: "imagesizes",
|
|
276
|
+
imageSrcSet: "imagesrcset",
|
|
277
|
+
inputMode: "inputmode",
|
|
278
|
+
itemID: "itemid",
|
|
279
|
+
itemProp: "itemprop",
|
|
280
|
+
itemRef: "itemref",
|
|
281
|
+
itemScope: "itemscope",
|
|
282
|
+
itemType: "itemtype",
|
|
283
|
+
maxLength: "maxlength",
|
|
284
|
+
minLength: "minlength",
|
|
285
|
+
noModule: "nomodule",
|
|
286
|
+
noValidate: "novalidate",
|
|
287
|
+
playsInline: "playsinline",
|
|
288
|
+
readOnly: "readonly",
|
|
289
|
+
referrerPolicy: "referrerpolicy",
|
|
290
|
+
rowSpan: "rowspan",
|
|
291
|
+
spellCheck: "spellcheck",
|
|
292
|
+
srcDoc: "srcdoc",
|
|
293
|
+
srcLang: "srclang",
|
|
294
|
+
srcSet: "srcset",
|
|
295
|
+
tabIndex: "tabindex",
|
|
296
|
+
useMap: "usemap",
|
|
297
|
+
popoverTarget: "popovertarget",
|
|
298
|
+
popoverTargetAction: "popovertargetaction",
|
|
299
|
+
dirName: "dirname"
|
|
300
|
+
};
|
|
696
301
|
|
|
697
302
|
// src/component-generator.ts
|
|
698
303
|
var generateAction = ({
|
|
@@ -787,6 +392,8 @@ var generatePropValue = ({
|
|
|
787
392
|
var generateJsxElement = ({
|
|
788
393
|
context = "jsx",
|
|
789
394
|
scope,
|
|
395
|
+
metas,
|
|
396
|
+
tagsOverrides,
|
|
790
397
|
instance,
|
|
791
398
|
props,
|
|
792
399
|
dataSources,
|
|
@@ -798,6 +405,8 @@ var generateJsxElement = ({
|
|
|
798
405
|
if (instance.component === descendantComponent) {
|
|
799
406
|
return "";
|
|
800
407
|
}
|
|
408
|
+
const meta = metas.get(instance.component);
|
|
409
|
+
const hasTags = Object.keys(meta?.presetStyle ?? {}).length > 0;
|
|
801
410
|
let generatedProps = "";
|
|
802
411
|
const index = indexesWithinAncestors.get(instance.id);
|
|
803
412
|
if (index !== void 0) {
|
|
@@ -826,7 +435,7 @@ ${tagProperty}=${JSON.stringify(instance.tag)}`;
|
|
|
826
435
|
continue;
|
|
827
436
|
}
|
|
828
437
|
let name = prop.name;
|
|
829
|
-
if (
|
|
438
|
+
if (hasTags && !meta?.props?.[prop.name]) {
|
|
830
439
|
name = standardAttributesToReactProps[prop.name] ?? prop.name;
|
|
831
440
|
}
|
|
832
441
|
if (prop.name === showAttribute) {
|
|
@@ -888,21 +497,19 @@ ${name}={${propValue}}`;
|
|
|
888
497
|
`;
|
|
889
498
|
} else if (instance.component === blockComponent) {
|
|
890
499
|
generatedElement += children;
|
|
891
|
-
} else
|
|
892
|
-
|
|
893
|
-
if (instance.
|
|
894
|
-
|
|
895
|
-
|
|
500
|
+
} else {
|
|
501
|
+
let componentVariable;
|
|
502
|
+
if (instance.component === elementComponent) {
|
|
503
|
+
componentVariable = instance.tag ?? "div";
|
|
504
|
+
const componentDescriptor = tagsOverrides?.[componentVariable];
|
|
505
|
+
if (componentDescriptor !== void 0) {
|
|
506
|
+
const [_importSource, importSpecifier] = componentDescriptor.split(":");
|
|
507
|
+
componentVariable = scope.getName(componentDescriptor, importSpecifier);
|
|
508
|
+
}
|
|
896
509
|
} else {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
generatedElement += children;
|
|
900
|
-
generatedElement += `</${tagName}>
|
|
901
|
-
`;
|
|
510
|
+
const [_namespace, shortName] = parseComponentName(instance.component);
|
|
511
|
+
componentVariable = scope.getName(instance.component, shortName);
|
|
902
512
|
}
|
|
903
|
-
} else {
|
|
904
|
-
const [_namespace, shortName] = parseComponentName(instance.component);
|
|
905
|
-
const componentVariable = scope.getName(instance.component, shortName);
|
|
906
513
|
if (instance.children.length === 0) {
|
|
907
514
|
generatedElement += `<${componentVariable}${generatedProps} />
|
|
908
515
|
`;
|
|
@@ -939,6 +546,8 @@ ${name}={${propValue}}`;
|
|
|
939
546
|
};
|
|
940
547
|
var generateJsxChildren = ({
|
|
941
548
|
scope,
|
|
549
|
+
metas,
|
|
550
|
+
tagsOverrides,
|
|
942
551
|
children,
|
|
943
552
|
instances,
|
|
944
553
|
props,
|
|
@@ -979,6 +588,8 @@ var generateJsxChildren = ({
|
|
|
979
588
|
generatedChildren += generateJsxElement({
|
|
980
589
|
context: "jsx",
|
|
981
590
|
scope,
|
|
591
|
+
metas,
|
|
592
|
+
tagsOverrides,
|
|
982
593
|
instance,
|
|
983
594
|
props,
|
|
984
595
|
dataSources,
|
|
@@ -988,6 +599,8 @@ var generateJsxChildren = ({
|
|
|
988
599
|
children: generateJsxChildren({
|
|
989
600
|
classesMap,
|
|
990
601
|
scope,
|
|
602
|
+
metas,
|
|
603
|
+
tagsOverrides,
|
|
991
604
|
children: instance.children,
|
|
992
605
|
instances,
|
|
993
606
|
props,
|
|
@@ -1012,6 +625,7 @@ var generateWebstudioComponent = ({
|
|
|
1012
625
|
props,
|
|
1013
626
|
dataSources,
|
|
1014
627
|
metas,
|
|
628
|
+
tagsOverrides,
|
|
1015
629
|
classesMap
|
|
1016
630
|
}) => {
|
|
1017
631
|
const instance = instances.get(rootInstanceId);
|
|
@@ -1024,6 +638,8 @@ var generateWebstudioComponent = ({
|
|
|
1024
638
|
generatedJsx = generateJsxElement({
|
|
1025
639
|
context: "expression",
|
|
1026
640
|
scope,
|
|
641
|
+
metas,
|
|
642
|
+
tagsOverrides,
|
|
1027
643
|
instance,
|
|
1028
644
|
props,
|
|
1029
645
|
dataSources,
|
|
@@ -1032,6 +648,8 @@ var generateWebstudioComponent = ({
|
|
|
1032
648
|
classesMap,
|
|
1033
649
|
children: generateJsxChildren({
|
|
1034
650
|
scope,
|
|
651
|
+
metas,
|
|
652
|
+
tagsOverrides,
|
|
1035
653
|
children: instance.children,
|
|
1036
654
|
instances,
|
|
1037
655
|
props,
|
|
@@ -1097,7 +715,6 @@ var generateWebstudioComponent = ({
|
|
|
1097
715
|
return generatedComponent;
|
|
1098
716
|
};
|
|
1099
717
|
export {
|
|
1100
|
-
animationCanPlayOnCanvasAttribute,
|
|
1101
718
|
collapsedAttribute,
|
|
1102
719
|
componentAttribute,
|
|
1103
720
|
generateJsxChildren,
|
|
@@ -1108,7 +725,9 @@ export {
|
|
|
1108
725
|
idAttribute,
|
|
1109
726
|
isAttributeNameSafe,
|
|
1110
727
|
normalizeProps,
|
|
728
|
+
reactPropsToStandardAttributes,
|
|
1111
729
|
selectorIdAttribute,
|
|
1112
730
|
showAttribute,
|
|
731
|
+
standardAttributesToReactProps,
|
|
1113
732
|
textContentAttribute
|
|
1114
733
|
};
|
package/lib/runtime.js
CHANGED
|
@@ -86,7 +86,8 @@ var PageSettingsMeta = ({
|
|
|
86
86
|
host,
|
|
87
87
|
siteName,
|
|
88
88
|
pageMeta,
|
|
89
|
-
imageLoader
|
|
89
|
+
imageLoader,
|
|
90
|
+
assetBaseUrl
|
|
90
91
|
}) => {
|
|
91
92
|
const metas = [];
|
|
92
93
|
if (url !== void 0) {
|
|
@@ -128,7 +129,7 @@ var PageSettingsMeta = ({
|
|
|
128
129
|
metas.push({
|
|
129
130
|
property: "og:image",
|
|
130
131
|
content: `https://${host}${imageLoader({
|
|
131
|
-
src: pageMeta.socialImageAssetName
|
|
132
|
+
src: `${assetBaseUrl}${pageMeta.socialImageAssetName}`,
|
|
132
133
|
// Do not transform social image (not enough information do we need to do this)
|
|
133
134
|
format: "raw"
|
|
134
135
|
})}`
|
|
@@ -140,6 +141,12 @@ var PageSettingsMeta = ({
|
|
|
140
141
|
});
|
|
141
142
|
}
|
|
142
143
|
metas.push(...pageMeta.custom);
|
|
144
|
+
const isTwitterCardSizeDefined = pageMeta.custom.some(
|
|
145
|
+
(meta) => meta.property === "twitter:card"
|
|
146
|
+
);
|
|
147
|
+
if ((pageMeta.socialImageAssetName !== void 0 || pageMeta.socialImageUrl !== void 0) && isTwitterCardSizeDefined === false) {
|
|
148
|
+
metas.push({ property: "twitter:card", content: "summary_large_image" });
|
|
149
|
+
}
|
|
143
150
|
return metas.map((meta, index) => /* @__PURE__ */ jsx(Meta, { ...meta }, index));
|
|
144
151
|
};
|
|
145
152
|
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { Instances, Instance, Props, Scope, DataSources, Prop, WsComponentMeta, IndexesWithinAncestors } from "@webstudio-is/sdk";
|
|
2
|
-
export declare const generateJsxElement: ({ context, scope, instance, props, dataSources, usedDataSources, indexesWithinAncestors, children, classesMap, }: {
|
|
2
|
+
export declare const generateJsxElement: ({ context, scope, metas, tagsOverrides, instance, props, dataSources, usedDataSources, indexesWithinAncestors, children, classesMap, }: {
|
|
3
3
|
context?: "expression" | "jsx";
|
|
4
4
|
scope: Scope;
|
|
5
|
+
metas: Map<Instance["component"], WsComponentMeta>;
|
|
6
|
+
/**
|
|
7
|
+
* Record<tag, componentDescriptor>
|
|
8
|
+
*/
|
|
9
|
+
tagsOverrides?: Record<string, string>;
|
|
5
10
|
instance: Instance;
|
|
6
11
|
props: Props;
|
|
7
12
|
dataSources: DataSources;
|
|
@@ -10,8 +15,10 @@ export declare const generateJsxElement: ({ context, scope, instance, props, dat
|
|
|
10
15
|
children: string;
|
|
11
16
|
classesMap?: Map<string, Array<string>>;
|
|
12
17
|
}) => string;
|
|
13
|
-
export declare const generateJsxChildren: ({ scope, children, instances, props, dataSources, usedDataSources, indexesWithinAncestors, classesMap, excludePlaceholders, }: {
|
|
18
|
+
export declare const generateJsxChildren: ({ scope, metas, tagsOverrides, children, instances, props, dataSources, usedDataSources, indexesWithinAncestors, classesMap, excludePlaceholders, }: {
|
|
14
19
|
scope: Scope;
|
|
20
|
+
metas: Map<Instance["component"], WsComponentMeta>;
|
|
21
|
+
tagsOverrides?: Record<string, string>;
|
|
15
22
|
children: Instance["children"];
|
|
16
23
|
instances: Instances;
|
|
17
24
|
props: Props;
|
|
@@ -21,7 +28,7 @@ export declare const generateJsxChildren: ({ scope, children, instances, props,
|
|
|
21
28
|
classesMap?: Map<string, Array<string>>;
|
|
22
29
|
excludePlaceholders?: boolean;
|
|
23
30
|
}) => string;
|
|
24
|
-
export declare const generateWebstudioComponent: ({ scope, name, rootInstanceId, parameters, instances, props, dataSources, metas, classesMap, }: {
|
|
31
|
+
export declare const generateWebstudioComponent: ({ scope, name, rootInstanceId, parameters, instances, props, dataSources, metas, tagsOverrides, classesMap, }: {
|
|
25
32
|
scope: Scope;
|
|
26
33
|
name: string;
|
|
27
34
|
rootInstanceId: Instance["id"];
|
|
@@ -33,4 +40,8 @@ export declare const generateWebstudioComponent: ({ scope, name, rootInstanceId,
|
|
|
33
40
|
dataSources: DataSources;
|
|
34
41
|
classesMap: Map<string, Array<string>>;
|
|
35
42
|
metas: Map<Instance["component"], WsComponentMeta>;
|
|
43
|
+
/**
|
|
44
|
+
* Record<tag, componentDescriptor>
|
|
45
|
+
*/
|
|
46
|
+
tagsOverrides?: Record<string, string>;
|
|
36
47
|
}) => string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ImageLoader } from "@webstudio-is/image";
|
|
2
2
|
import type { PageMeta } from "@webstudio-is/sdk";
|
|
3
3
|
export declare const isElementRenderedWithReact: (element: Element) => boolean;
|
|
4
|
-
export declare const PageSettingsMeta: ({ url, host, siteName, pageMeta, imageLoader, }: {
|
|
4
|
+
export declare const PageSettingsMeta: ({ url, host, siteName, pageMeta, imageLoader, assetBaseUrl, }: {
|
|
5
5
|
url?: string;
|
|
6
6
|
host: string;
|
|
7
7
|
siteName: string;
|
|
8
8
|
pageMeta: PageMeta;
|
|
9
9
|
imageLoader: ImageLoader;
|
|
10
|
+
assetBaseUrl: string;
|
|
10
11
|
}) => import("react/jsx-runtime").JSX.Element[];
|
package/lib/types/props.d.ts
CHANGED
|
@@ -1432,5 +1432,4 @@ export declare const componentAttribute: "data-ws-component";
|
|
|
1432
1432
|
export declare const showAttribute: "data-ws-show";
|
|
1433
1433
|
export declare const collapsedAttribute: "data-ws-collapsed";
|
|
1434
1434
|
export declare const textContentAttribute: "data-ws-text-content";
|
|
1435
|
-
export declare const animationCanPlayOnCanvasAttribute = "data-ws-animation-can-play-on-canvas";
|
|
1436
1435
|
export declare const isAttributeNameSafe: (attributeName: string) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.220.0",
|
|
4
4
|
"description": "Webstudio JavaScript / TypeScript API",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
13
13
|
"strip-indent": "^4.0.0",
|
|
14
14
|
"type-fest": "^4.37.0",
|
|
15
|
-
"vitest": "^3.
|
|
15
|
+
"vitest": "^3.1.2",
|
|
16
16
|
"zod": "^3.24.2",
|
|
17
|
-
"@webstudio-is/template": "0.
|
|
17
|
+
"@webstudio-is/template": "0.220.0",
|
|
18
18
|
"@webstudio-is/tsconfig": "1.0.7"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"change-case": "^5.4.4",
|
|
27
27
|
"html-tags": "^4.0.0",
|
|
28
28
|
"nanoid": "^5.1.5",
|
|
29
|
-
"@webstudio-is/
|
|
30
|
-
"@webstudio-is/icons": "^0.
|
|
31
|
-
"@webstudio-is/
|
|
32
|
-
"@webstudio-is/
|
|
33
|
-
"@webstudio-is/image": "0.
|
|
29
|
+
"@webstudio-is/css-engine": "0.220.0",
|
|
30
|
+
"@webstudio-is/icons": "^0.220.0",
|
|
31
|
+
"@webstudio-is/sdk": "0.220.0",
|
|
32
|
+
"@webstudio-is/fonts": "0.220.0",
|
|
33
|
+
"@webstudio-is/image": "0.220.0"
|
|
34
34
|
},
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
export declare const standardAttributesToReactProps: Record<string, string>;
|