contour-ds 1.0.0 → 1.1.1

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.
Files changed (60) hide show
  1. package/README.md +1 -1
  2. package/dist/build-manifest.json +55 -55
  3. package/dist/contour-wc.esm.js +1461 -182
  4. package/dist/contour-wc.esm.min.js +1 -1
  5. package/dist/contour-wc.js +1461 -182
  6. package/dist/contour-wc.min.js +1 -1
  7. package/dist/contour.components.json +435 -22
  8. package/dist/contour.css +426 -45
  9. package/dist/contour.d.ts +31 -0
  10. package/dist/contour.esm.js +12 -0
  11. package/dist/contour.esm.min.js +1 -1
  12. package/dist/contour.js +12 -0
  13. package/dist/contour.min.css +1 -1
  14. package/dist/contour.min.js +1 -1
  15. package/dist/docs/actions.md +1 -1
  16. package/dist/docs/affordances.md +1 -1
  17. package/dist/docs/colour.md +1 -1
  18. package/dist/docs/data.md +1 -1
  19. package/dist/docs/docs.md +1 -1
  20. package/dist/docs/feedback.md +1 -1
  21. package/dist/docs/field.md +1 -1
  22. package/dist/docs/forms.md +1 -1
  23. package/dist/docs/index.json +15 -4
  24. package/dist/docs/install.md +1 -1
  25. package/dist/docs/landing.md +1 -1
  26. package/dist/docs/mapengine.md +1 -1
  27. package/dist/docs/motion.md +1 -1
  28. package/dist/docs/navigation.md +1 -1
  29. package/dist/docs/overlays.md +1 -1
  30. package/dist/docs/overview.md +1 -1
  31. package/dist/docs/patterns.md +1 -1
  32. package/dist/docs/playground.md +1 -1
  33. package/dist/docs/principles.md +1 -1
  34. package/dist/docs/recipes.md +1 -1
  35. package/dist/docs/space.md +1 -1
  36. package/dist/docs/status.md +1 -1
  37. package/dist/docs/surfaces.md +1 -1
  38. package/dist/docs/theming.md +1 -1
  39. package/dist/docs/type.md +1 -1
  40. package/dist/docs/webcomponents.md +1 -1
  41. package/dist/registry/items/contour-core.json +2 -2
  42. package/dist/registry/items/contour-data.json +2 -2
  43. package/dist/registry/items/contour-docs.json +2 -2
  44. package/dist/registry/items/contour-landing.json +2 -2
  45. package/dist/registry/registry.json +8 -8
  46. package/dist/surfaces/contour-core.min.css +1 -1
  47. package/dist/surfaces/contour-data.min.css +1 -1
  48. package/dist/surfaces/contour-docs.min.css +1 -1
  49. package/dist/surfaces/contour-landing.min.css +1 -1
  50. package/dist/wc/core.mjs +17 -6
  51. package/dist/wc/data.mjs +816 -45
  52. package/dist/wc/forms.mjs +119 -61
  53. package/dist/wc/index.mjs +1 -1
  54. package/dist/wc/interaction.mjs +3 -2
  55. package/dist/wc/map.mjs +280 -49
  56. package/dist/wc/navigation.mjs +66 -11
  57. package/dist/wc/shadow.mjs +29 -1
  58. package/dist/wc/svg.mjs +16 -1
  59. package/dist/wc/ui.mjs +117 -9
  60. package/package.json +1 -1
package/dist/wc/ui.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { ContourBase, define, contourId } from './core.mjs';
1
+ import { ContourBase, define, contourId, onDispose } from './core.mjs';
2
2
  import { wireRemovable } from './behaviours.mjs';
