webstudio 0.205.0 → 0.206.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/cli.js CHANGED
@@ -1106,7 +1106,10 @@ const mergeStyles = (styleMap) => {
1106
1106
  mergeBackgroundPosition(newStyle);
1107
1107
  return newStyle;
1108
1108
  };
1109
- const hyphenateProperty = (property) => property.replace(/[A-Z]/g, (match) => "-" + match.toLowerCase());
1109
+ const hyphenateProperty = (property) => property.replace(
1110
+ /[A-Z]/g,
1111
+ (match) => "-" + match.toLowerCase()
1112
+ );
1110
1113
  const mapGroupBy = (array, getKey2) => {
1111
1114
  const groups = /* @__PURE__ */ new Map();
1112
1115
  for (const item of array) {
@@ -1889,6 +1892,12 @@ const WsEmbedTemplate = z.lazy(
1889
1892
  z.union([EmbedTemplateInstance, EmbedTemplateText, EmbedTemplateExpression])
1890
1893
  )
1891
1894
  );
1895
+ const PresetStyleDecl = z.object({
1896
+ // State selector, e.g. :hover
1897
+ state: z.optional(z.string()),
1898
+ property: z.string(),
1899
+ value: StyleValue
1900
+ });
1892
1901
  z.object({
1893
1902
  props: z.record(PropMeta),
1894
1903
  // Props that will be always visible in properties panel.
@@ -1940,9 +1949,7 @@ z.object({
1940
1949
  label: z.optional(z.string()),
1941
1950
  description: z.string().optional(),
1942
1951
  icon: z.string(),
1943
- presetStyle: z.optional(
1944
- z.record(z.string(), z.array(EmbedTemplateStyleDecl))
1945
- ),
1952
+ presetStyle: z.optional(z.record(z.string(), z.array(PresetStyleDecl))),
1946
1953
  states: z.optional(z.array(ComponentState)),
1947
1954
  template: z.optional(WsEmbedTemplate),
1948
1955
  order: z.number().optional()
@@ -2004,21 +2011,24 @@ const WindowTitleIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" vie
2004
2011
  const XmlIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16" width="100%" height="100%" style="display: block;"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M12.163 9.02v-4L8.83 1.686h-5.5A1.333 1.333 0 0 0 1.997 3.02v6"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M8.164 2.186v1.667a1.333 1.333 0 0 0 1.333 1.333h2.667M1.997 11.314l3 3M4.997 11.314l-3 3M6.997 14.314v-3l1.5 1.523 1.5-1.523v3M12.163 11.314v3h1.84"/></svg>`;
2005
2012
  const YoutubeIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 16 16" width="100%" height="100%" style="display: block;"><path d="M.892 11.528a18.047 18.047 0 0 1 0-7.482A1.496 1.496 0 0 1 1.94 3a37.082 37.082 0 0 1 12.12 0 1.497 1.497 0 0 1 1.048 1.047 18.046 18.046 0 0 1 0 7.482 1.497 1.497 0 0 1-1.048 1.048 37.077 37.077 0 0 1-12.12 0 1.497 1.497 0 0 1-1.048-1.048Z"/><path d="m6.5 10.3 4-2.4-4-2.4v4.8Z"/></svg>`;
2006
2013
  const div = [
2007
- { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
2008
- { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
2014
+ { property: "box-sizing", value: { type: "keyword", value: "border-box" } },
2009
2015
  {
2010
- property: "borderRightWidth",
2016
+ property: "border-top-width",
2011
2017
  value: { type: "unit", unit: "px", value: 1 }
2012
2018
  },
2013
2019
  {
2014
- property: "borderBottomWidth",
2020
+ property: "border-right-width",
2015
2021
  value: { type: "unit", unit: "px", value: 1 }
2016
2022
  },
2017
2023
  {
2018
- property: "borderLeftWidth",
2024
+ property: "border-bottom-width",
2019
2025
  value: { type: "unit", unit: "px", value: 1 }
2020
2026
  },
2021
- { property: "outlineWidth", value: { type: "unit", unit: "px", value: 1 } }
2027
+ {
2028
+ property: "border-left-width",
2029
+ value: { type: "unit", unit: "px", value: 1 }
2030
+ },
2031
+ { property: "outline-width", value: { type: "unit", unit: "px", value: 1 } }
2022
2032
  ];
2023
2033
  const address = div;
2024
2034
  const article = div;
@@ -2048,88 +2058,100 @@ const p = div;
2048
2058
  const span = div;
2049
2059
  const html = [
2050
2060
  { property: "display", value: { type: "keyword", value: "grid" } },
2051
- { property: "minHeight", value: { type: "unit", unit: "%", value: 100 } },
2061
+ { property: "min-height", value: { type: "unit", unit: "%", value: 100 } },
2052
2062
  {
2053
- property: "fontFamily",
2063
+ property: "font-family",
2054
2064
  value: { type: "fontFamily", value: ["Arial", "Roboto", "sans-serif"] }
2055
2065
  },
2056
- { property: "fontSize", value: { type: "unit", unit: "px", value: 16 } },
2066
+ { property: "font-size", value: { type: "unit", unit: "px", value: 16 } },
2057
2067
  {
2058
- property: "lineHeight",
2068
+ property: "line-height",
2059
2069
  value: { type: "unit", unit: "number", value: 1.2 }
2060
2070
  },
2061
2071
  {
2062
- property: "whiteSpaceCollapse",
2072
+ property: "white-space-collapse",
2063
2073
  value: { type: "keyword", value: "preserve" }
2064
2074
  }
2065
2075
  ];
2066
2076
  const body = [
2067
- { property: "marginTop", value: { type: "unit", unit: "number", value: 0 } },
2077
+ { property: "margin-top", value: { type: "unit", unit: "number", value: 0 } },
2068
2078
  {
2069
- property: "marginRight",
2079
+ property: "margin-right",
2070
2080
  value: { type: "unit", unit: "number", value: 0 }
2071
2081
  },
2072
2082
  {
2073
- property: "marginBottom",
2083
+ property: "margin-bottom",
2074
2084
  value: { type: "unit", unit: "number", value: 0 }
2075
2085
  },
2076
- { property: "marginLeft", value: { type: "unit", unit: "number", value: 0 } },
2077
- { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
2078
- { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
2079
2086
  {
2080
- property: "borderRightWidth",
2087
+ property: "margin-left",
2088
+ value: { type: "unit", unit: "number", value: 0 }
2089
+ },
2090
+ { property: "box-sizing", value: { type: "keyword", value: "border-box" } },
2091
+ {
2092
+ property: "border-top-width",
2081
2093
  value: { type: "unit", unit: "px", value: 1 }
2082
2094
  },
2083
2095
  {
2084
- property: "borderBottomWidth",
2096
+ property: "border-right-width",
2085
2097
  value: { type: "unit", unit: "px", value: 1 }
2086
2098
  },
2087
2099
  {
2088
- property: "borderLeftWidth",
2100
+ property: "border-bottom-width",
2101
+ value: { type: "unit", unit: "px", value: 1 }
2102
+ },
2103
+ {
2104
+ property: "border-left-width",
2089
2105
  value: { type: "unit", unit: "px", value: 1 }
2090
2106
  }
2091
2107
  ];
2092
2108
  const hr = [
2093
2109
  { property: "height", value: { type: "unit", unit: "number", value: 0 } },
2094
2110
  { property: "color", value: { type: "keyword", value: "inherit" } },
2095
- { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
2096
- { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
2111
+ { property: "box-sizing", value: { type: "keyword", value: "border-box" } },
2112
+ {
2113
+ property: "border-top-width",
2114
+ value: { type: "unit", unit: "px", value: 1 }
2115
+ },
2097
2116
  {
2098
- property: "borderRightWidth",
2117
+ property: "border-right-width",
2099
2118
  value: { type: "unit", unit: "px", value: 1 }
2100
2119
  },
2101
2120
  {
2102
- property: "borderBottomWidth",
2121
+ property: "border-bottom-width",
2103
2122
  value: { type: "unit", unit: "px", value: 1 }
2104
2123
  },
2105
2124
  {
2106
- property: "borderLeftWidth",
2125
+ property: "border-left-width",
2107
2126
  value: { type: "unit", unit: "px", value: 1 }
2108
2127
  }
2109
2128
  ];
2110
2129
  const b = [
2111
2130
  {
2112
- property: "fontWeight",
2131
+ property: "font-weight",
2113
2132
  value: { type: "unit", unit: "number", value: 700 }
2114
2133
  },
2115
- { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
2116
- { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
2134
+ { property: "box-sizing", value: { type: "keyword", value: "border-box" } },
2135
+ {
2136
+ property: "border-top-width",
2137
+ value: { type: "unit", unit: "px", value: 1 }
2138
+ },
2117
2139
  {
2118
- property: "borderRightWidth",
2140
+ property: "border-right-width",
2119
2141
  value: { type: "unit", unit: "px", value: 1 }
2120
2142
  },
2121
2143
  {
2122
- property: "borderBottomWidth",
2144
+ property: "border-bottom-width",
2123
2145
  value: { type: "unit", unit: "px", value: 1 }
2124
2146
  },
2125
2147
  {
2126
- property: "borderLeftWidth",
2148
+ property: "border-left-width",
2127
2149
  value: { type: "unit", unit: "px", value: 1 }
2128
2150
  }
2129
2151
  ];
2130
2152
  const code = [
2131
2153
  {
2132
- property: "fontFamily",
2154
+ property: "font-family",
2133
2155
  value: {
2134
2156
  type: "fontFamily",
2135
2157
  value: [
@@ -2142,174 +2164,222 @@ const code = [
2142
2164
  ]
2143
2165
  }
2144
2166
  },
2145
- { property: "fontSize", value: { type: "unit", unit: "em", value: 1 } },
2146
- { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
2147
- { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
2167
+ { property: "font-size", value: { type: "unit", unit: "em", value: 1 } },
2168
+ { property: "box-sizing", value: { type: "keyword", value: "border-box" } },
2148
2169
  {
2149
- property: "borderRightWidth",
2170
+ property: "border-top-width",
2150
2171
  value: { type: "unit", unit: "px", value: 1 }
2151
2172
  },
2152
2173
  {
2153
- property: "borderBottomWidth",
2174
+ property: "border-right-width",
2154
2175
  value: { type: "unit", unit: "px", value: 1 }
2155
2176
  },
2156
2177
  {
2157
- property: "borderLeftWidth",
2178
+ property: "border-bottom-width",
2179
+ value: { type: "unit", unit: "px", value: 1 }
2180
+ },
2181
+ {
2182
+ property: "border-left-width",
2158
2183
  value: { type: "unit", unit: "px", value: 1 }
2159
2184
  }
2160
2185
  ];
2161
2186
  const sub = [
2162
- { property: "fontSize", value: { type: "unit", unit: "%", value: 75 } },
2163
- { property: "lineHeight", value: { type: "unit", unit: "number", value: 0 } },
2187
+ { property: "font-size", value: { type: "unit", unit: "%", value: 75 } },
2188
+ {
2189
+ property: "line-height",
2190
+ value: { type: "unit", unit: "number", value: 0 }
2191
+ },
2164
2192
  { property: "position", value: { type: "keyword", value: "relative" } },
2165
- { property: "verticalAlign", value: { type: "keyword", value: "baseline" } },
2166
- { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
2167
- { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
2193
+ { property: "vertical-align", value: { type: "keyword", value: "baseline" } },
2194
+ { property: "box-sizing", value: { type: "keyword", value: "border-box" } },
2168
2195
  {
2169
- property: "borderRightWidth",
2196
+ property: "border-top-width",
2170
2197
  value: { type: "unit", unit: "px", value: 1 }
2171
2198
  },
2172
2199
  {
2173
- property: "borderBottomWidth",
2200
+ property: "border-right-width",
2174
2201
  value: { type: "unit", unit: "px", value: 1 }
2175
2202
  },
2176
2203
  {
2177
- property: "borderLeftWidth",
2204
+ property: "border-bottom-width",
2205
+ value: { type: "unit", unit: "px", value: 1 }
2206
+ },
2207
+ {
2208
+ property: "border-left-width",
2178
2209
  value: { type: "unit", unit: "px", value: 1 }
2179
2210
  },
2180
2211
  { property: "bottom", value: { type: "unit", unit: "em", value: -0.25 } }
2181
2212
  ];
2182
2213
  const sup = [
2183
- { property: "fontSize", value: { type: "unit", unit: "%", value: 75 } },
2184
- { property: "lineHeight", value: { type: "unit", unit: "number", value: 0 } },
2214
+ { property: "font-size", value: { type: "unit", unit: "%", value: 75 } },
2215
+ {
2216
+ property: "line-height",
2217
+ value: { type: "unit", unit: "number", value: 0 }
2218
+ },
2185
2219
  { property: "position", value: { type: "keyword", value: "relative" } },
2186
- { property: "verticalAlign", value: { type: "keyword", value: "baseline" } },
2187
- { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
2188
- { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
2220
+ { property: "vertical-align", value: { type: "keyword", value: "baseline" } },
2221
+ { property: "box-sizing", value: { type: "keyword", value: "border-box" } },
2189
2222
  {
2190
- property: "borderRightWidth",
2223
+ property: "border-top-width",
2191
2224
  value: { type: "unit", unit: "px", value: 1 }
2192
2225
  },
2193
2226
  {
2194
- property: "borderBottomWidth",
2227
+ property: "border-right-width",
2195
2228
  value: { type: "unit", unit: "px", value: 1 }
2196
2229
  },
2197
2230
  {
2198
- property: "borderLeftWidth",
2231
+ property: "border-bottom-width",
2232
+ value: { type: "unit", unit: "px", value: 1 }
2233
+ },
2234
+ {
2235
+ property: "border-left-width",
2199
2236
  value: { type: "unit", unit: "px", value: 1 }
2200
2237
  },
2201
2238
  { property: "top", value: { type: "unit", unit: "em", value: -0.5 } }
2202
2239
  ];
2203
2240
  const input = [
2204
- { property: "fontFamily", value: { type: "keyword", value: "inherit" } },
2205
- { property: "fontSize", value: { type: "unit", unit: "%", value: 100 } },
2241
+ { property: "font-family", value: { type: "keyword", value: "inherit" } },
2242
+ { property: "font-size", value: { type: "unit", unit: "%", value: 100 } },
2206
2243
  {
2207
- property: "lineHeight",
2244
+ property: "line-height",
2208
2245
  value: { type: "unit", unit: "number", value: 1.15 }
2209
2246
  },
2210
- { property: "marginTop", value: { type: "unit", unit: "number", value: 0 } },
2247
+ { property: "margin-top", value: { type: "unit", unit: "number", value: 0 } },
2248
+ {
2249
+ property: "margin-right",
2250
+ value: { type: "unit", unit: "number", value: 0 }
2251
+ },
2211
2252
  {
2212
- property: "marginRight",
2253
+ property: "margin-bottom",
2213
2254
  value: { type: "unit", unit: "number", value: 0 }
2214
2255
  },
2215
2256
  {
2216
- property: "marginBottom",
2257
+ property: "margin-left",
2217
2258
  value: { type: "unit", unit: "number", value: 0 }
2218
2259
  },
2219
- { property: "marginLeft", value: { type: "unit", unit: "number", value: 0 } },
2220
- { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
2221
- { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
2260
+ { property: "box-sizing", value: { type: "keyword", value: "border-box" } },
2261
+ {
2262
+ property: "border-top-width",
2263
+ value: { type: "unit", unit: "px", value: 1 }
2264
+ },
2222
2265
  {
2223
- property: "borderRightWidth",
2266
+ property: "border-right-width",
2224
2267
  value: { type: "unit", unit: "px", value: 1 }
2225
2268
  },
2226
2269
  {
2227
- property: "borderBottomWidth",
2270
+ property: "border-bottom-width",
2228
2271
  value: { type: "unit", unit: "px", value: 1 }
2229
2272
  },
2230
2273
  {
2231
- property: "borderLeftWidth",
2274
+ property: "border-left-width",
2232
2275
  value: { type: "unit", unit: "px", value: 1 }
2233
2276
  },
2234
- { property: "borderTopStyle", value: { type: "keyword", value: "solid" } },
2235
- { property: "borderRightStyle", value: { type: "keyword", value: "solid" } },
2236
- { property: "borderBottomStyle", value: { type: "keyword", value: "solid" } },
2237
- { property: "borderLeftStyle", value: { type: "keyword", value: "solid" } }
2277
+ { property: "border-top-style", value: { type: "keyword", value: "solid" } },
2278
+ {
2279
+ property: "border-right-style",
2280
+ value: { type: "keyword", value: "solid" }
2281
+ },
2282
+ {
2283
+ property: "border-bottom-style",
2284
+ value: { type: "keyword", value: "solid" }
2285
+ },
2286
+ { property: "border-left-style", value: { type: "keyword", value: "solid" } }
2238
2287
  ];
2239
2288
  const textarea = input;
2240
2289
  const radio = [
2241
- { property: "fontFamily", value: { type: "keyword", value: "inherit" } },
2242
- { property: "fontSize", value: { type: "unit", unit: "%", value: 100 } },
2290
+ { property: "font-family", value: { type: "keyword", value: "inherit" } },
2291
+ { property: "font-size", value: { type: "unit", unit: "%", value: 100 } },
2243
2292
  {
2244
- property: "lineHeight",
2293
+ property: "line-height",
2245
2294
  value: { type: "unit", unit: "number", value: 1.15 }
2246
2295
  },
2247
- { property: "marginTop", value: { type: "unit", unit: "number", value: 0 } },
2296
+ { property: "margin-top", value: { type: "unit", unit: "number", value: 0 } },
2248
2297
  {
2249
- property: "marginRight",
2298
+ property: "margin-right",
2250
2299
  value: { type: "unit", unit: "number", value: 0 }
2251
2300
  },
2252
2301
  {
2253
- property: "marginBottom",
2302
+ property: "margin-bottom",
2254
2303
  value: { type: "unit", unit: "number", value: 0 }
2255
2304
  },
2256
- { property: "marginLeft", value: { type: "unit", unit: "number", value: 0 } },
2257
- { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
2258
- { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
2259
2305
  {
2260
- property: "borderRightWidth",
2306
+ property: "margin-left",
2307
+ value: { type: "unit", unit: "number", value: 0 }
2308
+ },
2309
+ { property: "box-sizing", value: { type: "keyword", value: "border-box" } },
2310
+ {
2311
+ property: "border-top-width",
2261
2312
  value: { type: "unit", unit: "px", value: 1 }
2262
2313
  },
2263
2314
  {
2264
- property: "borderBottomWidth",
2315
+ property: "border-right-width",
2265
2316
  value: { type: "unit", unit: "px", value: 1 }
2266
2317
  },
2267
2318
  {
2268
- property: "borderLeftWidth",
2319
+ property: "border-bottom-width",
2269
2320
  value: { type: "unit", unit: "px", value: 1 }
2270
2321
  },
2271
- { property: "borderTopStyle", value: { type: "keyword", value: "none" } },
2272
- { property: "borderRightStyle", value: { type: "keyword", value: "none" } },
2273
- { property: "borderBottomStyle", value: { type: "keyword", value: "none" } },
2274
- { property: "borderLeftStyle", value: { type: "keyword", value: "none" } }
2322
+ {
2323
+ property: "border-left-width",
2324
+ value: { type: "unit", unit: "px", value: 1 }
2325
+ },
2326
+ { property: "border-top-style", value: { type: "keyword", value: "none" } },
2327
+ { property: "border-right-style", value: { type: "keyword", value: "none" } },
2328
+ {
2329
+ property: "border-bottom-style",
2330
+ value: { type: "keyword", value: "none" }
2331
+ },
2332
+ { property: "border-left-style", value: { type: "keyword", value: "none" } }
2275
2333
  ];
2276
2334
  const checkbox = radio;
2277
2335
  const button = [
2278
- { property: "fontFamily", value: { type: "keyword", value: "inherit" } },
2279
- { property: "fontSize", value: { type: "unit", unit: "%", value: 100 } },
2336
+ { property: "font-family", value: { type: "keyword", value: "inherit" } },
2337
+ { property: "font-size", value: { type: "unit", unit: "%", value: 100 } },
2280
2338
  {
2281
- property: "lineHeight",
2339
+ property: "line-height",
2282
2340
  value: { type: "unit", unit: "number", value: 1.15 }
2283
2341
  },
2284
- { property: "marginTop", value: { type: "unit", unit: "number", value: 0 } },
2342
+ { property: "margin-top", value: { type: "unit", unit: "number", value: 0 } },
2343
+ {
2344
+ property: "margin-right",
2345
+ value: { type: "unit", unit: "number", value: 0 }
2346
+ },
2285
2347
  {
2286
- property: "marginRight",
2348
+ property: "margin-bottom",
2287
2349
  value: { type: "unit", unit: "number", value: 0 }
2288
2350
  },
2289
2351
  {
2290
- property: "marginBottom",
2352
+ property: "margin-left",
2291
2353
  value: { type: "unit", unit: "number", value: 0 }
2292
2354
  },
2293
- { property: "marginLeft", value: { type: "unit", unit: "number", value: 0 } },
2294
- { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
2295
- { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
2355
+ { property: "box-sizing", value: { type: "keyword", value: "border-box" } },
2296
2356
  {
2297
- property: "borderRightWidth",
2357
+ property: "border-top-width",
2298
2358
  value: { type: "unit", unit: "px", value: 1 }
2299
2359
  },
2300
2360
  {
2301
- property: "borderBottomWidth",
2361
+ property: "border-right-width",
2302
2362
  value: { type: "unit", unit: "px", value: 1 }
2303
2363
  },
2304
2364
  {
2305
- property: "borderLeftWidth",
2365
+ property: "border-bottom-width",
2306
2366
  value: { type: "unit", unit: "px", value: 1 }
2307
2367
  },
2308
- { property: "borderTopStyle", value: { type: "keyword", value: "solid" } },
2309
- { property: "borderRightStyle", value: { type: "keyword", value: "solid" } },
2310
- { property: "borderBottomStyle", value: { type: "keyword", value: "solid" } },
2311
- { property: "borderLeftStyle", value: { type: "keyword", value: "solid" } },
2312
- { property: "textTransform", value: { type: "keyword", value: "none" } }
2368
+ {
2369
+ property: "border-left-width",
2370
+ value: { type: "unit", unit: "px", value: 1 }
2371
+ },
2372
+ { property: "border-top-style", value: { type: "keyword", value: "solid" } },
2373
+ {
2374
+ property: "border-right-style",
2375
+ value: { type: "keyword", value: "solid" }
2376
+ },
2377
+ {
2378
+ property: "border-bottom-style",
2379
+ value: { type: "keyword", value: "solid" }
2380
+ },
2381
+ { property: "border-left-style", value: { type: "keyword", value: "solid" } },
2382
+ { property: "text-transform", value: { type: "keyword", value: "none" } }
2313
2383
  ];
2314
2384
  const select = button;
2315
2385
  const rootComponent = "ws:root";
@@ -2406,6 +2476,51 @@ const parseComponentName = (componentName) => {
2406
2476
  }
2407
2477
  return [namespace, name2];
2408
2478
  };
2479
+ const getIndexesWithinAncestors = (metas, instances, rootIds) => {
2480
+ const ancestors = /* @__PURE__ */ new Set();
2481
+ for (const meta2 of metas.values()) {
2482
+ if (meta2.indexWithinAncestor !== void 0) {
2483
+ ancestors.add(meta2.indexWithinAncestor);
2484
+ }
2485
+ }
2486
+ const indexes = /* @__PURE__ */ new Map();
2487
+ const traverseInstances2 = (instances2, instanceId, latestIndexes2 = /* @__PURE__ */ new Map()) => {
2488
+ const instance = instances2.get(instanceId);
2489
+ if (instance === void 0) {
2490
+ return;
2491
+ }
2492
+ const meta2 = metas.get(instance.component);
2493
+ if (ancestors.has(instance.component)) {
2494
+ latestIndexes2 = new Map(latestIndexes2);
2495
+ latestIndexes2.set(instance.component, /* @__PURE__ */ new Map());
2496
+ }
2497
+ if (instance.component === blockTemplateComponent) {
2498
+ latestIndexes2 = new Map(latestIndexes2);
2499
+ for (const key of latestIndexes2.keys()) {
2500
+ latestIndexes2.set(key, /* @__PURE__ */ new Map());
2501
+ }
2502
+ }
2503
+ if ((meta2 == null ? void 0 : meta2.indexWithinAncestor) !== void 0) {
2504
+ const ancestorIndexes = latestIndexes2.get(meta2.indexWithinAncestor);
2505
+ if (ancestorIndexes) {
2506
+ let index = ancestorIndexes.get(instance.component) ?? -1;
2507
+ index += 1;
2508
+ ancestorIndexes.set(instance.component, index);
2509
+ indexes.set(instance.id, index);
2510
+ }
2511
+ }
2512
+ for (const child of instance.children) {
2513
+ if (child.type === "id") {
2514
+ traverseInstances2(instances2, child.value, latestIndexes2);
2515
+ }
2516
+ }
2517
+ };
2518
+ const latestIndexes = /* @__PURE__ */ new Map();
2519
+ for (const instanceId of rootIds) {
2520
+ traverseInstances2(instances, instanceId, latestIndexes);
2521
+ }
2522
+ return indexes;
2523
+ };
2409
2524
  const SYSTEM_VARIABLE_ID = ":system";
2410
2525
  const systemParameter = {
2411
2526
  id: SYSTEM_VARIABLE_ID,
@@ -3250,48 +3365,6 @@ const namespaceMeta = (meta2, namespace, components) => {
3250
3365
  }
3251
3366
  return newMeta;
3252
3367
  };
3253
- const getIndexesWithinAncestors = (metas, instances, rootIds) => {
3254
- const ancestors = /* @__PURE__ */ new Set();
3255
- for (const meta2 of metas.values()) {
3256
- if (meta2.indexWithinAncestor !== void 0) {
3257
- ancestors.add(meta2.indexWithinAncestor);
3258
- }
3259
- }
3260
- const indexes = /* @__PURE__ */ new Map();
3261
- const traverseInstances2 = (instances2, instanceId, latestIndexes2 = /* @__PURE__ */ new Map()) => {
3262
- const instance = instances2.get(instanceId);
3263
- if (instance === void 0) {
3264
- return;
3265
- }
3266
- const meta2 = metas.get(instance.component);
3267
- if (meta2 === void 0) {
3268
- return;
3269
- }
3270
- if (ancestors.has(instance.component)) {
3271
- latestIndexes2 = new Map(latestIndexes2);
3272
- latestIndexes2.set(instance.component, /* @__PURE__ */ new Map());
3273
- }
3274
- if (meta2.indexWithinAncestor !== void 0) {
3275
- const ancestorIndexes = latestIndexes2.get(meta2.indexWithinAncestor);
3276
- if (ancestorIndexes !== void 0) {
3277
- let index = ancestorIndexes.get(instance.component) ?? -1;
3278
- index += 1;
3279
- ancestorIndexes.set(instance.component, index);
3280
- indexes.set(instance.id, index);
3281
- }
3282
- }
3283
- for (const child of instance.children) {
3284
- if (child.type === "id") {
3285
- traverseInstances2(instances2, child.value, latestIndexes2);
3286
- }
3287
- }
3288
- };
3289
- const latestIndexes = /* @__PURE__ */ new Map();
3290
- for (const instanceId of rootIds) {
3291
- traverseInstances2(instances, instanceId, latestIndexes);
3292
- }
3293
- return indexes;
3294
- };
3295
3368
  const generateAction = ({
3296
3369
  scope,
3297
3370
  prop,
@@ -3586,13 +3659,16 @@ const generateWebstudioComponent = ({
3586
3659
  instances,
3587
3660
  props: props2,
3588
3661
  dataSources,
3589
- indexesWithinAncestors,
3662
+ metas,
3590
3663
  classesMap
3591
3664
  }) => {
3592
3665
  const instance = instances.get(rootInstanceId);
3593
3666
  if (instance === void 0) {
3594
3667
  return "";
3595
3668
  }
3669
+ const indexesWithinAncestors = getIndexesWithinAncestors(metas, instances, [
3670
+ rootInstanceId
3671
+ ]);
3596
3672
  const usedDataSources = /* @__PURE__ */ new Map();
3597
3673
  const generatedJsx = generateJsxElement({
3598
3674
  context: "expression",
@@ -3807,7 +3883,7 @@ const presetStyle$y = {
3807
3883
  value: { type: "keyword", value: "contents" }
3808
3884
  },
3809
3885
  {
3810
- property: "whiteSpaceCollapse",
3886
+ property: "white-space-collapse",
3811
3887
  value: { type: "keyword", value: "collapse" }
3812
3888
  }
3813
3889
  ]
@@ -3852,7 +3928,7 @@ const meta$G = {
3852
3928
  value: { type: "keyword", value: "contents" }
3853
3929
  },
3854
3930
  {
3855
- property: "whiteSpaceCollapse",
3931
+ property: "white-space-collapse",
3856
3932
  value: { type: "keyword", value: "collapse" }
3857
3933
  }
3858
3934
  ]
@@ -3862,11 +3938,11 @@ const presetStyle$x = {
3862
3938
  body: [
3863
3939
  ...body,
3864
3940
  {
3865
- property: "WebkitFontSmoothing",
3941
+ property: "-webkit-font-smoothing",
3866
3942
  value: { type: "keyword", value: "antialiased" }
3867
3943
  },
3868
3944
  {
3869
- property: "MozOsxFontSmoothing",
3945
+ property: "-moz-osx-font-smoothing",
3870
3946
  value: { type: "keyword", value: "grayscale" }
3871
3947
  }
3872
3948
  ]
@@ -3902,7 +3978,7 @@ const presetStyle$v = {
3902
3978
  div: [
3903
3979
  ...div,
3904
3980
  {
3905
- property: "minHeight",
3981
+ property: "min-height",
3906
3982
  value: { type: "unit", unit: "em", value: 1 }
3907
3983
  }
3908
3984
  ]
@@ -4005,7 +4081,7 @@ const presetStyle$p = {
4005
4081
  i: [
4006
4082
  ...i,
4007
4083
  {
4008
- property: "fontStyle",
4084
+ property: "font-style",
4009
4085
  value: { type: "keyword", value: "italic" }
4010
4086
  }
4011
4087
  ]
@@ -4108,7 +4184,7 @@ const meta$r = {
4108
4184
  const presetStyle$k = {
4109
4185
  form: [
4110
4186
  ...form,
4111
- { property: "minHeight", value: { type: "unit", unit: "px", value: 20 } }
4187
+ { property: "min-height", value: { type: "unit", unit: "px", value: 20 } }
4112
4188
  ]
4113
4189
  };
4114
4190
  const meta$q = {
@@ -4130,7 +4206,7 @@ const presetStyle$j = {
4130
4206
  ...img,
4131
4207
  // Otherwise on new image insert onto canvas it can overfit screen size multiple times
4132
4208
  {
4133
- property: "maxWidth",
4209
+ property: "max-width",
4134
4210
  value: { type: "unit", unit: "%", value: 100 }
4135
4211
  },
4136
4212
  // inline | inline-block is not suitable because without line-height: 0 on the parent you get unsuitable spaces/margins
@@ -4160,47 +4236,47 @@ const meta$p = {
4160
4236
  const presetStyle$i = {
4161
4237
  blockquote: [
4162
4238
  {
4163
- property: "marginTop",
4239
+ property: "margin-top",
4164
4240
  value: { type: "unit", value: 0, unit: "number" }
4165
4241
  },
4166
4242
  {
4167
- property: "marginRight",
4243
+ property: "margin-right",
4168
4244
  value: { type: "unit", value: 0, unit: "number" }
4169
4245
  },
4170
4246
  {
4171
- property: "marginBottom",
4247
+ property: "margin-bottom",
4172
4248
  value: { type: "unit", value: 10, unit: "px" }
4173
4249
  },
4174
4250
  {
4175
- property: "marginLeft",
4251
+ property: "margin-left",
4176
4252
  value: { type: "unit", value: 0, unit: "number" }
4177
4253
  },
4178
4254
  {
4179
- property: "paddingTop",
4255
+ property: "padding-top",
4180
4256
  value: { type: "unit", value: 10, unit: "px" }
4181
4257
  },
4182
4258
  {
4183
- property: "paddingBottom",
4259
+ property: "padding-bottom",
4184
4260
  value: { type: "unit", value: 10, unit: "px" }
4185
4261
  },
4186
4262
  {
4187
- property: "paddingLeft",
4263
+ property: "padding-left",
4188
4264
  value: { type: "unit", value: 20, unit: "px" }
4189
4265
  },
4190
4266
  {
4191
- property: "paddingRight",
4267
+ property: "padding-right",
4192
4268
  value: { type: "unit", value: 20, unit: "px" }
4193
4269
  },
4194
4270
  {
4195
- property: "borderLeftWidth",
4271
+ property: "border-left-width",
4196
4272
  value: { type: "unit", value: 5, unit: "px" }
4197
4273
  },
4198
4274
  {
4199
- property: "borderLeftStyle",
4275
+ property: "border-left-style",
4200
4276
  value: { type: "keyword", value: "solid" }
4201
4277
  },
4202
4278
  {
4203
- property: "borderLeftColor",
4279
+ property: "border-left-color",
4204
4280
  value: { type: "rgb", r: 226, g: 226, b: 226, alpha: 1 }
4205
4281
  }
4206
4282
  ]
@@ -4216,30 +4292,30 @@ const presetStyle$h = {
4216
4292
  ol: [
4217
4293
  ...ol,
4218
4294
  {
4219
- property: "marginTop",
4295
+ property: "margin-top",
4220
4296
  value: { type: "keyword", value: "0" }
4221
4297
  },
4222
4298
  {
4223
- property: "marginBottom",
4299
+ property: "margin-bottom",
4224
4300
  value: { type: "keyword", value: "10px" }
4225
4301
  },
4226
4302
  {
4227
- property: "paddingLeft",
4303
+ property: "padding-left",
4228
4304
  value: { type: "keyword", value: "40px" }
4229
4305
  }
4230
4306
  ],
4231
4307
  ul: [
4232
4308
  ...ul,
4233
4309
  {
4234
- property: "marginTop",
4310
+ property: "margin-top",
4235
4311
  value: { type: "keyword", value: "0" }
4236
4312
  },
4237
4313
  {
4238
- property: "marginBottom",
4314
+ property: "margin-bottom",
4239
4315
  value: { type: "keyword", value: "10px" }
4240
4316
  },
4241
4317
  {
4242
- property: "paddingLeft",
4318
+ property: "padding-left",
4243
4319
  value: { type: "keyword", value: "40px" }
4244
4320
  }
4245
4321
  ]
@@ -4275,23 +4351,23 @@ const presetStyle$f = {
4275
4351
  value: { type: "keyword", value: "1px" }
4276
4352
  },
4277
4353
  {
4278
- property: "backgroundColor",
4354
+ property: "background-color",
4279
4355
  value: { type: "keyword", value: "gray" }
4280
4356
  },
4281
4357
  {
4282
- property: "borderTopStyle",
4358
+ property: "border-top-style",
4283
4359
  value: { type: "keyword", value: "none" }
4284
4360
  },
4285
4361
  {
4286
- property: "borderRightStyle",
4362
+ property: "border-right-style",
4287
4363
  value: { type: "keyword", value: "none" }
4288
4364
  },
4289
4365
  {
4290
- property: "borderLeftStyle",
4366
+ property: "border-left-style",
4291
4367
  value: { type: "keyword", value: "none" }
4292
4368
  },
4293
4369
  {
4294
- property: "borderBottomStyle",
4370
+ property: "border-bottom-style",
4295
4371
  value: { type: "keyword", value: "none" }
4296
4372
  }
4297
4373
  ]
@@ -4313,23 +4389,23 @@ const presetStyle$e = {
4313
4389
  value: { type: "keyword", value: "block" }
4314
4390
  },
4315
4391
  {
4316
- property: "whiteSpaceCollapse",
4392
+ property: "white-space-collapse",
4317
4393
  value: { type: "keyword", value: "preserve" }
4318
4394
  },
4319
4395
  {
4320
- property: "textWrapMode",
4396
+ property: "text-wrap-mode",
4321
4397
  value: { type: "keyword", value: "wrap" }
4322
4398
  },
4323
4399
  {
4324
- property: "paddingLeft",
4400
+ property: "padding-left",
4325
4401
  value: { type: "unit", value: 0.2, unit: "em" }
4326
4402
  },
4327
4403
  {
4328
- property: "paddingRight",
4404
+ property: "padding-right",
4329
4405
  value: { type: "unit", value: 0.2, unit: "em" }
4330
4406
  },
4331
4407
  {
4332
- property: "backgroundColor",
4408
+ property: "background-color",
4333
4409
  value: { type: "rgb", r: 238, g: 238, b: 238, alpha: 1 }
4334
4410
  }
4335
4411
  ]
@@ -4405,7 +4481,7 @@ const presetStyle$b = {
4405
4481
  input: [
4406
4482
  ...radio,
4407
4483
  {
4408
- property: "marginRight",
4484
+ property: "margin-right",
4409
4485
  value: { type: "unit", unit: "em", value: 0.5 }
4410
4486
  }
4411
4487
  ]
@@ -4435,7 +4511,7 @@ const presetStyle$a = {
4435
4511
  input: [
4436
4512
  ...checkbox,
4437
4513
  {
4438
- property: "marginRight",
4514
+ property: "margin-right",
4439
4515
  value: { type: "unit", unit: "em", value: 0.5 }
4440
4516
  }
4441
4517
  ]
@@ -4584,7 +4660,7 @@ const meta$7 = {
4584
4660
  const presetStyle$3 = {
4585
4661
  option: [
4586
4662
  {
4587
- property: "backgroundColor",
4663
+ property: "background-color",
4588
4664
  state: ":checked",
4589
4665
  value: {
4590
4666
  type: "rgb",
@@ -4776,29 +4852,29 @@ const rgb = (property, r, g, b2) => ({
4776
4852
  });
4777
4853
  const buttonReset = [
4778
4854
  {
4779
- property: "backgroundColor",
4855
+ property: "background-color",
4780
4856
  value: { type: "keyword", value: "transparent" }
4781
4857
  },
4782
4858
  {
4783
- property: "backgroundImage",
4859
+ property: "background-image",
4784
4860
  value: { type: "keyword", value: "none" }
4785
4861
  },
4786
- unit("borderTopWidth", 0, "px"),
4787
- unit("borderRightWidth", 0, "px"),
4788
- unit("borderBottomWidth", 0, "px"),
4789
- unit("borderLeftWidth", 0, "px"),
4790
- keyword("borderTopStyle", "solid"),
4791
- keyword("borderRightStyle", "solid"),
4792
- keyword("borderBottomStyle", "solid"),
4793
- keyword("borderLeftStyle", "solid"),
4794
- rgb("borderTopColor", 226, 232, 240),
4795
- rgb("borderRightColor", 226, 232, 240),
4796
- rgb("borderBottomColor", 226, 232, 240),
4797
- rgb("borderLeftColor", 226, 232, 240),
4798
- unit("paddingTop", 0, "px"),
4799
- unit("paddingRight", 0, "px"),
4800
- unit("paddingBottom", 0, "px"),
4801
- unit("paddingLeft", 0, "px")
4862
+ unit("border-top-width", 0, "px"),
4863
+ unit("border-right-width", 0, "px"),
4864
+ unit("border-bottom-width", 0, "px"),
4865
+ unit("border-left-width", 0, "px"),
4866
+ keyword("border-top-style", "solid"),
4867
+ keyword("border-right-style", "solid"),
4868
+ keyword("border-bottom-style", "solid"),
4869
+ keyword("border-left-style", "solid"),
4870
+ rgb("border-top-color", 226, 232, 240),
4871
+ rgb("border-right-color", 226, 232, 240),
4872
+ rgb("border-bottom-color", 226, 232, 240),
4873
+ rgb("border-left-color", 226, 232, 240),
4874
+ unit("padding-top", 0, "px"),
4875
+ unit("padding-right", 0, "px"),
4876
+ unit("padding-bottom", 0, "px"),
4877
+ unit("padding-left", 0, "px")
4802
4878
  ];
4803
4879
  const metaDialogTrigger = {
4804
4880
  type: "container",
@@ -5100,11 +5176,11 @@ const metaAccordionHeader = {
5100
5176
  h3: [
5101
5177
  ...h3,
5102
5178
  {
5103
- property: "marginTop",
5179
+ property: "margin-top",
5104
5180
  value: { type: "unit", unit: "px", value: 0 }
5105
5181
  },
5106
5182
  {
5107
- property: "marginBottom",
5183
+ property: "margin-bottom",
5108
5184
  value: { type: "unit", unit: "px", value: 0 }
5109
5185
  }
5110
5186
  ]
@@ -5881,7 +5957,7 @@ audit=false
5881
5957
  fund=false
5882
5958
  `;
5883
5959
  const prebuild = async (options) => {
5884
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
5960
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
5885
5961
  if (options.template.length === 0) {
5886
5962
  log.error(
5887
5963
  `Template is not provided
@@ -5935,10 +6011,9 @@ Please check webstudio --help for more details`
5935
6011
  componentSources.set(componentName, entry.source);
5936
6012
  }
5937
6013
  }
5938
- const projectMetas = new Map(
6014
+ const usedMetas = new Map(
5939
6015
  Object.entries(coreMetas)
5940
6016
  );
5941
- const componentsByPage = {};
5942
6017
  const siteDataByPage = {};
5943
6018
  const fontAssetsByPage = {};
5944
6019
  const backgroundImageAssetsByPage = {};
@@ -5948,6 +6023,7 @@ Please check webstudio --help for more details`
5948
6023
  instanceMap,
5949
6024
  page.rootInstanceId
5950
6025
  );
6026
+ pageInstanceSet.add(ROOT_INSTANCE_ID);
5951
6027
  const instances = siteData.build.instances.filter(([id]) => pageInstanceSet.has(id));
5952
6028
  const dataSources = [];
5953
6029
  const normalizedProps = normalizeProps({
@@ -5990,15 +6066,10 @@ Please check webstudio --help for more details`
5990
6066
  page,
5991
6067
  assets: siteData.assets
5992
6068
  };
5993
- componentsByPage[page.id] = /* @__PURE__ */ new Set();
5994
6069
  for (const [_instanceId, instance] of instances) {
5995
- if (isCoreComponent(instance.component)) {
5996
- continue;
5997
- }
5998
- componentsByPage[page.id].add(instance.component);
5999
6070
  const meta2 = metas.get(instance.component);
6000
6071
  if (meta2) {
6001
- projectMetas.set(instance.component, meta2);
6072
+ usedMetas.set(instance.component, meta2);
6002
6073
  }
6003
6074
  }
6004
6075
  const styleSourceSelections = ((_a = siteData.build) == null ? void 0 : _a.styleSourceSelections) ?? [];
@@ -6013,7 +6084,7 @@ Please check webstudio --help for more details`
6013
6084
  ([, { value }]) => value.type === "fontFamily" ? value.value : void 0
6014
6085
  ).flat().filter((value) => value !== void 0)
6015
6086
  );
6016
- const pageFontAssets = siteData.assets.filter((asset) => asset.type === "font").filter((fontAsset) => pageFontFamilySet.has(fontAsset.meta.family));
6087
+ const pageFontAssets = siteData.assets.filter((asset) => asset.type === "font").filter((fontAsset) => pageFontFamilySet.has(fontAsset.meta.family)).map((asset) => asset.name);
6017
6088
  fontAssetsByPage[page.id] = pageFontAssets;
6018
6089
  const backgroundImageAssetIdSet = new Set(
6019
6090
  pageStyles.filter(([, { property }]) => property === "backgroundImage").map(
@@ -6022,7 +6093,7 @@ Please check webstudio --help for more details`
6022
6093
  ) : void 0
6023
6094
  ).flat().filter((value) => value !== void 0)
6024
6095
  );
6025
- const backgroundImageAssets = siteData.assets.filter((asset) => asset.type === "image").filter((imageAsset) => backgroundImageAssetIdSet.has(imageAsset.id));
6096
+ const backgroundImageAssets = siteData.assets.filter((asset) => asset.type === "image").filter((imageAsset) => backgroundImageAssetIdSet.has(imageAsset.id)).map((asset) => asset.name);
6026
6097
  backgroundImageAssetsByPage[page.id] = backgroundImageAssets;
6027
6098
  }
6028
6099
  const assetsToDownload = [];
@@ -6062,12 +6133,12 @@ Please check webstudio --help for more details`
6062
6133
  styles: new Map((_e = siteData.build) == null ? void 0 : _e.styles),
6063
6134
  styleSourceSelections: new Map((_f = siteData.build) == null ? void 0 : _f.styleSourceSelections),
6064
6135
  // pass only used metas to not generate unused preset styles
6065
- componentMetas: projectMetas,
6136
+ componentMetas: usedMetas,
6066
6137
  assetBaseUrl,
6067
6138
  atomic: ((_g = siteData.build.pages.compiler) == null ? void 0 : _g.atomicStyles) ?? true
6068
6139
  });
6069
6140
  await createFileIfNotExists(join(generatedDir, "index.css"), cssText);
6070
- for (const [pageId, pageComponents] of Object.entries(componentsByPage)) {
6141
+ for (const page of Object.values(siteData.pages)) {
6071
6142
  const scope = createScope([
6072
6143
  // manually maintained list of occupied identifiers
6073
6144
  "useState",
@@ -6077,6 +6148,29 @@ Please check webstudio --help for more details`
6077
6148
  "Page",
6078
6149
  "_props"
6079
6150
  ]);
6151
+ const pageData = siteDataByPage[page.id];
6152
+ const instances = new Map(pageData.build.instances);
6153
+ const documentType = page.meta.documentType ?? "html";
6154
+ let rootInstanceId = page.rootInstanceId;
6155
+ if (documentType === "xml") {
6156
+ const bodyInstance = instances.get(rootInstanceId);
6157
+ if (((_h = bodyInstance == null ? void 0 : bodyInstance.children) == null ? void 0 : _h[0].type) === "id") {
6158
+ rootInstanceId = bodyInstance.children[0].value;
6159
+ }
6160
+ for (const instance of instances.values()) {
6161
+ if (isCoreComponent(instance.component)) {
6162
+ continue;
6163
+ }
6164
+ if (((_i = usedMetas.get(instance.component)) == null ? void 0 : _i.category) === "xml") {
6165
+ continue;
6166
+ }
6167
+ instances.delete(instance.id);
6168
+ }
6169
+ }
6170
+ const pageComponents = /* @__PURE__ */ new Set();
6171
+ for (const instance of instances.values()) {
6172
+ pageComponents.add(instance.component);
6173
+ }
6080
6174
  const namespaces = /* @__PURE__ */ new Map();
6081
6175
  for (const component of pageComponents) {
6082
6176
  const namespace = componentSources.get(component);
@@ -6090,50 +6184,18 @@ Please check webstudio --help for more details`
6090
6184
  );
6091
6185
  }
6092
6186
  const [_namespace, shortName] = parseComponentName(component);
6093
- (_h = namespaces.get(namespace)) == null ? void 0 : _h.add([shortName, component]);
6187
+ (_j = namespaces.get(namespace)) == null ? void 0 : _j.add([shortName, component]);
6094
6188
  }
6095
6189
  let componentImports = "";
6096
- let xmlPresentationComponents = "";
6097
- const pageData = siteDataByPage[pageId];
6098
- const documentType = pageData.page.meta.documentType ?? "html";
6099
6190
  for (const [namespace, componentsSet] of namespaces.entries()) {
6100
- switch (documentType) {
6101
- case "html":
6102
- {
6103
- const specifiers = Array.from(componentsSet).map(
6104
- ([shortName, component]) => `${shortName} as ${scope.getName(component, shortName)}`
6105
- ).join(", ");
6106
- componentImports += `import { ${specifiers} } from "${namespace}";
6191
+ const specifiers = Array.from(componentsSet).map(
6192
+ ([shortName, component]) => `${shortName} as ${scope.getName(component, shortName)}`
6193
+ ).join(", ");
6194
+ componentImports += `import { ${specifiers} } from "${namespace}";
6107
6195
  `;
6108
- }
6109
- break;
6110
- case "xml":
6111
- {
6112
- componentImports = `import { XmlNode, XmlTime } from "@webstudio-is/sdk-components-react";
6113
- `;
6114
- xmlPresentationComponents += Array.from(componentsSet).map(
6115
- ([shortName, component]) => scope.getName(component, shortName)
6116
- ).filter(
6117
- (scopedName) => scopedName !== "XmlNode" && scopedName !== "XmlTime"
6118
- ).map(
6119
- (scopedName) => scopedName === "Body" ? (
6120
- // Using <svg> prevents React from hoisting elements like <title>, <meta>, and <link>
6121
- // out of their intended scope during rendering.
6122
- // More details: https://github.com/facebook/react/blob/7c8e5e7ab8bb63de911637892392c5efd8ce1d0f/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js#L3083
6123
- `const ${scopedName} = (props: any) => <svg>{props.children}</svg>;`
6124
- ) : (
6125
- // Do not render all other components
6126
- `const ${scopedName} = (props: any) => null;`
6127
- )
6128
- ).join("\n");
6129
- }
6130
- break;
6131
- }
6132
6196
  }
6133
- const pageFontAssets = fontAssetsByPage[pageId];
6134
- const pageBackgroundImageAssets = backgroundImageAssetsByPage[pageId];
6135
- const rootInstanceId = pageData.page.rootInstanceId;
6136
- const instances = new Map(pageData.build.instances);
6197
+ const pageFontAssets = fontAssetsByPage[page.id];
6198
+ const pageBackgroundImageAssets = backgroundImageAssetsByPage[page.id];
6137
6199
  const props2 = new Map(pageData.build.props);
6138
6200
  const dataSources = new Map(pageData.build.dataSources);
6139
6201
  const resources = new Map(pageData.build.resources);
@@ -6152,7 +6214,7 @@ Please check webstudio --help for more details`
6152
6214
  instanceId: "",
6153
6215
  name: "system",
6154
6216
  type: "parameter",
6155
- value: pageData.page.systemDataSourceId ?? ""
6217
+ value: page.systemDataSourceId ?? ""
6156
6218
  },
6157
6219
  {
6158
6220
  id: "global-system",
@@ -6166,38 +6228,33 @@ Please check webstudio --help for more details`
6166
6228
  props: props2,
6167
6229
  dataSources,
6168
6230
  classesMap: classes,
6169
- indexesWithinAncestors: getIndexesWithinAncestors(
6170
- projectMetas,
6171
- instances,
6172
- [rootInstanceId]
6173
- )
6231
+ metas: usedMetas
6174
6232
  });
6175
6233
  const projectMeta = siteData.build.pages.meta;
6176
6234
  const contactEmail = (
6177
6235
  // fallback to user email when contact email is empty string
6178
- (projectMeta == null ? void 0 : projectMeta.contactEmail) || ((_i = siteData.user) == null ? void 0 : _i.email) || void 0
6236
+ (projectMeta == null ? void 0 : projectMeta.contactEmail) || ((_k = siteData.user) == null ? void 0 : _k.email) || void 0
6179
6237
  );
6180
- const favIconAsset = assets.get((projectMeta == null ? void 0 : projectMeta.faviconAssetId) ?? "");
6181
- const pagePath = getPagePath(pageData.page.id, siteData.build.pages);
6238
+ const favIconAsset = (_l = assets.get((projectMeta == null ? void 0 : projectMeta.faviconAssetId) ?? "")) == null ? void 0 : _l.name;
6239
+ const pagePath = getPagePath(page.id, siteData.build.pages);
6182
6240
  const pageExports = `/* eslint-disable */
6183
6241
  /* This is a auto generated file for building the project */
6184
6242
 
6185
6243
 
6186
6244
  import { Fragment, useState } from "react";
6187
- import type { FontAsset, ImageAsset } from "@webstudio-is/sdk";
6188
6245
  import { useResource, useVariableState } from "@webstudio-is/react-sdk/runtime";
6189
6246
  ${componentImports}
6190
6247
 
6191
6248
  export const siteName = ${JSON.stringify(projectMeta == null ? void 0 : projectMeta.siteName)};
6192
6249
 
6193
- export const favIconAsset: ImageAsset | undefined =
6250
+ export const favIconAsset: string | undefined =
6194
6251
  ${JSON.stringify(favIconAsset)};
6195
6252
 
6196
6253
  // Font assets on current page (can be preloaded)
6197
- export const pageFontAssets: FontAsset[] =
6254
+ export const pageFontAssets: string[] =
6198
6255
  ${JSON.stringify(pageFontAssets)}
6199
6256
 
6200
- export const pageBackgroundImageAssets: ImageAsset[] =
6257
+ export const pageBackgroundImageAssets: string[] =
6201
6258
  ${JSON.stringify(pageBackgroundImageAssets)}
6202
6259
 
6203
6260
  ${pagePath === "/" ? `
@@ -6223,8 +6280,6 @@ Please check webstudio --help for more details`
6223
6280
  }
6224
6281
  ` : ""}
6225
6282
 
6226
- ${xmlPresentationComponents}
6227
-
6228
6283
  ${pageComponent}
6229
6284
 
6230
6285
  export { Page }
@@ -6236,7 +6291,7 @@ Please check webstudio --help for more details`
6236
6291
  import type { PageMeta } from "@webstudio-is/sdk";
6237
6292
  ${generateResources({
6238
6293
  scope,
6239
- page: pageData.page,
6294
+ page,
6240
6295
  dataSources,
6241
6296
  props: props2,
6242
6297
  resources
@@ -6244,12 +6299,12 @@ Please check webstudio --help for more details`
6244
6299
 
6245
6300
  ${generatePageMeta({
6246
6301
  globalScope: scope,
6247
- page: pageData.page,
6302
+ page,
6248
6303
  dataSources,
6249
6304
  assets
6250
6305
  })}
6251
6306
 
6252
- ${generateRemixParams(pageData.page.path)}
6307
+ ${generateRemixParams(page.path)}
6253
6308
 
6254
6309
  export const projectId = "${siteData.build.projectId}";
6255
6310
 
@@ -6295,7 +6350,7 @@ Please check webstudio --help for more details`
6295
6350
  )};
6296
6351
  `
6297
6352
  );
6298
- const redirects = (_j = siteData.build.pages) == null ? void 0 : _j.redirects;
6353
+ const redirects = (_m = siteData.build.pages) == null ? void 0 : _m.redirects;
6299
6354
  if (redirects !== void 0 && redirects.length > 0) {
6300
6355
  for (const redirect of redirects) {
6301
6356
  const generatedBasename = generateRemixRoute(redirect.old);
@@ -6470,7 +6525,7 @@ const getDeploymentInstructions = (deployTarget) => {
6470
6525
  }
6471
6526
  };
6472
6527
  const name = "webstudio";
6473
- const version = "0.205.0";
6528
+ const version = "0.206.0";
6474
6529
  const description = "Webstudio CLI";
6475
6530
  const author = "Webstudio <github@webstudio.is>";
6476
6531
  const homepage = "https://webstudio.is";