@povio/ui 5.0.0-rc.6 → 5.0.0-rc.8
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/Button-BPTvffuk.js +86 -0
- package/dist/{Calendar-BTjajO6i.js → Calendar-BxtOuqIM.js} +3 -3
- package/dist/{Checkbox-CV1ILXXO.js → Checkbox-DYxXYfKL.js} +3 -2
- package/dist/CheckboxCheckmark-D_uc9pon.js +44 -0
- package/dist/{ComponentGallery-C2tjrHWn.js → ComponentGallery-Da70Y4_Q.js} +19 -178
- package/dist/{DatePicker-DOLL7mkc.js → DatePicker-wulRNGyL.js} +6 -6
- package/dist/{DatePickerInput-BLBcySA2.js → DatePickerInput-BB_vPlKu.js} +3 -3
- package/dist/{DateRangePicker-BF-1CztH.js → DateRangePicker-B0tMVREG.js} +6 -6
- package/dist/{DateTimePicker-Cj0qvJUz.js → DateTimePicker-WGMr0bEH.js} +6 -6
- package/dist/{FileInput-Br5DQaGQ.js → FileInput-DP105Iy9.js} +2 -2
- package/dist/{FileUpload--7ub3EZO.js → FileUpload-CgNDIvzg.js} +3 -3
- package/dist/{Form-BJ12MjE-.d.ts → Form-DbEWnCKc.d.ts} +1 -1
- package/dist/{FormField-B99dLt8o.js → FormField-AY25LzbW.js} +3 -96
- package/dist/{FormFieldError-DeOHHLo2.js → FormFieldError-BVAO5p7H.js} +2 -13
- package/dist/{InputItem-CIxbTxZu.js → InputItem-ZeN-aIz8.js} +11 -11
- package/dist/{Inputs-DJSKiaWY.js → Inputs-BC5q5Cvj.js} +1 -1
- package/dist/{Inputs-DA73LmLc.d.ts → Inputs-O84btFJL.d.ts} +1 -1
- package/dist/{NumberRangeInput-B8-LHfg3.js → NumberRangeInput-B_sMIpP1.js} +2 -2
- package/dist/{PaginationList-DtvuP63b.js → PaginationList-DptMNpNs.js} +1 -1
- package/dist/{Progress-B3mY9rIP.js → Progress-Du30L4_s.js} +2 -27
- package/dist/{RadioGroup-DOw3PRoX.js → RadioGroup-CUGNSJql.js} +3 -82
- package/dist/{RichTextEditor-D4yN7Wj7.js → RichTextEditor-VDOpj7sk.js} +3 -3
- package/dist/{Select-UR0ec2Ux.js → Select-B2pAfwRk.js} +2 -2
- package/dist/{Slider-CzEmKYBF.js → Slider-Clc1szFY.js} +1 -1
- package/dist/{Switch-CqnGEdeD.js → Switch-CimmMqEk.js} +3 -27
- package/dist/{Table-BN2_J_Ne.js → Table-CqepqSfe.js} +2 -1
- package/dist/{TextArea-D8WkKsGn.js → TextArea-B3teIhsJ.js} +3 -5
- package/dist/TextArea.cva-Bb73hriz.js +5 -0
- package/dist/{TimePicker-C4taAOFQ.js → TimePicker-CU_yL2sY.js} +4 -4
- package/dist/{Toast-DtG3pA61.js → Toast-DPbnLlBi.js} +1 -1
- package/dist/{ToggleGroup-DOk27fgI.js → ToggleGroup-BULVwErp.js} +1 -1
- package/dist/{Button-C5rv4Cr2.js → button.cva-rv5Uq4aW.js} +1 -84
- package/dist/{CheckboxCheckmark-CpC3wlMs.js → checkbox.cva-IfOByVLA.js} +1 -42
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/alert.js +116 -1
- package/dist/components/autocomplete.js +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/checkbox-group.js +3 -3
- package/dist/components/checkbox.js +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/date-time-picker.js +1 -1
- package/dist/components/file-input.js +1 -1
- package/dist/components/file-upload-container.js +1 -1
- package/dist/components/file-upload.js +1 -1
- package/dist/components/form-field.js +1 -1
- package/dist/components/icon-button.js +1 -1
- package/dist/components/inline-icon-button.js +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/number-field.js +3 -3
- package/dist/components/number-range-input.js +1 -1
- package/dist/components/pagination-list.js +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/progress.js +1 -1
- package/dist/components/query-autocomplete.js +1 -1
- package/dist/components/query-select.js +2 -2
- package/dist/components/radio-group.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/slider.js +1 -1
- package/dist/components/split-button.js +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/tag.js +93 -1
- package/dist/components/text-area.js +1 -1
- package/dist/components/text-button.js +1 -1
- package/dist/components/time-picker.js +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/components/toggle-button.js +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/use-toast.js +2 -2
- package/dist/config/app-canvas.d.ts +79 -0
- package/dist/config/app-canvas.js +2253 -0
- package/dist/config/ui-config.d.ts +1 -1
- package/dist/config/ui-configurator.d.ts +1 -920
- package/dist/config/ui-configurator.js +457 -466
- package/dist/configuration.context-f_FSPWhQ.d.ts +926 -0
- package/dist/{datePickerValue.utils-DCgoSrP3.js → datePickerValue.utils-CIFHjKwv.js} +1 -1
- package/dist/{dynamicInputs-iP39lVKf.d.ts → dynamicInputs-ByVMnx4Z.d.ts} +1 -1
- package/dist/formFieldError.cva-CsXaQRHX.js +14 -0
- package/dist/formFieldHelper.cva-B8F9LmsE.js +96 -0
- package/dist/grip-vertical-BVxcjdfr.js +54 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +24 -19
- package/dist/inspection-model-LuI36xTg.js +1339 -0
- package/dist/progress.cva-WQB8BGbk.js +28 -0
- package/dist/radio.cva-DGbvTymp.js +82 -0
- package/dist/rhf/checkbox.js +1 -1
- package/dist/rhf/date-picker.js +1 -1
- package/dist/rhf/date-range-picker.js +1 -1
- package/dist/rhf/date-time-picker.js +1 -1
- package/dist/rhf/file-input.js +1 -1
- package/dist/rhf/file-upload.js +1 -1
- package/dist/rhf/inputs.d.ts +1 -1
- package/dist/rhf/number-range-input.js +1 -1
- package/dist/rhf/radio-group.js +1 -1
- package/dist/rhf/rich-text-editor.js +1 -1
- package/dist/rhf/select.js +1 -1
- package/dist/rhf/slider.js +1 -1
- package/dist/rhf/switch.js +1 -1
- package/dist/rhf/text-area.js +1 -1
- package/dist/rhf/time-picker.js +1 -1
- package/dist/rhf/toggle-group.js +1 -1
- package/dist/rhf.d.ts +2 -2
- package/dist/rhf.js +24 -19
- package/dist/rich-text-editor.js +1 -1
- package/dist/{staticDateTimeSegments-DtU63_dw.js → staticDateTimeSegments-sf_ND7zL.js} +1 -1
- package/dist/{staticSelect.utils-uHa8f_c6.js → staticSelect.utils-CzlnLPPd.js} +3 -3
- package/dist/status.cva-6HxNR4EP.js +130 -0
- package/dist/styles/app-canvas.css +733 -0
- package/dist/styles/configurator.css +570 -6
- package/dist/switch.cva-BX3HOxbL.js +27 -0
- package/dist/{table.cva-D5oQ-QvA.js → table.cva-DlMT-zLD.js} +1 -54
- package/dist/{Tag-DPg5sL1Z.js → tag.cva-B3MudLeC.js} +1 -92
- package/dist/tanstack/checkbox.js +1 -1
- package/dist/tanstack/date-picker.js +1 -1
- package/dist/tanstack/date-range-picker.js +1 -1
- package/dist/tanstack/date-time-picker.js +1 -1
- package/dist/tanstack/file-input.js +1 -1
- package/dist/tanstack/file-upload.js +1 -1
- package/dist/tanstack/form.d.ts +1 -1
- package/dist/tanstack/form.js +1 -1
- package/dist/tanstack/inputs.d.ts +2 -2
- package/dist/tanstack/inputs.js +1 -1
- package/dist/tanstack/number-range-input.js +1 -1
- package/dist/tanstack/radio-group.js +1 -1
- package/dist/tanstack/rich-text-editor.js +1 -1
- package/dist/tanstack/select.js +1 -1
- package/dist/tanstack/slider.js +1 -1
- package/dist/tanstack/switch.js +1 -1
- package/dist/tanstack/table.js +2 -2
- package/dist/tanstack/text-area.js +1 -1
- package/dist/tanstack/time-picker.js +1 -1
- package/dist/tanstack/toggle-group.js +1 -1
- package/dist/tanstack.d.ts +4 -4
- package/dist/tanstack.js +39 -31
- package/dist/{toast.runtime-cxex9e4E.js → toast.runtime-Zf-XyAC3.js} +1 -1
- package/dist/{useFieldAccessibility-ScC6Mtd5.js → useFieldAccessibility-CcBTgGfm.js} +1 -1
- package/dist/{useFormAutosave-DfuP7drj.js → useFormAutosave-BD_TFqDF.js} +1 -1
- package/dist/{useStaticInputHandoff-NeZVnci-.js → useStaticInputHandoff-kkQrc6DA.js} +1 -1
- package/dist/{useTableColumnConfig-Di0_w80v.js → useTableColumnConfig-aVUWC2Mp.js} +2 -2
- package/package.json +7 -1
- package/src/configurator/README.md +1 -1
- package/dist/Alert-CnvEb1D_.js +0 -244
|
@@ -0,0 +1,1339 @@
|
|
|
1
|
+
import { t as createLucideIcon } from "./createLucideIcon-LcezOE4z.js";
|
|
2
|
+
import { t as UIConfig } from "./uiConfig.context-BS3r_kTS.js";
|
|
3
|
+
import { n as selectListBoxItemDefinition, r as selectInputTagsContentWrapperDefinition, t as selectPopoverDefinition } from "./selectDesktop.cva-CHAMxhfO.js";
|
|
4
|
+
import { t as clsx } from "./clsx-CnD0nOiA.js";
|
|
5
|
+
import { n as StyleMergeUtils, t as UIOverrides } from "./uiOverrides.context-BTCH9y5a.js";
|
|
6
|
+
import { a as breadcrumbsDefinition, i as breadcrumbSegmentDefinition, n as breadcrumbIconDefinition, r as breadcrumbItemDefinition, t as breadcrumbChevronDefinition } from "./breadcrumbs.cva-7zzdDhVR.js";
|
|
7
|
+
import { i as menuPopoverWrapperDefinition, n as menuItemDefinition, r as menuPopoverDefinition, t as dropdownMenuDefinition } from "./dropdownMenu.cva-DvEmX0bs.js";
|
|
8
|
+
import { i as tooltipTextDefinition, n as tooltipPointerHorizontalDefinition, r as tooltipPointerVerticalDefinition, t as tooltipDefinition } from "./tooltip.cva-BIzlOXHH.js";
|
|
9
|
+
import { t as typographyDefinition } from "./typography.cva-iD15k56p.js";
|
|
10
|
+
import { i as buttonSizeDefinition, n as buttonDefinition, r as buttonIconSizeDefinition, t as buttonContentDefinition } from "./button.cva-rv5Uq4aW.js";
|
|
11
|
+
import { r as badgeButtonDefinition } from "./badgeButton.cva-CvN4CTx5.js";
|
|
12
|
+
import { t as formFieldErrorDefinition } from "./formFieldError.cva-CsXaQRHX.js";
|
|
13
|
+
import { i as formFieldHeaderDefinition, n as labelDefinition, t as formFieldHelperDefinition } from "./formFieldHelper.cva-B8F9LmsE.js";
|
|
14
|
+
import { t as tagDefinition } from "./tag.cva-B3MudLeC.js";
|
|
15
|
+
import { a as inputSizeDefinition, i as inputSideDefinition, n as inputClearClassDefinition, r as inputContentWrapperDefinition, t as inputBaseDefinition } from "./input.cva-DJA8ovm_.js";
|
|
16
|
+
import { a as checkboxGroupLabelDefinition, i as checkboxDefinition, n as checkboxContentRowDefinition, o as checkboxIconDefinition, r as checkboxContentWrapperDefinition } from "./checkbox.cva-IfOByVLA.js";
|
|
17
|
+
import { t as popoverDefinition } from "./popover.cva-Bhud1wnp.js";
|
|
18
|
+
import { t as datePickerInputContentRowDefinition } from "./datePickerInput.cva-Cd7UUN61.js";
|
|
19
|
+
import { n as switchDefinition } from "./switch.cva-BX3HOxbL.js";
|
|
20
|
+
import { a as progressValueDefinition, i as progressTrackWrapperDefinition, n as progressFillDefinition, r as progressTrackDefinition, t as progressDefinition } from "./progress.cva-WQB8BGbk.js";
|
|
21
|
+
import { t as fileUploadDropZoneDefinition } from "./fileUpload.cva-ujmStxB1.js";
|
|
22
|
+
import { i as radioDefinition, n as radioContentRowDefinition, r as radioContentWrapperDefinition } from "./radio.cva-DGbvTymp.js";
|
|
23
|
+
import { n as toggleGroupItemDefinition, t as toggleGroupDefinition } from "./toggleGroup.cva-MbpaEBg1.js";
|
|
24
|
+
import { t as textAreaWrapperDefinition } from "./TextArea.cva-Bb73hriz.js";
|
|
25
|
+
import { a as accordionHeadingTitleDefinition, c as accordionPanelContentDefinition, i as accordionHeadingSubtitleDefinition, l as accordionPanelDefinition, n as accordionDefinition, o as accordionIconDefinition, r as accordionHeadingDefinition, s as accordionItemDefinition, t as accordionChevronDefinition, u as accordionTriggerDefinition } from "./accordion.cva-CL1bVscW.js";
|
|
26
|
+
import { a as stepperSeparatorDefinition, i as stepperNumberDefinition, n as stepperIconDefinition, o as stepperSubtextDefinition, r as stepperItemDefinition, s as stepperTitleDefinition, t as stepperDefinition } from "./stepper.cva-CZ0Kj-s7.js";
|
|
27
|
+
import { i as dialogOverlayDefinition, n as dialogMainDefinition, t as dialogContentDefinition } from "./dialog.cva-COhDZaVl.js";
|
|
28
|
+
import { n as statusSeparatorDefinition, r as alertDefinition, t as statusIconDefinition } from "./status.cva-6HxNR4EP.js";
|
|
29
|
+
import { a as toastDefinition, i as toastContainerDefinition } from "./toast.cva-C_L_RffH.js";
|
|
30
|
+
import { a as tableHeaderTextDefinition, i as tableHeadRowDefinition, n as tableDataDefinition, o as tableRowDefinition, r as tableHeadDataDefinition, s as theadDefinition, t as tableCellTextDefinition } from "./table.cva-DlMT-zLD.js";
|
|
31
|
+
import { t as linkDefinition } from "./link.cva-DMTHZiJG.js";
|
|
32
|
+
import { t as tooltipWrapperTriggerDefinition } from "./tooltipWrapper.cva-BBQ4ic3D.js";
|
|
33
|
+
import { r as emptyTheme, y as runtimeCss } from "./theme-model-DtYPxNvH.js";
|
|
34
|
+
import { createContext, use, useState } from "react";
|
|
35
|
+
import { c } from "react/compiler-runtime";
|
|
36
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
37
|
+
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/moon.mjs
|
|
38
|
+
/**
|
|
39
|
+
* @license lucide-react v1.43.0 - ISC
|
|
40
|
+
*
|
|
41
|
+
* This source code is licensed under the ISC license.
|
|
42
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
43
|
+
*/
|
|
44
|
+
const __iconData$2 = {
|
|
45
|
+
name: "moon",
|
|
46
|
+
size: 24,
|
|
47
|
+
node: [["path", {
|
|
48
|
+
d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",
|
|
49
|
+
key: "kfwtm"
|
|
50
|
+
}]]
|
|
51
|
+
};
|
|
52
|
+
__iconData$2.node;
|
|
53
|
+
const Moon = createLucideIcon(__iconData$2);
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/pin.mjs
|
|
56
|
+
/**
|
|
57
|
+
* @license lucide-react v1.43.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/
|
|
62
|
+
const __iconData$1 = {
|
|
63
|
+
name: "pin",
|
|
64
|
+
size: 24,
|
|
65
|
+
node: [["path", {
|
|
66
|
+
d: "M12 17v5",
|
|
67
|
+
key: "bb1du9"
|
|
68
|
+
}], ["path", {
|
|
69
|
+
d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",
|
|
70
|
+
key: "1nkz8b"
|
|
71
|
+
}]]
|
|
72
|
+
};
|
|
73
|
+
__iconData$1.node;
|
|
74
|
+
const Pin = createLucideIcon(__iconData$1);
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/sun.mjs
|
|
77
|
+
/**
|
|
78
|
+
* @license lucide-react v1.43.0 - ISC
|
|
79
|
+
*
|
|
80
|
+
* This source code is licensed under the ISC license.
|
|
81
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
+
*/
|
|
83
|
+
const __iconData = {
|
|
84
|
+
name: "sun",
|
|
85
|
+
size: 24,
|
|
86
|
+
node: [
|
|
87
|
+
["circle", {
|
|
88
|
+
cx: "12",
|
|
89
|
+
cy: "12",
|
|
90
|
+
r: "4",
|
|
91
|
+
key: "4exip2"
|
|
92
|
+
}],
|
|
93
|
+
["path", {
|
|
94
|
+
d: "M12 2v2",
|
|
95
|
+
key: "tus03m"
|
|
96
|
+
}],
|
|
97
|
+
["path", {
|
|
98
|
+
d: "M12 20v2",
|
|
99
|
+
key: "1lh1kg"
|
|
100
|
+
}],
|
|
101
|
+
["path", {
|
|
102
|
+
d: "m4.93 4.93 1.41 1.41",
|
|
103
|
+
key: "149t6j"
|
|
104
|
+
}],
|
|
105
|
+
["path", {
|
|
106
|
+
d: "m17.66 17.66 1.41 1.41",
|
|
107
|
+
key: "ptbguv"
|
|
108
|
+
}],
|
|
109
|
+
["path", {
|
|
110
|
+
d: "M2 12h2",
|
|
111
|
+
key: "1t8f8n"
|
|
112
|
+
}],
|
|
113
|
+
["path", {
|
|
114
|
+
d: "M20 12h2",
|
|
115
|
+
key: "1q8mjw"
|
|
116
|
+
}],
|
|
117
|
+
["path", {
|
|
118
|
+
d: "m6.34 17.66-1.41 1.41",
|
|
119
|
+
key: "1m8zz5"
|
|
120
|
+
}],
|
|
121
|
+
["path", {
|
|
122
|
+
d: "m19.07 4.93-1.41 1.41",
|
|
123
|
+
key: "1shlcs"
|
|
124
|
+
}]
|
|
125
|
+
]
|
|
126
|
+
};
|
|
127
|
+
__iconData.node;
|
|
128
|
+
const Sun = createLucideIcon(__iconData);
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/configurator/cva-definitions.ts
|
|
131
|
+
const cvaDefinitions = {
|
|
132
|
+
"datePickerInput.contentRowCva": datePickerInputContentRowDefinition,
|
|
133
|
+
"select.tagsContentWrapperCva": selectInputTagsContentWrapperDefinition,
|
|
134
|
+
"tooltip.pointerHorizontalCva": tooltipPointerHorizontalDefinition,
|
|
135
|
+
"accordion.chevronCva": accordionChevronDefinition,
|
|
136
|
+
"accordion.cva": accordionDefinition,
|
|
137
|
+
"accordion.headingCva": accordionHeadingDefinition,
|
|
138
|
+
"accordion.headingSubtitleCva": accordionHeadingSubtitleDefinition,
|
|
139
|
+
"accordion.headingTitleCva": accordionHeadingTitleDefinition,
|
|
140
|
+
"accordion.iconCva": accordionIconDefinition,
|
|
141
|
+
"accordion.itemCva": accordionItemDefinition,
|
|
142
|
+
"accordion.panelContentCva": accordionPanelContentDefinition,
|
|
143
|
+
"accordion.panelCva": accordionPanelDefinition,
|
|
144
|
+
"accordion.triggerCva": accordionTriggerDefinition,
|
|
145
|
+
"alert.cva": alertDefinition,
|
|
146
|
+
"breadcrumbs.chevronCva": breadcrumbChevronDefinition,
|
|
147
|
+
"breadcrumbs.cva": breadcrumbsDefinition,
|
|
148
|
+
"breadcrumbs.iconCva": breadcrumbIconDefinition,
|
|
149
|
+
"breadcrumbs.itemCva": breadcrumbItemDefinition,
|
|
150
|
+
"breadcrumbs.segmentCva": breadcrumbSegmentDefinition,
|
|
151
|
+
"button.contentCva": buttonContentDefinition,
|
|
152
|
+
"button.cva": buttonDefinition,
|
|
153
|
+
"button.iconSize": buttonIconSizeDefinition,
|
|
154
|
+
"button.sizeCva": buttonSizeDefinition,
|
|
155
|
+
"checkbox.contentRowCva": checkboxContentRowDefinition,
|
|
156
|
+
"checkbox.contentWrapperCva": checkboxContentWrapperDefinition,
|
|
157
|
+
"checkbox.cva": checkboxDefinition,
|
|
158
|
+
"checkbox.groupLabelCva": checkboxGroupLabelDefinition,
|
|
159
|
+
"checkbox.iconCva": checkboxIconDefinition,
|
|
160
|
+
"dialog.contentCva": dialogContentDefinition,
|
|
161
|
+
"dialog.mainCva": dialogMainDefinition,
|
|
162
|
+
"dialog.overlayCva": dialogOverlayDefinition,
|
|
163
|
+
"dropdownMenu.cva": dropdownMenuDefinition,
|
|
164
|
+
"dropdownMenu.itemCva": menuItemDefinition,
|
|
165
|
+
"dropdownMenu.popoverCva": menuPopoverDefinition,
|
|
166
|
+
"dropdownMenu.popoverWrapperCva": menuPopoverWrapperDefinition,
|
|
167
|
+
"fileUpload.dropZoneCva": fileUploadDropZoneDefinition,
|
|
168
|
+
"formField.errorLabelCva": formFieldErrorDefinition,
|
|
169
|
+
"formField.headerCva": formFieldHeaderDefinition,
|
|
170
|
+
"formField.helperLabelCva": formFieldHelperDefinition,
|
|
171
|
+
"input.baseCva": inputBaseDefinition,
|
|
172
|
+
"input.clearClassCva": inputClearClassDefinition,
|
|
173
|
+
"input.contentWrapperCva": inputContentWrapperDefinition,
|
|
174
|
+
"input.sideCva": inputSideDefinition,
|
|
175
|
+
"input.sizeCva": inputSizeDefinition,
|
|
176
|
+
"label.cva": labelDefinition,
|
|
177
|
+
"link.cva": linkDefinition,
|
|
178
|
+
"badgeButton.cva": badgeButtonDefinition,
|
|
179
|
+
"popover.cva": popoverDefinition,
|
|
180
|
+
"progress.cva": progressDefinition,
|
|
181
|
+
"progress.fillCva": progressFillDefinition,
|
|
182
|
+
"progress.trackCva": progressTrackDefinition,
|
|
183
|
+
"progress.trackWrapperCva": progressTrackWrapperDefinition,
|
|
184
|
+
"progress.valueCva": progressValueDefinition,
|
|
185
|
+
"radio.contentRowCva": radioContentRowDefinition,
|
|
186
|
+
"radio.contentWrapperCva": radioContentWrapperDefinition,
|
|
187
|
+
"radio.cva": radioDefinition,
|
|
188
|
+
"select.listBoxItemCva": selectListBoxItemDefinition,
|
|
189
|
+
"select.popoverCva": selectPopoverDefinition,
|
|
190
|
+
"status.iconCva": statusIconDefinition,
|
|
191
|
+
"status.separatorCva": statusSeparatorDefinition,
|
|
192
|
+
"stepper.cva": stepperDefinition,
|
|
193
|
+
"stepper.iconCva": stepperIconDefinition,
|
|
194
|
+
"stepper.itemCva": stepperItemDefinition,
|
|
195
|
+
"stepper.numberCva": stepperNumberDefinition,
|
|
196
|
+
"stepper.separatorCva": stepperSeparatorDefinition,
|
|
197
|
+
"stepper.subtextCva": stepperSubtextDefinition,
|
|
198
|
+
"stepper.titleCva": stepperTitleDefinition,
|
|
199
|
+
"switch.cva": switchDefinition,
|
|
200
|
+
"table.cellTextCva": tableCellTextDefinition,
|
|
201
|
+
"table.dataCva": tableDataDefinition,
|
|
202
|
+
"table.headDataCva": tableHeadDataDefinition,
|
|
203
|
+
"table.headRowCva": tableHeadRowDefinition,
|
|
204
|
+
"table.headerTextCva": tableHeaderTextDefinition,
|
|
205
|
+
"table.rowCva": tableRowDefinition,
|
|
206
|
+
"table.theadCva": theadDefinition,
|
|
207
|
+
"tag.cva": tagDefinition,
|
|
208
|
+
"textArea.wrapperCva": textAreaWrapperDefinition,
|
|
209
|
+
"toast.containerCva": toastContainerDefinition,
|
|
210
|
+
"toast.cva": toastDefinition,
|
|
211
|
+
"toggleGroup.cva": toggleGroupDefinition,
|
|
212
|
+
"toggleGroup.itemCva": toggleGroupItemDefinition,
|
|
213
|
+
"tooltip.cva": tooltipDefinition,
|
|
214
|
+
"tooltip.pointerVerticalCva": tooltipPointerVerticalDefinition,
|
|
215
|
+
"tooltip.textCva": tooltipTextDefinition,
|
|
216
|
+
"tooltipWrapper.triggerCva": tooltipWrapperTriggerDefinition,
|
|
217
|
+
"typography.cva": typographyDefinition
|
|
218
|
+
};
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/configurator/cva-model.ts
|
|
221
|
+
function resolveCvaDefinition(slot, inherited) {
|
|
222
|
+
const [component, part] = slot.split(".");
|
|
223
|
+
const override = (inherited?.[component])?.[part];
|
|
224
|
+
if (typeof override === "function") return null;
|
|
225
|
+
const fallback = cvaDefinitions[slot];
|
|
226
|
+
const definition = override && typeof override === "object" && "mode" in override ? StyleMergeUtils.mergeCvaDefinition(fallback, override) : fallback;
|
|
227
|
+
const config = definition.config;
|
|
228
|
+
return {
|
|
229
|
+
base: [...definition.base],
|
|
230
|
+
config: {
|
|
231
|
+
variants: Object.fromEntries(Object.entries(config?.variants ?? {}).map(([name, options]) => [name, Object.fromEntries(Object.entries(options).map(([value, classes]) => [value, clsx(classes)]))])),
|
|
232
|
+
defaultVariants: config?.defaultVariants ?? {},
|
|
233
|
+
compoundVariants: (config?.compoundVariants ?? []).map(({ class: classes, className, ...selectors }) => Object.assign(selectors, { className: clsx(classes, className) }))
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function applyCvaEdits(inherited, edits = {}) {
|
|
238
|
+
const result = { ...inherited };
|
|
239
|
+
for (const [slot, definition] of Object.entries(edits)) {
|
|
240
|
+
const [component, part] = slot.split(".");
|
|
241
|
+
const key = component;
|
|
242
|
+
result[key] = {
|
|
243
|
+
...result[key],
|
|
244
|
+
[part]: {
|
|
245
|
+
mode: "overrideCva",
|
|
246
|
+
...definition
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
252
|
+
function exportCvaEdits(edits = {}) {
|
|
253
|
+
const overrides = applyCvaEdits(void 0, edits);
|
|
254
|
+
const components = Object.keys(overrides).map((name) => ` ${name}: { ...existing.${name}, ...edited.${name} },`).join("\n");
|
|
255
|
+
return `import { UIOverrides } from "@povio/ui/ui-overrides";\n\nconst edited = ${JSON.stringify(overrides, null, 2)} satisfies UIOverrides.Config;\n\nexport function withUIOverrides(existing: UIOverrides.Config = {}): UIOverrides.Config {\n return {\n ...existing,\n${components}\n };\n}\n\n// <UIOverrides.Provider config={withUIOverrides(appOverrides)}>{children}</UIOverrides.Provider>\n`;
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/configurator/configuration.context.tsx
|
|
259
|
+
const emptyConfiguration = () => ({
|
|
260
|
+
theme: emptyTheme(),
|
|
261
|
+
config: {}
|
|
262
|
+
});
|
|
263
|
+
const ConfigurationContext = createContext(null);
|
|
264
|
+
function UIConfigurationProvider(t0) {
|
|
265
|
+
const $ = c(40);
|
|
266
|
+
const { defaults, initialValue, onApply, children } = t0;
|
|
267
|
+
const inheritedOverrides = UIOverrides.useConfig();
|
|
268
|
+
const [applied, setApplied] = useState(initialValue ?? emptyConfiguration);
|
|
269
|
+
const [draft, setDraft] = useState(applied);
|
|
270
|
+
const [isOpen, setOpen] = useState(false);
|
|
271
|
+
const [floating, setFloating] = useState(false);
|
|
272
|
+
const [revision, setRevision] = useState(0);
|
|
273
|
+
const [previewConfiguration, setPreviewConfiguration] = useState(null);
|
|
274
|
+
const active = previewConfiguration ?? (isOpen ? draft : applied);
|
|
275
|
+
let t1;
|
|
276
|
+
if ($[0] !== applied) {
|
|
277
|
+
t1 = () => {
|
|
278
|
+
setFloating(false);
|
|
279
|
+
setDraft(structuredClone(applied));
|
|
280
|
+
setRevision(_temp$1);
|
|
281
|
+
setOpen(true);
|
|
282
|
+
};
|
|
283
|
+
$[0] = applied;
|
|
284
|
+
$[1] = t1;
|
|
285
|
+
} else t1 = $[1];
|
|
286
|
+
const open = t1;
|
|
287
|
+
let t2;
|
|
288
|
+
if ($[2] !== isOpen || $[3] !== open) {
|
|
289
|
+
t2 = () => {
|
|
290
|
+
if (isOpen) setRevision(_temp2$1);
|
|
291
|
+
else open();
|
|
292
|
+
setFloating(true);
|
|
293
|
+
};
|
|
294
|
+
$[2] = isOpen;
|
|
295
|
+
$[3] = open;
|
|
296
|
+
$[4] = t2;
|
|
297
|
+
} else t2 = $[4];
|
|
298
|
+
const openFloating = t2;
|
|
299
|
+
let t3;
|
|
300
|
+
if ($[5] !== applied) {
|
|
301
|
+
t3 = () => {
|
|
302
|
+
setDraft(structuredClone(applied));
|
|
303
|
+
setOpen(false);
|
|
304
|
+
};
|
|
305
|
+
$[5] = applied;
|
|
306
|
+
$[6] = t3;
|
|
307
|
+
} else t3 = $[6];
|
|
308
|
+
const cancel = t3;
|
|
309
|
+
let t4;
|
|
310
|
+
if ($[7] !== draft || $[8] !== onApply) {
|
|
311
|
+
t4 = () => {
|
|
312
|
+
onApply?.(structuredClone(draft));
|
|
313
|
+
setApplied(structuredClone(draft));
|
|
314
|
+
setOpen(false);
|
|
315
|
+
};
|
|
316
|
+
$[7] = draft;
|
|
317
|
+
$[8] = onApply;
|
|
318
|
+
$[9] = t4;
|
|
319
|
+
} else t4 = $[9];
|
|
320
|
+
const apply = t4;
|
|
321
|
+
let t5;
|
|
322
|
+
if ($[10] !== active.overrides || $[11] !== inheritedOverrides) {
|
|
323
|
+
t5 = applyCvaEdits(inheritedOverrides, active.overrides);
|
|
324
|
+
$[10] = active.overrides;
|
|
325
|
+
$[11] = inheritedOverrides;
|
|
326
|
+
$[12] = t5;
|
|
327
|
+
} else t5 = $[12];
|
|
328
|
+
const overrides = t5;
|
|
329
|
+
let t6;
|
|
330
|
+
if ($[13] !== active || $[14] !== apply || $[15] !== cancel || $[16] !== defaults || $[17] !== draft || $[18] !== floating || $[19] !== inheritedOverrides || $[20] !== isOpen || $[21] !== open || $[22] !== openFloating || $[23] !== revision) {
|
|
331
|
+
t6 = {
|
|
332
|
+
defaults,
|
|
333
|
+
inheritedOverrides,
|
|
334
|
+
draft,
|
|
335
|
+
active,
|
|
336
|
+
setPreviewConfiguration,
|
|
337
|
+
setDraft,
|
|
338
|
+
isOpen,
|
|
339
|
+
open,
|
|
340
|
+
openFloating,
|
|
341
|
+
floating,
|
|
342
|
+
cancel,
|
|
343
|
+
apply,
|
|
344
|
+
revision
|
|
345
|
+
};
|
|
346
|
+
$[13] = active;
|
|
347
|
+
$[14] = apply;
|
|
348
|
+
$[15] = cancel;
|
|
349
|
+
$[16] = defaults;
|
|
350
|
+
$[17] = draft;
|
|
351
|
+
$[18] = floating;
|
|
352
|
+
$[19] = inheritedOverrides;
|
|
353
|
+
$[20] = isOpen;
|
|
354
|
+
$[21] = open;
|
|
355
|
+
$[22] = openFloating;
|
|
356
|
+
$[23] = revision;
|
|
357
|
+
$[24] = t6;
|
|
358
|
+
} else t6 = $[24];
|
|
359
|
+
const contextValue = t6;
|
|
360
|
+
let t7;
|
|
361
|
+
if ($[25] !== active.theme || $[26] !== defaults) {
|
|
362
|
+
t7 = runtimeCss(defaults, active.theme);
|
|
363
|
+
$[25] = active.theme;
|
|
364
|
+
$[26] = defaults;
|
|
365
|
+
$[27] = t7;
|
|
366
|
+
} else t7 = $[27];
|
|
367
|
+
let t8;
|
|
368
|
+
if ($[28] !== t7) {
|
|
369
|
+
t8 = /* @__PURE__ */ jsx("style", {
|
|
370
|
+
"data-povio-ui-configuration": true,
|
|
371
|
+
children: t7
|
|
372
|
+
});
|
|
373
|
+
$[28] = t7;
|
|
374
|
+
$[29] = t8;
|
|
375
|
+
} else t8 = $[29];
|
|
376
|
+
let t9;
|
|
377
|
+
if ($[30] !== active.config || $[31] !== children) {
|
|
378
|
+
t9 = /* @__PURE__ */ jsx(UIConfig.Provider, {
|
|
379
|
+
config: active.config,
|
|
380
|
+
children
|
|
381
|
+
});
|
|
382
|
+
$[30] = active.config;
|
|
383
|
+
$[31] = children;
|
|
384
|
+
$[32] = t9;
|
|
385
|
+
} else t9 = $[32];
|
|
386
|
+
let t10;
|
|
387
|
+
if ($[33] !== overrides || $[34] !== t9) {
|
|
388
|
+
t10 = /* @__PURE__ */ jsx(UIOverrides.Provider, {
|
|
389
|
+
config: overrides,
|
|
390
|
+
children: t9
|
|
391
|
+
});
|
|
392
|
+
$[33] = overrides;
|
|
393
|
+
$[34] = t9;
|
|
394
|
+
$[35] = t10;
|
|
395
|
+
} else t10 = $[35];
|
|
396
|
+
let t11;
|
|
397
|
+
if ($[36] !== contextValue || $[37] !== t10 || $[38] !== t8) {
|
|
398
|
+
t11 = /* @__PURE__ */ jsxs(ConfigurationContext.Provider, {
|
|
399
|
+
value: contextValue,
|
|
400
|
+
children: [t8, t10]
|
|
401
|
+
});
|
|
402
|
+
$[36] = contextValue;
|
|
403
|
+
$[37] = t10;
|
|
404
|
+
$[38] = t8;
|
|
405
|
+
$[39] = t11;
|
|
406
|
+
} else t11 = $[39];
|
|
407
|
+
return t11;
|
|
408
|
+
}
|
|
409
|
+
function _temp2$1(value_0) {
|
|
410
|
+
return value_0 + 1;
|
|
411
|
+
}
|
|
412
|
+
function _temp$1(value) {
|
|
413
|
+
return value + 1;
|
|
414
|
+
}
|
|
415
|
+
function useUIConfiguration() {
|
|
416
|
+
const context = use(ConfigurationContext);
|
|
417
|
+
if (!context) throw new Error("useUIConfiguration requires UIConfigurationProvider");
|
|
418
|
+
return context;
|
|
419
|
+
}
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/configurator/inspector/InspectorDetails.tsx
|
|
422
|
+
/** Shared inspector measurements and property groups for preview and app canvas. */
|
|
423
|
+
function InspectorDetails(t0) {
|
|
424
|
+
const $ = c(18);
|
|
425
|
+
const { snapshot, onSelect, onHighlight } = t0;
|
|
426
|
+
let t1;
|
|
427
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
428
|
+
t1 = /* @__PURE__ */ jsx("h3", { children: "Layout" });
|
|
429
|
+
$[0] = t1;
|
|
430
|
+
} else t1 = $[0];
|
|
431
|
+
let t2;
|
|
432
|
+
if ($[1] !== snapshot.display) {
|
|
433
|
+
t2 = /* @__PURE__ */ jsxs("div", {
|
|
434
|
+
className: "studio-inspector-section-heading",
|
|
435
|
+
children: [t1, /* @__PURE__ */ jsx("span", {
|
|
436
|
+
title: "CSS display",
|
|
437
|
+
children: snapshot.display
|
|
438
|
+
})]
|
|
439
|
+
});
|
|
440
|
+
$[1] = snapshot.display;
|
|
441
|
+
$[2] = t2;
|
|
442
|
+
} else t2 = $[2];
|
|
443
|
+
let t3;
|
|
444
|
+
if ($[3] !== onHighlight || $[4] !== onSelect || $[5] !== snapshot) {
|
|
445
|
+
t3 = /* @__PURE__ */ jsx(BoxModel, {
|
|
446
|
+
snapshot,
|
|
447
|
+
onSelect,
|
|
448
|
+
onHighlight
|
|
449
|
+
});
|
|
450
|
+
$[3] = onHighlight;
|
|
451
|
+
$[4] = onSelect;
|
|
452
|
+
$[5] = snapshot;
|
|
453
|
+
$[6] = t3;
|
|
454
|
+
} else t3 = $[6];
|
|
455
|
+
let t4;
|
|
456
|
+
if ($[7] !== t2 || $[8] !== t3) {
|
|
457
|
+
t4 = /* @__PURE__ */ jsxs("section", {
|
|
458
|
+
className: "studio-inspector-layout",
|
|
459
|
+
children: [t2, t3]
|
|
460
|
+
});
|
|
461
|
+
$[7] = t2;
|
|
462
|
+
$[8] = t3;
|
|
463
|
+
$[9] = t4;
|
|
464
|
+
} else t4 = $[9];
|
|
465
|
+
let t5;
|
|
466
|
+
if ($[10] !== onSelect || $[11] !== snapshot.groups) {
|
|
467
|
+
let t6;
|
|
468
|
+
if ($[13] !== onSelect) {
|
|
469
|
+
t6 = (group_1) => /* @__PURE__ */ jsxs("section", { children: [group_1.name !== "Layout" && /* @__PURE__ */ jsx("h3", { children: group_1.name }), /* @__PURE__ */ jsx("dl", { children: group_1.properties.map((property_0) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: property_0.label }), /* @__PURE__ */ jsxs("dd", { children: [
|
|
470
|
+
property_0.color && /* @__PURE__ */ jsx("i", { style: { background: property_0.color } }),
|
|
471
|
+
/* @__PURE__ */ jsx("span", { children: property_0.value }),
|
|
472
|
+
property_0.token && /* @__PURE__ */ jsx("button", {
|
|
473
|
+
type: "button",
|
|
474
|
+
title: `Edit ${property_0.token}`,
|
|
475
|
+
onClick: () => onSelect(property_0.token),
|
|
476
|
+
children: property_0.token.replace(/^--/, "")
|
|
477
|
+
})
|
|
478
|
+
] })] }, property_0.label)) })] }, group_1.name);
|
|
479
|
+
$[13] = onSelect;
|
|
480
|
+
$[14] = t6;
|
|
481
|
+
} else t6 = $[14];
|
|
482
|
+
t5 = snapshot.groups.map(_temp).filter(_temp2).map(t6);
|
|
483
|
+
$[10] = onSelect;
|
|
484
|
+
$[11] = snapshot.groups;
|
|
485
|
+
$[12] = t5;
|
|
486
|
+
} else t5 = $[12];
|
|
487
|
+
let t6;
|
|
488
|
+
if ($[15] !== t4 || $[16] !== t5) {
|
|
489
|
+
t6 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t4, t5] });
|
|
490
|
+
$[15] = t4;
|
|
491
|
+
$[16] = t5;
|
|
492
|
+
$[17] = t6;
|
|
493
|
+
} else t6 = $[17];
|
|
494
|
+
return t6;
|
|
495
|
+
}
|
|
496
|
+
function _temp2(group_0) {
|
|
497
|
+
return group_0.properties.length;
|
|
498
|
+
}
|
|
499
|
+
function _temp(group) {
|
|
500
|
+
return {
|
|
501
|
+
name: group.name,
|
|
502
|
+
properties: group.properties.filter((property) => group.name !== "Layout" || ![
|
|
503
|
+
"Width",
|
|
504
|
+
"Height",
|
|
505
|
+
"Margin",
|
|
506
|
+
"Border width",
|
|
507
|
+
"Radius",
|
|
508
|
+
"Row gap",
|
|
509
|
+
"Column gap",
|
|
510
|
+
"Display"
|
|
511
|
+
].includes(property.label) && !/^(Padding |Margin |Border .* width$)/.test(property.label))
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
function BoxModel(t0) {
|
|
515
|
+
const $ = c(39);
|
|
516
|
+
const { snapshot, onSelect, onHighlight } = t0;
|
|
517
|
+
const box = snapshot.box;
|
|
518
|
+
const number = _temp4;
|
|
519
|
+
let t1;
|
|
520
|
+
let t2;
|
|
521
|
+
let t3;
|
|
522
|
+
let t4;
|
|
523
|
+
if ($[0] !== box.border || $[1] !== box.content.height || $[2] !== box.content.width || $[3] !== box.gap.column || $[4] !== box.gap.row || $[5] !== box.margin || $[6] !== box.padding || $[7] !== box.position || $[8] !== box.radius || $[9] !== onHighlight || $[10] !== onSelect || $[11] !== snapshot.groups) {
|
|
524
|
+
const properties = snapshot.groups.flatMap(_temp5);
|
|
525
|
+
const tokenFor = (label) => properties.find((property) => property.label === label)?.token;
|
|
526
|
+
const nonzero = _temp7;
|
|
527
|
+
let t5;
|
|
528
|
+
if ($[16] !== onHighlight || $[17] !== onSelect) {
|
|
529
|
+
t5 = (text, label_0, className, token, key) => /* @__PURE__ */ jsx("button", {
|
|
530
|
+
type: "button",
|
|
531
|
+
className,
|
|
532
|
+
title: token ? `Edit ${token}` : `${label_0}: ${text}`,
|
|
533
|
+
"aria-label": `${label_0}: ${text}`,
|
|
534
|
+
"data-token": token,
|
|
535
|
+
"data-box-highlight": key,
|
|
536
|
+
onPointerEnter: () => onHighlight(key ?? null),
|
|
537
|
+
onPointerLeave: () => onHighlight(null),
|
|
538
|
+
onFocus: () => onHighlight(key ?? null),
|
|
539
|
+
onBlur: () => onHighlight(null),
|
|
540
|
+
onClick: () => token ? onSelect(token) : onHighlight(key ?? null),
|
|
541
|
+
children: number(text)
|
|
542
|
+
});
|
|
543
|
+
$[16] = onHighlight;
|
|
544
|
+
$[17] = onSelect;
|
|
545
|
+
$[18] = t5;
|
|
546
|
+
} else t5 = $[18];
|
|
547
|
+
const value_1 = t5;
|
|
548
|
+
const layer = (name, values, children) => /* @__PURE__ */ jsxs("div", {
|
|
549
|
+
className: `studio-box-layer is-${name}`,
|
|
550
|
+
style: name === "border" ? { borderRadius: [
|
|
551
|
+
box.radius.topLeft,
|
|
552
|
+
box.radius.topRight,
|
|
553
|
+
box.radius.bottomRight,
|
|
554
|
+
box.radius.bottomLeft
|
|
555
|
+
].map((radius) => nonzero(radius) ? "12px" : "0px").join(" ") } : void 0,
|
|
556
|
+
children: [
|
|
557
|
+
/* @__PURE__ */ jsx("span", {
|
|
558
|
+
className: "studio-box-name",
|
|
559
|
+
children: name
|
|
560
|
+
}),
|
|
561
|
+
[
|
|
562
|
+
"top",
|
|
563
|
+
"right",
|
|
564
|
+
"bottom",
|
|
565
|
+
"left"
|
|
566
|
+
].map((side) => /* @__PURE__ */ jsx("span", { children: value_1(values[side], `${name} ${side}`, `studio-box-value is-${side}`, tokenFor(`${name[0].toUpperCase()}${name.slice(1)} ${side}`), `${name}.${side}`) }, side)),
|
|
567
|
+
name === "border" && Object.values(box.radius).some(nonzero) && Object.entries(box.radius).map((t6) => {
|
|
568
|
+
const [corner, radius_0] = t6;
|
|
569
|
+
return /* @__PURE__ */ jsx("span", { children: value_1(radius_0, `Radius ${corner}`, `studio-box-radius is-${corner}`, tokenFor("Radius"), `radius.${corner}`) }, corner);
|
|
570
|
+
}),
|
|
571
|
+
children
|
|
572
|
+
]
|
|
573
|
+
});
|
|
574
|
+
let t7;
|
|
575
|
+
if ($[19] !== box.gap.row) {
|
|
576
|
+
t7 = nonzero(box.gap.row);
|
|
577
|
+
$[19] = box.gap.row;
|
|
578
|
+
$[20] = t7;
|
|
579
|
+
} else t7 = $[20];
|
|
580
|
+
const hasRowGap = t7;
|
|
581
|
+
let t8;
|
|
582
|
+
if ($[21] !== box.gap.column) {
|
|
583
|
+
t8 = nonzero(box.gap.column);
|
|
584
|
+
$[21] = box.gap.column;
|
|
585
|
+
$[22] = t8;
|
|
586
|
+
} else t8 = $[22];
|
|
587
|
+
const hasColumnGap = t8;
|
|
588
|
+
const t9 = `${Math.round(box.content.width * 10) / 10}px`;
|
|
589
|
+
let t10;
|
|
590
|
+
if ($[23] !== t9 || $[24] !== value_1) {
|
|
591
|
+
t10 = value_1(t9, "Content width", "studio-box-dimension-value", void 0, "width");
|
|
592
|
+
$[23] = t9;
|
|
593
|
+
$[24] = value_1;
|
|
594
|
+
$[25] = t10;
|
|
595
|
+
} else t10 = $[25];
|
|
596
|
+
let t11;
|
|
597
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
598
|
+
t11 = /* @__PURE__ */ jsx("span", { children: "×" });
|
|
599
|
+
$[26] = t11;
|
|
600
|
+
} else t11 = $[26];
|
|
601
|
+
const t12 = `${Math.round(box.content.height * 10) / 10}px`;
|
|
602
|
+
let t13;
|
|
603
|
+
if ($[27] !== t12 || $[28] !== value_1) {
|
|
604
|
+
t13 = value_1(t12, "Content height", "studio-box-dimension-value", void 0, "height");
|
|
605
|
+
$[27] = t12;
|
|
606
|
+
$[28] = value_1;
|
|
607
|
+
$[29] = t13;
|
|
608
|
+
} else t13 = $[29];
|
|
609
|
+
let t14;
|
|
610
|
+
if ($[30] !== t10 || $[31] !== t13) {
|
|
611
|
+
t14 = /* @__PURE__ */ jsx("div", {
|
|
612
|
+
className: "studio-box-content",
|
|
613
|
+
title: "Content width × height",
|
|
614
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
615
|
+
className: "studio-box-dimensions",
|
|
616
|
+
children: [
|
|
617
|
+
t10,
|
|
618
|
+
t11,
|
|
619
|
+
t13
|
|
620
|
+
]
|
|
621
|
+
})
|
|
622
|
+
});
|
|
623
|
+
$[30] = t10;
|
|
624
|
+
$[31] = t13;
|
|
625
|
+
$[32] = t14;
|
|
626
|
+
} else t14 = $[32];
|
|
627
|
+
const content = t14;
|
|
628
|
+
const diagram = layer("margin", box.margin, layer("border", box.border, layer("padding", box.padding, content)));
|
|
629
|
+
t1 = "studio-box-model";
|
|
630
|
+
t2 = "Box model";
|
|
631
|
+
t3 = box.position ? layer("position", box.position, diagram) : diagram;
|
|
632
|
+
t4 = (hasRowGap || hasColumnGap) && /* @__PURE__ */ jsx("div", {
|
|
633
|
+
className: "studio-box-gaps",
|
|
634
|
+
"aria-label": "Layout gaps",
|
|
635
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
636
|
+
className: "studio-gap-grid",
|
|
637
|
+
style: {
|
|
638
|
+
gridTemplateColumns: `minmax(0,1fr) ${hasColumnGap ? 28 : 0}px minmax(0,1fr)`,
|
|
639
|
+
gridTemplateRows: `20px ${hasRowGap ? 22 : 0}px 20px`
|
|
640
|
+
},
|
|
641
|
+
children: [
|
|
642
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
643
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
644
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
645
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
646
|
+
hasColumnGap && value_1(box.gap.column, "Column gap", "studio-gap-number is-column", tokenFor("Column gap"), "gap.column"),
|
|
647
|
+
hasRowGap && value_1(box.gap.row, "Row gap", "studio-gap-number is-row", tokenFor("Row gap"), "gap.row")
|
|
648
|
+
]
|
|
649
|
+
})
|
|
650
|
+
});
|
|
651
|
+
$[0] = box.border;
|
|
652
|
+
$[1] = box.content.height;
|
|
653
|
+
$[2] = box.content.width;
|
|
654
|
+
$[3] = box.gap.column;
|
|
655
|
+
$[4] = box.gap.row;
|
|
656
|
+
$[5] = box.margin;
|
|
657
|
+
$[6] = box.padding;
|
|
658
|
+
$[7] = box.position;
|
|
659
|
+
$[8] = box.radius;
|
|
660
|
+
$[9] = onHighlight;
|
|
661
|
+
$[10] = onSelect;
|
|
662
|
+
$[11] = snapshot.groups;
|
|
663
|
+
$[12] = t1;
|
|
664
|
+
$[13] = t2;
|
|
665
|
+
$[14] = t3;
|
|
666
|
+
$[15] = t4;
|
|
667
|
+
} else {
|
|
668
|
+
t1 = $[12];
|
|
669
|
+
t2 = $[13];
|
|
670
|
+
t3 = $[14];
|
|
671
|
+
t4 = $[15];
|
|
672
|
+
}
|
|
673
|
+
let t5;
|
|
674
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
675
|
+
t5 = /* @__PURE__ */ jsx("figcaption", { children: "Box model · px" });
|
|
676
|
+
$[33] = t5;
|
|
677
|
+
} else t5 = $[33];
|
|
678
|
+
let t6;
|
|
679
|
+
if ($[34] !== t1 || $[35] !== t2 || $[36] !== t3 || $[37] !== t4) {
|
|
680
|
+
t6 = /* @__PURE__ */ jsxs("figure", {
|
|
681
|
+
className: t1,
|
|
682
|
+
"aria-label": t2,
|
|
683
|
+
children: [
|
|
684
|
+
t3,
|
|
685
|
+
t4,
|
|
686
|
+
t5
|
|
687
|
+
]
|
|
688
|
+
});
|
|
689
|
+
$[34] = t1;
|
|
690
|
+
$[35] = t2;
|
|
691
|
+
$[36] = t3;
|
|
692
|
+
$[37] = t4;
|
|
693
|
+
$[38] = t6;
|
|
694
|
+
} else t6 = $[38];
|
|
695
|
+
return t6;
|
|
696
|
+
}
|
|
697
|
+
function _temp7(value_0) {
|
|
698
|
+
return value_0 !== "normal" && value_0.split(/\s+/).some(_temp6);
|
|
699
|
+
}
|
|
700
|
+
function _temp6(part) {
|
|
701
|
+
return parseFloat(part) !== 0 && Number.isFinite(parseFloat(part));
|
|
702
|
+
}
|
|
703
|
+
function _temp5(group) {
|
|
704
|
+
return group.properties;
|
|
705
|
+
}
|
|
706
|
+
function _temp4(value) {
|
|
707
|
+
return value.replace(/(-?\d*\.?\d+)px/g, _temp3);
|
|
708
|
+
}
|
|
709
|
+
function _temp3(_, amount) {
|
|
710
|
+
return String(Math.round(Number(amount) * 10) / 10);
|
|
711
|
+
}
|
|
712
|
+
//#endregion
|
|
713
|
+
//#region src/configurator/inspector/HighlightOverlay.tsx
|
|
714
|
+
const arcs = {
|
|
715
|
+
topLeft: "M0 100 A100 100 0 0 1 100 0",
|
|
716
|
+
topRight: "M0 0 A100 100 0 0 1 100 100",
|
|
717
|
+
bottomRight: "M100 0 A100 100 0 0 1 0 100",
|
|
718
|
+
bottomLeft: "M100 100 A100 100 0 0 1 0 0"
|
|
719
|
+
};
|
|
720
|
+
function HighlightOverlay(t0) {
|
|
721
|
+
const $ = c(17);
|
|
722
|
+
const { highlight, width } = t0;
|
|
723
|
+
const first = highlight.regions[0];
|
|
724
|
+
let t1;
|
|
725
|
+
if ($[0] !== highlight.key) {
|
|
726
|
+
t1 = highlight.key.split(".");
|
|
727
|
+
$[0] = highlight.key;
|
|
728
|
+
$[1] = t1;
|
|
729
|
+
} else t1 = $[1];
|
|
730
|
+
const kind = t1[0];
|
|
731
|
+
const t2 = highlight.key;
|
|
732
|
+
let t3;
|
|
733
|
+
if ($[2] !== highlight.regions || $[3] !== kind) {
|
|
734
|
+
let t4;
|
|
735
|
+
if ($[5] !== kind) {
|
|
736
|
+
t4 = (region) => /* @__PURE__ */ jsx("div", {
|
|
737
|
+
className: `studio-measure-region is-${kind}${region.line ? ` is-${region.line}` : ""}${region.corner ? " is-corner" : ""}`,
|
|
738
|
+
style: {
|
|
739
|
+
left: region.left,
|
|
740
|
+
top: region.top,
|
|
741
|
+
width: region.width,
|
|
742
|
+
height: region.height
|
|
743
|
+
},
|
|
744
|
+
children: region.corner && /* @__PURE__ */ jsx("svg", {
|
|
745
|
+
viewBox: "0 0 100 100",
|
|
746
|
+
preserveAspectRatio: "none",
|
|
747
|
+
"aria-hidden": "true",
|
|
748
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
749
|
+
d: arcs[region.corner],
|
|
750
|
+
fill: "none",
|
|
751
|
+
stroke: "currentColor",
|
|
752
|
+
strokeWidth: "2",
|
|
753
|
+
vectorEffect: "non-scaling-stroke"
|
|
754
|
+
})
|
|
755
|
+
})
|
|
756
|
+
}, `${region.left}:${region.top}:${region.width}:${region.height}`);
|
|
757
|
+
$[5] = kind;
|
|
758
|
+
$[6] = t4;
|
|
759
|
+
} else t4 = $[6];
|
|
760
|
+
t3 = highlight.regions.map(t4);
|
|
761
|
+
$[2] = highlight.regions;
|
|
762
|
+
$[3] = kind;
|
|
763
|
+
$[4] = t3;
|
|
764
|
+
} else t3 = $[4];
|
|
765
|
+
const t4 = Math.max(4, Math.min(first?.left ?? 4, width - 220));
|
|
766
|
+
const t5 = Math.max(4, (first?.top ?? 26) - 22);
|
|
767
|
+
let t6;
|
|
768
|
+
if ($[7] !== t4 || $[8] !== t5) {
|
|
769
|
+
t6 = {
|
|
770
|
+
left: t4,
|
|
771
|
+
top: t5
|
|
772
|
+
};
|
|
773
|
+
$[7] = t4;
|
|
774
|
+
$[8] = t5;
|
|
775
|
+
$[9] = t6;
|
|
776
|
+
} else t6 = $[9];
|
|
777
|
+
let t7;
|
|
778
|
+
if ($[10] !== highlight.label || $[11] !== t6) {
|
|
779
|
+
t7 = /* @__PURE__ */ jsx("span", {
|
|
780
|
+
className: "studio-measure-label",
|
|
781
|
+
style: t6,
|
|
782
|
+
children: highlight.label
|
|
783
|
+
});
|
|
784
|
+
$[10] = highlight.label;
|
|
785
|
+
$[11] = t6;
|
|
786
|
+
$[12] = t7;
|
|
787
|
+
} else t7 = $[12];
|
|
788
|
+
let t8;
|
|
789
|
+
if ($[13] !== highlight.key || $[14] !== t3 || $[15] !== t7) {
|
|
790
|
+
t8 = /* @__PURE__ */ jsxs("div", {
|
|
791
|
+
className: "studio-measure-regions",
|
|
792
|
+
"data-property": t2,
|
|
793
|
+
children: [t3, t7]
|
|
794
|
+
});
|
|
795
|
+
$[13] = highlight.key;
|
|
796
|
+
$[14] = t3;
|
|
797
|
+
$[15] = t7;
|
|
798
|
+
$[16] = t8;
|
|
799
|
+
} else t8 = $[16];
|
|
800
|
+
return t8;
|
|
801
|
+
}
|
|
802
|
+
//#endregion
|
|
803
|
+
//#region src/configurator/inspector/box-highlights.ts
|
|
804
|
+
const sides = [
|
|
805
|
+
"top",
|
|
806
|
+
"right",
|
|
807
|
+
"bottom",
|
|
808
|
+
"left"
|
|
809
|
+
];
|
|
810
|
+
const corners = [
|
|
811
|
+
"topLeft",
|
|
812
|
+
"topRight",
|
|
813
|
+
"bottomRight",
|
|
814
|
+
"bottomLeft"
|
|
815
|
+
];
|
|
816
|
+
const numeric = (value) => Number.parseFloat(value) || 0;
|
|
817
|
+
const formatted = (value) => String(Math.round(value * 100) / 100);
|
|
818
|
+
/** Read-only geometry in the inspected element's viewport (including pop-out documents). */
|
|
819
|
+
function getBoxHighlights(element, key) {
|
|
820
|
+
const view = element.ownerDocument.defaultView;
|
|
821
|
+
if (!view) return {
|
|
822
|
+
regions: [],
|
|
823
|
+
label: ""
|
|
824
|
+
};
|
|
825
|
+
const style = view.getComputedStyle(element);
|
|
826
|
+
const rect = element.getBoundingClientRect();
|
|
827
|
+
const sx = element.offsetWidth ? rect.width / element.offsetWidth : 1;
|
|
828
|
+
const sy = element.offsetHeight ? rect.height / element.offsetHeight : 1;
|
|
829
|
+
const read = (name) => style.getPropertyValue(name);
|
|
830
|
+
const scale = (side) => side === "left" || side === "right" ? sx : sy;
|
|
831
|
+
const values = (prefix, suffix = "") => Object.fromEntries(sides.map((side) => [side, numeric(read(`${prefix}-${side}${suffix}`)) * scale(side)]));
|
|
832
|
+
const border = values("border", "-width");
|
|
833
|
+
const padding = values("padding");
|
|
834
|
+
const inner = {
|
|
835
|
+
left: rect.left + border.left,
|
|
836
|
+
top: rect.top + border.top,
|
|
837
|
+
width: Math.max(0, rect.width - border.left - border.right),
|
|
838
|
+
height: Math.max(0, rect.height - border.top - border.bottom)
|
|
839
|
+
};
|
|
840
|
+
const content = {
|
|
841
|
+
left: inner.left + padding.left,
|
|
842
|
+
top: inner.top + padding.top,
|
|
843
|
+
width: Math.max(0, inner.width - padding.left - padding.right),
|
|
844
|
+
height: Math.max(0, inner.height - padding.top - padding.bottom)
|
|
845
|
+
};
|
|
846
|
+
const [kind, part] = key.split(".");
|
|
847
|
+
let regions = [];
|
|
848
|
+
let value = "";
|
|
849
|
+
if (kind === "width" || kind === "height") {
|
|
850
|
+
value = formatted(content[kind] / (kind === "width" ? sx : sy));
|
|
851
|
+
regions = [{
|
|
852
|
+
left: content.left,
|
|
853
|
+
top: content.top,
|
|
854
|
+
width: kind === "width" ? content.width : 1,
|
|
855
|
+
height: kind === "height" ? content.height : 1,
|
|
856
|
+
line: kind === "width" ? "horizontal" : "vertical"
|
|
857
|
+
}];
|
|
858
|
+
} else if (kind === "radius") {
|
|
859
|
+
const radii = corners.map((corner) => {
|
|
860
|
+
const cssCorner = corner.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
861
|
+
const components = read(`border-${cssCorner}-radius`).trim().split(/\s+/);
|
|
862
|
+
const resolve = (raw, dimension, factor) => raw.endsWith("%") ? numeric(raw) / 100 * dimension : numeric(raw) * factor;
|
|
863
|
+
return [resolve(components[0] || "0", rect.width, sx), resolve(components[1] || components[0] || "0", rect.height, sy)];
|
|
864
|
+
});
|
|
865
|
+
const factor = Math.min(1, rect.width / (radii[0][0] + radii[1][0] || 1), rect.width / (radii[3][0] + radii[2][0] || 1), rect.height / (radii[0][1] + radii[3][1] || 1), rect.height / (radii[1][1] + radii[2][1] || 1));
|
|
866
|
+
const corner = part;
|
|
867
|
+
const radius = radii[corners.indexOf(corner)];
|
|
868
|
+
const width = Math.max(1, radius[0] * factor);
|
|
869
|
+
const height = Math.max(1, radius[1] * factor);
|
|
870
|
+
value = `${formatted(radius[0] * factor / sx)} × ${formatted(radius[1] * factor / sy)}`;
|
|
871
|
+
regions = [{
|
|
872
|
+
left: rect.left + (corner.endsWith("Right") ? rect.width - width : 0),
|
|
873
|
+
top: rect.top + (corner.startsWith("bottom") ? rect.height - height : 0),
|
|
874
|
+
width,
|
|
875
|
+
height,
|
|
876
|
+
corner
|
|
877
|
+
}];
|
|
878
|
+
} else if (kind === "gap") {
|
|
879
|
+
const row = part === "row";
|
|
880
|
+
const rawGap = read(`${part}-gap`);
|
|
881
|
+
const gap = rawGap.endsWith("%") ? numeric(rawGap) / 100 * (row ? content.height / sy : content.width / sx) : numeric(rawGap);
|
|
882
|
+
const size = gap * (row ? sy : sx);
|
|
883
|
+
value = formatted(gap);
|
|
884
|
+
if (size > 0 && /^(inline-)?(flex|grid)$/.test(read("display"))) {
|
|
885
|
+
const children = Array.from(element.children).slice(0, 80).flatMap((child) => {
|
|
886
|
+
const childStyle = view.getComputedStyle(child);
|
|
887
|
+
const box = child.getBoundingClientRect();
|
|
888
|
+
return childStyle.display === "none" || childStyle.visibility === "hidden" || /^(absolute|fixed)$/.test(childStyle.position) || !box.width || !box.height ? [] : [box];
|
|
889
|
+
}).sort((a, b) => row ? a.top - b.top : a.left - b.left);
|
|
890
|
+
const seen = /* @__PURE__ */ new Set();
|
|
891
|
+
for (let i = 0; i < children.length; i++) {
|
|
892
|
+
const a = children[i];
|
|
893
|
+
for (let j = i + 1; j < children.length; j++) {
|
|
894
|
+
const b = children[j];
|
|
895
|
+
const start = row ? a.bottom : a.right;
|
|
896
|
+
const end = row ? b.top : b.left;
|
|
897
|
+
const crossStart = Math.max(row ? a.left : a.top, row ? b.left : b.top, row ? content.left : content.top);
|
|
898
|
+
const crossEnd = Math.min(row ? a.right : a.bottom, row ? b.right : b.bottom, row ? content.left + content.width : content.top + content.height);
|
|
899
|
+
if (end - start < size - .5 || crossEnd <= crossStart) continue;
|
|
900
|
+
if (children.some((c, index) => index !== i && index !== j && (row ? c.top >= start && c.bottom <= end && c.right > crossStart && c.left < crossEnd : c.left >= start && c.right <= end && c.bottom > crossStart && c.top < crossEnd))) continue;
|
|
901
|
+
const axisStart = Math.max((start + end - size) / 2, row ? content.top : content.left);
|
|
902
|
+
const axisEnd = Math.min((start + end + size) / 2, row ? content.top + content.height : content.left + content.width);
|
|
903
|
+
if (axisEnd <= axisStart) continue;
|
|
904
|
+
const region = row ? {
|
|
905
|
+
left: crossStart,
|
|
906
|
+
top: axisStart,
|
|
907
|
+
width: crossEnd - crossStart,
|
|
908
|
+
height: axisEnd - axisStart
|
|
909
|
+
} : {
|
|
910
|
+
left: axisStart,
|
|
911
|
+
top: crossStart,
|
|
912
|
+
width: axisEnd - axisStart,
|
|
913
|
+
height: crossEnd - crossStart
|
|
914
|
+
};
|
|
915
|
+
const id = Object.values(region).map(formatted).join(",");
|
|
916
|
+
if (!seen.has(id)) {
|
|
917
|
+
seen.add(id);
|
|
918
|
+
regions.push(region);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
} else {
|
|
924
|
+
const side = part;
|
|
925
|
+
const horizontal = side === "top" || side === "bottom";
|
|
926
|
+
const raw = read(kind === "position" ? side : `${kind}-${side}${kind === "border" ? "-width" : ""}`);
|
|
927
|
+
const amount = numeric(raw) * scale(side);
|
|
928
|
+
value = formatted(numeric(raw));
|
|
929
|
+
const base = kind === "padding" ? inner : rect;
|
|
930
|
+
const outward = kind === "margin" || kind === "position";
|
|
931
|
+
const thickness = Math.max(1, Math.abs(amount));
|
|
932
|
+
const positiveEdge = side === "bottom" || side === "right";
|
|
933
|
+
const edge = horizontal ? base.top + (positiveEdge ? base.height : 0) : base.left + (positiveEdge ? base.width : 0);
|
|
934
|
+
const offset = outward ? positiveEdge ? amount < 0 ? -thickness : 0 : amount < 0 ? 0 : -thickness : positiveEdge ? -thickness : 0;
|
|
935
|
+
regions = [{
|
|
936
|
+
left: horizontal ? base.left : edge + offset,
|
|
937
|
+
top: horizontal ? edge + offset : base.top,
|
|
938
|
+
width: horizontal ? base.width : thickness,
|
|
939
|
+
height: horizontal ? thickness : base.height
|
|
940
|
+
}];
|
|
941
|
+
if (kind === "position") {
|
|
942
|
+
if (raw === "auto" || read("position") === "static") regions = [];
|
|
943
|
+
else if (read("position") === "absolute" || read("position") === "fixed") {
|
|
944
|
+
const parent = element.offsetParent;
|
|
945
|
+
const parentRect = parent?.getBoundingClientRect();
|
|
946
|
+
const parentStyle = parent ? view.getComputedStyle(parent) : null;
|
|
947
|
+
const parentScale = parent && "offsetWidth" in parent && parent.offsetWidth ? parentRect.width / Number(parent.offsetWidth) : 1;
|
|
948
|
+
const parentScaleY = parent && "offsetHeight" in parent && parent.offsetHeight ? parentRect.height / Number(parent.offsetHeight) : 1;
|
|
949
|
+
const referenceEdge = (parentRect ? {
|
|
950
|
+
left: parentRect.left + numeric(parentStyle.getPropertyValue("border-left-width")) * parentScale,
|
|
951
|
+
right: parentRect.right - numeric(parentStyle.getPropertyValue("border-right-width")) * parentScale,
|
|
952
|
+
top: parentRect.top + numeric(parentStyle.getPropertyValue("border-top-width")) * parentScaleY,
|
|
953
|
+
bottom: parentRect.bottom - numeric(parentStyle.getPropertyValue("border-bottom-width")) * parentScaleY
|
|
954
|
+
} : {
|
|
955
|
+
left: 0,
|
|
956
|
+
top: 0,
|
|
957
|
+
right: view.innerWidth,
|
|
958
|
+
bottom: view.innerHeight
|
|
959
|
+
})[side];
|
|
960
|
+
const targetEdge = edge + (positiveEdge ? 1 : -1) * numeric(read(`margin-${side}`)) * scale(side);
|
|
961
|
+
const start = Math.min(referenceEdge, targetEdge);
|
|
962
|
+
const length = Math.max(1, Math.abs(referenceEdge - targetEdge));
|
|
963
|
+
regions = [{
|
|
964
|
+
left: horizontal ? rect.left : start,
|
|
965
|
+
top: horizontal ? start : rect.top,
|
|
966
|
+
width: horizontal ? rect.width : length,
|
|
967
|
+
height: horizontal ? length : rect.height
|
|
968
|
+
}];
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
const name = key.replace(".", " ").replace(/([a-z])([A-Z])/g, "$1 $2").toLowerCase();
|
|
973
|
+
return {
|
|
974
|
+
regions,
|
|
975
|
+
label: `${name}: ${value} px`
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region src/configurator/inspector/token-classes.ts
|
|
980
|
+
/** Tailwind breakpoints from the Atlas base theme, in rem. */
|
|
981
|
+
const breakpoints = {
|
|
982
|
+
sm: 23.75,
|
|
983
|
+
md: 37.5,
|
|
984
|
+
lg: 80,
|
|
985
|
+
xl: 105
|
|
986
|
+
};
|
|
987
|
+
/** Utility prefix → the slots it sets, its specificity, and the theme namespace its value lives in. */
|
|
988
|
+
const utilities = [
|
|
989
|
+
[
|
|
990
|
+
"p",
|
|
991
|
+
[
|
|
992
|
+
"padding.top",
|
|
993
|
+
"padding.right",
|
|
994
|
+
"padding.bottom",
|
|
995
|
+
"padding.left"
|
|
996
|
+
],
|
|
997
|
+
0,
|
|
998
|
+
"spacing"
|
|
999
|
+
],
|
|
1000
|
+
[
|
|
1001
|
+
"px",
|
|
1002
|
+
["padding.left", "padding.right"],
|
|
1003
|
+
1,
|
|
1004
|
+
"spacing"
|
|
1005
|
+
],
|
|
1006
|
+
[
|
|
1007
|
+
"py",
|
|
1008
|
+
["padding.top", "padding.bottom"],
|
|
1009
|
+
1,
|
|
1010
|
+
"spacing"
|
|
1011
|
+
],
|
|
1012
|
+
[
|
|
1013
|
+
"pt",
|
|
1014
|
+
["padding.top"],
|
|
1015
|
+
2,
|
|
1016
|
+
"spacing"
|
|
1017
|
+
],
|
|
1018
|
+
[
|
|
1019
|
+
"pr",
|
|
1020
|
+
["padding.right"],
|
|
1021
|
+
2,
|
|
1022
|
+
"spacing"
|
|
1023
|
+
],
|
|
1024
|
+
[
|
|
1025
|
+
"pe",
|
|
1026
|
+
["padding.right"],
|
|
1027
|
+
2,
|
|
1028
|
+
"spacing"
|
|
1029
|
+
],
|
|
1030
|
+
[
|
|
1031
|
+
"pb",
|
|
1032
|
+
["padding.bottom"],
|
|
1033
|
+
2,
|
|
1034
|
+
"spacing"
|
|
1035
|
+
],
|
|
1036
|
+
[
|
|
1037
|
+
"pl",
|
|
1038
|
+
["padding.left"],
|
|
1039
|
+
2,
|
|
1040
|
+
"spacing"
|
|
1041
|
+
],
|
|
1042
|
+
[
|
|
1043
|
+
"ps",
|
|
1044
|
+
["padding.left"],
|
|
1045
|
+
2,
|
|
1046
|
+
"spacing"
|
|
1047
|
+
],
|
|
1048
|
+
[
|
|
1049
|
+
"gap",
|
|
1050
|
+
["gap.row", "gap.column"],
|
|
1051
|
+
0,
|
|
1052
|
+
"spacing"
|
|
1053
|
+
],
|
|
1054
|
+
[
|
|
1055
|
+
"gap-x",
|
|
1056
|
+
["gap.column"],
|
|
1057
|
+
1,
|
|
1058
|
+
"spacing"
|
|
1059
|
+
],
|
|
1060
|
+
[
|
|
1061
|
+
"gap-y",
|
|
1062
|
+
["gap.row"],
|
|
1063
|
+
1,
|
|
1064
|
+
"spacing"
|
|
1065
|
+
],
|
|
1066
|
+
[
|
|
1067
|
+
"rounded",
|
|
1068
|
+
["radius"],
|
|
1069
|
+
0,
|
|
1070
|
+
"radius"
|
|
1071
|
+
]
|
|
1072
|
+
];
|
|
1073
|
+
/** Splits `md:hover:px-4` into its variants and utility, ignoring colons inside `[...]` / `(...)`. */
|
|
1074
|
+
function splitVariants(className) {
|
|
1075
|
+
const parts = [];
|
|
1076
|
+
let depth = 0;
|
|
1077
|
+
let current = "";
|
|
1078
|
+
for (const char of className) {
|
|
1079
|
+
if (char === "[" || char === "(") depth++;
|
|
1080
|
+
if (char === "]" || char === ")") depth--;
|
|
1081
|
+
if (char === ":" && depth === 0) {
|
|
1082
|
+
parts.push(current);
|
|
1083
|
+
current = "";
|
|
1084
|
+
} else current += char;
|
|
1085
|
+
}
|
|
1086
|
+
return {
|
|
1087
|
+
variants: parts,
|
|
1088
|
+
utility: current
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
/** Breakpoint weight when every variant is an active breakpoint; `undefined` for state variants or inactive breakpoints. */
|
|
1092
|
+
function variantWeight(variants, viewportWidth, rootFontSize) {
|
|
1093
|
+
let weight = 0;
|
|
1094
|
+
for (const variant of variants) {
|
|
1095
|
+
const max = variant.startsWith("max-");
|
|
1096
|
+
const size = breakpoints[max ? variant.slice(4) : variant];
|
|
1097
|
+
if (size === void 0) return void 0;
|
|
1098
|
+
if (!(max ? viewportWidth < size * rootFontSize : viewportWidth >= size * rootFontSize)) return void 0;
|
|
1099
|
+
weight = Math.max(weight, size);
|
|
1100
|
+
}
|
|
1101
|
+
return weight;
|
|
1102
|
+
}
|
|
1103
|
+
function tokenFor(value, namespace, isKnown) {
|
|
1104
|
+
const referenced = value.match(/^\[.*?var\((--[\w-]+)/)?.[1] ?? value.match(/^\((--[\w-]+)\)$/)?.[1];
|
|
1105
|
+
if (referenced) return isKnown(referenced) ? referenced : void 0;
|
|
1106
|
+
const name = `--${namespace}-${value}`;
|
|
1107
|
+
return isKnown(name) ? name : void 0;
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* Resolves which theme tokens drive an element's padding, gap and radius from its rendered Tailwind classes.
|
|
1111
|
+
* Only tokens accepted by `isKnown` are returned, so every result can be opened in the editor.
|
|
1112
|
+
*/
|
|
1113
|
+
function inspectTokens(className, isKnown, viewportWidth = Infinity, rootFontSize = 16) {
|
|
1114
|
+
const winners = /* @__PURE__ */ new Map();
|
|
1115
|
+
for (const raw of className.split(/\s+/).filter(Boolean)) {
|
|
1116
|
+
const { variants, utility } = splitVariants(raw);
|
|
1117
|
+
const weight = variantWeight(variants, viewportWidth, rootFontSize);
|
|
1118
|
+
if (weight === void 0) continue;
|
|
1119
|
+
const clean = utility.replace(/^!|!$/g, "");
|
|
1120
|
+
for (const [prefix, slots, specificity, namespace] of utilities) {
|
|
1121
|
+
if (!clean.startsWith(`${prefix}-`)) continue;
|
|
1122
|
+
const token = tokenFor(clean.slice(prefix.length + 1), namespace, isKnown);
|
|
1123
|
+
if (!token) continue;
|
|
1124
|
+
const rank = weight * 10 + specificity;
|
|
1125
|
+
for (const slot of slots) if ((winners.get(slot)?.rank ?? -1) <= rank) winners.set(slot, {
|
|
1126
|
+
token,
|
|
1127
|
+
rank
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
const result = {
|
|
1132
|
+
padding: {},
|
|
1133
|
+
gap: {}
|
|
1134
|
+
};
|
|
1135
|
+
for (const [slot, { token }] of winners) if (slot === "radius") result.radius = token;
|
|
1136
|
+
else if (slot.startsWith("gap.")) result.gap[slot.slice(4)] = token;
|
|
1137
|
+
else result.padding[slot.slice(8)] = token;
|
|
1138
|
+
return result;
|
|
1139
|
+
}
|
|
1140
|
+
//#endregion
|
|
1141
|
+
//#region src/configurator/inspector/inspection-model.ts
|
|
1142
|
+
function readableColor(value) {
|
|
1143
|
+
const rgb = value.trim().match(/^rgb\(\s*(\d+)\s*[, ]\s*(\d+)\s*[, ]\s*(\d+)\s*\)$/);
|
|
1144
|
+
if (!rgb) return value;
|
|
1145
|
+
return `#${rgb.slice(1).map((channel) => Number(channel).toString(16).padStart(2, "0")).join("")}`;
|
|
1146
|
+
}
|
|
1147
|
+
function resolveToken(style, name, seen = /* @__PURE__ */ new Set()) {
|
|
1148
|
+
if (seen.has(name)) return "";
|
|
1149
|
+
seen.add(name);
|
|
1150
|
+
const value = style.getPropertyValue(name).trim();
|
|
1151
|
+
const reference = value.match(/^var\((--[\w-]+)\)$/);
|
|
1152
|
+
return reference ? resolveToken(style, reference[1], seen) : value;
|
|
1153
|
+
}
|
|
1154
|
+
/** Read-only inspection; always use the element's window, including detached previews. */
|
|
1155
|
+
function inspectElement(element, isKnown) {
|
|
1156
|
+
const view = element.ownerDocument.defaultView;
|
|
1157
|
+
if (!view) throw new Error("The inspected element has no document window.");
|
|
1158
|
+
const style = view.getComputedStyle(element);
|
|
1159
|
+
const rootFontSize = Number.parseFloat(view.getComputedStyle(element.ownerDocument.documentElement).fontSize) || 16;
|
|
1160
|
+
const bounds = element.getBoundingClientRect();
|
|
1161
|
+
const sides = [
|
|
1162
|
+
"top",
|
|
1163
|
+
"right",
|
|
1164
|
+
"bottom",
|
|
1165
|
+
"left"
|
|
1166
|
+
];
|
|
1167
|
+
const readSides = (prefix, suffix = "") => Object.fromEntries(sides.map((side) => [side, style.getPropertyValue(`${prefix}${side}${suffix}`) || "0px"]));
|
|
1168
|
+
const padding = readSides("padding-");
|
|
1169
|
+
const border = readSides("border-", "-width");
|
|
1170
|
+
const margin = readSides("margin-");
|
|
1171
|
+
const contentDimension = (axis) => {
|
|
1172
|
+
const value = style.getPropertyValue(axis);
|
|
1173
|
+
const dimension = Number.parseFloat(value);
|
|
1174
|
+
const hasPixelDimension = /^\d+(?:\.\d+)?px$/.test(value);
|
|
1175
|
+
if (hasPixelDimension && style.getPropertyValue("box-sizing") !== "border-box") return dimension;
|
|
1176
|
+
const inset = (axis === "width" ? ["left", "right"] : ["top", "bottom"]).reduce((total, side) => total + (Number.parseFloat(padding[side]) || 0) + (Number.parseFloat(border[side]) || 0), 0);
|
|
1177
|
+
return Math.max(0, (hasPixelDimension ? dimension : bounds[axis]) - inset);
|
|
1178
|
+
};
|
|
1179
|
+
const box = {
|
|
1180
|
+
content: {
|
|
1181
|
+
width: contentDimension("width"),
|
|
1182
|
+
height: contentDimension("height")
|
|
1183
|
+
},
|
|
1184
|
+
padding,
|
|
1185
|
+
border,
|
|
1186
|
+
margin,
|
|
1187
|
+
radius: {
|
|
1188
|
+
topLeft: style.getPropertyValue("border-top-left-radius") || "0px",
|
|
1189
|
+
topRight: style.getPropertyValue("border-top-right-radius") || "0px",
|
|
1190
|
+
bottomRight: style.getPropertyValue("border-bottom-right-radius") || "0px",
|
|
1191
|
+
bottomLeft: style.getPropertyValue("border-bottom-left-radius") || "0px"
|
|
1192
|
+
},
|
|
1193
|
+
gap: {
|
|
1194
|
+
row: style.getPropertyValue("row-gap") || "normal",
|
|
1195
|
+
column: style.getPropertyValue("column-gap") || "normal"
|
|
1196
|
+
}
|
|
1197
|
+
};
|
|
1198
|
+
const position = style.getPropertyValue("position");
|
|
1199
|
+
if (position && position !== "static") box.position = readSides("");
|
|
1200
|
+
const classes = Array.from(element.classList);
|
|
1201
|
+
const plainClasses = classes.filter((name) => !splitVariants(name).variants.length && !name.includes("["));
|
|
1202
|
+
const spacing = inspectTokens(plainClasses.join(" "), isKnown);
|
|
1203
|
+
const candidates = (prefix, namespaces) => plainClasses.flatMap((raw) => {
|
|
1204
|
+
const utility = raw.replace(/^!|!$/g, "");
|
|
1205
|
+
if (!utility.startsWith(`${prefix}-`)) return [];
|
|
1206
|
+
const suffix = utility.slice(prefix.length + 1);
|
|
1207
|
+
return namespaces.map((namespace) => `--${namespace}${suffix}`);
|
|
1208
|
+
});
|
|
1209
|
+
const variantsAffect = (prefixes) => classes.some((raw) => {
|
|
1210
|
+
const { variants, utility } = splitVariants(raw);
|
|
1211
|
+
return variants.length > 0 && prefixes.some((prefix) => utility.replace(/^!/, "").startsWith(`${prefix}-`));
|
|
1212
|
+
});
|
|
1213
|
+
const equivalent = (value, computed, property) => {
|
|
1214
|
+
if (!value) return false;
|
|
1215
|
+
if (property.includes("color")) {
|
|
1216
|
+
if (value.match(/^\d+(?:\.\d+)?\s+\d+(?:\.\d+)?\s+\d+(?:\.\d+)?$/)) value = `rgb(${value})`;
|
|
1217
|
+
return readableColor(value).toLowerCase() === readableColor(computed).toLowerCase();
|
|
1218
|
+
}
|
|
1219
|
+
const length = value.match(/^(-?\d+(?:\.\d+)?)(rem|px|em)$/);
|
|
1220
|
+
if (length && computed.endsWith("px")) {
|
|
1221
|
+
let factor = 1;
|
|
1222
|
+
if (length[2] === "rem") factor = rootFontSize;
|
|
1223
|
+
if (length[2] === "em") factor = Number.parseFloat(style.fontSize);
|
|
1224
|
+
return Math.abs(Number(length[1]) * factor - Number.parseFloat(computed)) < .02;
|
|
1225
|
+
}
|
|
1226
|
+
return value.replace(/["']/g, "").replace(/\s+/g, " ") === computed.replace(/["']/g, "").replace(/\s+/g, " ");
|
|
1227
|
+
};
|
|
1228
|
+
const property = (label, css, tokens = [], prefixes = []) => {
|
|
1229
|
+
const computed = style.getPropertyValue(css);
|
|
1230
|
+
const matching = variantsAffect(prefixes) ? [] : tokens.filter((token) => !!token && isKnown(token) && equivalent(resolveToken(style, token), computed, css));
|
|
1231
|
+
const token = [...new Set(matching)][0];
|
|
1232
|
+
const isColor = css.includes("color");
|
|
1233
|
+
return {
|
|
1234
|
+
label,
|
|
1235
|
+
value: isColor ? readableColor(computed) : computed,
|
|
1236
|
+
...token ? { token } : {},
|
|
1237
|
+
...isColor ? { color: computed } : {}
|
|
1238
|
+
};
|
|
1239
|
+
};
|
|
1240
|
+
const tag = element.tagName.toLowerCase();
|
|
1241
|
+
const role = element.getAttribute("role");
|
|
1242
|
+
const context = element.closest("[data-inspector-name]")?.getAttribute("data-inspector-name") || element.closest(".studio-gallery-card")?.querySelector(".studio-gallery-card-title")?.textContent?.trim();
|
|
1243
|
+
const description = (element.getAttribute("aria-label") || element.innerText || element.textContent || "").trim().replace(/\s+/g, " ").slice(0, 100);
|
|
1244
|
+
const name = context || role || tag;
|
|
1245
|
+
const paddingPrefixes = [
|
|
1246
|
+
"p",
|
|
1247
|
+
"px",
|
|
1248
|
+
"py",
|
|
1249
|
+
"pt",
|
|
1250
|
+
"pr",
|
|
1251
|
+
"pb",
|
|
1252
|
+
"pl",
|
|
1253
|
+
"ps",
|
|
1254
|
+
"pe"
|
|
1255
|
+
];
|
|
1256
|
+
const layout = [
|
|
1257
|
+
{
|
|
1258
|
+
label: "Width",
|
|
1259
|
+
value: style.getPropertyValue("width") || `${bounds.width}px`
|
|
1260
|
+
},
|
|
1261
|
+
{
|
|
1262
|
+
label: "Height",
|
|
1263
|
+
value: style.getPropertyValue("height") || `${bounds.height}px`
|
|
1264
|
+
},
|
|
1265
|
+
property("Display", "display"),
|
|
1266
|
+
property("Position", "position"),
|
|
1267
|
+
...sides.map((side) => property(`Padding ${side}`, `padding-${side}`, [spacing.padding[side]], paddingPrefixes)),
|
|
1268
|
+
...sides.map((side) => property(`Margin ${side}`, `margin-${side}`)),
|
|
1269
|
+
property("Row gap", "row-gap", [spacing.gap.row], ["gap"]),
|
|
1270
|
+
property("Column gap", "column-gap", [spacing.gap.column], ["gap"]),
|
|
1271
|
+
property("Radius", "border-radius", [spacing.radius], ["rounded"]),
|
|
1272
|
+
...sides.map((side) => property(`Border ${side} width`, `border-${side}-width`))
|
|
1273
|
+
];
|
|
1274
|
+
const typography = [
|
|
1275
|
+
property("Font", "font-family", candidates("font", ["font-"]), ["font"]),
|
|
1276
|
+
property("Size", "font-size", candidates("text", ["text-"]), ["text"]),
|
|
1277
|
+
property("Weight", "font-weight", candidates("font", ["font-weight-"]), ["font"]),
|
|
1278
|
+
property("Line height", "line-height"),
|
|
1279
|
+
property("Letter spacing", "letter-spacing"),
|
|
1280
|
+
property("Alignment", "text-align")
|
|
1281
|
+
];
|
|
1282
|
+
const appearance = [
|
|
1283
|
+
property("Text", "color", candidates("text", ["color-", ""]).flatMap((token) => [token, `${token}-base`]), ["text"]),
|
|
1284
|
+
property("Fill", "background-color", candidates("bg", ["color-", ""]).flatMap((token) => [token, `${token}-base`]), ["bg"]),
|
|
1285
|
+
property("Border", "border-top-color", candidates("border", ["color-", ""]).flatMap((token) => [token, `${token}-base`]), ["border"]),
|
|
1286
|
+
property("Opacity", "opacity"),
|
|
1287
|
+
property("Shadow", "box-shadow")
|
|
1288
|
+
];
|
|
1289
|
+
const isZero = (value) => value.split(/\s+/).every((part) => /^-?0(?:\.0+)?(?:px|rem|em|%)?$/.test(part));
|
|
1290
|
+
const visibleProperty = (row) => {
|
|
1291
|
+
if (row.label === "Width" || row.label === "Height" || row.token) return true;
|
|
1292
|
+
const value = row.value.trim();
|
|
1293
|
+
if (!value) return false;
|
|
1294
|
+
if (/^(Padding|Margin|Border .* width|Row gap|Column gap|Radius)/.test(row.label) && (isZero(value) || value === "normal")) return false;
|
|
1295
|
+
if (row.label === "Position" && value === "static") return false;
|
|
1296
|
+
if (row.label === "Display" && ["inline", "block"].includes(value)) return false;
|
|
1297
|
+
if (row.label === "Shadow" && value === "none") return false;
|
|
1298
|
+
if (row.label === "Opacity" && Number(value) === 1) return false;
|
|
1299
|
+
if (row.label === "Fill" && (value === "transparent" || /^rgba?\([^)]*[,/]\s*0(?:\.0+)?%?\s*\)$/.test(value))) return false;
|
|
1300
|
+
if (row.label === "Border" && !(Number.parseFloat(border.top) > 0)) return false;
|
|
1301
|
+
if (row.label === "Line height" && value === "normal") return false;
|
|
1302
|
+
if (row.label === "Letter spacing" && (value === "normal" || isZero(value))) return false;
|
|
1303
|
+
if (row.label === "Alignment" && [
|
|
1304
|
+
"normal",
|
|
1305
|
+
"start",
|
|
1306
|
+
"left"
|
|
1307
|
+
].includes(value)) return false;
|
|
1308
|
+
if (row.label === "Weight" && ["400", "normal"].includes(value)) return false;
|
|
1309
|
+
return true;
|
|
1310
|
+
};
|
|
1311
|
+
return {
|
|
1312
|
+
name,
|
|
1313
|
+
display: style.display,
|
|
1314
|
+
tag,
|
|
1315
|
+
description,
|
|
1316
|
+
width: bounds.width,
|
|
1317
|
+
height: bounds.height,
|
|
1318
|
+
box,
|
|
1319
|
+
groups: [
|
|
1320
|
+
{
|
|
1321
|
+
name: "Layout",
|
|
1322
|
+
properties: layout
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
name: "Typography",
|
|
1326
|
+
properties: typography
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
name: "Appearance",
|
|
1330
|
+
properties: appearance
|
|
1331
|
+
}
|
|
1332
|
+
].map((group) => ({
|
|
1333
|
+
name: group.name,
|
|
1334
|
+
properties: group.properties.filter(visibleProperty)
|
|
1335
|
+
})).filter((group) => group.properties.length > 0)
|
|
1336
|
+
};
|
|
1337
|
+
}
|
|
1338
|
+
//#endregion
|
|
1339
|
+
export { InspectorDetails as a, useUIConfiguration as c, cvaDefinitions as d, Sun as f, HighlightOverlay as i, exportCvaEdits as l, Moon as m, inspectTokens as n, UIConfigurationProvider as o, Pin as p, getBoxHighlights as r, emptyConfiguration as s, inspectElement as t, resolveCvaDefinition as u };
|