inline-style-editor 1.2.11 → 1.2.13

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.
@@ -2027,8 +2027,7 @@ function listFonts() {
2027
2027
 
2028
2028
  function get_each_context(ctx, list, i) {
2029
2029
  const child_ctx = ctx.slice();
2030
- child_ctx[61] = list[i][0];
2031
- child_ctx[62] = list[i][1];
2030
+ child_ctx[62] = list[i];
2032
2031
  child_ctx[64] = list;
2033
2032
  child_ctx[65] = i;
2034
2033
  const constants_0 = /*choices*/ child_ctx[62].props[/*choices*/ child_ctx[62].selected];
@@ -2077,7 +2076,7 @@ function get_each_context_5(ctx, list, i) {
2077
2076
  return child_ctx;
2078
2077
  }
2079
2078
 
2080
- // (396:4) {#if targetsToSearch.length > 1}
2079
+ // (406:4) {#if targetsToSearch.length > 1}
2081
2080
  function create_if_block_8(ctx) {
2082
2081
  let div;
2083
2082
  let b;
@@ -2142,7 +2141,7 @@ function create_if_block_8(ctx) {
2142
2141
  };
2143
2142
  }
2144
2143
 
2145
- // (399:8) {#each targetsToSearch as target, elemIndex}
2144
+ // (409:8) {#each targetsToSearch as target, elemIndex}
2146
2145
  function create_each_block_5(ctx) {
2147
2146
  let span;
2148
2147
  let t0;
@@ -2189,7 +2188,7 @@ function create_each_block_5(ctx) {
2189
2188
  };
2190
2189
  }
2191
2190
 
2192
- // (408:8) {#each getRuleNames(allRules[selectedElemIndex]) as ruleName, ruleIndex}
2191
+ // (418:8) {#each getRuleNames(allRules[selectedElemIndex]) as ruleName, ruleIndex}
2193
2192
  function create_each_block_4(ctx) {
2194
2193
  let span;
2195
2194
  let t_value = /*ruleName*/ ctx[75] + "";
@@ -2238,7 +2237,7 @@ function create_each_block_4(ctx) {
2238
2237
  };
2239
2238
  }
2240
2239
 
2241
- // (419:12) {#if type !== 'custom' || (currentRule === 'inline' && type === 'custom' && hasDisplayedCustom )}
2240
+ // (429:12) {#if type !== 'custom' || (currentRule === 'inline' && type === 'custom' && hasDisplayedCustom )}
2242
2241
  function create_if_block_7(ctx) {
2243
2242
  let span;
2244
2243
  let t0_value = /*type*/ ctx[72] + "";
@@ -2284,7 +2283,7 @@ function create_if_block_7(ctx) {
2284
2283
  };
2285
2284
  }
2286
2285
 
2287
- // (417:8) {#each allTypes[selectedElemIndex] || [] as type, typeIndex}
2286
+ // (427:8) {#each allTypes[selectedElemIndex] || [] as type, typeIndex}
2288
2287
  function create_each_block_3(ctx) {
2289
2288
  let if_block_anchor;
2290
2289
  let if_block = (/*type*/ ctx[72] !== 'custom' || /*currentRule*/ ctx[16] === 'inline' && /*type*/ ctx[72] === 'custom' && /*hasDisplayedCustom*/ ctx[15]) && create_if_block_7(ctx);
@@ -2319,12 +2318,12 @@ function create_each_block_3(ctx) {
2319
2318
  };
2320
2319
  }
2321
2320
 
2322
- // (424:4) {#if allTypes[selectedElemIndex]}
2321
+ // (434:4) {#if allTypes[selectedElemIndex]}
2323
2322
  function create_if_block(ctx) {
2324
2323
  let div;
2325
2324
  let t;
2326
2325
  let current;
2327
- let each_value = Object.entries(/*propsByType*/ ctx[12]);
2326
+ let each_value = /*propsByType*/ ctx[12];
2328
2327
  let each_blocks = [];
2329
2328
 
2330
2329
  for (let i = 0; i < each_value.length; i += 1) {
@@ -2362,7 +2361,7 @@ function create_if_block(ctx) {
2362
2361
  },
2363
2362
  p(ctx, dirty) {
2364
2363
  if (dirty[0] & /*allCurrentPropDefs, propsByType, updateProp, deleteProp*/ 1323008) {
2365
- each_value = Object.entries(/*propsByType*/ ctx[12]);
2364
+ each_value = /*propsByType*/ ctx[12];
2366
2365
  let i;
2367
2366
 
2368
2367
  for (i = 0; i < each_value.length; i += 1) {
@@ -2427,7 +2426,7 @@ function create_if_block(ctx) {
2427
2426
  };
2428
2427
  }
2429
2428
 
2430
- // (435:16) {:else}
2429
+ // (445:16) {:else}
2431
2430
  function create_else_block(ctx) {
2432
2431
  let span;
2433
2432
  let t_value = /*selectedName*/ ctx[63] + "";
@@ -2451,7 +2450,7 @@ function create_else_block(ctx) {
2451
2450
  };
2452
2451
  }
2453
2452
 
2454
- // (429:16) {#if choices.props.length > 1}
2453
+ // (439:16) {#if choices.props.length > 1}
2455
2454
  function create_if_block_6(ctx) {
2456
2455
  let div;
2457
2456
  let select;
@@ -2465,7 +2464,7 @@ function create_if_block_6(ctx) {
2465
2464
  }
2466
2465
 
2467
2466
  function change_handler(...args) {
2468
- return /*change_handler*/ ctx[35](/*choices*/ ctx[62], /*each_value*/ ctx[64], /*each_index*/ ctx[65], ...args);
2467
+ return /*change_handler*/ ctx[35](/*choices*/ ctx[62], /*each_value*/ ctx[64], /*choices_index*/ ctx[65], ...args);
2469
2468
  }
2470
2469
 
2471
2470
  return {
@@ -2525,7 +2524,7 @@ function create_if_block_6(ctx) {
2525
2524
  };
2526
2525
  }
2527
2526
 
2528
- // (431:24) {#each choices.props as propName, i}
2527
+ // (441:24) {#each choices.props as propName, i}
2529
2528
  function create_each_block_2(ctx) {
2530
2529
  let option;
2531
2530
  let t0_value = /*propName*/ ctx[69] + "";
@@ -2560,7 +2559,7 @@ function create_each_block_2(ctx) {
2560
2559
  };
2561
2560
  }
2562
2561
 
2563
- // (458:46)
2562
+ // (468:50)
2564
2563
  function create_if_block_5(ctx) {
2565
2564
  let colorpicker;
2566
2565
  let current;
@@ -2606,7 +2605,7 @@ function create_if_block_5(ctx) {
2606
2605
  };
2607
2606
  }
2608
2607
 
2609
- // (448:47)
2608
+ // (458:51)
2610
2609
  function create_if_block_3(ctx) {
2611
2610
  let select;
2612
2611
  let show_if = !/*choices*/ ctx[62].includes(/*allCurrentPropDefs*/ ctx[13][/*selectedName*/ ctx[63]].value);
@@ -2699,7 +2698,7 @@ function create_if_block_3(ctx) {
2699
2698
  };
2700
2699
  }
2701
2700
 
2702
- // (439:16) {#if propType === 'slider'}
2701
+ // (449:16) {#if choices.type === 'slider'}
2703
2702
  function create_if_block_2(ctx) {
2704
2703
  let input;
2705
2704
  let input_min_value;
@@ -2774,7 +2773,7 @@ function create_if_block_2(ctx) {
2774
2773
  };
2775
2774
  }
2776
2775
 
2777
- // (451:24) {#if !choices.includes(allCurrentPropDefs[selectedName].value)}
2776
+ // (461:24) {#if !choices.includes(allCurrentPropDefs[selectedName].value)}
2778
2777
  function create_if_block_4(ctx) {
2779
2778
  let option;
2780
2779
 
@@ -2795,7 +2794,7 @@ function create_if_block_4(ctx) {
2795
2794
  };
2796
2795
  }
2797
2796
 
2798
- // (454:24) {#each choices as choice}
2797
+ // (464:24) {#each choices as choice}
2799
2798
  function create_each_block_1(ctx) {
2800
2799
  let option;
2801
2800
  let t_value = /*choice*/ ctx[66] + "";
@@ -2833,7 +2832,7 @@ function create_each_block_1(ctx) {
2833
2832
  };
2834
2833
  }
2835
2834
 
2836
- // (426:8) {#each Object.entries(propsByType) as [propType, choices]}
2835
+ // (436:8) {#each propsByType as choices}
2837
2836
  function create_each_block(ctx) {
2838
2837
  let div;
2839
2838
  let t0;
@@ -2861,9 +2860,9 @@ function create_each_block(ctx) {
2861
2860
  const if_blocks = [];
2862
2861
 
2863
2862
  function select_block_type_1(ctx, dirty) {
2864
- if (/*propType*/ ctx[61] === 'slider') return 0;
2865
- if (/*propType*/ ctx[61] == 'select') return 1;
2866
- if (/*propType*/ ctx[61] == 'color') return 2;
2863
+ if (/*choices*/ ctx[62].type === 'slider') return 0;
2864
+ if (/*choices*/ ctx[62].type == 'select') return 1;
2865
+ if (/*choices*/ ctx[62].type == 'color') return 2;
2867
2866
  return -1;
2868
2867
  }
2869
2868
 
@@ -2979,7 +2978,7 @@ function create_each_block(ctx) {
2979
2978
  };
2980
2979
  }
2981
2980
 
2982
- // (466:8) {#if currentRule === 'inline' && bringableToFront[selectedElemIndex] !== null}
2981
+ // (476:8) {#if currentRule === 'inline' && bringableToFront[selectedElemIndex] !== null}
2983
2982
  function create_if_block_1(ctx) {
2984
2983
  let div;
2985
2984
  let mounted;
@@ -3358,7 +3357,7 @@ function instance($$self, $$props, $$invalidate) {
3358
3357
  const borderProps = ["border-radius", "border-width", "border-color", "border-style"];
3359
3358
  const backgroundProps = ["background-color"];
3360
3359
  const fontProps = ["font-family", "font-size", "font-weight", "color"];
3361
- const pathProps = ["stroke-width", "stroke", "stroke-dasharray", "fill"];
3360
+ const pathProps = ["stroke-width", "stroke", "stroke-dasharray", "stroke-linejoin", "fill"];
3362
3361
 
3363
3362
  const cssPropByType = {
3364
3363
  "border-radius": {
@@ -3405,6 +3404,10 @@ function instance($$self, $$props, $$invalidate) {
3405
3404
  suffix: 'px'
3406
3405
  },
3407
3406
  'stroke': { type: "color" },
3407
+ "stroke-linejoin": {
3408
+ type: 'select',
3409
+ choices: () => ["bevel", "miter", "round"]
3410
+ },
3408
3411
  'fill': { type: "color" },
3409
3412
  "stroke-dasharray": {
3410
3413
  type: "slider",
@@ -3435,6 +3438,7 @@ function instance($$self, $$props, $$invalidate) {
3435
3438
  [customType]: Object.keys(customProps)
3436
3439
  };
3437
3440
 
3441
+ const inputTypeOrder = { slider: 0, select: 1, color: 2 };
3438
3442
  let elementToListen = null;
3439
3443
  let positionAnchor;
3440
3444
  let self;
@@ -3509,11 +3513,22 @@ function instance($$self, $$props, $$invalidate) {
3509
3513
  $$invalidate(12, propsByType = Object.entries(_allCurrentPropDefs).reduce(
3510
3514
  (byType, [propName, selectorDef]) => {
3511
3515
  const selectorType = selectorDef.type;
3512
- if (!(selectorType in byType)) byType[selectorType] = { selected: 0, props: [propName] }; else byType[selectorType].props.push(propName);
3516
+ const existing = byType.find(x => x.type === selectorType);
3517
+
3518
+ if (!existing) byType.push({
3519
+ selected: 0,
3520
+ props: [propName],
3521
+ type: selectorType
3522
+ }); else existing.props.push(propName);
3523
+
3513
3524
  return byType;
3514
3525
  },
3515
- {}
3516
- ));
3526
+ []
3527
+ ).sort((a, b) => {
3528
+ if (inputTypeOrder[a.type] < inputTypeOrder[b.type]) return -1;
3529
+ if (inputTypeOrder[a.type] > inputTypeOrder[b.type]) return 1;
3530
+ return 0;
3531
+ }));
3517
3532
 
3518
3533
  $$invalidate(13, allCurrentPropDefs = _allCurrentPropDefs);
3519
3534
  updateHelpers();
@@ -3623,13 +3638,13 @@ function instance($$self, $$props, $$invalidate) {
3623
3638
  allTypes[0].push(customType);
3624
3639
  }
3625
3640
 
3641
+ await tick();
3642
+ initAndGroup();
3643
+
3626
3644
  if (x && y) show(x, y); else {
3627
3645
  const rect = getBoundingBoxInfos(el, 15);
3628
3646
  show(rect.left, rect.top);
3629
3647
  }
3630
-
3631
- await tick();
3632
- initAndGroup();
3633
3648
  }
3634
3649
 
3635
3650
  function close() {
@@ -3647,18 +3662,22 @@ function instance($$self, $$props, $$invalidate) {
3647
3662
  }
3648
3663
 
3649
3664
  function show(x, y) {
3650
- x = x + 260 > pageDimensions.width
3651
- ? pageDimensions.width - 300
3665
+ $$invalidate(8, self.style.display = "block", self);
3666
+ $$invalidate(8, self.style.opacity = 0, self);
3667
+ const popupDimension = self.getBoundingClientRect();
3668
+
3669
+ x = x + popupDimension.width > pageDimensions.width
3670
+ ? x - popupDimension.width
3652
3671
  : x + 10;
3653
3672
 
3654
- y = y + 410 > pageDimensions.height
3655
- ? pageDimensions.height - 450
3673
+ y = y + popupDimension.height > pageDimensions.height
3674
+ ? y - popupDimension.height
3656
3675
  : y + 10;
3657
3676
 
3658
3677
  $$invalidate(8, self.style.left = x + "px", self);
3659
3678
  $$invalidate(8, self.style.top = y + "px", self);
3660
3679
  $$invalidate(9, helperElemWrapper.style.display = "block", helperElemWrapper);
3661
- $$invalidate(8, self.style.display = "block", self);
3680
+ $$invalidate(8, self.style.opacity = 1, self);
3662
3681
  updateHelpers();
3663
3682
  }
3664
3683
 
@@ -3774,8 +3793,8 @@ function instance($$self, $$props, $$invalidate) {
3774
3793
  $$invalidate(6, selectedTypeIndex = typeIndex);
3775
3794
  };
3776
3795
 
3777
- const change_handler = async (choices, each_value, each_index, e) => {
3778
- $$invalidate(12, each_value[each_index][1].selected = e.target.value, propsByType);
3796
+ const change_handler = async (choices, each_value, choices_index, e) => {
3797
+ $$invalidate(12, each_value[choices_index].selected = e.target.value, propsByType);
3779
3798
  await tick();
3780
3799
  };
3781
3800