@gild-ui/vue 0.0.0-stage → 0.1.0-alpha.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.
Files changed (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +97 -2
  3. package/dist/Button.cjs +238 -0
  4. package/dist/Button.d.cts +17 -0
  5. package/dist/Button.d.mts +17 -0
  6. package/dist/Button.mjs +237 -0
  7. package/dist/Button.types-BnJ28ym9.d.mts +1113 -0
  8. package/dist/Flex.cjs +25 -0
  9. package/dist/Flex.d.cts +11 -0
  10. package/dist/Flex.d.mts +11 -0
  11. package/dist/Flex.mjs +24 -0
  12. package/dist/Modal.cjs +369 -0
  13. package/dist/Modal.d.cts +23 -0
  14. package/dist/Modal.d.mts +23 -0
  15. package/dist/Modal.mjs +368 -0
  16. package/dist/TextInput.cjs +299 -0
  17. package/dist/TextInput.d.cts +37 -0
  18. package/dist/TextInput.d.mts +37 -0
  19. package/dist/TextInput.mjs +298 -0
  20. package/dist/ThemeProvider-CareN7BO.mjs +58 -0
  21. package/dist/ThemeProvider-DIeSdYou.cjs +63 -0
  22. package/dist/ThemeProvider.cjs +3 -0
  23. package/dist/ThemeProvider.d.cts +25 -0
  24. package/dist/ThemeProvider.d.mts +25 -0
  25. package/dist/ThemeProvider.mjs +1 -0
  26. package/dist/Typography.cjs +72 -0
  27. package/dist/Typography.d.cts +15 -0
  28. package/dist/Typography.d.mts +15 -0
  29. package/dist/Typography.mjs +71 -0
  30. package/dist/View.cjs +12 -0
  31. package/dist/View.d.cts +11 -0
  32. package/dist/View.d.mts +11 -0
  33. package/dist/View.mjs +11 -0
  34. package/dist/ViewRoot-CsaIxrtD.mjs +40 -0
  35. package/dist/ViewRoot-X9F9RROv.cjs +45 -0
  36. package/dist/bridge-D-x2kK4r.d.mts +36 -0
  37. package/dist/bridge-t6zHXVt-.d.cts +36 -0
  38. package/dist/engine.cjs +82 -0
  39. package/dist/engine.d.cts +46 -0
  40. package/dist/engine.d.mts +46 -0
  41. package/dist/engine.mjs +26 -0
  42. package/dist/index.cjs +57 -0
  43. package/dist/index.d.cts +37 -0
  44. package/dist/index.d.mts +37 -0
  45. package/dist/index.mjs +6 -0
  46. package/dist/props-BRLGZVjJ.d.mts +21 -0
  47. package/dist/props-Bzm7Wbdv.d.cts +21 -0
  48. package/dist/props-DDBSpAkG.mjs +49 -0
  49. package/dist/props-DxoB9cT4.cjs +72 -0
  50. package/dist/styled-Cmxvlft5.mjs +34 -0
  51. package/dist/styled-JHkZtq_1.cjs +39 -0
  52. package/dist/themes-BqxOUMCB.cjs +12 -0
  53. package/dist/themes-CgFrk0_b.d.cts +1112 -0
  54. package/dist/themes-rGHVhV5e.mjs +8 -0
  55. package/dist/useDefaultProps--fOGOSGa.mjs +18 -0
  56. package/dist/useDefaultProps-qCDgeYFm.cjs +23 -0
  57. package/dist/useTheme.cjs +8 -0
  58. package/dist/useTheme.d.cts +3 -0
  59. package/dist/useTheme.d.mts +3 -0
  60. package/dist/useTheme.mjs +1 -0
  61. package/package.json +171 -3
@@ -0,0 +1,37 @@
1
+ import { i as Tag, n as SharedProps } from "./props-Bzm7Wbdv.cjs";
2
+ import { S as TextInputVariant, _ as TextInputProps$1, b as TextInputTextColor, g as TextInputOwnerState, h as TextInputColor, m as TextInputClasses, v as TextInputSize, x as TextInputThemeConfig, y as TextInputSlot } from "./themes-CgFrk0_b.cjs";
3
+ import { InputHTMLAttributes, SlotsType, TextareaHTMLAttributes } from "vue";
4
+ /** The attributes of the native element: of an input and of a textarea, without `style`. */
5
+ type InputAttributes = Omit<InputHTMLAttributes & TextareaHTMLAttributes, 'style'>;
6
+ /**
7
+ * The props of `TextInput`: the shared props of `@gild-ui/react`, with the components as tags or
8
+ * components, the attributes of the native element in Vue's form, and `modelValue` for `v-model`
9
+ * (`value` still works). `onChange` is the listener of the `change` event, below.
10
+ */
11
+ export type TextInputProps = SharedProps<TextInputProps$1, 'components' | 'inputComponent' | 'inputProps'> & {
12
+ components?: {
13
+ Input?: Tag;
14
+ Root?: Tag;
15
+ };
16
+ inputComponent?: Tag;
17
+ inputProps?: InputAttributes;
18
+ modelValue?: NonNullable<TextInputProps$1['value']>;
19
+ };
20
+ /** What a `TextInput` emits: `change` on every edit, as the `onChange` of React fires, and `update:modelValue` for `v-model`. */
21
+ export type TextInputEmits = {
22
+ change: (event: Event) => true;
23
+ 'update:modelValue': (value: string) => true;
24
+ };
25
+ export declare const TextInput: import("vue").DefineSetupFnComponent<TextInputProps, TextInputEmits, SlotsType<Record<never, never>>, SharedProps<TextInputProps$1, "components" | "inputComponent" | "inputProps"> & {
26
+ components?: {
27
+ Input?: Tag;
28
+ Root?: Tag;
29
+ };
30
+ inputComponent?: Tag;
31
+ inputProps?: InputAttributes;
32
+ modelValue?: NonNullable<TextInputProps$1['value']>;
33
+ } & {
34
+ onChange?: ((event: Event) => any) | undefined;
35
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
36
+ }, import("vue").PublicProps>;
37
+ export type { TextInputClasses, TextInputColor, TextInputOwnerState, TextInputSize, TextInputSlot, TextInputTextColor, TextInputThemeConfig, TextInputVariant };
@@ -0,0 +1,37 @@
1
+ import { i as Tag, n as SharedProps } from "./props-BRLGZVjJ.mjs";
2
+ import { A as TextInputTextColor, D as TextInputProps$1, E as TextInputOwnerState, M as TextInputVariant, O as TextInputSize, T as TextInputColor, j as TextInputThemeConfig, k as TextInputSlot, w as TextInputClasses } from "./Button.types-BnJ28ym9.mjs";
3
+ import { InputHTMLAttributes, SlotsType, TextareaHTMLAttributes } from "vue";
4
+ /** The attributes of the native element: of an input and of a textarea, without `style`. */
5
+ type InputAttributes = Omit<InputHTMLAttributes & TextareaHTMLAttributes, 'style'>;
6
+ /**
7
+ * The props of `TextInput`: the shared props of `@gild-ui/react`, with the components as tags or
8
+ * components, the attributes of the native element in Vue's form, and `modelValue` for `v-model`
9
+ * (`value` still works). `onChange` is the listener of the `change` event, below.
10
+ */
11
+ export type TextInputProps = SharedProps<TextInputProps$1, 'components' | 'inputComponent' | 'inputProps'> & {
12
+ components?: {
13
+ Input?: Tag;
14
+ Root?: Tag;
15
+ };
16
+ inputComponent?: Tag;
17
+ inputProps?: InputAttributes;
18
+ modelValue?: NonNullable<TextInputProps$1['value']>;
19
+ };
20
+ /** What a `TextInput` emits: `change` on every edit, as the `onChange` of React fires, and `update:modelValue` for `v-model`. */
21
+ export type TextInputEmits = {
22
+ change: (event: Event) => true;
23
+ 'update:modelValue': (value: string) => true;
24
+ };
25
+ export declare const TextInput: import("vue").DefineSetupFnComponent<TextInputProps, TextInputEmits, SlotsType<Record<never, never>>, SharedProps<TextInputProps$1, "components" | "inputComponent" | "inputProps"> & {
26
+ components?: {
27
+ Input?: Tag;
28
+ Root?: Tag;
29
+ };
30
+ inputComponent?: Tag;
31
+ inputProps?: InputAttributes;
32
+ modelValue?: NonNullable<TextInputProps$1['value']>;
33
+ } & {
34
+ onChange?: ((event: Event) => any) | undefined;
35
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
36
+ }, import("vue").PublicProps>;
37
+ export type { TextInputClasses, TextInputColor, TextInputOwnerState, TextInputSize, TextInputSlot, TextInputTextColor, TextInputThemeConfig, TextInputVariant };
@@ -0,0 +1,298 @@
1
+ import { r as styled$1 } from "./styled-Cmxvlft5.mjs";
2
+ import { i as mergeOverrides, n as flag, t as declare } from "./props-DDBSpAkG.mjs";
3
+ import { defineComponent, h, nextTick, onMounted, ref, watch } from "vue";
4
+ import { useTheme } from "@umber-style/vue";
5
+ import { themeDefault } from "@gild-ui/core/theme";
6
+ import { createShouldForwardProp, props } from "@soroush.tech/styled-system/should-forward-prop";
7
+ import { get, space, system, variant } from "@soroush.tech/styled-system";
8
+ // src/TextInput/TextAreaAutoResize.ts
9
+ const adjust = (el, minRows, maxRows) => {
10
+ const style = getComputedStyle(el);
11
+ const lineHeight = Number.parseFloat(style.lineHeight) || Number.parseFloat(style.fontSize) * 1.2;
12
+ const paddingY = Number.parseFloat(style.paddingTop) + Number.parseFloat(style.paddingBottom);
13
+ el.style.height = "auto";
14
+ const scrollHeight = el.scrollHeight;
15
+ const min = minRows == null ? 0 : Number(minRows) * lineHeight + paddingY;
16
+ const max = maxRows == null ? 1e400 : Number(maxRows) * lineHeight + paddingY;
17
+ el.style.height = `${Math.min(max, Math.max(min, scrollHeight))}px`;
18
+ el.style.overflow = scrollHeight > max ? "auto" : "hidden";
19
+ };
20
+ /**
21
+ * A textarea that grows with its content: its height is set again whenever its value or its row limits
22
+ * change, and as the user types. It takes the attributes of a textarea, `minRows` and `maxRows`.
23
+ */
24
+ const TextAreaAutoResize = defineComponent((props, { attrs }) => {
25
+ const element = ref(null);
26
+ const resize = () => element.value && adjust(element.value, props.minRows, props.maxRows);
27
+ onMounted(resize);
28
+ watch(() => [
29
+ props.value,
30
+ props.minRows,
31
+ props.maxRows
32
+ ], () => nextTick(resize));
33
+ return () => h("textarea", {
34
+ ...attrs,
35
+ ref: element,
36
+ value: props.value,
37
+ onInput: (event) => {
38
+ resize();
39
+ const listener = attrs.onInput;
40
+ if (typeof listener === "function") listener(event);
41
+ }
42
+ });
43
+ }, {
44
+ name: "TextAreaAutoResize",
45
+ inheritAttrs: false,
46
+ props: {
47
+ value: [
48
+ String,
49
+ Number,
50
+ Array
51
+ ],
52
+ minRows: [Number, String],
53
+ maxRows: [Number, String]
54
+ }
55
+ });
56
+ // ../react/src/utils/inputVariantStyles.ts
57
+ const inputVariantStyles = variant({
58
+ prop: "variant",
59
+ variants: {
60
+ outlined: {
61
+ borderRadius: "sq",
62
+ borderWidth: "thin",
63
+ borderStyle: "solid"
64
+ },
65
+ default: {
66
+ borderRadius: "sq",
67
+ borderStyle: "none"
68
+ },
69
+ underline: {
70
+ borderRadius: "sq",
71
+ borderStyle: "none",
72
+ borderBottomWidth: "thin",
73
+ borderBottomStyle: "solid"
74
+ },
75
+ text: {
76
+ borderRadius: "sq",
77
+ borderStyle: "none"
78
+ }
79
+ }
80
+ });
81
+ // ../react/src/utils/inputStyles.ts
82
+ /** The least width of a field that does not fill its row: `theme.defaults.inputMinWidth`, else `'12rem'`. */
83
+ const getInputMinWidth = (theme) => themeDefault(theme, "inputMinWidth", "12rem");
84
+ /**
85
+ * The keyboard focus ring of every input - the one the border takes on focus: the error color
86
+ * while it is in error, else the field's own color.
87
+ */
88
+ const getFocusRing = (theme, color, isError = false) => {
89
+ return {
90
+ outline: `2px solid ${get(theme, `palette.${isError ? "error" : color}.main`)}`,
91
+ outlineOffset: "2px"
92
+ };
93
+ };
94
+ // src/TextInput/TextInput.ts
95
+ const shouldForwardProp = createShouldForwardProp([
96
+ ...props,
97
+ "as",
98
+ "color",
99
+ "textColor",
100
+ "variant",
101
+ "error",
102
+ "disabled",
103
+ "fullWidth"
104
+ ]);
105
+ const baseStyle = {
106
+ display: "inline-flex",
107
+ alignItems: "center",
108
+ transition: "border-color 0.15s ease"
109
+ };
110
+ const backgroundStyle = ({ theme, textColor, color = themeDefault(theme, "color", "primary") }) => {
111
+ return {
112
+ backgroundColor: get(theme, `background.${themeDefault(theme, "inputBg", "terminal")}`),
113
+ color: textColor ? get(theme, `text.${textColor}`) : get(theme, `palette.${color}.main`),
114
+ fontFamily: get(theme, "fonts.body"),
115
+ fontSize: get(theme, "fontSizes.1"),
116
+ lineHeight: get(theme, "lineHeights.base")
117
+ };
118
+ };
119
+ const colorBorder = ({ theme, color = themeDefault(theme, "color", "primary"), error }) => {
120
+ return { borderColor: error ? get(theme, "palette.error.main") : get(theme, `palette.${color}.light`) };
121
+ };
122
+ const focusVisibleRing = ({ theme, color = themeDefault(theme, "color", "primary"), error }) => ({ "&:has(:focus-visible)": getFocusRing(theme, color, error) });
123
+ const focusWithinColor = ({ theme, color = themeDefault(theme, "color", "primary"), error }) => ({ "&:focus-within": { borderColor: error ? get(theme, "palette.error.main") : get(theme, `palette.${color}.main`) } });
124
+ const borderRadiusStyle = ({ variant: v = "default", borderRadius, theme }) => {
125
+ if (v === "underline" || v === "text" || !borderRadius) return {};
126
+ return { borderRadius: get(theme, `radii.${borderRadius}`) };
127
+ };
128
+ const layoutStyles = ({ theme, fullWidth, disabled }) => ({
129
+ minWidth: getInputMinWidth(theme),
130
+ ...fullWidth ? {
131
+ display: "flex",
132
+ width: "100%"
133
+ } : {},
134
+ ...disabled ? {
135
+ opacity: .5,
136
+ cursor: "not-allowed",
137
+ pointerEvents: "none"
138
+ } : {}
139
+ });
140
+ const nativeBaseStyles = {
141
+ flex: 1,
142
+ minWidth: 0,
143
+ width: "100%",
144
+ border: "none",
145
+ outline: "none",
146
+ background: "transparent",
147
+ color: "inherit",
148
+ fontFamily: "inherit",
149
+ lineHeight: "inherit",
150
+ "&::placeholder": {
151
+ color: "inherit",
152
+ opacity: .5
153
+ },
154
+ "&:disabled": { cursor: "not-allowed" }
155
+ };
156
+ const textAreaBaseStyles = {
157
+ resize: "none",
158
+ overflow: "auto"
159
+ };
160
+ const InputBase = defineComponent((props, { attrs }) => () => h(props.inputComponent ?? "input", {
161
+ ...attrs,
162
+ size: props.inputSize
163
+ }), {
164
+ name: "InputBase",
165
+ inheritAttrs: false,
166
+ props: {
167
+ inputSize: Number,
168
+ inputComponent: { type: null }
169
+ }
170
+ });
171
+ const widthStyles = system({
172
+ width: true,
173
+ minWidth: true,
174
+ maxWidth: true
175
+ });
176
+ const sizeVariants = ({ theme, size }) => {
177
+ const s = theme.sizes[size];
178
+ return {
179
+ paddingTop: theme.space[s.paddingTop],
180
+ paddingBottom: theme.space[s.paddingBottom],
181
+ paddingLeft: theme.space[s.paddingLeft],
182
+ paddingRight: theme.space[s.paddingRight],
183
+ fontSize: theme.fontSizes[s.fontSize]
184
+ };
185
+ };
186
+ const TextInputRoot = styled$1("div", {
187
+ name: "TextInput",
188
+ label: "TextInput",
189
+ shouldForwardProp,
190
+ systemProps: [space, widthStyles]
191
+ })(baseStyle, inputVariantStyles, borderRadiusStyle, colorBorder, focusWithinColor, focusVisibleRing, backgroundStyle, layoutStyles);
192
+ const StyledInput = styled$1(InputBase, {
193
+ name: "TextInput",
194
+ slot: "input",
195
+ label: "TextInputInput"
196
+ })(nativeBaseStyles, sizeVariants);
197
+ const shouldForwardInputProps = (prop) => prop !== "size";
198
+ const StyledTextarea = styled$1("textarea", {
199
+ name: "TextInput",
200
+ slot: "input",
201
+ label: "TextInputTextarea",
202
+ shouldForwardProp: shouldForwardInputProps
203
+ })(nativeBaseStyles, textAreaBaseStyles, sizeVariants);
204
+ const StyledAutoResizeTextarea = styled$1(TextAreaAutoResize, {
205
+ name: "TextInput",
206
+ slot: "input",
207
+ label: "TextInputTextarea",
208
+ shouldForwardProp: shouldForwardInputProps
209
+ })(nativeBaseStyles, textAreaBaseStyles, sizeVariants);
210
+ /** The value of the field an event came from, which is the target of an `input` event. */
211
+ const valueOf = (event) => {
212
+ const { target } = event;
213
+ return target && "value" in target && typeof target.value === "string" ? target.value : "";
214
+ };
215
+ const TextInput = defineComponent((props, { attrs, emit }) => {
216
+ const theme = useTheme();
217
+ return () => {
218
+ const { class: className, ...otherAttributes } = attrs;
219
+ const { classes, components, inputProps, slotProps, multiline, rows, resize, minRows } = props;
220
+ const { value } = theme;
221
+ const size = props.size ?? themeDefault(value, "size", "md");
222
+ const color = props.color ?? themeDefault(value, "color", "primary");
223
+ const type = props.type ?? "text";
224
+ const isAutoResize = resize ?? false;
225
+ const isMultiline = (multiline ?? false) || rows !== void 0 && Number(rows) > 1;
226
+ const isTextarea = (isAutoResize || isMultiline) && (!type || type === "text");
227
+ const inputComponent = props.inputComponent ?? components?.Input;
228
+ const inputElProps = {
229
+ ...inputProps,
230
+ id: props.id,
231
+ name: props.name,
232
+ disabled: props.disabled ?? false,
233
+ required: props.required ?? false,
234
+ autocomplete: props.autoComplete,
235
+ autofocus: props.autoFocus,
236
+ placeholder: props.placeholder,
237
+ readonly: props.readOnly,
238
+ value: props.modelValue ?? props.value,
239
+ onInput: (event) => {
240
+ emit("update:modelValue", valueOf(event));
241
+ emit("change", event);
242
+ },
243
+ ...mergeOverrides({ className: classes?.input }, slotProps?.input),
244
+ type: isTextarea ? void 0 : type,
245
+ rows: isMultiline && rows !== void 0 ? Number(rows) : void 0,
246
+ size,
247
+ "aria-describedby": inputProps?.["aria-describedby"]
248
+ };
249
+ let inputElement = h(StyledInput, {
250
+ inputComponent,
251
+ inputSize: props.inputSize ?? (inputComponent ? void 0 : 1),
252
+ ...inputElProps
253
+ });
254
+ if (isTextarea) inputElement = isAutoResize ? h(StyledAutoResizeTextarea, {
255
+ ...inputElProps,
256
+ cols: 1,
257
+ minRows: minRows ?? rows,
258
+ maxRows: props.maxRows
259
+ }) : h(StyledTextarea, {
260
+ ...inputElProps,
261
+ cols: 1
262
+ });
263
+ return h(TextInputRoot, {
264
+ as: components?.Root,
265
+ color,
266
+ textColor: props.textColor,
267
+ variant: props.variant ?? themeDefault(value, "inputVariant", "default"),
268
+ error: props.error ?? false,
269
+ disabled: props.disabled ?? false,
270
+ fullWidth: props.fullWidth ?? false,
271
+ borderRadius: props.borderRadius,
272
+ ...mergeOverrides(slotProps?.root, {
273
+ style: props.style,
274
+ class: [classes?.root, className]
275
+ }),
276
+ ...otherAttributes
277
+ }, () => inputElement);
278
+ };
279
+ }, {
280
+ name: "TextInput",
281
+ inheritAttrs: false,
282
+ props: {
283
+ ...declare("borderRadius", "autoComplete", "autoFocus", "classes", "components", "color", "textColor", "id", "inputComponent", "inputProps", "inputSize", "maxRows", "minRows", "name", "placeholder", "rows", "size", "type", "variant", "value", "modelValue", "slotProps", "style"),
284
+ disabled: flag,
285
+ error: flag,
286
+ fullWidth: flag,
287
+ multiline: flag,
288
+ readOnly: flag,
289
+ required: flag,
290
+ resize: flag
291
+ },
292
+ emits: {
293
+ change: () => true,
294
+ "update:modelValue": () => true
295
+ },
296
+ slots: {}
297
+ });
298
+ export { TextInput };
@@ -0,0 +1,58 @@
1
+ import { t as baseTheme$1 } from "./themes-rGHVhV5e.mjs";
2
+ import { defineComponent, h } from "vue";
3
+ import { ThemeProvider as ThemeProvider$1 } from "@umber-style/vue";
4
+ import { createTheme } from "@gild-ui/core/theme";
5
+ // ../react/src/theme/derivedTheme.ts
6
+ /**
7
+ * A function that gives the same result for the same two objects, so a provider hands the engine
8
+ * the same theme object on every render. The engine keeps a theme's declarations by the object,
9
+ * and on a server `useMemo` keeps nothing between renders: a theme made anew each render is
10
+ * declared anew each render.
11
+ */
12
+ function derivedBy(derive) {
13
+ const results = /* @__PURE__ */ new WeakMap();
14
+ return (first, second) => {
15
+ let bySecond = results.get(first);
16
+ if (!bySecond) {
17
+ bySecond = /* @__PURE__ */ new WeakMap();
18
+ results.set(first, bySecond);
19
+ }
20
+ let result = bySecond.get(second);
21
+ if (!result) {
22
+ result = derive(first, second);
23
+ bySecond.set(second, result);
24
+ }
25
+ return result;
26
+ };
27
+ }
28
+ // src/ThemeProvider/ThemeProvider.ts
29
+ const noDefaults = {};
30
+ const known = /* @__PURE__ */ new Map();
31
+ const sameDefaults = (defaults) => {
32
+ const key = JSON.stringify(defaults);
33
+ const first = known.get(key);
34
+ if (first) return first;
35
+ known.set(key, defaults);
36
+ return defaults;
37
+ };
38
+ const withDefaults = derivedBy((theme, defaults) => {
39
+ if (defaults !== noDefaults) return createTheme(theme, { defaults });
40
+ return "up" in theme.breakpoints ? theme : createTheme(theme, {});
41
+ });
42
+ /**
43
+ * The theme of the subtree, with the props of `ThemeProvider` of `@gild-ui/react`: `theme`, `defaults`
44
+ * and the content as the default slot. A provider inside another one renders a wrapper element, which
45
+ * takes `class` and `as`; the outermost one renders none and declares its theme on `:root`.
46
+ */
47
+ const ThemeProvider = defineComponent((props, { attrs, slots }) => () => h(ThemeProvider$1, {
48
+ ...attrs,
49
+ theme: withDefaults(props.theme ?? baseTheme$1, props.defaults ? sameDefaults(props.defaults) : noDefaults)
50
+ }, slots), {
51
+ name: "ThemeProvider",
52
+ inheritAttrs: false,
53
+ props: {
54
+ theme: null,
55
+ defaults: null
56
+ }
57
+ });
58
+ export { ThemeProvider as t };
@@ -0,0 +1,63 @@
1
+ const require_themes = require("./themes-BqxOUMCB.cjs");
2
+ let vue = require("vue");
3
+ let _umber_style_vue = require("@umber-style/vue");
4
+ let _gild_ui_core_theme = require("@gild-ui/core/theme");
5
+ // ../react/src/theme/derivedTheme.ts
6
+ /**
7
+ * A function that gives the same result for the same two objects, so a provider hands the engine
8
+ * the same theme object on every render. The engine keeps a theme's declarations by the object,
9
+ * and on a server `useMemo` keeps nothing between renders: a theme made anew each render is
10
+ * declared anew each render.
11
+ */
12
+ function derivedBy(derive) {
13
+ const results = /* @__PURE__ */ new WeakMap();
14
+ return (first, second) => {
15
+ let bySecond = results.get(first);
16
+ if (!bySecond) {
17
+ bySecond = /* @__PURE__ */ new WeakMap();
18
+ results.set(first, bySecond);
19
+ }
20
+ let result = bySecond.get(second);
21
+ if (!result) {
22
+ result = derive(first, second);
23
+ bySecond.set(second, result);
24
+ }
25
+ return result;
26
+ };
27
+ }
28
+ // src/ThemeProvider/ThemeProvider.ts
29
+ const noDefaults = {};
30
+ const known = /* @__PURE__ */ new Map();
31
+ const sameDefaults = (defaults) => {
32
+ const key = JSON.stringify(defaults);
33
+ const first = known.get(key);
34
+ if (first) return first;
35
+ known.set(key, defaults);
36
+ return defaults;
37
+ };
38
+ const withDefaults = derivedBy((theme, defaults) => {
39
+ if (defaults !== noDefaults) return (0, _gild_ui_core_theme.createTheme)(theme, { defaults });
40
+ return "up" in theme.breakpoints ? theme : (0, _gild_ui_core_theme.createTheme)(theme, {});
41
+ });
42
+ /**
43
+ * The theme of the subtree, with the props of `ThemeProvider` of `@gild-ui/react`: `theme`, `defaults`
44
+ * and the content as the default slot. A provider inside another one renders a wrapper element, which
45
+ * takes `class` and `as`; the outermost one renders none and declares its theme on `:root`.
46
+ */
47
+ const ThemeProvider = (0, vue.defineComponent)((props, { attrs, slots }) => () => (0, vue.h)(_umber_style_vue.ThemeProvider, {
48
+ ...attrs,
49
+ theme: withDefaults(props.theme ?? require_themes.baseTheme, props.defaults ? sameDefaults(props.defaults) : noDefaults)
50
+ }, slots), {
51
+ name: "ThemeProvider",
52
+ inheritAttrs: false,
53
+ props: {
54
+ theme: null,
55
+ defaults: null
56
+ }
57
+ });
58
+ Object.defineProperty(exports, "ThemeProvider", {
59
+ enumerable: true,
60
+ get: function() {
61
+ return ThemeProvider;
62
+ }
63
+ });
@@ -0,0 +1,3 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_ThemeProvider = require("./ThemeProvider-DIeSdYou.cjs");
3
+ exports.ThemeProvider = require_ThemeProvider.ThemeProvider;
@@ -0,0 +1,25 @@
1
+ import "./bridge-t6zHXVt-.cjs";
2
+ import { i as Theme$1, t as AppTheme } from "./themes-CgFrk0_b.cjs";
3
+ import { Register, ThemeDefaults } from "@gild-ui/core/theme";
4
+ /** What the provider takes: `theme` is optional until the app registers its themes, which have no built-in theme to fall back to. */
5
+ export type ThemeProviderProps = Register extends {
6
+ themes: unknown;
7
+ } ? {
8
+ theme: AppTheme;
9
+ defaults?: ThemeDefaults;
10
+ } : {
11
+ theme?: Theme$1;
12
+ defaults?: ThemeDefaults;
13
+ };
14
+ /**
15
+ * The theme of the subtree, with the props of `ThemeProvider` of `@gild-ui/react`: `theme`, `defaults`
16
+ * and the content as the default slot. A provider inside another one renders a wrapper element, which
17
+ * takes `class` and `as`; the outermost one renders none and declares its theme on `:root`.
18
+ */
19
+ export declare const ThemeProvider: import("vue").DefineSetupFnComponent<{
20
+ theme?: Theme$1;
21
+ defaults?: ThemeDefaults;
22
+ }, {}, {}, {
23
+ theme?: Theme$1;
24
+ defaults?: ThemeDefaults;
25
+ } & {}, import("vue").PublicProps>;
@@ -0,0 +1,25 @@
1
+ import "./bridge-D-x2kK4r.mjs";
2
+ import { d as AppTheme, m as Theme$1 } from "./Button.types-BnJ28ym9.mjs";
3
+ import { Register, ThemeDefaults } from "@gild-ui/core/theme";
4
+ /** What the provider takes: `theme` is optional until the app registers its themes, which have no built-in theme to fall back to. */
5
+ export type ThemeProviderProps = Register extends {
6
+ themes: unknown;
7
+ } ? {
8
+ theme: AppTheme;
9
+ defaults?: ThemeDefaults;
10
+ } : {
11
+ theme?: Theme$1;
12
+ defaults?: ThemeDefaults;
13
+ };
14
+ /**
15
+ * The theme of the subtree, with the props of `ThemeProvider` of `@gild-ui/react`: `theme`, `defaults`
16
+ * and the content as the default slot. A provider inside another one renders a wrapper element, which
17
+ * takes `class` and `as`; the outermost one renders none and declares its theme on `:root`.
18
+ */
19
+ export declare const ThemeProvider: import("vue").DefineSetupFnComponent<{
20
+ theme?: Theme$1;
21
+ defaults?: ThemeDefaults;
22
+ }, {}, {}, {
23
+ theme?: Theme$1;
24
+ defaults?: ThemeDefaults;
25
+ } & {}, import("vue").PublicProps>;
@@ -0,0 +1 @@
1
+ export { t as ThemeProvider } from "./ThemeProvider-CareN7BO.mjs";
@@ -0,0 +1,72 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_styled = require("./styled-JHkZtq_1.cjs");
3
+ const require_props = require("./props-DxoB9cT4.cjs");
4
+ let vue = require("vue");
5
+ let _umber_style_vue = require("@umber-style/vue");
6
+ let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
7
+ let _soroush_tech_styled_system = require("@soroush.tech/styled-system");
8
+ // src/Typography/Typography.ts
9
+ const shouldForwardProp = (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([
10
+ ..._soroush_tech_styled_system_should_forward_prop.props,
11
+ "noWrap",
12
+ "gutterBottom",
13
+ "align",
14
+ "textTransform"
15
+ ]);
16
+ const colorSystem = (0, _soroush_tech_styled_system.system)({
17
+ color: {
18
+ property: "color",
19
+ scale: "text"
20
+ },
21
+ bg: {
22
+ property: "backgroundColor",
23
+ scale: "background"
24
+ },
25
+ opacity: { property: "opacity" },
26
+ textTransform: { property: "textTransform" }
27
+ });
28
+ const typographyVariants = ({ variant = "body1", theme }) => {
29
+ const { fontSize, fontWeight, letterSpacing, textTransform } = theme.typography[variant];
30
+ return {
31
+ ...fontSize !== void 0 && { fontSize: theme.fontSizes[fontSize] },
32
+ ...fontWeight && { fontWeight: theme.fontWeights[fontWeight] },
33
+ ...letterSpacing && { letterSpacing: theme.letterSpacings[letterSpacing] },
34
+ ...textTransform && { textTransform }
35
+ };
36
+ };
37
+ const TypographyBase = require_styled.styled("p", {
38
+ name: "Typography",
39
+ label: "Typography",
40
+ shouldForwardProp,
41
+ systemProps: [
42
+ _soroush_tech_styled_system.space,
43
+ _soroush_tech_styled_system.layout,
44
+ colorSystem,
45
+ _soroush_tech_styled_system.typography,
46
+ _soroush_tech_styled_system.flexbox,
47
+ _soroush_tech_styled_system.border,
48
+ _soroush_tech_styled_system.position
49
+ ]
50
+ })(typographyVariants, ({ align }) => align ? { textAlign: align } : {}, ({ gutterBottom }) => gutterBottom ? { marginBottom: "0.5em" } : {}, ({ noWrap }) => noWrap ? {
51
+ overflow: "hidden",
52
+ textOverflow: "ellipsis",
53
+ whiteSpace: "nowrap"
54
+ } : {});
55
+ const Typography = (0, vue.defineComponent)((props, { attrs, slots }) => {
56
+ const theme = (0, _umber_style_vue.useTheme)();
57
+ return () => {
58
+ const variant = props.variant ?? "body1";
59
+ const element = props.as ?? theme.value.typography[variant].element;
60
+ return (0, vue.h)(TypographyBase, {
61
+ as: element,
62
+ variant,
63
+ ...require_props.rootProps(props, attrs)
64
+ }, slots);
65
+ };
66
+ }, {
67
+ name: "Typography",
68
+ inheritAttrs: false,
69
+ props: require_props.declare("variant", "align", "gutterBottom", "noWrap", "as", "slotProps", "style"),
70
+ slots: {}
71
+ });
72
+ exports.Typography = Typography;
@@ -0,0 +1,15 @@
1
+ import { i as Tag, n as SharedProps, r as Slot, t as Listeners } from "./props-Bzm7Wbdv.cjs";
2
+ import { c as TypographyAlign, d as TypographySlot, f as TypographyThemeConfig, l as TypographyOwnerState, o as BackgroundToken, p as TypographyVariant, s as TextColorToken, u as TypographyProps$1 } from "./themes-CgFrk0_b.cjs";
3
+ import { HTMLAttributes, SlotsType } from "vue";
4
+ /** The props of `Typography`: the shared props of `@gild-ui/react`, with `as` a tag or a component, and a listener for each DOM event of the element. */
5
+ export type TypographyProps = SharedProps<TypographyProps$1, 'as'> & Listeners<HTMLAttributes> & {
6
+ as?: Tag;
7
+ };
8
+ /** The slots of the `Typography` component: the content. */
9
+ export interface TypographySlots {
10
+ default?: Slot;
11
+ }
12
+ export declare const Typography: import("vue").DefineSetupFnComponent<TypographyProps, Record<never, never>, SlotsType<TypographySlots>, SharedProps<TypographyProps$1, "as"> & Pick<HTMLAttributes, "onAbort" | "onAnimationcancel" | "onAnimationend" | "onAnimationiteration" | "onAnimationstart" | "onAuxclick" | "onBeforeinput" | "onBeforetoggle" | "onBlur" | "onCanplay" | "onCanplaythrough" | "onChange" | "onClick" | "onCompositionend" | "onCompositionstart" | "onCompositionupdate" | "onContextmenu" | "onCopy" | "onCut" | "onDblclick" | "onDrag" | "onDragend" | "onDragenter" | "onDragexit" | "onDragleave" | "onDragover" | "onDragstart" | "onDrop" | "onDurationchange" | "onEmptied" | "onEncrypted" | "onEnded" | "onError" | "onFocus" | "onFocusin" | "onFocusout" | "onFormdata" | "onFullscreenchange" | "onFullscreenerror" | "onGotpointercapture" | "onInput" | "onInvalid" | "onKeydown" | "onKeypress" | "onKeyup" | "onLoad" | "onLoadeddata" | "onLoadedmetadata" | "onLoadstart" | "onLostpointercapture" | "onMousedown" | "onMouseenter" | "onMouseleave" | "onMousemove" | "onMouseout" | "onMouseover" | "onMouseup" | "onPaste" | "onPause" | "onPlay" | "onPlaying" | "onPointercancel" | "onPointerdown" | "onPointerenter" | "onPointerleave" | "onPointermove" | "onPointerout" | "onPointerover" | "onPointerup" | "onProgress" | "onRatechange" | "onReset" | "onScroll" | "onScrollend" | "onSecuritypolicyviolation" | "onSeeked" | "onSeeking" | "onSelect" | "onStalled" | "onSubmit" | "onSuspend" | "onTimeupdate" | "onToggle" | "onTouchcancel" | "onTouchend" | "onTouchmove" | "onTouchstart" | "onTransitioncancel" | "onTransitionend" | "onTransitionrun" | "onTransitionstart" | "onVolumechange" | "onWaiting" | "onWheel"> & Pick<HTMLAttributes, "class"> & {
13
+ as?: Tag;
14
+ } & {}, import("vue").PublicProps>;
15
+ export type { BackgroundToken, TextColorToken, TypographyAlign, TypographyOwnerState, TypographySlot, TypographyThemeConfig, TypographyVariant };
@@ -0,0 +1,15 @@
1
+ import { i as Tag, n as SharedProps, r as Slot, t as Listeners } from "./props-BRLGZVjJ.mjs";
2
+ import { C as TypographyVariant, S as TypographyThemeConfig, _ as TextColorToken, b as TypographyProps$1, g as BackgroundToken, v as TypographyAlign, x as TypographySlot, y as TypographyOwnerState } from "./Button.types-BnJ28ym9.mjs";
3
+ import { HTMLAttributes, SlotsType } from "vue";
4
+ /** The props of `Typography`: the shared props of `@gild-ui/react`, with `as` a tag or a component, and a listener for each DOM event of the element. */
5
+ export type TypographyProps = SharedProps<TypographyProps$1, 'as'> & Listeners<HTMLAttributes> & {
6
+ as?: Tag;
7
+ };
8
+ /** The slots of the `Typography` component: the content. */
9
+ export interface TypographySlots {
10
+ default?: Slot;
11
+ }
12
+ export declare const Typography: import("vue").DefineSetupFnComponent<TypographyProps, Record<never, never>, SlotsType<TypographySlots>, SharedProps<TypographyProps$1, "as"> & Pick<HTMLAttributes, "onAbort" | "onAnimationcancel" | "onAnimationend" | "onAnimationiteration" | "onAnimationstart" | "onAuxclick" | "onBeforeinput" | "onBeforetoggle" | "onBlur" | "onCanplay" | "onCanplaythrough" | "onChange" | "onClick" | "onCompositionend" | "onCompositionstart" | "onCompositionupdate" | "onContextmenu" | "onCopy" | "onCut" | "onDblclick" | "onDrag" | "onDragend" | "onDragenter" | "onDragexit" | "onDragleave" | "onDragover" | "onDragstart" | "onDrop" | "onDurationchange" | "onEmptied" | "onEncrypted" | "onEnded" | "onError" | "onFocus" | "onFocusin" | "onFocusout" | "onFormdata" | "onFullscreenchange" | "onFullscreenerror" | "onGotpointercapture" | "onInput" | "onInvalid" | "onKeydown" | "onKeypress" | "onKeyup" | "onLoad" | "onLoadeddata" | "onLoadedmetadata" | "onLoadstart" | "onLostpointercapture" | "onMousedown" | "onMouseenter" | "onMouseleave" | "onMousemove" | "onMouseout" | "onMouseover" | "onMouseup" | "onPaste" | "onPause" | "onPlay" | "onPlaying" | "onPointercancel" | "onPointerdown" | "onPointerenter" | "onPointerleave" | "onPointermove" | "onPointerout" | "onPointerover" | "onPointerup" | "onProgress" | "onRatechange" | "onReset" | "onScroll" | "onScrollend" | "onSecuritypolicyviolation" | "onSeeked" | "onSeeking" | "onSelect" | "onStalled" | "onSubmit" | "onSuspend" | "onTimeupdate" | "onToggle" | "onTouchcancel" | "onTouchend" | "onTouchmove" | "onTouchstart" | "onTransitioncancel" | "onTransitionend" | "onTransitionrun" | "onTransitionstart" | "onVolumechange" | "onWaiting" | "onWheel"> & Pick<HTMLAttributes, "class"> & {
13
+ as?: Tag;
14
+ } & {}, import("vue").PublicProps>;
15
+ export type { BackgroundToken, TextColorToken, TypographyAlign, TypographyOwnerState, TypographySlot, TypographyThemeConfig, TypographyVariant };