@sveltejs/vite-plugin-svelte 1.0.5 → 1.0.7

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/index.d.ts CHANGED
@@ -54,6 +54,7 @@ interface PluginOptions {
54
54
  */
55
55
  hot?: boolean | {
56
56
  injectCss?: boolean;
57
+ partialAccept?: boolean;
57
58
  [key: string]: any;
58
59
  };
59
60
  /**
@@ -182,6 +183,35 @@ interface InspectorOptions {
182
183
  * To avoid conflicts or accidentally typing into inputs, modifier only combinations are recommended.
183
184
  */
184
185
  toggleKeyCombo?: string;
186
+ /**
187
+ * define keys to select elements with via keyboard
188
+ * @default {parent: 'ArrowUp', child: 'ArrowDown', next: 'ArrowRight', prev: 'ArrowLeft' }
189
+ *
190
+ * improves accessibility and also helps when you want to select elements that do not have a hoverable surface area
191
+ * due to tight wrapping
192
+ *
193
+ * A note for users of screen-readers:
194
+ * If you are using arrow keys to navigate the page itself, change the navKeys to avoid conflicts.
195
+ * e.g. navKeys: {parent: 'w', prev: 'a', child: 's', next: 'd'}
196
+ *
197
+ *
198
+ * parent: select closest parent
199
+ * child: select first child (or grandchild)
200
+ * next: next sibling (or parent if no next sibling exists)
201
+ * prev: previous sibling (or parent if no prev sibling exists)
202
+ */
203
+ navKeys?: {
204
+ parent: string;
205
+ child: string;
206
+ next: string;
207
+ prev: string;
208
+ };
209
+ /**
210
+ * define key to open the editor for the currently selected dom node
211
+ *
212
+ * @default 'Enter'
213
+ */
214
+ openKey?: string;
185
215
  /**
186
216
  * inspector is automatically disabled when releasing toggleKeyCombo after holding it for a longpress
187
217
  * @default false
package/dist/index.js CHANGED
@@ -1245,8 +1245,12 @@ function mergeConfigs(...configs) {
1245
1245
  return result;
1246
1246
  }
1247
1247
  function resolveOptions(preResolveOptions2, viteConfig) {
1248
+ var _a;
1248
1249
  const defaultOptions = {
1249
- hot: viteConfig.isProduction ? false : { injectCss: !preResolveOptions2.emitCss },
1250
+ hot: viteConfig.isProduction ? false : {
1251
+ injectCss: !preResolveOptions2.emitCss,
1252
+ partialAccept: !!((_a = viteConfig.experimental) == null ? void 0 : _a.hmrPartialAccept)
1253
+ },
1250
1254
  compilerOptions: {
1251
1255
  css: !preResolveOptions2.emitCss,
1252
1256
  dev: !viteConfig.isProduction
@@ -1351,7 +1355,7 @@ function resolveViteRoot(viteConfig) {
1351
1355
  return normalizePath2(viteConfig.root ? path4.resolve(viteConfig.root) : process.cwd());
1352
1356
  }
1353
1357
  function buildExtraViteConfig(options, config) {
1354
- var _a;
1358
+ var _a, _b;
1355
1359
  const svelteDeps = findRootSvelteDependencies(options.root);
1356
1360
  const extraViteConfig = {
1357
1361
  resolve: {
@@ -1375,6 +1379,10 @@ function buildExtraViteConfig(options, config) {
1375
1379
  };
1376
1380
  }
1377
1381
  extraViteConfig.ssr = buildSSROptionsForSvelte(svelteDeps, options, config, extraViteConfig);
1382
+ if ((options.hot == null || options.hot === true || options.hot && options.hot.partialAccept !== false) && ((_b = config.experimental) == null ? void 0 : _b.hmrPartialAccept) !== false) {
1383
+ log.debug('enabling "experimental.hmrPartialAccept" in vite config');
1384
+ extraViteConfig.experimental = { hmrPartialAccept: true };
1385
+ }
1378
1386
  return extraViteConfig;
1379
1387
  }
1380
1388
  function buildOptimizeDepsForSvelte(svelteDeps, options, optimizeDeps) {
@@ -1742,6 +1750,8 @@ function idToFile(id) {
1742
1750
  // src/ui/inspector/plugin.ts
1743
1751
  var defaultInspectorOptions = {
1744
1752
  toggleKeyCombo: process.platform === "win32" ? "control-shift" : "meta-shift",
1753
+ navKeys: { parent: "ArrowUp", child: "ArrowDown", next: "ArrowRight", prev: "ArrowLeft" },
1754
+ openKey: "Enter",
1745
1755
  holdMode: false,
1746
1756
  showToggleButton: "active",
1747
1757
  toggleButtonPos: "top-right",