3
3
  class ContourAvatar extends ContourBase {
4
4
  static get observed() { return ["name", "size", "variant", "src", "status"]; }
@@ -737,8 +737,8 @@ class ContourStyleSwitcher extends ContourBase {
737
737
  define("contour-style-switcher", ContourStyleSwitcher);
738
738
 
739
739
  class ContourStylePanel extends ContourBase {
740
- static get observed() { return ["title", "layers"]; }
741
- static get properties() { return { title: { attribute: "title" }, layers: { attribute: "layers" } }; }
740
+ static get observed() { return ["title", "layers", "layer", "single", "classification", "palette", "breaks", "opacity", "n", "colors"]; }
741
+ static get properties() { return { title: { attribute: "title" }, layers: { attribute: "layers" }, classification: { attribute: "classification" }, palette: { attribute: "palette" }, breaks: { attribute: "breaks" }, opacity: { attribute: "opacity" } }; }
742
742
  render() {
743
743
  this.classList.add("c-style-panel");
744
744
  const title = this.getAttribute("title");
@@ -746,13 +746,69 @@ class ContourStylePanel extends ContourBase {
746
746
  const t = this.ensure(".c-style-panel__title", () => { const el = document.createElement("div"); el.className = "c-style-panel__title"; return el; });
747
747
  t.textContent = title;
748
748
  }
749
- const layers = this.getAttribute("layers");
749
+ const singleMode = this.hasAttribute("single") || !!this.getAttribute("layer");
750
+ if (singleMode) {
751
+ const body = this.ensure(".c-style-panel__body", () => { const el = document.createElement("div"); el.className = "c-style-panel__body"; return el; });
752
+ body.innerHTML = "";
753
+ // classification method selector
754
+ const clsLabel = document.createElement("label"); clsLabel.textContent = "Classification"; body.appendChild(clsLabel);
755
+ const clsSel = document.createElement("select"); clsSel.className = "c-style-panel__classification";
756
+ ["equal","quantile","jenks","manual"].forEach((m) => { const o = document.createElement("option"); o.value = m; o.textContent = m; clsSel.appendChild(o); });
757
+ const cls = this.getAttribute("classification"); if (cls) clsSel.value = cls;
758
+ body.appendChild(clsSel);
759
+ // palette picker
760
+ const pal = document.createElement("input"); pal.type = "text"; pal.className = "c-style-panel__palette"; pal.placeholder = "palette";
761
+ const palv = this.getAttribute("palette"); if (palv) pal.value = palv;
762
+ body.appendChild(pal);
763
+ // n (class count)
764
+ const nIn = document.createElement("input"); nIn.type = "number"; nIn.className = "c-style-panel__n"; nIn.min = "2"; nIn.max = "12";
765
+ const nv = this.getAttribute("n"); if (nv) nIn.value = nv; else nIn.value = "5";
766
+ body.appendChild(nIn);
767
+ // opacity slider
768
+ const op = document.createElement("input"); op.type = "range"; op.className = "c-style-panel__opacity"; op.min = "0"; op.max = "100";
769
+ const ov = this.getAttribute("opacity"); op.value = ov != null ? ov : "100";
770
+ body.appendChild(op);
771
+ // breaks editor
772
+ const breaks = document.createElement("input"); breaks.type = "text"; breaks.className = "c-style-panel__breaks"; breaks.placeholder = "breaks";
773
+ const bv = this.getAttribute("breaks"); if (bv) breaks.value = bv;
774
+ body.appendChild(breaks);
775
+ // color list
776
+ const colorsAttr = this.getAttribute("colors");
777
+ let colors = null;
778
+ if (colorsAttr) { try { colors = JSON.parse(colorsAttr); } catch (e) { colors = colorsAttr.split(",").map((s) => s.trim()); } }
779
+ if (Array.isArray(colors)) {
780
+ const list = document.createElement("div"); list.className = "c-style-panel__colors";
781
+ colors.forEach((c) => {
782
+ const sw = document.createElement("span"); sw.className = "c-style-panel__color"; sw.style.background = c; list.appendChild(sw);
783
+ });
784
+ body.appendChild(list);
785
+ }
786
+ return;
787
+ }
788
+ const layers = this.getAttribute("layers");
750
789
  const body = this.ensure(".c-style-panel__body", () => { const el = document.createElement("div"); el.className = "c-style-panel__body"; return el; });
751
- if (layers) {
790
+ // Slotted content support: authored .c-style-panel__row children take
791
+ // precedence over the JSON `layers` attribute.
792
+ const authoredRows = Array.from(this.querySelectorAll(":scope > .c-style-panel__row"));
793
+ let parsed = null;
794
+ if (authoredRows.length) {
795
+ parsed = authoredRows.map((row) => ({
796
+ name: row.querySelector(".c-style-panel__name")?.textContent || "",
797
+ color: row.querySelector(".c-style-panel__color")?.value,
798
+ classification: row.querySelector(".c-style-panel__classification")?.value,
799
+ palette: row.querySelector(".c-style-panel__palette")?.value,
800
+ breaks: row.querySelector(".c-style-panel__breaks")?.value,
801
+ opacity: row.querySelector(".c-style-panel__opacity")?.value,
802
+ }));
803
+ authoredRows.forEach((row) => row.remove());
804
+ } else if (layers) {
752
805
  try {
753
- const parsed = JSON.parse(layers);
754
- body.innerHTML = "";
755
- parsed.forEach((l) => {
806
+ parsed = JSON.parse(layers);
807
+ } catch (e) { parsed = null; }
808
+ }
809
+ if (parsed) {
810
+ body.innerHTML = "";
811
+ parsed.forEach((l) => {
756
812
  const row = document.createElement("div");
757
813
  row.className = "c-style-panel__row";
758
814
  const name = document.createElement("span");
@@ -764,11 +820,63 @@ class ContourStylePanel extends ContourBase {
764
820
  input.className = "c-style-panel__color";
765
821
  if (typeof l === "object" && l.color) input.value = l.color;
766
822
  row.appendChild(input);
823
+ // classification method selector
824
+ const clsSel = document.createElement("select");
825
+ clsSel.className = "c-style-panel__classification";
826
+ ["equal","quantile","jenks","manual"].forEach((m) => { const o = document.createElement("option"); o.value = m; o.textContent = m; clsSel.appendChild(o); });
827
+ if (typeof l === "object" && l.classification) clsSel.value = l.classification;
828
+ row.appendChild(clsSel);
829
+ // palette picker
830
+ const pal = document.createElement("input");
831
+ pal.type = "text";
832
+ pal.className = "c-style-panel__palette";
833
+ pal.placeholder = "palette";
834
+ if (typeof l === "object" && l.palette) pal.value = l.palette;
835
+ row.appendChild(pal);
836
+ // breaks editor
837
+ const breaks = document.createElement("input");
838
+ breaks.type = "text";
839
+ breaks.className = "c-style-panel__breaks";
840
+ breaks.placeholder = "breaks";
841
+ if (typeof l === "object" && l.breaks) breaks.value = (Array.isArray(l.breaks) ? l.breaks.join(",") : l.breaks);
842
+ row.appendChild(breaks);
843
+ // opacity control
844
+ const op = document.createElement("input");
845
+ op.type = "range";
846
+ op.className = "c-style-panel__opacity";
847
+ op.min = "0"; op.max = "100";
848
+ op.value = (typeof l === "object" && l.opacity != null) ? l.opacity : "100";
849
+ row.appendChild(op);
767
850
  body.appendChild(row);
768
851
  });
769
- } catch (e) { /* keep existing */ }
770
852
  }
771
853
  }
854
+ enhance() {
855
+ if (this._wiredStylePanel) return;
856
+ this._wiredStylePanel = true;
857
+ this.addEventListener("change", (e) => {
858
+ const t = e.target;
859
+ if (!t || !this.contains(t)) return;
860
+ const row = t.closest(".c-style-panel__row");
861
+ const name = row ? (row.querySelector(".c-style-panel__name")?.textContent || "") : "";
862
+ if (t.classList.contains("c-style-panel__color")) {
863
+ this.dispatchEvent(new CustomEvent("contour:style-resolved", { detail: { value: t.value, layer: name, property: "color" }, bubbles: true, composed: true }));
864
+ } else if (t.classList.contains("c-style-panel__classification")) {
865
+ this.dispatchEvent(new CustomEvent("contour:break-change", { detail: { value: t.value, layer: name }, bubbles: true, composed: true }));
866
+ } else if (t.classList.contains("c-style-panel__opacity")) {
867
+ this.dispatchEvent(new CustomEvent("contour:layer-opacity", { detail: { name, opacity: Number(t.value) }, bubbles: true, composed: true }));
868
+ }
869
+ });
870
+ this.addEventListener("input", (e) => {
871
+ const t = e.target;
872
+ if (!t || !this.contains(t)) return;
873
+ if (t.classList.contains("c-style-panel__palette") || t.classList.contains("c-style-panel__breaks")) {
874
+ const row = t.closest(".c-style-panel__row");
875
+ const name = row ? (row.querySelector(".c-style-panel__name")?.textContent || "") : "";
876
+ this.dispatchEvent(new CustomEvent("contour:style-resolved", { detail: { value: t.value, layer: name, property: t.classList.contains("c-style-panel__palette") ? "palette" : "breaks" }, bubbles: true, composed: true }));
877
+ }
878
+ });
879
+ }
772
880
  }
773
881
  define("contour-style-panel", ContourStylePanel);
774
882
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contour-ds",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "A token-driven design system for spatial interfaces",
5
5
  "license": "MIT",
6
6
  "type": "module",