@zumer/orbit 0.4.1 → 0.5.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/dist/orbit.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /*
3
3
  * orbit
4
- * v.0.4.1
4
+ * v.0.5.0
5
5
  * Author Juan Martin Muda - Zumerlab
6
6
  * License MIT
7
7
  **/
@@ -222,7 +222,7 @@
222
222
  }
223
223
  };
224
224
 
225
- // src/js/orbit-slice.js
225
+ // src/js/orbit-arc.js
226
226
  var template = document.createElement("template");
227
227
  template.innerHTML = `
228
228
  <style>
@@ -238,23 +238,23 @@
238
238
  svg * {
239
239
  pointer-events: stroke;
240
240
  }
241
- .slice {
242
- stroke: var(--o-slice-color, var(--o-cyan-light));
241
+ .arc {
242
+ stroke: var(--o-arc-color, var(--o-cyan-light));
243
243
  stroke-width: calc(var(--o-radius) / var(--o-orbit-number) * var(--o-size-ratio, 1));
244
244
  transition: stroke 0.3s;
245
245
  }
246
246
 
247
- :host(:hover) .slice {
248
- stroke: var(--o-hover-slice-color, var(--o-slice-color));
247
+ :host(:hover) .arc {
248
+ stroke: var(--o-hover-arc-color, var(--o-arc-color));
249
249
 
250
250
  }
251
251
  </style>
252
252
  <svg viewBox="0 0 100 100">
253
253
  <defs></defs>
254
- <path class="slice" vector-effect="non-scaling-stroke" fill="transparent"></path>
254
+ <path class="arc" vector-effect="non-scaling-stroke" fill="transparent"></path>
255
255
  </svg>
256
256
  `;
257
- var OrbitSlice = class extends HTMLElement {
257
+ var OrbitArc = class extends HTMLElement {
258
258
  constructor() {
259
259
  super();
260
260
  this.attachShadow({ mode: "open" });
@@ -281,17 +281,17 @@
281
281
  path.setAttribute("marker-end", "url(#head)");
282
282
  path.setAttribute("marker-start", "url(#tail)");
283
283
  }
284
- const { realRadius, sliceColor, gap } = this.getAttributes();
284
+ const { realRadius, arcColor, gap } = this.getAttributes();
285
285
  const angle = this.calculateAngle();
286
286
  const { d } = this.calculateArcParameters(angle, realRadius, gap);
287
287
  path.setAttribute("d", d);
288
- path.setAttribute("stroke", sliceColor);
288
+ path.setAttribute("stroke", arcColor);
289
289
  }
290
290
  getAttributes() {
291
291
  const orbitRadius = parseFloat(getComputedStyle(this).getPropertyValue("r") || 0);
292
292
  const gap = parseFloat(getComputedStyle(this).getPropertyValue("--o-gap") || 1e-3);
293
293
  const shape = this.getAttribute("shape") || "none";
294
- const sliceColor = this.getAttribute("slice-color");
294
+ const arcColor = this.getAttribute("arc-color");
295
295
  const rawAngle = getComputedStyle(this).getPropertyValue("--o-angle");
296
296
  const strokeWidth = parseFloat(getComputedStyle(this).getPropertyValue("stroke-width") || 1);
297
297
  const strokeWithPercentage = strokeWidth / 2 * 100 / orbitRadius / 2;
@@ -309,20 +309,20 @@
309
309
  innerOuter = strokeWithPercentage * 0.75;
310
310
  }
311
311
  const realRadius = 50 + innerOuter - strokeWithPercentage;
312
- const sliceAngle = calcularExpresionCSS(rawAngle);
312
+ const arcAngle = calcularExpresionCSS(rawAngle);
313
313
  return {
314
314
  orbitRadius,
315
315
  strokeWidth,
316
316
  realRadius,
317
- sliceColor,
317
+ arcColor,
318
318
  gap,
319
- sliceAngle,
319
+ arcAngle,
320
320
  shape
321
321
  };
322
322
  }
323
323
  calculateAngle() {
324
- const { sliceAngle, gap } = this.getAttributes();
325
- return sliceAngle - gap;
324
+ const { arcAngle, gap } = this.getAttributes();
325
+ return arcAngle - gap;
326
326
  }
327
327
  calculateArcParameters(angle, realRadius) {
328
328
  const radiusX = realRadius / 1;
@@ -579,7 +579,7 @@
579
579
 
580
580
  // src/orbit.js
581
581
  customElements.define("o-progress", OrbitProgress);
582
- customElements.define("o-slice", OrbitSlice);
582
+ customElements.define("o-arc", OrbitArc);
583
583
  customElements.define("o-text", OrbitText);
584
584
  window.Orbit = Orbit;
585
585
  })();