@frontfriend/sdk 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +46 -0
- package/README.md +341 -2
- package/dist/THIRD_PARTY_NOTICES +44 -0
- package/dist/application-adoption-lock.d.ts +31 -0
- package/dist/application-adoption.d.ts +103 -0
- package/dist/browser.mjs +1 -0
- package/dist/cli.js +372 -0
- package/dist/cn.d.ts +2 -0
- package/dist/cn.js +1 -0
- package/dist/cn.mjs +1 -0
- package/dist/component-config.d.ts +330 -0
- package/dist/component-config.mjs +1 -0
- package/dist/component-recipes.d.ts +29 -0
- package/dist/components-config-schema.d.ts +2 -0
- package/dist/components-config-schema.js +1 -0
- package/dist/ffdc.d.ts +17 -0
- package/dist/ffdc.js +1 -0
- package/dist/ffdc.mjs +1 -0
- package/dist/foundation-contract.json +56 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/dist/lib/core/adoption.js +1 -0
- package/dist/lib/core/api-client.js +10 -0
- package/dist/lib/core/application-adoption-lock.js +6 -0
- package/dist/lib/core/application-adoption.js +28 -0
- package/dist/lib/core/cache-manager.js +1 -0
- package/dist/lib/core/cached-components-config.js +1 -0
- package/dist/lib/core/classes-source.js +1 -0
- package/dist/lib/core/component-config.js +1 -0
- package/dist/lib/core/component-recipes.js +8 -0
- package/dist/lib/core/components-config-schema.js +1 -0
- package/dist/lib/core/config-loader.js +1 -0
- package/dist/lib/core/constants.js +1 -0
- package/dist/lib/core/credentials.js +2 -0
- package/dist/lib/core/env-utils.js +2 -0
- package/dist/lib/core/errors.js +1 -0
- package/dist/lib/core/file-utils.js +2 -0
- package/dist/lib/core/nativeSource.d.ts +10 -0
- package/dist/lib/core/nativeSource.js +2 -0
- package/dist/lib/core/package-identity.js +1 -0
- package/dist/lib/core/path-utils.js +2 -0
- package/dist/lib/core/project-target.js +1 -0
- package/dist/lib/core/static-config.js +9 -0
- package/dist/lib/core/token-artifact-client.js +8 -0
- package/dist/lib/core/token-artifact.d.ts +27 -0
- package/dist/lib/core/token-artifact.js +1 -0
- package/dist/lib/core/token-processor.d.ts +23 -0
- package/dist/lib/core/token-processor.js +5 -0
- package/dist/lib/react/utils.d.ts +25 -0
- package/dist/lib/react/utils.mjs +1 -0
- package/dist/lib/vue/utils.d.ts +27 -0
- package/dist/lib/vue/utils.mjs +1 -0
- package/dist/mcp.cjs +226 -0
- package/dist/next.d.ts +11 -0
- package/dist/next.js +2 -0
- package/dist/next.mjs +1 -0
- package/dist/package.json +4 -0
- package/dist/project-target.d.ts +22 -0
- package/dist/runtime.d.ts +15 -0
- package/dist/runtime.js +1 -0
- package/dist/runtime.mjs +1 -0
- package/dist/scripts/generate-icon-types.js +38 -0
- package/dist/theme.css +3 -0
- package/dist/types/index.d.ts +68 -0
- package/dist/vite.d.mts +9 -0
- package/dist/vite.d.ts +8 -0
- package/dist/vite.js +9 -0
- package/dist/vite.mjs +1 -0
- package/package.json +205 -4
package/dist/cn.d.ts
ADDED
package/dist/cn.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var m=(c,a)=>{for(var f in a)o(c,f,{get:a[f],enumerable:!0})},p=(c,a,f,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of d(a))!l.call(c,e)&&e!==f&&o(c,e,{get:()=>a[e],enumerable:!(r=t(a,e))||r.enumerable});return c};var s=c=>p(o({},"__esModule",{value:!0}),c);var u={};m(u,{cn:()=>n.cn,default:()=>n.cn});module.exports=s(u);var n=require("cn");0&&(module.exports={cn});
|
package/dist/cn.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cn as e,cn as f}from"cn";export{e as cn,f as default};
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration policies for canonical components.
|
|
3
|
+
*
|
|
4
|
+
* A component passes the runtime configuration it received from `ffdc` and reads
|
|
5
|
+
* the resolved view instead of choosing between alternative configuration fields
|
|
6
|
+
* itself. Each policy below owns the old structures and value alternatives of one
|
|
7
|
+
* component. The resolver is pure: it never writes to its input, never reads
|
|
8
|
+
* global configuration, and never supplies style defaults.
|
|
9
|
+
*
|
|
10
|
+
* A resolved view is derived data. Every object in it keeps the fields of the
|
|
11
|
+
* object it was derived from, including custom fields and the values a runtime
|
|
12
|
+
* proxy produces on demand, and adds the resolved fields as own properties. Do
|
|
13
|
+
* not save a view as configuration: its alias fields would stop following later
|
|
14
|
+
* edits to the fields they were resolved from.
|
|
15
|
+
*/
|
|
16
|
+
/** Tailwind classes read from configuration. */
|
|
17
|
+
export type ConfigClass = string;
|
|
18
|
+
/** An icon size read from configuration, passed to the Icon `size` prop. */
|
|
19
|
+
export type IconSizeValue = string;
|
|
20
|
+
/** Fields a component does not read stay readable, but are not typed. */
|
|
21
|
+
type Open<T> = T & {
|
|
22
|
+
readonly [key: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
type Resolved<T> = Open<Readonly<T>>;
|
|
25
|
+
type ClassMap<K extends string> = {
|
|
26
|
+
[P in K]?: ConfigClass | null;
|
|
27
|
+
};
|
|
28
|
+
type IconSizeMap<K extends string> = {
|
|
29
|
+
[P in K]?: IconSizeValue | null;
|
|
30
|
+
};
|
|
31
|
+
type Optional<T> = T | null | undefined;
|
|
32
|
+
type ButtonVariantName = "main" | "default" | "destructive" | "tertiary" | "outline" | "secondary" | "ghost" | "ghostmain" | "link" | "linkDestructive" | "linkdestructive";
|
|
33
|
+
type ButtonSizeName = "xs" | "default" | "sm" | "lg" | "small" | "large" | "icon" | "icon-xs" | "icon-sm" | "icon-lg";
|
|
34
|
+
type ButtonIconPositionName = "prefix" | "suffix" | "default";
|
|
35
|
+
type ButtonIconPositionSizeName = "sm" | "small" | "default" | "lg" | "large";
|
|
36
|
+
type ButtonVariantAliases = "default" | "outline" | "linkDestructive";
|
|
37
|
+
type ButtonIconSizes = "icon" | "icon-xs" | "icon-sm" | "icon-lg";
|
|
38
|
+
interface ButtonBuckets {
|
|
39
|
+
variant?: Open<ClassMap<ButtonVariantName>> | null;
|
|
40
|
+
size?: Open<ClassMap<ButtonSizeName>> | null;
|
|
41
|
+
iconPosition?: Open<{
|
|
42
|
+
[P in ButtonIconPositionName]?: Open<ClassMap<ButtonIconPositionSizeName>> | null;
|
|
43
|
+
}> | null;
|
|
44
|
+
fullwidth?: Open<ClassMap<"true" | "false">> | null;
|
|
45
|
+
}
|
|
46
|
+
interface ButtonIconBuckets {
|
|
47
|
+
size?: Open<IconSizeMap<ButtonSizeName>> | null;
|
|
48
|
+
color?: Open<ClassMap<ButtonVariantName>> | null;
|
|
49
|
+
}
|
|
50
|
+
/** Button configuration: top-level buckets, or the same buckets under `variants`. */
|
|
51
|
+
export type ButtonConfigInput = Open<ButtonBuckets & {
|
|
52
|
+
root?: ConfigClass;
|
|
53
|
+
variants?: Open<ButtonBuckets> | null;
|
|
54
|
+
slots?: Open<{
|
|
55
|
+
icon?: Open<ButtonIconBuckets & {
|
|
56
|
+
root?: ConfigClass;
|
|
57
|
+
variants?: Open<ButtonIconBuckets> | null;
|
|
58
|
+
}> | null;
|
|
59
|
+
}> | null;
|
|
60
|
+
compoundVariants?: Open<{
|
|
61
|
+
links?: ConfigClass;
|
|
62
|
+
}>;
|
|
63
|
+
}>;
|
|
64
|
+
export type ResolvedButtonConfig = Resolved<{
|
|
65
|
+
root?: ConfigClass;
|
|
66
|
+
variant: Resolved<ClassMap<ButtonVariantName> & Record<ButtonVariantAliases, ConfigClass>>;
|
|
67
|
+
size: Resolved<ClassMap<ButtonSizeName> & Record<ButtonIconSizes, ConfigClass>>;
|
|
68
|
+
iconPosition: Resolved<{
|
|
69
|
+
[P in ButtonIconPositionName]: Resolved<ClassMap<ButtonIconPositionSizeName> & Record<"sm" | "lg", ConfigClass>>;
|
|
70
|
+
}>;
|
|
71
|
+
fullwidth: Resolved<ClassMap<"true" | "false">>;
|
|
72
|
+
slots: Resolved<{
|
|
73
|
+
icon: Resolved<{
|
|
74
|
+
root?: ConfigClass;
|
|
75
|
+
size: Resolved<IconSizeMap<ButtonSizeName> & Record<ButtonIconSizes, IconSizeValue>>;
|
|
76
|
+
color: Resolved<ClassMap<ButtonVariantName> & Record<ButtonVariantAliases, ConfigClass>>;
|
|
77
|
+
}>;
|
|
78
|
+
}>;
|
|
79
|
+
compoundVariants?: Resolved<{
|
|
80
|
+
links?: ConfigClass;
|
|
81
|
+
}>;
|
|
82
|
+
}>;
|
|
83
|
+
type BadgeVariantName = "main" | "default" | "outline" | "ghost" | "link" | "secondary" | "destructive" | "success" | "tertiary" | "warning" | "brand" | "informative" | "highlight" | "extendedOne";
|
|
84
|
+
type BadgeSlots = ClassMap<"bullet" | "icon">;
|
|
85
|
+
type BadgeStates = ClassMap<"dismissable">;
|
|
86
|
+
export type BadgeConfigInput = Open<{
|
|
87
|
+
root?: ConfigClass;
|
|
88
|
+
variant?: Open<ClassMap<BadgeVariantName> & {
|
|
89
|
+
subtle?: Open<ClassMap<BadgeVariantName>> | null;
|
|
90
|
+
}> | null;
|
|
91
|
+
slots?: Open<BadgeSlots>;
|
|
92
|
+
states?: Open<BadgeStates>;
|
|
93
|
+
}>;
|
|
94
|
+
export type ResolvedBadgeConfig = Resolved<{
|
|
95
|
+
root?: ConfigClass;
|
|
96
|
+
variant: Resolved<ClassMap<BadgeVariantName> & Record<"default" | "outline" | "ghost" | "link", ConfigClass> & {
|
|
97
|
+
subtle: Resolved<ClassMap<BadgeVariantName> & {
|
|
98
|
+
default: ConfigClass;
|
|
99
|
+
}>;
|
|
100
|
+
}>;
|
|
101
|
+
slots: Resolved<BadgeSlots>;
|
|
102
|
+
states: Resolved<BadgeStates>;
|
|
103
|
+
}>;
|
|
104
|
+
type CalendarCaption = ClassMap<"root" | "overlay" | "label" | "custom" | "hidden">;
|
|
105
|
+
export type CalendarConfigInput = Open<{
|
|
106
|
+
slots?: Open<{
|
|
107
|
+
caption?: Open<CalendarCaption> | null;
|
|
108
|
+
}> | null;
|
|
109
|
+
}>;
|
|
110
|
+
/** `slots.caption.overlay` is the caption between the navigation arrows, or `root` when none is set. */
|
|
111
|
+
export type ResolvedCalendarConfig = Resolved<{
|
|
112
|
+
slots: Resolved<{
|
|
113
|
+
caption: Resolved<CalendarCaption>;
|
|
114
|
+
}>;
|
|
115
|
+
}>;
|
|
116
|
+
type DateSliderCalendarSlots = ClassMap<"root" | "content" | "customRoot" | "header" | "months" | "options" | "row">;
|
|
117
|
+
type DateSliderCalendarDay = ClassMap<"root" | "variants">;
|
|
118
|
+
type DateSliderCalendarRange = ClassMap<"root" | "container" | "row">;
|
|
119
|
+
type DateSliderCalendar = Open<{
|
|
120
|
+
root?: ConfigClass;
|
|
121
|
+
slots?: Open<DateSliderCalendarSlots & {
|
|
122
|
+
day?: Open<DateSliderCalendarDay>;
|
|
123
|
+
range?: Open<DateSliderCalendarRange> | null;
|
|
124
|
+
}> | null;
|
|
125
|
+
}>;
|
|
126
|
+
/** Date slider configuration, with an optional calendar configuration of its own under `slots.calendar`. */
|
|
127
|
+
export type DateSliderConfigInput = Open<{
|
|
128
|
+
slots?: Open<{
|
|
129
|
+
calendar?: DateSliderCalendar | null;
|
|
130
|
+
}> | null;
|
|
131
|
+
}>;
|
|
132
|
+
/**
|
|
133
|
+
* The shared calendar configuration, used when the date slider has none of its own.
|
|
134
|
+
* Use a getter when reading this configuration can throw: the resolver reads it
|
|
135
|
+
* only when the local calendar is null or absent.
|
|
136
|
+
*/
|
|
137
|
+
export interface DateSliderDependencies {
|
|
138
|
+
readonly calendar: DateSliderCalendar | null | undefined;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* `slots.calendar` is the date slider's calendar configuration. Its `slots.range`
|
|
142
|
+
* fields fall back to the calendar's `root`, `content` and `row` slots.
|
|
143
|
+
*/
|
|
144
|
+
export type ResolvedDateSliderConfig = Resolved<{
|
|
145
|
+
slots: Resolved<{
|
|
146
|
+
calendar: Resolved<{
|
|
147
|
+
root?: ConfigClass;
|
|
148
|
+
slots: Resolved<DateSliderCalendarSlots & {
|
|
149
|
+
day: Resolved<DateSliderCalendarDay>;
|
|
150
|
+
range: Resolved<DateSliderCalendarRange>;
|
|
151
|
+
}>;
|
|
152
|
+
}>;
|
|
153
|
+
}>;
|
|
154
|
+
}>;
|
|
155
|
+
type CardSlots = ClassMap<"header" | "title" | "description" | "content" | "action" | "footer">;
|
|
156
|
+
type CardStates = ClassMap<"noContent" | "outside">;
|
|
157
|
+
type CardProps = {
|
|
158
|
+
footerAlign?: Open<ClassMap<string>>;
|
|
159
|
+
};
|
|
160
|
+
type ResolvedCardProps = {
|
|
161
|
+
footerAlign: Resolved<ClassMap<string>>;
|
|
162
|
+
};
|
|
163
|
+
/** Card configuration: `slots`, `states` and `props` buckets, or their fields on the root. */
|
|
164
|
+
export type CardConfigInput = Open<CardSlots & CardStates & CardProps & {
|
|
165
|
+
root?: ConfigClass;
|
|
166
|
+
slots?: Open<CardSlots> | null;
|
|
167
|
+
states?: Open<CardStates> | null;
|
|
168
|
+
props?: Open<CardProps> | null;
|
|
169
|
+
}>;
|
|
170
|
+
export type ResolvedCardConfig = Resolved<{
|
|
171
|
+
root?: ConfigClass;
|
|
172
|
+
slots: Resolved<CardSlots>;
|
|
173
|
+
states: Resolved<CardStates>;
|
|
174
|
+
props: Resolved<ResolvedCardProps>;
|
|
175
|
+
}>;
|
|
176
|
+
type CommandClassSlots = ClassMap<"list" | "empty" | "group" | "separator" | "item" | "shortcut">;
|
|
177
|
+
type CommandNestedSlots = {
|
|
178
|
+
dialog: ClassMap<"content" | "srOnly" | "root">;
|
|
179
|
+
input: ClassMap<"wrapper" | "icon" | "root">;
|
|
180
|
+
combobox: ClassMap<"label">;
|
|
181
|
+
};
|
|
182
|
+
type CommandSlots = CommandClassSlots & {
|
|
183
|
+
[K in keyof CommandNestedSlots]?: Open<CommandNestedSlots[K]>;
|
|
184
|
+
};
|
|
185
|
+
type ResolvedCommandSlots = CommandClassSlots & {
|
|
186
|
+
[K in keyof CommandNestedSlots]: Resolved<CommandNestedSlots[K]>;
|
|
187
|
+
};
|
|
188
|
+
/** Command configuration: a `slots` bucket, or its fields on the root. */
|
|
189
|
+
export type CommandConfigInput = Open<CommandSlots & {
|
|
190
|
+
root?: ConfigClass;
|
|
191
|
+
slots?: Open<CommandSlots> | null;
|
|
192
|
+
}>;
|
|
193
|
+
export type ResolvedCommandConfig = Resolved<{
|
|
194
|
+
root?: ConfigClass;
|
|
195
|
+
slots: Resolved<ResolvedCommandSlots>;
|
|
196
|
+
}>;
|
|
197
|
+
type InputGroupNestedSlots = {
|
|
198
|
+
addon: {
|
|
199
|
+
root?: ConfigClass;
|
|
200
|
+
align?: Open<ClassMap<string>>;
|
|
201
|
+
};
|
|
202
|
+
button: {
|
|
203
|
+
root?: ConfigClass;
|
|
204
|
+
size?: Open<ClassMap<string>>;
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
type InputGroupSlots = ClassMap<"text" | "input" | "textarea"> & {
|
|
208
|
+
[K in keyof InputGroupNestedSlots]?: Open<InputGroupNestedSlots[K]>;
|
|
209
|
+
};
|
|
210
|
+
type ResolvedInputGroupSlots = ClassMap<"text" | "input" | "textarea"> & {
|
|
211
|
+
[K in keyof InputGroupNestedSlots]: Resolved<InputGroupNestedSlots[K]>;
|
|
212
|
+
};
|
|
213
|
+
/** Input group configuration: a `slots` bucket, or its fields on the root. */
|
|
214
|
+
export type InputGroupConfigInput = Open<InputGroupSlots & {
|
|
215
|
+
root?: ConfigClass;
|
|
216
|
+
slots?: Open<InputGroupSlots> | null;
|
|
217
|
+
}>;
|
|
218
|
+
export type ResolvedInputGroupConfig = Resolved<{
|
|
219
|
+
root?: ConfigClass;
|
|
220
|
+
slots: Resolved<ResolvedInputGroupSlots>;
|
|
221
|
+
}>;
|
|
222
|
+
type Padding = Open<ClassMap<"true" | "false" | "horizontal" | "vertical">>;
|
|
223
|
+
/** Padding classes under `props.padding`, or under `padding` on the root. */
|
|
224
|
+
type PaddingInput = {
|
|
225
|
+
padding?: Padding | null;
|
|
226
|
+
props?: Open<{
|
|
227
|
+
padding?: Padding | null;
|
|
228
|
+
}> | null;
|
|
229
|
+
};
|
|
230
|
+
export type PopoverConfigInput = Open<PaddingInput>;
|
|
231
|
+
export type ResolvedPopoverConfig = Resolved<{
|
|
232
|
+
props: Resolved<{
|
|
233
|
+
padding?: Padding | null;
|
|
234
|
+
}>;
|
|
235
|
+
}>;
|
|
236
|
+
type SeparatorContainer = ClassMap<"root" | "horizontal" | "vertical">;
|
|
237
|
+
type SeparatorSlots = ClassMap<"horizontal" | "vertical"> & {
|
|
238
|
+
container?: Open<SeparatorContainer>;
|
|
239
|
+
};
|
|
240
|
+
/** Separator configuration: a `slots` bucket, or its fields on the root. */
|
|
241
|
+
export type SeparatorConfigInput = Open<PaddingInput & SeparatorSlots & {
|
|
242
|
+
root?: ConfigClass;
|
|
243
|
+
slots?: Open<SeparatorSlots> | null;
|
|
244
|
+
}>;
|
|
245
|
+
export type ResolvedSeparatorConfig = Resolved<{
|
|
246
|
+
root?: ConfigClass;
|
|
247
|
+
slots: Resolved<ClassMap<"horizontal" | "vertical"> & {
|
|
248
|
+
container: Resolved<SeparatorContainer>;
|
|
249
|
+
}>;
|
|
250
|
+
props: Resolved<{
|
|
251
|
+
padding?: Padding | null;
|
|
252
|
+
}>;
|
|
253
|
+
}>;
|
|
254
|
+
/** Spinner runtime configuration. */
|
|
255
|
+
export type SpinnerConfigInput = Open<{
|
|
256
|
+
root?: ConfigClass;
|
|
257
|
+
slots?: Open<{
|
|
258
|
+
track?: ConfigClass | null;
|
|
259
|
+
}> | null;
|
|
260
|
+
}>;
|
|
261
|
+
/** `slots.track` is absent when the configuration sets none; each target keeps its own default. */
|
|
262
|
+
export type ResolvedSpinnerConfig = Resolved<{
|
|
263
|
+
root?: ConfigClass;
|
|
264
|
+
slots: Resolved<{
|
|
265
|
+
track?: ConfigClass | null;
|
|
266
|
+
}>;
|
|
267
|
+
}>;
|
|
268
|
+
/** The configuration each policy reads and the view it returns, by component name. */
|
|
269
|
+
export interface ComponentConfigPolicies {
|
|
270
|
+
button: {
|
|
271
|
+
input: ButtonConfigInput;
|
|
272
|
+
output: ResolvedButtonConfig;
|
|
273
|
+
};
|
|
274
|
+
badge: {
|
|
275
|
+
input: BadgeConfigInput;
|
|
276
|
+
output: ResolvedBadgeConfig;
|
|
277
|
+
};
|
|
278
|
+
calendar: {
|
|
279
|
+
input: CalendarConfigInput;
|
|
280
|
+
output: ResolvedCalendarConfig;
|
|
281
|
+
};
|
|
282
|
+
card: {
|
|
283
|
+
input: CardConfigInput;
|
|
284
|
+
output: ResolvedCardConfig;
|
|
285
|
+
};
|
|
286
|
+
command: {
|
|
287
|
+
input: CommandConfigInput;
|
|
288
|
+
output: ResolvedCommandConfig;
|
|
289
|
+
};
|
|
290
|
+
"date-slider": {
|
|
291
|
+
input: DateSliderConfigInput;
|
|
292
|
+
output: ResolvedDateSliderConfig;
|
|
293
|
+
dependencies: DateSliderDependencies;
|
|
294
|
+
};
|
|
295
|
+
"input-group": {
|
|
296
|
+
input: InputGroupConfigInput;
|
|
297
|
+
output: ResolvedInputGroupConfig;
|
|
298
|
+
};
|
|
299
|
+
popover: {
|
|
300
|
+
input: PopoverConfigInput;
|
|
301
|
+
output: ResolvedPopoverConfig;
|
|
302
|
+
};
|
|
303
|
+
separator: {
|
|
304
|
+
input: SeparatorConfigInput;
|
|
305
|
+
output: ResolvedSeparatorConfig;
|
|
306
|
+
};
|
|
307
|
+
spinner: {
|
|
308
|
+
input: SpinnerConfigInput;
|
|
309
|
+
output: ResolvedSpinnerConfig;
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
export type ConfiguredComponentName = keyof ComponentConfigPolicies;
|
|
313
|
+
/** The configuration of other components a policy reads, passed by the caller. */
|
|
314
|
+
type DependencyArgs<N extends ConfiguredComponentName> = ComponentConfigPolicies[N] extends {
|
|
315
|
+
dependencies: infer D;
|
|
316
|
+
} ? [dependencies: D] : [];
|
|
317
|
+
/**
|
|
318
|
+
* The view of one component's runtime configuration that its policy resolves.
|
|
319
|
+
*
|
|
320
|
+
* `config` is what `ffdc(config)[name]` returns. A policy that reads another
|
|
321
|
+
* component's configuration takes it as `dependencies`. `null` and `undefined` are
|
|
322
|
+
* returned unchanged, so a component without configuration fails where it did
|
|
323
|
+
* before. Other inputs must be runtime configuration objects.
|
|
324
|
+
*/
|
|
325
|
+
export declare function resolveComponentConfig<N extends ConfiguredComponentName>(name: N, config: ComponentConfigPolicies[N]["input"], ...dependencies: DependencyArgs<N>): ComponentConfigPolicies[N]["output"];
|
|
326
|
+
export declare function resolveComponentConfig<N extends ConfiguredComponentName, A extends null | undefined>(name: N, config: A, ...dependencies: DependencyArgs<N>): A;
|
|
327
|
+
export declare function resolveComponentConfig<N extends ConfiguredComponentName>(name: N, config: Optional<ComponentConfigPolicies[N]["input"]>, ...dependencies: DependencyArgs<N>): Optional<ComponentConfigPolicies[N]["output"]>;
|
|
328
|
+
/** Component names that have a configuration policy. */
|
|
329
|
+
export declare const CONFIGURED_COMPONENTS: readonly ConfiguredComponentName[];
|
|
330
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function S(e){return typeof e=="object"&&e!==null||typeof e=="function"}function o(e,n){return S(e)?e[n]:void 0}function t(e,n){let a=S(e)?e:null,s=a?Object.create(a):{},r=(p,u)=>Object.defineProperty(s,p,{value:u,enumerable:!0,writable:!0,configurable:!0});if(a)for(let p of Object.keys(a))r(p,a[p]);for(let p of Object.keys(n))r(p,n[p]);return s}function N(e,n){let a={};for(let s of n){let r=o(e,s);r!==void 0&&(a[s]=r)}return a}function l(...e){return e.find(n=>n!=null)||""}function d(...e){return e.find(Boolean)||{}}function C(e,n,a){return e[n]||N(e,a)}function v(e){return t(e,{default:l(e.default,e.main),outline:l(e.outline,e.tertiary),linkDestructive:l(e.linkDestructive,e.linkdestructive)})}function x(e){let n=o(e,"variants"),a=d(e.variant,o(n,"variant")),s=d(e.size,o(n,"size")),r=d(e.iconPosition,o(n,"iconPosition")),p=d(e.fullwidth,o(n,"fullwidth")),u=o(e.slots,"icon")||{},m=o(u,"variants"),i=d(u.size,o(m,"size")),R=d(u.color,o(m,"color")),f=O=>{let c=o(r,O);return t(c,{sm:l(o(c,"sm"),o(c,"small")),lg:l(o(c,"lg"),o(c,"large"))})};return t(e,{variant:v(a),size:t(s,{icon:l(s.icon,o(o(r,"default"),"default")),"icon-xs":l(s["icon-xs"],s.xs,s.small,s.sm),"icon-sm":l(s["icon-sm"],s.small,s.sm),"icon-lg":l(s["icon-lg"],s.large,s.lg)}),iconPosition:t(r,{prefix:f("prefix"),suffix:f("suffix"),default:f("default")}),fullwidth:p,slots:t(e.slots,{icon:t(u,{size:t(i,{icon:l(i.icon,i.default),"icon-xs":l(i["icon-xs"],i.xs,i.small,i.sm,i.default),"icon-sm":l(i["icon-sm"],i.sm,i.default),"icon-lg":l(i["icon-lg"],i.lg,i.default)}),color:v(R)})})})}function I(e){let n=e.variant,a=o(n,"subtle");return t(e,{variant:t(n,{default:l(o(n,"default"),o(n,"main")),outline:l(o(n,"outline"),o(n,"tertiary")),ghost:l(o(n,"ghost"),o(n,"tertiary")),link:l(o(n,"link"),o(n,"tertiary")),subtle:t(a,{default:l(o(a,"default"),o(a,"main"))})})})}function B(e){let n=e.slots,a=o(n,"caption");return t(e,{slots:t(n,{caption:t(a,{overlay:o(a,"overlay")??o(a,"root")})})})}function P(e,n={}){let a=o(e.slots,"calendar")??n.calendar,s=o(a,"slots"),r=o(s,"range");return t(e,{slots:t(e.slots,{calendar:t(a,{slots:t(s,{range:t(r,{root:o(r,"root")??o(s,"root"),container:o(r,"container")??o(s,"content"),row:o(r,"row")??o(s,"row")})})})})})}var k=["header","title","description","content","action","footer"],M=["noContent","outside"],D=["footerAlign"];function z(e){return t(e,{slots:C(e,"slots",k),states:C(e,"states",M),props:C(e,"props",D)})}var b=["dialog","input","list","empty","group","separator","item","shortcut","combobox"];function h(e){return t(e,{slots:C(e,"slots",b)})}var w=["addon","button","text","input","textarea"];function A(e){return t(e,{slots:C(e,"slots",w)})}function y(e){return t(e.props,{padding:o(e.props,"padding")||e.padding})}function V(e){return t(e,{props:y(e)})}var G=["horizontal","vertical","container"];function T(e){return t(e,{slots:C(e,"slots",G),props:y(e)})}function K(e){return t(e,{root:e.root,slots:t(e.slots,{track:o(e.slots,"track")})})}var g={button:x,badge:I,calendar:B,card:z,command:h,"date-slider":P,"input-group":A,popover:V,separator:T,spinner:K};function j(e,n,...a){if(!Object.prototype.hasOwnProperty.call(g,e))throw new TypeError(`No component configuration policy for "${String(e)}".`);if(n==null)return n;if(!S(n))throw new TypeError("Component config must be an object.");let s=n;return g[e](s,a[0])}var _=Object.freeze(Object.keys(g));export{_ as CONFIGURED_COMPONENTS,j as resolveComponentConfig};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface ComponentRecipe {
|
|
2
|
+
config: Record<string, any>;
|
|
3
|
+
classes: Record<string, string>;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function createComponentRecipe(
|
|
7
|
+
componentsConfig: Record<string, any>,
|
|
8
|
+
options?: { prefix?: string }
|
|
9
|
+
): ComponentRecipe;
|
|
10
|
+
|
|
11
|
+
export function emitComponentRecipeCss(
|
|
12
|
+
classes: Record<string, string>,
|
|
13
|
+
options?: {
|
|
14
|
+
scope?: string;
|
|
15
|
+
/** Chains of markers from weaker to stronger. Each marker is emitted after the
|
|
16
|
+
* ones before it in its chain, so it wins where a component composes it later;
|
|
17
|
+
* every other marker keeps its order. Contradicting chains throw. */
|
|
18
|
+
order?: string[][];
|
|
19
|
+
}
|
|
20
|
+
): string;
|
|
21
|
+
|
|
22
|
+
/** Cross-primitive state variant definitions, one `@custom-variant` per line group. */
|
|
23
|
+
export const STATE_VARIANT_CSS: string[];
|
|
24
|
+
|
|
25
|
+
/** Names of every variant in STATE_VARIANT_CSS, e.g. "data-checked". */
|
|
26
|
+
export const STATE_VARIANT_NAMES: string[];
|
|
27
|
+
|
|
28
|
+
/** STATE_VARIANT_CSS joined into a stylesheet fragment. */
|
|
29
|
+
export function stateVariantCss(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t={$id:"https://frontfriend.dev/schemas/components-config.schema.json",type:"object",additionalProperties:{$ref:"#/$defs/componentConfig"},$defs:{componentConfig:{$ref:"#/$defs/componentEnvelope"},styleTree:{anyOf:[{type:"string"},{type:"object",additionalProperties:{$ref:"#/$defs/styleTree"}}]},behaviorTree:{anyOf:[{type:["string","number","boolean","null"]},{type:"array",items:{$ref:"#/$defs/behaviorTree"}},{type:"object",additionalProperties:{$ref:"#/$defs/behaviorTree"}}]},componentEnvelope:{type:"object",additionalProperties:!1,required:["styles"],properties:{styles:{type:"object",additionalProperties:{$ref:"#/$defs/styleTree"}},behavior:{type:"object",additionalProperties:{$ref:"#/$defs/behaviorTree"}}}}}};function o(e){return typeof e=="string"&&e.trim().length>0}module.exports={componentsConfigSchema:t,isCSSClassString:o};
|
package/dist/ffdc.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentConfigPolicies, ConfiguredComponentName } from './component-config';
|
|
2
|
+
export type ComponentStyles = string | { [key: string]: ComponentStyles };
|
|
3
|
+
export type ComponentBehavior = string | number | boolean | null | ComponentBehavior[] | { [key: string]: ComponentBehavior };
|
|
4
|
+
export interface ComponentConfigEnvelope {
|
|
5
|
+
styles: Record<string, ComponentStyles>;
|
|
6
|
+
behavior?: Record<string, ComponentBehavior>;
|
|
7
|
+
}
|
|
8
|
+
export type ComponentsConfig = Record<string, ComponentConfigEnvelope>;
|
|
9
|
+
|
|
10
|
+
/** A component consumption view. The input and the one-argument result stay unchanged. */
|
|
11
|
+
declare function ffdc<N extends ConfiguredComponentName>(config: ComponentsConfig | Record<string, any> | null | undefined, component: N): ComponentConfigPolicies[N]['output'] | null | undefined;
|
|
12
|
+
// Keep the one-argument overload last so callbacks such as array.map(ffdc) retain their return type.
|
|
13
|
+
declare function ffdc(config: ComponentsConfig | Record<string, any> | null | undefined): Record<string, any>;
|
|
14
|
+
export { ffdc };
|
|
15
|
+
export default ffdc;
|
|
16
|
+
export const componentsConfigSchema: Record<string, any>;
|
|
17
|
+
export function isCSSClassString(value: string): boolean;
|
package/dist/ffdc.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var S=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var P=(e,o)=>()=>(e&&(o=e(e=0)),o);var b=(e,o)=>()=>(o||e((o={exports:{}}).exports,o),o.exports),_=(e,o)=>{for(var n in o)S(e,n,{get:o[n],enumerable:!0})},L=(e,o,n,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of E(o))!K.call(e,r)&&r!==n&&S(e,r,{get:()=>o[r],enumerable:!(t=G(o,r))||t.enumerable});return e};var q=e=>L(S({},"__esModule",{value:!0}),e);var B=b((Se,I)=>{var U={$id:"https://frontfriend.dev/schemas/components-config.schema.json",type:"object",additionalProperties:{$ref:"#/$defs/componentConfig"},$defs:{componentConfig:{$ref:"#/$defs/componentEnvelope"},styleTree:{anyOf:[{type:"string"},{type:"object",additionalProperties:{$ref:"#/$defs/styleTree"}}]},behaviorTree:{anyOf:[{type:["string","number","boolean","null"]},{type:"array",items:{$ref:"#/$defs/behaviorTree"}},{type:"object",additionalProperties:{$ref:"#/$defs/behaviorTree"}}]},componentEnvelope:{type:"object",additionalProperties:!1,required:["styles"],properties:{styles:{type:"object",additionalProperties:{$ref:"#/$defs/styleTree"}},behavior:{type:"object",additionalProperties:{$ref:"#/$defs/behaviorTree"}}}}}};function F(e){return typeof e=="string"&&e.trim().length>0}I.exports={componentsConfigSchema:U,isCSSClassString:F}});var D=b((ye,M)=>{function u(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function y(e,o){if(!u(e)||!u(o))return o===void 0?e:o;let n={...e};for(let[t,r]of Object.entries(o))n[t]=t in n?y(n[t],r):r;return n}function v(e,o,n=[],t=[]){if(e===void 0||o===void 0)return t;if(!u(e)||!u(o))return t.push(n.join(".")),t;for(let r of Object.keys(e))r in o&&v(e[r],o[r],[...n,r],t);return t}function h(e){return u(e)&&("styles"in e||"behavior"in e)}function k(e,o="component"){if(!h(e)||!u(e.styles)||e.behavior!==void 0&&!u(e.behavior)||Object.keys(e).some(t=>!["styles","behavior"].includes(t)))throw new TypeError(`Component ${o} must use the styles/behavior envelope`);let n=v(e.styles,e.behavior,[o]);if(n.length>0)throw new Error(`Component config styles/behavior conflict at ${n.join(", ")}`);return y(e.styles||{},e.behavior||{})}function H(e){if(!u(e))return e;let o=!1,n={};for(let[t,r]of Object.entries(e))n[t]=k(r,t),n[t]!==r&&(o=!0);return o?n:e}M.exports={isPlainObject:u,deepMerge:y,findTreeConflicts:v,isComponentEnvelope:h,toRuntimeComponentConfig:k,toRuntimeComponentsConfig:H}});function O(e){return typeof e=="object"&&e!==null||typeof e=="function"}function s(e,o){return O(e)?e[o]:void 0}function a(e,o){let n=O(e)?e:null,t=n?Object.create(n):{},r=(p,d)=>Object.defineProperty(t,p,{value:d,enumerable:!0,writable:!0,configurable:!0});if(n)for(let p of Object.keys(n))r(p,n[p]);for(let p of Object.keys(o))r(p,o[p]);return t}function J(e,o){let n={};for(let t of o){let r=s(e,t);r!==void 0&&(n[t]=r)}return n}function i(...e){return e.find(o=>o!=null)||""}function c(...e){return e.find(Boolean)||{}}function C(e,o,n){return e[o]||J(e,n)}function z(e){return a(e,{default:i(e.default,e.main),outline:i(e.outline,e.tertiary),linkDestructive:i(e.linkDestructive,e.linkdestructive)})}function Q(e){let o=s(e,"variants"),n=c(e.variant,s(o,"variant")),t=c(e.size,s(o,"size")),r=c(e.iconPosition,s(o,"iconPosition")),p=c(e.fullwidth,s(o,"fullwidth")),d=s(e.slots,"icon")||{},x=s(d,"variants"),l=c(d.size,s(x,"size")),V=c(d.color,s(x,"color")),m=$=>{let g=s(r,$);return a(g,{sm:i(s(g,"sm"),s(g,"small")),lg:i(s(g,"lg"),s(g,"large"))})};return a(e,{variant:z(n),size:a(t,{icon:i(t.icon,s(s(r,"default"),"default")),"icon-xs":i(t["icon-xs"],t.xs,t.small,t.sm),"icon-sm":i(t["icon-sm"],t.small,t.sm),"icon-lg":i(t["icon-lg"],t.large,t.lg)}),iconPosition:a(r,{prefix:m("prefix"),suffix:m("suffix"),default:m("default")}),fullwidth:p,slots:a(e.slots,{icon:a(d,{size:a(l,{icon:i(l.icon,l.default),"icon-xs":i(l["icon-xs"],l.xs,l.small,l.sm,l.default),"icon-sm":i(l["icon-sm"],l.sm,l.default),"icon-lg":i(l["icon-lg"],l.lg,l.default)}),color:z(V)})})})}function W(e){let o=e.variant,n=s(o,"subtle");return a(e,{variant:a(o,{default:i(s(o,"default"),s(o,"main")),outline:i(s(o,"outline"),s(o,"tertiary")),ghost:i(s(o,"ghost"),s(o,"tertiary")),link:i(s(o,"link"),s(o,"tertiary")),subtle:a(n,{default:i(s(n,"default"),s(n,"main"))})})})}function X(e){let o=e.slots,n=s(o,"caption");return a(e,{slots:a(o,{caption:a(n,{overlay:s(n,"overlay")??s(n,"root")})})})}function Y(e,o={}){let n=s(e.slots,"calendar")??o.calendar,t=s(n,"slots"),r=s(t,"range");return a(e,{slots:a(e.slots,{calendar:a(n,{slots:a(t,{range:a(r,{root:s(r,"root")??s(t,"root"),container:s(r,"container")??s(t,"content"),row:s(r,"row")??s(t,"row")})})})})})}function ne(e){return a(e,{slots:C(e,"slots",Z),states:C(e,"states",ee),props:C(e,"props",oe)})}function se(e){return a(e,{slots:C(e,"slots",te)})}function ae(e){return a(e,{slots:C(e,"slots",re)})}function w(e){return a(e.props,{padding:s(e.props,"padding")||e.padding})}function ie(e){return a(e,{props:w(e)})}function pe(e){return a(e,{slots:C(e,"slots",le),props:w(e)})}function ue(e){return a(e,{root:e.root,slots:a(e.slots,{track:s(e.slots,"track")})})}function N(e,o,...n){if(!Object.prototype.hasOwnProperty.call(R,e))throw new TypeError(`No component configuration policy for "${String(e)}".`);if(o==null)return o;if(!O(o))throw new TypeError("Component config must be an object.");let t=o;return R[e](t,n[0])}var Z,ee,oe,te,re,le,R,ve,j=P(()=>{Z=["header","title","description","content","action","footer"],ee=["noContent","outside"],oe=["footerAlign"];te=["dialog","input","list","empty","group","separator","item","shortcut","combobox"];re=["addon","button","text","input","textarea"];le=["horizontal","vertical","container"];R={button:Q,badge:W,calendar:X,card:ne,command:se,"date-slider":Y,"input-group":ae,popover:ie,separator:pe,spinner:ue};ve=Object.freeze(Object.keys(R))});var T={};_(T,{componentConfig:()=>de});function de(e,o){let n=e[o];return o==="date-slider"?N(o,n,{get calendar(){return e.calendar}}):N(o,n)}var A=P(()=>{j()});var{componentsConfigSchema:ce,isCSSClassString:Ce}=B(),{toRuntimeComponentsConfig:fe}=D(),{componentConfig:ge}=(A(),q(T));function f(e,o){if(typeof o=="string")return ge(f(e),o);if(!e)return{};if(typeof e!="object")throw new Error("Config must be an object");return fe(e)}f.componentsConfigSchema=ce;f.isCSSClassString=Ce;module.exports=f;module.exports.default=f;module.exports.ffdc=f;
|
package/dist/ffdc.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var L=Object.create;var m=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var B=(e,o)=>()=>(e&&(o=e(e=0)),o);var v=(e,o)=>()=>(o||e((o={exports:{}}).exports,o),o.exports),J=(e,o)=>{for(var n in o)m(e,n,{get:o[n],enumerable:!0})},h=(e,o,n,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of U(o))!H.call(e,r)&&r!==n&&m(e,r,{get:()=>o[r],enumerable:!(t=q(o,r))||t.enumerable});return e};var Q=(e,o,n)=>(n=e!=null?L(F(e)):{},h(o||!e||!e.__esModule?m(n,"default",{value:e,enumerable:!0}):n,e)),W=e=>h(m({},"__esModule",{value:!0}),e);var M=v((Ne,k)=>{var X={$id:"https://frontfriend.dev/schemas/components-config.schema.json",type:"object",additionalProperties:{$ref:"#/$defs/componentConfig"},$defs:{componentConfig:{$ref:"#/$defs/componentEnvelope"},styleTree:{anyOf:[{type:"string"},{type:"object",additionalProperties:{$ref:"#/$defs/styleTree"}}]},behaviorTree:{anyOf:[{type:["string","number","boolean","null"]},{type:"array",items:{$ref:"#/$defs/behaviorTree"}},{type:"object",additionalProperties:{$ref:"#/$defs/behaviorTree"}}]},componentEnvelope:{type:"object",additionalProperties:!1,required:["styles"],properties:{styles:{type:"object",additionalProperties:{$ref:"#/$defs/styleTree"}},behavior:{type:"object",additionalProperties:{$ref:"#/$defs/behaviorTree"}}}}}};function Y(e){return typeof e=="string"&&e.trim().length>0}k.exports={componentsConfigSchema:X,isCSSClassString:Y}});var j=v((Pe,w)=>{function u(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function R(e,o){if(!u(e)||!u(o))return o===void 0?e:o;let n={...e};for(let[t,r]of Object.entries(o))n[t]=t in n?R(n[t],r):r;return n}function O(e,o,n=[],t=[]){if(e===void 0||o===void 0)return t;if(!u(e)||!u(o))return t.push(n.join(".")),t;for(let r of Object.keys(e))r in o&&O(e[r],o[r],[...n,r],t);return t}function D(e){return u(e)&&("styles"in e||"behavior"in e)}function z(e,o="component"){if(!D(e)||!u(e.styles)||e.behavior!==void 0&&!u(e.behavior)||Object.keys(e).some(t=>!["styles","behavior"].includes(t)))throw new TypeError(`Component ${o} must use the styles/behavior envelope`);let n=O(e.styles,e.behavior,[o]);if(n.length>0)throw new Error(`Component config styles/behavior conflict at ${n.join(", ")}`);return R(e.styles||{},e.behavior||{})}function Z(e){if(!u(e))return e;let o=!1,n={};for(let[t,r]of Object.entries(e))n[t]=z(r,t),n[t]!==r&&(o=!0);return o?n:e}w.exports={isPlainObject:u,deepMerge:R,findTreeConflicts:O,isComponentEnvelope:D,toRuntimeComponentConfig:z,toRuntimeComponentsConfig:Z}});function N(e){return typeof e=="object"&&e!==null||typeof e=="function"}function s(e,o){return N(e)?e[o]:void 0}function a(e,o){let n=N(e)?e:null,t=n?Object.create(n):{},r=(p,d)=>Object.defineProperty(t,p,{value:d,enumerable:!0,writable:!0,configurable:!0});if(n)for(let p of Object.keys(n))r(p,n[p]);for(let p of Object.keys(o))r(p,o[p]);return t}function ee(e,o){let n={};for(let t of o){let r=s(e,t);r!==void 0&&(n[t]=r)}return n}function i(...e){return e.find(o=>o!=null)||""}function c(...e){return e.find(Boolean)||{}}function C(e,o,n){return e[o]||ee(e,n)}function T(e){return a(e,{default:i(e.default,e.main),outline:i(e.outline,e.tertiary),linkDestructive:i(e.linkDestructive,e.linkdestructive)})}function oe(e){let o=s(e,"variants"),n=c(e.variant,s(o,"variant")),t=c(e.size,s(o,"size")),r=c(e.iconPosition,s(o,"iconPosition")),p=c(e.fullwidth,s(o,"fullwidth")),d=s(e.slots,"icon")||{},I=s(d,"variants"),l=c(d.size,s(I,"size")),K=c(d.color,s(I,"color")),y=_=>{let g=s(r,_);return a(g,{sm:i(s(g,"sm"),s(g,"small")),lg:i(s(g,"lg"),s(g,"large"))})};return a(e,{variant:T(n),size:a(t,{icon:i(t.icon,s(s(r,"default"),"default")),"icon-xs":i(t["icon-xs"],t.xs,t.small,t.sm),"icon-sm":i(t["icon-sm"],t.small,t.sm),"icon-lg":i(t["icon-lg"],t.large,t.lg)}),iconPosition:a(r,{prefix:y("prefix"),suffix:y("suffix"),default:y("default")}),fullwidth:p,slots:a(e.slots,{icon:a(d,{size:a(l,{icon:i(l.icon,l.default),"icon-xs":i(l["icon-xs"],l.xs,l.small,l.sm,l.default),"icon-sm":i(l["icon-sm"],l.sm,l.default),"icon-lg":i(l["icon-lg"],l.lg,l.default)}),color:T(K)})})})}function ne(e){let o=e.variant,n=s(o,"subtle");return a(e,{variant:a(o,{default:i(s(o,"default"),s(o,"main")),outline:i(s(o,"outline"),s(o,"tertiary")),ghost:i(s(o,"ghost"),s(o,"tertiary")),link:i(s(o,"link"),s(o,"tertiary")),subtle:a(n,{default:i(s(n,"default"),s(n,"main"))})})})}function te(e){let o=e.slots,n=s(o,"caption");return a(e,{slots:a(o,{caption:a(n,{overlay:s(n,"overlay")??s(n,"root")})})})}function se(e,o={}){let n=s(e.slots,"calendar")??o.calendar,t=s(n,"slots"),r=s(t,"range");return a(e,{slots:a(e.slots,{calendar:a(n,{slots:a(t,{range:a(r,{root:s(r,"root")??s(t,"root"),container:s(r,"container")??s(t,"content"),row:s(r,"row")??s(t,"row")})})})})})}function le(e){return a(e,{slots:C(e,"slots",re),states:C(e,"states",ae),props:C(e,"props",ie)})}function ue(e){return a(e,{slots:C(e,"slots",pe)})}function ce(e){return a(e,{slots:C(e,"slots",de)})}function A(e){return a(e.props,{padding:s(e.props,"padding")||e.padding})}function Ce(e){return a(e,{props:A(e)})}function ge(e){return a(e,{slots:C(e,"slots",fe),props:A(e)})}function me(e){return a(e,{root:e.root,slots:a(e.slots,{track:s(e.slots,"track")})})}function P(e,o,...n){if(!Object.prototype.hasOwnProperty.call(x,e))throw new TypeError(`No component configuration policy for "${String(e)}".`);if(o==null)return o;if(!N(o))throw new TypeError("Component config must be an object.");let t=o;return x[e](t,n[0])}var re,ae,ie,pe,de,fe,x,be,V=B(()=>{re=["header","title","description","content","action","footer"],ae=["noContent","outside"],ie=["footerAlign"];pe=["dialog","input","list","empty","group","separator","item","shortcut","combobox"];de=["addon","button","text","input","textarea"];fe=["horizontal","vertical","container"];x={button:oe,badge:ne,calendar:te,card:le,command:ue,"date-slider":se,"input-group":ce,popover:Ce,separator:ge,spinner:me};be=Object.freeze(Object.keys(x))});var $={};J($,{componentConfig:()=>Se});function Se(e,o){let n=e[o];return o==="date-slider"?P(o,n,{get calendar(){return e.calendar}}):P(o,n)}var G=B(()=>{V()});var E=v((he,S)=>{var{componentsConfigSchema:ye,isCSSClassString:ve}=M(),{toRuntimeComponentsConfig:Re}=j(),{componentConfig:Oe}=(G(),W($));function f(e,o){if(typeof o=="string")return Oe(f(e),o);if(!e)return{};if(typeof e!="object")throw new Error("Config must be an object");return Re(e)}f.componentsConfigSchema=ye;f.isCSSClassString=ve;S.exports=f;S.exports.default=f;S.exports.ffdc=f});var b=Q(E(),1),{componentsConfigSchema:ke,isCSSClassString:Me}=b.default;var De=b.default;var export_ffdc=b.default;export{ke as componentsConfigSchema,De as default,export_ffdc as ffdc,Me as isCSSClassString};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"steps": ["low", "mid", "strong", "subtle"],
|
|
3
|
+
"states": ["hover", "active", "selected", "disabled"],
|
|
4
|
+
"family_intents": {
|
|
5
|
+
"brand": "Brand identity and primary actions.",
|
|
6
|
+
"neutral": "Default surfaces, borders, and content.",
|
|
7
|
+
"inverse": "Content and surfaces on an inverted background.",
|
|
8
|
+
"interactive": "Interactive controls and affordances.",
|
|
9
|
+
"highlight": "Highlighted or emphasized content.",
|
|
10
|
+
"info": "Informational status and feedback.",
|
|
11
|
+
"positive": "Success and positive status.",
|
|
12
|
+
"negative": "Errors, danger, and destructive actions.",
|
|
13
|
+
"warning": "Warnings and cautionary status.",
|
|
14
|
+
"onbrand": "Foreground content placed on brand surfaces.",
|
|
15
|
+
"oninteractive": "Foreground content placed on interactive surfaces.",
|
|
16
|
+
"onhighlight": "Foreground content placed on highlight surfaces.",
|
|
17
|
+
"oninfo": "Foreground content placed on informational surfaces.",
|
|
18
|
+
"onpositive": "Foreground content placed on positive surfaces.",
|
|
19
|
+
"onnegative": "Foreground content placed on negative surfaces.",
|
|
20
|
+
"onwarning": "Foreground content placed on warning surfaces.",
|
|
21
|
+
"layer": "Page, panel, control, popover, and dialog surfaces.",
|
|
22
|
+
"overlay": "Scrims placed between content layers.",
|
|
23
|
+
"disabled": "Disabled controls and content."
|
|
24
|
+
},
|
|
25
|
+
"shadcn_mapping": {
|
|
26
|
+
"primary": "brand-mid",
|
|
27
|
+
"primary-foreground": "onbrand-mid",
|
|
28
|
+
"secondary": "neutral-subtle",
|
|
29
|
+
"secondary-foreground": "neutral-strong",
|
|
30
|
+
"destructive": "negative-mid",
|
|
31
|
+
"destructive-foreground": "onnegative-mid",
|
|
32
|
+
"background": "layer-below",
|
|
33
|
+
"foreground": "neutral-strong",
|
|
34
|
+
"card": "layer-raised",
|
|
35
|
+
"card-foreground": "neutral-strong",
|
|
36
|
+
"popover": "layer-popover",
|
|
37
|
+
"popover-foreground": "neutral-strong",
|
|
38
|
+
"muted": "neutral-subtle",
|
|
39
|
+
"muted-foreground": "neutral-mid",
|
|
40
|
+
"accent": "neutral-subtle",
|
|
41
|
+
"accent-foreground": "neutral-strong",
|
|
42
|
+
"border": "neutral-subtle",
|
|
43
|
+
"ring": "brand-mid",
|
|
44
|
+
"input background": "layer-control",
|
|
45
|
+
"input border or ring": "neutral-subtle",
|
|
46
|
+
"success": "positive-mid",
|
|
47
|
+
"success-foreground": "onpositive-mid",
|
|
48
|
+
"info": "info-mid",
|
|
49
|
+
"info-foreground": "oninfo-mid",
|
|
50
|
+
"warning": "warning-mid",
|
|
51
|
+
"warning-foreground": "onwarning-mid",
|
|
52
|
+
"invert": "inverse-mid",
|
|
53
|
+
"invert-foreground": "neutral-low",
|
|
54
|
+
"scrim": "overlay"
|
|
55
|
+
}
|
|
56
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var v=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var B=(e,o)=>()=>(e&&(o=e(e=0)),o);var O=(e,o)=>()=>(o||e((o={exports:{}}).exports,o),o.exports),L=(e,o)=>{for(var n in o)v(e,n,{get:o[n],enumerable:!0})},U=(e,o,n,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of K(o))!q.call(e,r)&&r!==n&&v(e,r,{get:()=>o[r],enumerable:!(t=E(o,r))||t.enumerable});return e};var H=e=>U(v({},"__esModule",{value:!0}),e);var R=O((Ne,w)=>{var J={$id:"https://frontfriend.dev/schemas/components-config.schema.json",type:"object",additionalProperties:{$ref:"#/$defs/componentConfig"},$defs:{componentConfig:{$ref:"#/$defs/componentEnvelope"},styleTree:{anyOf:[{type:"string"},{type:"object",additionalProperties:{$ref:"#/$defs/styleTree"}}]},behaviorTree:{anyOf:[{type:["string","number","boolean","null"]},{type:"array",items:{$ref:"#/$defs/behaviorTree"}},{type:"object",additionalProperties:{$ref:"#/$defs/behaviorTree"}}]},componentEnvelope:{type:"object",additionalProperties:!1,required:["styles"],properties:{styles:{type:"object",additionalProperties:{$ref:"#/$defs/styleTree"}},behavior:{type:"object",additionalProperties:{$ref:"#/$defs/behaviorTree"}}}}}};function Q(e){return typeof e=="string"&&e.trim().length>0}w.exports={componentsConfigSchema:J,isCSSClassString:Q}});var D=O((xe,M)=>{function u(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function N(e,o){if(!u(e)||!u(o))return o===void 0?e:o;let n={...e};for(let[t,r]of Object.entries(o))n[t]=t in n?N(n[t],r):r;return n}function x(e,o,n=[],t=[]){if(e===void 0||o===void 0)return t;if(!u(e)||!u(o))return t.push(n.join(".")),t;for(let r of Object.keys(e))r in o&&x(e[r],o[r],[...n,r],t);return t}function _(e){return u(e)&&("styles"in e||"behavior"in e)}function k(e,o="component"){if(!_(e)||!u(e.styles)||e.behavior!==void 0&&!u(e.behavior)||Object.keys(e).some(t=>!["styles","behavior"].includes(t)))throw new TypeError(`Component ${o} must use the styles/behavior envelope`);let n=x(e.styles,e.behavior,[o]);if(n.length>0)throw new Error(`Component config styles/behavior conflict at ${n.join(", ")}`);return N(e.styles||{},e.behavior||{})}function W(e){if(!u(e))return e;let o=!1,n={};for(let[t,r]of Object.entries(e))n[t]=k(r,t),n[t]!==r&&(o=!0);return o?n:e}M.exports={isPlainObject:u,deepMerge:N,findTreeConflicts:x,isComponentEnvelope:_,toRuntimeComponentConfig:k,toRuntimeComponentsConfig:W}});function P(e){return typeof e=="object"&&e!==null||typeof e=="function"}function s(e,o){return P(e)?e[o]:void 0}function a(e,o){let n=P(e)?e:null,t=n?Object.create(n):{},r=(p,d)=>Object.defineProperty(t,p,{value:d,enumerable:!0,writable:!0,configurable:!0});if(n)for(let p of Object.keys(n))r(p,n[p]);for(let p of Object.keys(o))r(p,o[p]);return t}function X(e,o){let n={};for(let t of o){let r=s(e,t);r!==void 0&&(n[t]=r)}return n}function i(...e){return e.find(o=>o!=null)||""}function c(...e){return e.find(Boolean)||{}}function C(e,o,n){return e[o]||X(e,n)}function z(e){return a(e,{default:i(e.default,e.main),outline:i(e.outline,e.tertiary),linkDestructive:i(e.linkDestructive,e.linkdestructive)})}function Y(e){let o=s(e,"variants"),n=c(e.variant,s(o,"variant")),t=c(e.size,s(o,"size")),r=c(e.iconPosition,s(o,"iconPosition")),p=c(e.fullwidth,s(o,"fullwidth")),d=s(e.slots,"icon")||{},h=s(d,"variants"),l=c(d.size,s(h,"size")),V=c(d.color,s(h,"color")),y=$=>{let g=s(r,$);return a(g,{sm:i(s(g,"sm"),s(g,"small")),lg:i(s(g,"lg"),s(g,"large"))})};return a(e,{variant:z(n),size:a(t,{icon:i(t.icon,s(s(r,"default"),"default")),"icon-xs":i(t["icon-xs"],t.xs,t.small,t.sm),"icon-sm":i(t["icon-sm"],t.small,t.sm),"icon-lg":i(t["icon-lg"],t.large,t.lg)}),iconPosition:a(r,{prefix:y("prefix"),suffix:y("suffix"),default:y("default")}),fullwidth:p,slots:a(e.slots,{icon:a(d,{size:a(l,{icon:i(l.icon,l.default),"icon-xs":i(l["icon-xs"],l.xs,l.small,l.sm,l.default),"icon-sm":i(l["icon-sm"],l.sm,l.default),"icon-lg":i(l["icon-lg"],l.lg,l.default)}),color:z(V)})})})}function Z(e){let o=e.variant,n=s(o,"subtle");return a(e,{variant:a(o,{default:i(s(o,"default"),s(o,"main")),outline:i(s(o,"outline"),s(o,"tertiary")),ghost:i(s(o,"ghost"),s(o,"tertiary")),link:i(s(o,"link"),s(o,"tertiary")),subtle:a(n,{default:i(s(n,"default"),s(n,"main"))})})})}function ee(e){let o=e.slots,n=s(o,"caption");return a(e,{slots:a(o,{caption:a(n,{overlay:s(n,"overlay")??s(n,"root")})})})}function oe(e,o={}){let n=s(e.slots,"calendar")??o.calendar,t=s(n,"slots"),r=s(t,"range");return a(e,{slots:a(e.slots,{calendar:a(n,{slots:a(t,{range:a(r,{root:s(r,"root")??s(t,"root"),container:s(r,"container")??s(t,"content"),row:s(r,"row")??s(t,"row")})})})})})}function re(e){return a(e,{slots:C(e,"slots",ne),states:C(e,"states",te),props:C(e,"props",se)})}function ie(e){return a(e,{slots:C(e,"slots",ae)})}function pe(e){return a(e,{slots:C(e,"slots",le)})}function j(e){return a(e.props,{padding:s(e.props,"padding")||e.padding})}function ue(e){return a(e,{props:j(e)})}function ce(e){return a(e,{slots:C(e,"slots",de),props:j(e)})}function Ce(e){return a(e,{root:e.root,slots:a(e.slots,{track:s(e.slots,"track")})})}function b(e,o,...n){if(!Object.prototype.hasOwnProperty.call(I,e))throw new TypeError(`No component configuration policy for "${String(e)}".`);if(o==null)return o;if(!P(o))throw new TypeError("Component config must be an object.");let t=o;return I[e](t,n[0])}var ne,te,se,ae,le,de,I,Ie,T=B(()=>{ne=["header","title","description","content","action","footer"],te=["noContent","outside"],se=["footerAlign"];ae=["dialog","input","list","empty","group","separator","item","shortcut","combobox"];le=["addon","button","text","input","textarea"];de=["horizontal","vertical","container"];I={button:Y,badge:Z,calendar:ee,card:re,command:ie,"date-slider":oe,"input-group":pe,popover:ue,separator:ce,spinner:Ce};Ie=Object.freeze(Object.keys(I))});var A={};L(A,{componentConfig:()=>fe});function fe(e,o){let n=e[o];return o==="date-slider"?b(o,n,{get calendar(){return e.calendar}}):b(o,n)}var F=B(()=>{T()});var G=O((he,m)=>{var{componentsConfigSchema:ge,isCSSClassString:me}=R(),{toRuntimeComponentsConfig:Se}=D(),{componentConfig:ye}=(F(),H(A));function f(e,o){if(typeof o=="string")return ye(f(e),o);if(!e)return{};if(typeof e!="object")throw new Error("Config must be an object");return Se(e)}f.componentsConfigSchema=ge;f.isCSSClassString=me;m.exports=f;m.exports.default=f;m.exports.ffdc=f});var{componentsConfigSchema:ve,isCSSClassString:Oe}=R(),S=require("./lib/core/cache-manager");module.exports={};Object.defineProperty(module.exports,"config",{get:function(){if(typeof __FF_CONFIG__<"u")return __FF_CONFIG__;if(typeof window<"u"&&window.__FF_CONFIG__)return window.__FF_CONFIG__;if(S)try{let e=new S(process.cwd());if(e.exists()){let o=e.load();if(o)return o.componentsConfig||null}}catch{}return null}});Object.defineProperty(module.exports,"iconSet",{get:function(){if(typeof __FF_ICONS__<"u")return __FF_ICONS__;if(typeof window<"u"&&window.__FF_ICONS__)return window.__FF_ICONS__;if(S)try{let e=new S(process.cwd());if(e.exists()){let o=e.load();if(o)return o.icons||null}}catch{}return null}});module.exports.componentsConfigSchema=ve;module.exports.isCSSClassString=Oe;module.exports.ffdc=G();
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Y=Object.create;var y=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var oe=(e,n)=>()=>(e&&(n=e(e=0)),n);var O=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),se=(e,n)=>{for(var t in n)y(e,t,{get:n[t],enumerable:!0})},M=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of ee(n))!te.call(e,r)&&r!==t&&y(e,r,{get:()=>n[r],enumerable:!(o=Z(n,r))||o.enumerable});return e};var _=(e,n,t)=>(t=e!=null?Y(ne(e)):{},M(n||!e||!e.__esModule?y(t,"default",{value:e,enumerable:!0}):t,e)),re=e=>M(y({},"__esModule",{value:!0}),e);var F=O(($e,z)=>{function p(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function R(e,n){if(!p(e)||!p(n))return n===void 0?e:n;let t={...e};for(let[o,r]of Object.entries(n))t[o]=o in t?R(t[o],r):r;return t}function b(e,n,t=[],o=[]){if(e===void 0||n===void 0)return o;if(!p(e)||!p(n))return o.push(t.join(".")),o;for(let r of Object.keys(e))r in n&&b(e[r],n[r],[...t,r],o);return o}function D(e){return p(e)&&("styles"in e||"behavior"in e)}function j(e,n="component"){if(!D(e)||!p(e.styles)||e.behavior!==void 0&&!p(e.behavior)||Object.keys(e).some(o=>!["styles","behavior"].includes(o)))throw new TypeError(`Component ${n} must use the styles/behavior envelope`);let t=b(e.styles,e.behavior,[n]);if(t.length>0)throw new Error(`Component config styles/behavior conflict at ${t.join(", ")}`);return R(e.styles||{},e.behavior||{})}function ie(e){if(!p(e))return e;let n=!1,t={};for(let[o,r]of Object.entries(e))t[o]=j(r,o),t[o]!==r&&(n=!0);return n?t:e}z.exports={isPlainObject:p,deepMerge:R,findTreeConflicts:b,isComponentEnvelope:D,toRuntimeComponentConfig:j,toRuntimeComponentsConfig:ie}});var A=O((Ve,T)=>{var ae={$id:"https://frontfriend.dev/schemas/components-config.schema.json",type:"object",additionalProperties:{$ref:"#/$defs/componentConfig"},$defs:{componentConfig:{$ref:"#/$defs/componentEnvelope"},styleTree:{anyOf:[{type:"string"},{type:"object",additionalProperties:{$ref:"#/$defs/styleTree"}}]},behaviorTree:{anyOf:[{type:["string","number","boolean","null"]},{type:"array",items:{$ref:"#/$defs/behaviorTree"}},{type:"object",additionalProperties:{$ref:"#/$defs/behaviorTree"}}]},componentEnvelope:{type:"object",additionalProperties:!1,required:["styles"],properties:{styles:{type:"object",additionalProperties:{$ref:"#/$defs/styleTree"}},behavior:{type:"object",additionalProperties:{$ref:"#/$defs/behaviorTree"}}}}}};function le(e){return typeof e=="string"&&e.trim().length>0}T.exports={componentsConfigSchema:ae,isCSSClassString:le}});var V={};se(V,{CONFIGURED_COMPONENTS:()=>Ie,resolveComponentConfig:()=>xe});function N(e){return typeof e=="object"&&e!==null||typeof e=="function"}function s(e,n){return N(e)?e[n]:void 0}function i(e,n){let t=N(e)?e:null,o=t?Object.create(t):{},r=(u,d)=>Object.defineProperty(o,u,{value:d,enumerable:!0,writable:!0,configurable:!0});if(t)for(let u of Object.keys(t))r(u,t[u]);for(let u of Object.keys(n))r(u,n[u]);return o}function ue(e,n){let t={};for(let o of n){let r=s(e,o);r!==void 0&&(t[o]=r)}return t}function a(...e){return e.find(n=>n!=null)||""}function c(...e){return e.find(Boolean)||{}}function C(e,n,t){return e[n]||ue(e,t)}function G(e){return i(e,{default:a(e.default,e.main),outline:a(e.outline,e.tertiary),linkDestructive:a(e.linkDestructive,e.linkdestructive)})}function pe(e){let n=s(e,"variants"),t=c(e.variant,s(n,"variant")),o=c(e.size,s(n,"size")),r=c(e.iconPosition,s(n,"iconPosition")),u=c(e.fullwidth,s(n,"fullwidth")),d=s(e.slots,"icon")||{},k=s(d,"variants"),l=c(d.size,s(k,"size")),H=c(d.color,s(k,"color")),v=Q=>{let g=s(r,Q);return i(g,{sm:a(s(g,"sm"),s(g,"small")),lg:a(s(g,"lg"),s(g,"large"))})};return i(e,{variant:G(t),size:i(o,{icon:a(o.icon,s(s(r,"default"),"default")),"icon-xs":a(o["icon-xs"],o.xs,o.small,o.sm),"icon-sm":a(o["icon-sm"],o.small,o.sm),"icon-lg":a(o["icon-lg"],o.large,o.lg)}),iconPosition:i(r,{prefix:v("prefix"),suffix:v("suffix"),default:v("default")}),fullwidth:u,slots:i(e.slots,{icon:i(d,{size:i(l,{icon:a(l.icon,l.default),"icon-xs":a(l["icon-xs"],l.xs,l.small,l.sm,l.default),"icon-sm":a(l["icon-sm"],l.sm,l.default),"icon-lg":a(l["icon-lg"],l.lg,l.default)}),color:G(H)})})})}function de(e){let n=e.variant,t=s(n,"subtle");return i(e,{variant:i(n,{default:a(s(n,"default"),s(n,"main")),outline:a(s(n,"outline"),s(n,"tertiary")),ghost:a(s(n,"ghost"),s(n,"tertiary")),link:a(s(n,"link"),s(n,"tertiary")),subtle:i(t,{default:a(s(t,"default"),s(t,"main"))})})})}function ce(e){let n=e.slots,t=s(n,"caption");return i(e,{slots:i(n,{caption:i(t,{overlay:s(t,"overlay")??s(t,"root")})})})}function Ce(e,n={}){let t=s(e.slots,"calendar")??n.calendar,o=s(t,"slots"),r=s(o,"range");return i(e,{slots:i(e.slots,{calendar:i(t,{slots:i(o,{range:i(r,{root:s(r,"root")??s(o,"root"),container:s(r,"container")??s(o,"content"),row:s(r,"row")??s(o,"row")})})})})})}function ye(e){return i(e,{slots:C(e,"slots",fe),states:C(e,"states",ge),props:C(e,"props",me)})}function ve(e){return i(e,{slots:C(e,"slots",Se)})}function _e(e){return i(e,{slots:C(e,"slots",Oe)})}function $(e){return i(e.props,{padding:s(e.props,"padding")||e.padding})}function Re(e){return i(e,{props:$(e)})}function Pe(e){return i(e,{slots:C(e,"slots",be),props:$(e)})}function Ne(e){return i(e,{root:e.root,slots:i(e.slots,{track:s(e.slots,"track")})})}function xe(e,n,...t){if(!Object.prototype.hasOwnProperty.call(P,e))throw new TypeError(`No component configuration policy for "${String(e)}".`);if(n==null)return n;if(!N(n))throw new TypeError("Component config must be an object.");let o=n;return P[e](o,t[0])}var fe,ge,me,Se,Oe,be,P,Ie,E=oe(()=>{fe=["header","title","description","content","action","footer"],ge=["noContent","outside"],me=["footerAlign"];Se=["dialog","input","list","empty","group","separator","item","shortcut","combobox"];Oe=["addon","button","text","input","textarea"];be=["horizontal","vertical","container"];P={button:pe,badge:de,calendar:ce,card:ye,command:ve,"date-slider":Ce,"input-group":_e,popover:Re,separator:Pe,spinner:Ne};Ie=Object.freeze(Object.keys(P))});var q=O((Ee,U)=>{var x=Object.defineProperty,he=Object.getOwnPropertyDescriptor,we=Object.getOwnPropertyNames,Be=Object.prototype.hasOwnProperty,ke=(e,n)=>{for(var t in n)x(e,t,{get:n[t],enumerable:!0})},Me=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of we(n))!Be.call(e,r)&&r!==t&&x(e,r,{get:()=>n[r],enumerable:!(o=he(n,r))||o.enumerable});return e},De=e=>Me(x({},"__esModule",{value:!0}),e),L={};ke(L,{componentConfig:()=>je});U.exports=De(L);var K=(E(),re(V));function je(e,n){let t=e[n];return n==="date-slider"?(0,K.resolveComponentConfig)(n,t,{get calendar(){return e.calendar}}):(0,K.resolveComponentConfig)(n,t)}});var f=_(F(),1),S=_(A(),1),W=_(q(),1),ze=typeof window<"u"&&typeof window.document<"u";function I(e){return typeof e!="string"?!1:e.startsWith("__v_")||e==="then"}function B(e=""){let n=new Map;return new Proxy({},{get(t,o){if(o===Symbol.toPrimitive||o==="valueOf")return()=>e;if(o==="toString"||o===Symbol.toStringTag)return()=>e;if(o==="constructor")return Object;if(!I(o))return n.has(o)||n.set(o,B(e)),n.get(o)},has(t,o){return!I(o)},ownKeys(){return[]},getOwnPropertyDescriptor(t,o){if(!I(o))return{enumerable:!0,configurable:!0}}})}var J=new Map;function Fe(e){try{let n=e==="__FF_CONFIG__"?process.env.NEXT_PUBLIC_FF_CONFIG:process.env.NEXT_PUBLIC_FF_ICONS;if(!n)return null;let t=J.get(e);if(t?.serialized===n)return t.value;let o=JSON.parse(n);return(0,f.isPlainObject)(o)?(J.set(e,{serialized:n,value:o}),o):null}catch{return null}}function m(e){return e==="__FF_CONFIG__"&&typeof __FF_CONFIG__<"u"?__FF_CONFIG__:e==="__FF_ICONS__"&&typeof __FF_ICONS__<"u"?__FF_ICONS__:typeof globalThis<"u"&&globalThis[e]?globalThis[e]:ze&&window[e]?window[e]:Fe(e)}function X(e,n){return typeof n=="string"?(0,W.componentConfig)(X(e),n):!e||typeof e!="object"?B():(0,f.toRuntimeComponentsConfig)(e)}var h=new Map,w=new WeakMap,Te=new Proxy({},{get(e,n){if(n===Symbol.toPrimitive||n==="valueOf")return()=>"";if(n==="toString"||n===Symbol.toStringTag)return()=>"[object Object]";if(n==="constructor")return Object;let t=m("__FF_CONFIG__");if(t&&n in t){let o=t[n];return w.has(o)||w.set(o,(0,f.toRuntimeComponentConfig)(o,String(n))),w.get(o)}return h.has(n)||h.set(n,B()),h.get(n)},has(){return!0},ownKeys(){return[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}}),Ae=new Proxy({},{get(e,n){if(n===Symbol.toPrimitive||n==="valueOf")return()=>"";if(n==="toString"||n===Symbol.toStringTag)return()=>"[object Object]";if(n==="constructor")return Object;let t=m("__FF_ICONS__");return t&&n in t?t[n]:null},has(e,n){let t=m("__FF_ICONS__");return t?n in t:!1},ownKeys(){let e=m("__FF_ICONS__");return e?Object.keys(e):[]},getOwnPropertyDescriptor(e,n){let t=m("__FF_ICONS__");if(t&&n in t)return{enumerable:!0,configurable:!0,value:t[n]}}});var export_componentsConfigSchema=S.componentsConfigSchema;var export_isCSSClassString=S.isCSSClassString;export{export_componentsConfigSchema as componentsConfigSchema,Te as config,X as ffdc,Ae as iconSet,export_isCSSClassString as isCSSClassString};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var j=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var S=j((q,F)=>{F.exports={name:"@frontfriend/sdk",version:"1.0.0"}});var C=j(($,b)=>{var{name:w}=S();b.exports={PACKAGE_NAME:w}});var{PACKAGE_NAME:m}=C(),u=require("fs"),E=require("http"),O=require("https"),i=require("path"),g=["contracts","tokens","components"],T=["app/globals.css","src/app/globals.css","styles/globals.css","src/styles/globals.css","src/styles.css","src/index.css","src/style.css"],k={next:["next.config.js","next.config.mjs","next.config.ts"],vite:["vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"]},x=["primereact","@mui/material","antd","@chakra-ui/react","@mantine/core","@fluentui/react"],I=["style-dictionary","@tokens-studio/sd-transforms","@vanilla-extract/css","styled-components","@emotion/react"];function A(n){try{return JSON.parse(u.readFileSync(n,"utf8"))}catch{return{}}}function h(n){if(n===void 0)return null;if(!Array.isArray(n)){let t=new Error("`adopt` in frontfriend.config.js must be an array.");throw t.code="FRONTFRIEND_CONFIG_VALIDATION",t}let e=n.filter(t=>!g.includes(t));if(e.length>0){let t=new Error(`Unknown Frontfriend adoption level: ${e.join(", ")}.`);throw t.code="FRONTFRIEND_CONFIG_VALIDATION",t}let o=n.includes("components")?2:n.includes("tokens")?1:0;return g.slice(0,o+1)}function _(n){for(let[e,o]of Object.entries(k)){let t=o.find(s=>u.existsSync(i.join(n,s)));if(!t)continue;let r=u.readFileSync(i.join(n,t),"utf8");return{buildTool:e,present:r.includes(`${m}/${e}`)}}return{buildTool:null,present:!1}}function v(n){let e=[i.join(n,"components","ui"),i.join(n,"src","components","ui"),i.join(n,"app","components","ui")].filter(r=>u.existsSync(r)),o=new Set;function t(r){for(let s of u.readdirSync(r,{withFileTypes:!0})){let c=i.join(r,s.name);if(s.isDirectory())t(c);else if(/\.(js|jsx|ts|tsx|vue)$/.test(s.name)){if(!u.readFileSync(c,"utf8").includes(m))continue;let a=i.basename(s.name,i.extname(s.name));o.add(a.toLowerCase()==="index"?i.basename(r):a.toLowerCase())}}}return e.forEach(t),[...o].sort()}function P(n){let e=A(i.join(n,"package.json")),o={...e.dependencies||{},...e.devDependencies||{}},t=o.tailwindcss||null,s=[A(i.join(n,"components.json"))?.tailwind?.css,...T].filter(Boolean).find(a=>u.existsSync(i.join(n,a))),c=s?u.readFileSync(i.join(n,s),"utf8"):"",l=I.filter(a=>o[a]);return!l.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(c)&&!c.includes(`${m}/theme.css`)&&l.push("css-custom-properties"),{nativeTokens:{present:c.includes("/* Frontfriend managed native tokens: start */"),file:s||null},tailwind:{present:!!t,version:t,major:t&&Number((String(t).match(/\d+/)||[])[0])||null},componentsJson:u.existsSync(i.join(n,"components.json")),themeImport:{present:c.includes(`${m}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(c),file:s||null},plugin:_(n),frontfriendComponents:v(n),foreignComponentLibraries:x.filter(a=>o[a]),foreignTokenSystems:l}}function D(n,e){let o=h(n)||g,t=o.includes("tokens"),r=o.includes("components"),s=[];return t&&!e.themeImport.present&&!e.nativeTokens?.present&&s.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!t&&e.themeImport.present&&s.push("Frontfriend tokens are present in CSS but are not adopted in config."),r&&!e.componentsJson&&s.push("Config adopts components, but components.json was not observed."),!r&&e.frontfriendComponents.length>0&&s.push("Frontfriend components are installed but are not adopted in config."),s}function L({apiUrl:n,token:e,ffId:o,name:t,adopt:r,observed:s,framework:c,primitive:l}){if(!n||!e||!o||!t||!c||l===void 0)return Promise.resolve({reported:!1,unavailable:!0});let a=new URL("/api/apps/sync",n),y=JSON.stringify({ffId:o,name:t,adopt:h(r),observed:s,runtime:"sdk",framework:c,primitive:l}),N=a.protocol==="https:"?O:E;return new Promise(d=>{let f=N.request(a,{method:"POST",headers:{authorization:`Bearer ${e}`,"content-type":"application/json","content-length":Buffer.byteLength(y)}},p=>{p.resume(),p.on("end",()=>{p.statusCode>=200&&p.statusCode<300?d({reported:!0,unavailable:!1}):d({reported:!1,unavailable:!0})})});f.on("error",()=>d({reported:!1,unavailable:!0})),f.setTimeout(1500,()=>{f.destroy(),d({reported:!1,unavailable:!0})}),f.end(y)})}module.exports={ADOPTION_LEVELS:g,normalizeAdopt:h,probeAdoption:P,adoptionWarnings:D,reportAdoption:L};
|