@rogieking/figui3 10.0.13 → 11.0.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/.cursor/skills/figui3/components.md +8 -15
- package/.cursor/skills/figui3/react.md +0 -1
- package/.cursor/skills/figui3/reference.md +3 -9
- package/CHANGELOG.md +26 -0
- package/README.md +6 -46
- package/components.css +42 -23
- package/dist/components.css +1 -1
- package/dist/fig.css +1 -1
- package/dist/fig.js +6 -6
- package/fig.js +0 -99
- package/package.json +1 -1
package/fig.js
CHANGED
|
@@ -916,105 +916,6 @@ class FigButton extends HTMLElement {
|
|
|
916
916
|
}
|
|
917
917
|
figDefineElement("fig-button", FigButton);
|
|
918
918
|
|
|
919
|
-
/**
|
|
920
|
-
* A full-width secondary button for opening a property editor or flyout.
|
|
921
|
-
* @attr {string} icon - Optional fig-icon name shown before the button label.
|
|
922
|
-
* Author a custom child with slot="prepend" instead when needed.
|
|
923
|
-
* @attr {boolean} disabled - Whether the trigger is disabled.
|
|
924
|
-
*/
|
|
925
|
-
class FigPropertyButton extends FigButton {
|
|
926
|
-
#syncingContract = false;
|
|
927
|
-
|
|
928
|
-
static get observedAttributes() {
|
|
929
|
-
return [
|
|
930
|
-
...super.observedAttributes,
|
|
931
|
-
"icon",
|
|
932
|
-
"variant",
|
|
933
|
-
"full",
|
|
934
|
-
"align",
|
|
935
|
-
];
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
connectedCallback() {
|
|
939
|
-
this.#enforceContract();
|
|
940
|
-
super.connectedCallback();
|
|
941
|
-
this.#syncIcon();
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
get icon() {
|
|
945
|
-
return this.getAttribute("icon") || "";
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
set icon(value) {
|
|
949
|
-
if (value === null || value === undefined || value === "") {
|
|
950
|
-
this.removeAttribute("icon");
|
|
951
|
-
} else {
|
|
952
|
-
this.setAttribute("icon", String(value));
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
#enforceContract() {
|
|
957
|
-
if (this.#syncingContract) return;
|
|
958
|
-
this.#syncingContract = true;
|
|
959
|
-
if (this.getAttribute("variant") !== "secondary") {
|
|
960
|
-
this.setAttribute("variant", "secondary");
|
|
961
|
-
}
|
|
962
|
-
if (!this.hasAttribute("full") || this.getAttribute("full") === "false") {
|
|
963
|
-
this.setAttribute("full", "");
|
|
964
|
-
}
|
|
965
|
-
if (this.getAttribute("align") !== "start") {
|
|
966
|
-
this.setAttribute("align", "start");
|
|
967
|
-
}
|
|
968
|
-
this.#syncingContract = false;
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
#syncIcon() {
|
|
972
|
-
const generated = Array.from(
|
|
973
|
-
this.querySelectorAll(
|
|
974
|
-
':scope > fig-icon[slot="prepend"][data-generated="property-button-icon"]',
|
|
975
|
-
),
|
|
976
|
-
);
|
|
977
|
-
const authoredPrepend = this.querySelector(
|
|
978
|
-
':scope > [slot="prepend"]:not([data-generated="property-button-icon"])',
|
|
979
|
-
);
|
|
980
|
-
if (authoredPrepend) {
|
|
981
|
-
generated.forEach((icon) => icon.remove());
|
|
982
|
-
return;
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
const iconName = this.icon.trim();
|
|
986
|
-
if (!iconName) {
|
|
987
|
-
generated.forEach((icon) => icon.remove());
|
|
988
|
-
return;
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
let icon = generated.shift();
|
|
992
|
-
generated.forEach((duplicate) => duplicate.remove());
|
|
993
|
-
if (!icon) {
|
|
994
|
-
icon = createFigIcon(iconName);
|
|
995
|
-
icon.setAttribute("slot", "prepend");
|
|
996
|
-
icon.setAttribute("data-generated", "property-button-icon");
|
|
997
|
-
this.prepend(icon);
|
|
998
|
-
} else if (icon.getAttribute("name") !== iconName) {
|
|
999
|
-
icon.setAttribute("name", iconName);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
1004
|
-
if (oldValue === newValue) return;
|
|
1005
|
-
if (name === "icon") {
|
|
1006
|
-
this.#syncIcon();
|
|
1007
|
-
return;
|
|
1008
|
-
}
|
|
1009
|
-
if (name === "variant" || name === "full" || name === "align") {
|
|
1010
|
-
this.#enforceContract();
|
|
1011
|
-
return;
|
|
1012
|
-
}
|
|
1013
|
-
super.attributeChangedCallback(name, oldValue, newValue);
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
figDefineElement("fig-property-button", FigPropertyButton);
|
|
1017
|
-
|
|
1018
919
|
/**
|
|
1019
920
|
* A custom dropdown/select element.
|
|
1020
921
|
* @attr {string} type - The dropdown type: "select" (default) or "dropdown"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rogieking/figui3",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "A lightweight web components library for building Figma plugin and widget UIs with native look and feel",
|
|
5
5
|
"author": "Rogie King",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|