@webstudio-is/react-sdk 0.185.0 → 0.189.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 CHANGED
@@ -84,7 +84,7 @@ import {
84
84
  import {
85
85
  ListViewIcon,
86
86
  PaintBrushIcon,
87
- EmbedIcon
87
+ SettingsIcon
88
88
  } from "@webstudio-is/icons/svg";
89
89
  import { html } from "@webstudio-is/sdk/normalize.css";
90
90
  var rootComponent = "ws:root";
@@ -92,7 +92,7 @@ var rootMeta = {
92
92
  category: "hidden",
93
93
  type: "container",
94
94
  label: "Global Root",
95
- icon: EmbedIcon,
95
+ icon: SettingsIcon,
96
96
  presetStyle: {
97
97
  html
98
98
  }
@@ -346,120 +346,6 @@ ${sheet.cssText}`,
346
346
  };
347
347
  };
348
348
 
349
- // src/tree/create-elements-tree.tsx
350
- import {
351
- Fragment
352
- } from "react";
353
-
354
- // src/context.tsx
355
- import { createContext, useContext, useMemo } from "react";
356
- import { createJsonStringifyProxy, isPlainObject } from "@webstudio-is/sdk";
357
- var ReactSdkContext = createContext({
358
- assetBaseUrl: "/",
359
- imageBaseUrl: "/",
360
- imageLoader: ({ src }) => src,
361
- resources: {}
362
- });
363
-
364
- // src/tree/create-elements-tree.tsx
365
- import { jsx, jsxs } from "react/jsx-runtime";
366
- var createElementsTree = ({
367
- renderer,
368
- assetBaseUrl,
369
- imageBaseUrl,
370
- imageLoader,
371
- instances,
372
- rootInstanceId,
373
- Component,
374
- components
375
- }) => {
376
- const rootInstance = instances.get(rootInstanceId);
377
- if (rootInstance === void 0) {
378
- return null;
379
- }
380
- const rootInstanceSelector = [rootInstanceId];
381
- const root = createInstanceElement({
382
- Component,
383
- instance: rootInstance,
384
- instanceSelector: rootInstanceSelector,
385
- components
386
- });
387
- return /* @__PURE__ */ jsx(
388
- ReactSdkContext.Provider,
389
- {
390
- value: {
391
- renderer,
392
- imageLoader,
393
- assetBaseUrl,
394
- imageBaseUrl,
395
- resources: {}
396
- },
397
- children: root
398
- }
399
- );
400
- };
401
- var renderText = (text) => {
402
- const lines = text.split("\n");
403
- return lines.map((line, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
404
- line,
405
- index < lines.length - 1 && /* @__PURE__ */ jsx("br", {})
406
- ] }, index));
407
- };
408
- var createInstanceChildrenElements = ({
409
- instances,
410
- instanceSelector,
411
- children,
412
- Component,
413
- components
414
- }) => {
415
- const elements = [];
416
- for (const child of children) {
417
- if (child.type === "text") {
418
- elements.push(renderText(child.value));
419
- continue;
420
- }
421
- if (child.type === "expression") {
422
- continue;
423
- }
424
- if (child.type === "id") {
425
- const childInstance = instances.get(child.value);
426
- if (childInstance === void 0) {
427
- continue;
428
- }
429
- const childInstanceSelector = [child.value, ...instanceSelector];
430
- const element = createInstanceElement({
431
- instance: childInstance,
432
- instanceSelector: childInstanceSelector,
433
- Component,
434
- components
435
- });
436
- elements.push(element);
437
- continue;
438
- }
439
- child;
440
- }
441
- if (elements.length === 0) {
442
- return;
443
- }
444
- return elements;
445
- };
446
- var createInstanceElement = ({
447
- Component,
448
- instance,
449
- instanceSelector,
450
- components
451
- }) => {
452
- return /* @__PURE__ */ jsx(
453
- Component,
454
- {
455
- instance,
456
- instanceSelector,
457
- components
458
- },
459
- instance.id
460
- );
461
- };
462
-
463
349
  // src/props.ts
464
350
  import {
465
351
  getPagePath,
@@ -1616,9 +1502,7 @@ export {
1616
1502
  componentCategories,
1617
1503
  coreMetas,
1618
1504
  corePropsMetas,
1619
- createElementsTree,
1620
1505
  createImageValueTransformer,
1621
- createInstanceChildrenElements,
1622
1506
  defaultStates,
1623
1507
  descendantComponent,
1624
1508
  generateCss,