@measured/puck 0.21.0-canary.7dca3a5a → 0.21.0-canary.8358d3e1

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 (41) hide show
  1. package/dist/Editor-F2LSS6SE.css +403 -0
  2. package/dist/Editor-N46HUQEC.mjs +201 -0
  3. package/dist/Render-QEMDIDQC.css +101 -0
  4. package/dist/Render-Y567PGZ7.mjs +53 -0
  5. package/dist/chunk-3QHWXJEI.mjs +33 -0
  6. package/dist/chunk-7KY6RHEY.mjs +2230 -0
  7. package/dist/chunk-C2TVYIYC.mjs +415 -0
  8. package/dist/chunk-DCSQEDMK.mjs +194 -0
  9. package/dist/chunk-DJSH5REF.mjs +537 -0
  10. package/dist/chunk-DNF2EMM4.mjs +63 -0
  11. package/dist/chunk-FNWOH4R6.mjs +109 -0
  12. package/dist/chunk-GQKMOYLG.mjs +53 -0
  13. package/dist/chunk-K3V4LVUL.mjs +704 -0
  14. package/dist/{chunk-FKDVYRQW.mjs → chunk-N5XMZOMC.mjs} +5078 -7463
  15. package/dist/chunk-R6CVX2IY.mjs +103 -0
  16. package/dist/chunk-WUWXFMEM.mjs +11 -0
  17. package/dist/full-2GJTAAZE.css +301 -0
  18. package/dist/full-NLUNPJWS.mjs +90 -0
  19. package/dist/index.css +636 -758
  20. package/dist/index.d.mts +101 -20
  21. package/dist/index.d.ts +101 -20
  22. package/dist/index.js +7363 -4751
  23. package/dist/index.mjs +25 -15
  24. package/dist/loaded-EV34KGYJ.mjs +57 -0
  25. package/dist/loaded-HMSPJUZM.mjs +54 -0
  26. package/dist/loaded-RVWBFK7L.css +87 -0
  27. package/dist/loaded-ZXOU6S6R.mjs +54 -0
  28. package/dist/no-external.css +636 -758
  29. package/dist/no-external.d.mts +17 -2
  30. package/dist/no-external.d.ts +17 -2
  31. package/dist/no-external.js +7360 -4748
  32. package/dist/no-external.mjs +25 -15
  33. package/dist/rsc.css +101 -0
  34. package/dist/rsc.d.mts +17 -2
  35. package/dist/rsc.d.ts +17 -2
  36. package/dist/rsc.js +419 -34
  37. package/dist/rsc.mjs +16 -9
  38. package/dist/{walk-tree-DS1xB387.d.mts → walk-tree-Ja9bNCM9.d.mts} +216 -26
  39. package/dist/{walk-tree-DS1xB387.d.ts → walk-tree-Ja9bNCM9.d.ts} +216 -26
  40. package/package.json +23 -1
  41. package/dist/chunk-6SIKCDJJ.mjs +0 -967
@@ -0,0 +1,415 @@
1
+ import {
2
+ styles_module_default
3
+ } from "./chunk-WUWXFMEM.mjs";
4
+ import {
5
+ defaultAppState,
6
+ mapFields,
7
+ resolveComponentData,
8
+ walkAppState,
9
+ walkTree
10
+ } from "./chunk-DJSH5REF.mjs";
11
+ import {
12
+ __async,
13
+ __objRest,
14
+ __spreadProps,
15
+ __spreadValues,
16
+ get_class_name_factory_default,
17
+ init_react_import
18
+ } from "./chunk-DCSQEDMK.mjs";
19
+
20
+ // lib/migrate.ts
21
+ init_react_import();
22
+ var migrations = [
23
+ // Migrate root to root.props
24
+ (data) => {
25
+ const rootProps = data.root.props || data.root;
26
+ if (Object.keys(data.root).length > 0 && !data.root.props) {
27
+ console.warn(
28
+ "Migration applied: Root props moved from `root` to `root.props`."
29
+ );
30
+ return __spreadProps(__spreadValues({}, data), {
31
+ root: {
32
+ props: __spreadValues({}, rootProps)
33
+ }
34
+ });
35
+ }
36
+ return data;
37
+ },
38
+ // Migrate zones to slots
39
+ (data, config, migrationOptions) => {
40
+ var _a, _b;
41
+ if (!config) return data;
42
+ console.log("Migrating DropZones to slots...");
43
+ const updatedItems = {};
44
+ const appState = __spreadProps(__spreadValues({}, defaultAppState), { data });
45
+ const { indexes } = walkAppState(appState, config);
46
+ const deletedCompounds = [];
47
+ walkAppState(appState, config, (content, zoneCompound, zoneType) => {
48
+ var _a2, _b2, _c;
49
+ if (zoneType === "dropzone") {
50
+ const [id, slotName] = zoneCompound.split(":");
51
+ const nodeData = indexes.nodes[id].data;
52
+ const componentType = nodeData.type;
53
+ const configForComponent = id === "root" ? config.root : config.components[componentType];
54
+ if (((_b2 = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b2.type) === "slot") {
55
+ updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
56
+ props: __spreadProps(__spreadValues(__spreadValues({}, nodeData.props), (_c = updatedItems[id]) == null ? void 0 : _c.props), {
57
+ [slotName]: content
58
+ })
59
+ });
60
+ deletedCompounds.push(zoneCompound);
61
+ }
62
+ return content;
63
+ }
64
+ return content;
65
+ });
66
+ const updated = walkAppState(
67
+ appState,
68
+ config,
69
+ (content) => content,
70
+ (item) => {
71
+ var _a2;
72
+ return (_a2 = updatedItems[item.props.id]) != null ? _a2 : item;
73
+ }
74
+ );
75
+ deletedCompounds.forEach((zoneCompound) => {
76
+ var _a2;
77
+ const [_, propName] = zoneCompound.split(":");
78
+ console.log(
79
+ `\u2713 Success: Migrated "${zoneCompound}" from DropZone to slot field "${propName}"`
80
+ );
81
+ (_a2 = updated.data.zones) == null ? true : delete _a2[zoneCompound];
82
+ });
83
+ if (migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) {
84
+ const unmigratedZonesGrouped = {};
85
+ Object.keys((_a = updated.data.zones) != null ? _a : {}).forEach((zoneCompound) => {
86
+ var _a2;
87
+ const [componentId, propName] = zoneCompound.split(":");
88
+ const content = (_a2 = updated.data.zones) == null ? void 0 : _a2[zoneCompound];
89
+ if (!content) {
90
+ return;
91
+ }
92
+ if (!unmigratedZonesGrouped[componentId]) {
93
+ unmigratedZonesGrouped[componentId] = {};
94
+ }
95
+ if (!unmigratedZonesGrouped[componentId][propName]) {
96
+ unmigratedZonesGrouped[componentId][propName] = content;
97
+ }
98
+ });
99
+ Object.keys(unmigratedZonesGrouped).forEach((componentId) => {
100
+ updated.data = walkTree(updated.data, config, (content) => {
101
+ return content.map((child) => {
102
+ var _a2;
103
+ if (child.props.id !== componentId) {
104
+ return child;
105
+ }
106
+ const migrateFn = (_a2 = migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) == null ? void 0 : _a2[child.type];
107
+ if (!migrateFn) {
108
+ return child;
109
+ }
110
+ const zones = unmigratedZonesGrouped[componentId];
111
+ const migratedProps = migrateFn(child.props, zones);
112
+ Object.keys(zones).forEach((propName) => {
113
+ var _a3;
114
+ const zoneCompound = `${componentId}:${propName}`;
115
+ console.log(`\u2713 Success: Migrated "${zoneCompound}" DropZone`);
116
+ (_a3 = updated.data.zones) == null ? true : delete _a3[zoneCompound];
117
+ });
118
+ return __spreadProps(__spreadValues({}, child), {
119
+ props: migratedProps
120
+ });
121
+ });
122
+ });
123
+ });
124
+ }
125
+ Object.keys((_b = updated.data.zones) != null ? _b : {}).forEach((zoneCompound) => {
126
+ const [_, propName] = zoneCompound.split(":");
127
+ throw new Error(
128
+ `Could not migrate DropZone "${zoneCompound}" to slot field. No slot exists with the name "${propName}".`
129
+ );
130
+ });
131
+ delete updated.data.zones;
132
+ return updated.data;
133
+ }
134
+ ];
135
+ function migrate(data, config, migrationOptions) {
136
+ return migrations == null ? void 0 : migrations.reduce(
137
+ (acc, migration) => migration(acc, config, migrationOptions),
138
+ data
139
+ );
140
+ }
141
+
142
+ // lib/transform-props.ts
143
+ init_react_import();
144
+
145
+ // lib/data/default-data.ts
146
+ init_react_import();
147
+ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
148
+ root: data.root || {},
149
+ content: data.content || []
150
+ });
151
+
152
+ // lib/transform-props.ts
153
+ function transformProps(data, propTransforms, config = { components: {} }) {
154
+ const mapItem = (item) => {
155
+ if (propTransforms[item.type]) {
156
+ return __spreadProps(__spreadValues({}, item), {
157
+ props: __spreadValues({
158
+ id: item.props.id
159
+ }, propTransforms[item.type](item.props))
160
+ });
161
+ }
162
+ return item;
163
+ };
164
+ const defaultedData = defaultData(data);
165
+ const rootProps = defaultedData.root.props || defaultedData.root;
166
+ let newRoot = __spreadValues({}, defaultedData.root);
167
+ if (propTransforms["root"]) {
168
+ newRoot.props = propTransforms["root"](rootProps);
169
+ }
170
+ const dataWithUpdatedRoot = __spreadProps(__spreadValues({}, defaultedData), { root: newRoot });
171
+ const updatedData = walkTree(
172
+ dataWithUpdatedRoot,
173
+ config,
174
+ (content) => content.map(mapItem)
175
+ );
176
+ if (!defaultedData.root.props) {
177
+ updatedData.root = updatedData.root.props;
178
+ }
179
+ return updatedData;
180
+ }
181
+
182
+ // lib/resolve-all-data.ts
183
+ init_react_import();
184
+
185
+ // lib/data/to-component.ts
186
+ init_react_import();
187
+ var toComponent = (item) => {
188
+ return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
189
+ props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
190
+ type: "root"
191
+ });
192
+ };
193
+
194
+ // lib/resolve-all-data.ts
195
+ function resolveAllData(_0, _1) {
196
+ return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
197
+ var _a;
198
+ const defaultedData = defaultData(data);
199
+ const resolveNode = (_node) => __async(null, null, function* () {
200
+ const node = toComponent(_node);
201
+ onResolveStart == null ? void 0 : onResolveStart(node);
202
+ const resolved = (yield resolveComponentData(
203
+ node,
204
+ config,
205
+ metadata,
206
+ () => {
207
+ },
208
+ () => {
209
+ },
210
+ "force"
211
+ )).node;
212
+ const resolvedDeep = yield mapFields(
213
+ resolved,
214
+ { slot: ({ value }) => processContent(value) },
215
+ config
216
+ );
217
+ onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
218
+ return resolvedDeep;
219
+ });
220
+ const processContent = (content) => __async(null, null, function* () {
221
+ return Promise.all(content.map(resolveNode));
222
+ });
223
+ const processZones = () => __async(null, null, function* () {
224
+ var _a2;
225
+ const zones = (_a2 = data.zones) != null ? _a2 : {};
226
+ Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
227
+ zones[zoneKey] = yield Promise.all(content.map(resolveNode));
228
+ }));
229
+ return zones;
230
+ });
231
+ const dynamic = {
232
+ root: yield resolveNode(defaultedData.root),
233
+ content: yield processContent(defaultedData.content),
234
+ zones: yield processZones()
235
+ };
236
+ Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(null, null, function* () {
237
+ const content = defaultedData.zones[zoneKey];
238
+ dynamic.zones[zoneKey] = yield processContent(content);
239
+ }), {});
240
+ return dynamic;
241
+ });
242
+ }
243
+
244
+ // lib/field-transforms/use-field-transforms.tsx
245
+ init_react_import();
246
+ import { useMemo } from "react";
247
+ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
248
+ const mappers = useMemo(() => {
249
+ return Object.keys(transforms).reduce((acc, _fieldType) => {
250
+ const fieldType = _fieldType;
251
+ return __spreadProps(__spreadValues({}, acc), {
252
+ [fieldType]: (_a) => {
253
+ var _b = _a, {
254
+ parentId
255
+ } = _b, params = __objRest(_b, [
256
+ "parentId"
257
+ ]);
258
+ const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
259
+ const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
260
+ const fn = transforms[fieldType];
261
+ return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
262
+ isReadOnly,
263
+ componentId: parentId
264
+ }));
265
+ }
266
+ });
267
+ }, {});
268
+ }, [transforms, readOnly, forceReadOnly]);
269
+ const transformedProps = useMemo(() => {
270
+ const mapped = mapFields(item, mappers, config).props;
271
+ return mapped;
272
+ }, [config, item, mappers]);
273
+ const mergedProps = useMemo(
274
+ () => __spreadValues(__spreadValues({}, item.props), transformedProps),
275
+ [item.props, transformedProps]
276
+ );
277
+ return mergedProps;
278
+ }
279
+
280
+ // lib/field-transforms/default-transforms/slot-transform.tsx
281
+ init_react_import();
282
+ var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
283
+ slot: ({ value: content, propName, field, isReadOnly }) => {
284
+ const render = isReadOnly ? renderSlotRender : renderSlotEdit;
285
+ const Slot = (dzProps) => render(__spreadProps(__spreadValues({
286
+ allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
287
+ disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
288
+ }, dzProps), {
289
+ zone: propName,
290
+ content
291
+ }));
292
+ return Slot;
293
+ }
294
+ });
295
+
296
+ // lib/use-slots.tsx
297
+ init_react_import();
298
+ function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
299
+ return useFieldTransforms(
300
+ config,
301
+ item,
302
+ getSlotTransform(renderSlotEdit, renderSlotRender),
303
+ readOnly,
304
+ forceReadOnly
305
+ );
306
+ }
307
+
308
+ // components/RichTextEditor/lib/use-richtext-props.tsx
309
+ init_react_import();
310
+ import { lazy, Suspense, useMemo as useMemo2 } from "react";
311
+
312
+ // components/RichTextEditor/components/RenderFallback.tsx
313
+ init_react_import();
314
+ import { jsx } from "react/jsx-runtime";
315
+ var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
316
+ function RichTextRenderFallback({ content }) {
317
+ return /* @__PURE__ */ jsx("div", { className: getClassName(), children: /* @__PURE__ */ jsx(
318
+ "div",
319
+ {
320
+ className: "rich-text",
321
+ dangerouslySetInnerHTML: { __html: content }
322
+ }
323
+ ) });
324
+ }
325
+
326
+ // components/RichTextEditor/lib/use-richtext-props.tsx
327
+ import { jsx as jsx2 } from "react/jsx-runtime";
328
+ function useRichtextProps(fields, props) {
329
+ const findAllRichtextKeys = (fields2) => {
330
+ if (!fields2) return [];
331
+ const result = [];
332
+ for (const [key, field] of Object.entries(fields2)) {
333
+ if (field.type === "richtext") {
334
+ result.push(key);
335
+ }
336
+ }
337
+ return result;
338
+ };
339
+ const richtextKeys = useMemo2(() => findAllRichtextKeys(fields), [fields]);
340
+ const richtextProps = useMemo2(() => {
341
+ if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
342
+ const RichTextRender = lazy(
343
+ () => import("./Render-Y567PGZ7.mjs").then((m) => ({
344
+ default: m.RichTextRender
345
+ }))
346
+ );
347
+ return richtextKeys.reduce((acc, key) => {
348
+ acc[key] = /* @__PURE__ */ jsx2(Suspense, { fallback: /* @__PURE__ */ jsx2(RichTextRenderFallback, { content: props[key] }), children: /* @__PURE__ */ jsx2(
349
+ RichTextRender,
350
+ {
351
+ content: props[key],
352
+ field: fields[key]
353
+ }
354
+ ) });
355
+ return acc;
356
+ }, {});
357
+ }, [richtextKeys, props, fields]);
358
+ return richtextProps;
359
+ }
360
+
361
+ // components/SlotRender/server.tsx
362
+ init_react_import();
363
+ import { forwardRef } from "react";
364
+ import { jsx as jsx3 } from "react/jsx-runtime";
365
+ var SlotRenderPure = (props) => /* @__PURE__ */ jsx3(SlotRender, __spreadValues({}, props));
366
+ var Item = ({
367
+ config,
368
+ item,
369
+ metadata
370
+ }) => {
371
+ const Component = config.components[item.type];
372
+ const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx3(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
373
+ const richtextProps = useRichtextProps(Component.fields, props);
374
+ return /* @__PURE__ */ jsx3(
375
+ Component.render,
376
+ __spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
377
+ puck: __spreadProps(__spreadValues({}, props.puck), {
378
+ metadata: metadata || {}
379
+ })
380
+ })
381
+ );
382
+ };
383
+ var SlotRender = forwardRef(
384
+ function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
385
+ const El = as != null ? as : "div";
386
+ return /* @__PURE__ */ jsx3(El, { className, style, ref, children: content.map((item) => {
387
+ if (!config.components[item.type]) {
388
+ return null;
389
+ }
390
+ return /* @__PURE__ */ jsx3(
391
+ Item,
392
+ {
393
+ config,
394
+ item,
395
+ metadata
396
+ },
397
+ item.props.id
398
+ );
399
+ }) });
400
+ }
401
+ );
402
+
403
+ export {
404
+ useFieldTransforms,
405
+ getSlotTransform,
406
+ useSlots,
407
+ RichTextRenderFallback,
408
+ useRichtextProps,
409
+ SlotRenderPure,
410
+ SlotRender,
411
+ toComponent,
412
+ migrate,
413
+ transformProps,
414
+ resolveAllData
415
+ };
@@ -0,0 +1,194 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __objRest = (source, exclude) => {
25
+ var target = {};
26
+ for (var prop in source)
27
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
+ target[prop] = source[prop];
29
+ if (source != null && __getOwnPropSymbols)
30
+ for (var prop of __getOwnPropSymbols(source)) {
31
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
+ target[prop] = source[prop];
33
+ }
34
+ return target;
35
+ };
36
+ var __esm = (fn, res) => function __init() {
37
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
38
+ };
39
+ var __commonJS = (cb, mod) => function __require() {
40
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
41
+ };
42
+ var __copyProps = (to, from, except, desc) => {
43
+ if (from && typeof from === "object" || typeof from === "function") {
44
+ for (let key of __getOwnPropNames(from))
45
+ if (!__hasOwnProp.call(to, key) && key !== except)
46
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
47
+ }
48
+ return to;
49
+ };
50
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
51
+ // If the importer is in node compatibility mode or this is not an ESM
52
+ // file that has been converted to a CommonJS file using a Babel-
53
+ // compatible transform (i.e. "__esModule" has not been set), then set
54
+ // "default" to the CommonJS "module.exports" for node compatibility.
55
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
56
+ mod
57
+ ));
58
+ var __async = (__this, __arguments, generator) => {
59
+ return new Promise((resolve, reject) => {
60
+ var fulfilled = (value) => {
61
+ try {
62
+ step(generator.next(value));
63
+ } catch (e) {
64
+ reject(e);
65
+ }
66
+ };
67
+ var rejected = (value) => {
68
+ try {
69
+ step(generator.throw(value));
70
+ } catch (e) {
71
+ reject(e);
72
+ }
73
+ };
74
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
75
+ step((generator = generator.apply(__this, __arguments)).next());
76
+ });
77
+ };
78
+
79
+ // ../tsup-config/react-import.js
80
+ import React from "react";
81
+ var init_react_import = __esm({
82
+ "../tsup-config/react-import.js"() {
83
+ "use strict";
84
+ }
85
+ });
86
+
87
+ // ../../node_modules/classnames/index.js
88
+ var require_classnames = __commonJS({
89
+ "../../node_modules/classnames/index.js"(exports, module) {
90
+ "use strict";
91
+ init_react_import();
92
+ (function() {
93
+ "use strict";
94
+ var hasOwn = {}.hasOwnProperty;
95
+ function classNames() {
96
+ var classes = "";
97
+ for (var i = 0; i < arguments.length; i++) {
98
+ var arg = arguments[i];
99
+ if (arg) {
100
+ classes = appendClass(classes, parseValue(arg));
101
+ }
102
+ }
103
+ return classes;
104
+ }
105
+ function parseValue(arg) {
106
+ if (typeof arg === "string" || typeof arg === "number") {
107
+ return arg;
108
+ }
109
+ if (typeof arg !== "object") {
110
+ return "";
111
+ }
112
+ if (Array.isArray(arg)) {
113
+ return classNames.apply(null, arg);
114
+ }
115
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
116
+ return arg.toString();
117
+ }
118
+ var classes = "";
119
+ for (var key in arg) {
120
+ if (hasOwn.call(arg, key) && arg[key]) {
121
+ classes = appendClass(classes, key);
122
+ }
123
+ }
124
+ return classes;
125
+ }
126
+ function appendClass(value, newClass) {
127
+ if (!newClass) {
128
+ return value;
129
+ }
130
+ if (value) {
131
+ return value + " " + newClass;
132
+ }
133
+ return value + newClass;
134
+ }
135
+ if (typeof module !== "undefined" && module.exports) {
136
+ classNames.default = classNames;
137
+ module.exports = classNames;
138
+ } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
139
+ define("classnames", [], function() {
140
+ return classNames;
141
+ });
142
+ } else {
143
+ window.classNames = classNames;
144
+ }
145
+ })();
146
+ }
147
+ });
148
+
149
+ // lib/get-class-name-factory.ts
150
+ init_react_import();
151
+ var import_classnames = __toESM(require_classnames());
152
+ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (options = {}) => {
153
+ if (typeof options === "string") {
154
+ const descendant = options;
155
+ const style = styles[`${rootClass}-${descendant}`];
156
+ if (style) {
157
+ return config.baseClass + styles[`${rootClass}-${descendant}`] || "";
158
+ }
159
+ return "";
160
+ } else if (typeof options === "object") {
161
+ const modifiers = options;
162
+ const prefixedModifiers = {};
163
+ for (let modifier in modifiers) {
164
+ prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
165
+ }
166
+ const c = styles[rootClass];
167
+ return config.baseClass + (0, import_classnames.default)(__spreadValues({
168
+ [c]: !!c
169
+ }, prefixedModifiers));
170
+ } else {
171
+ return config.baseClass + styles[rootClass] || "";
172
+ }
173
+ };
174
+ var get_class_name_factory_default = getClassNameFactory;
175
+
176
+ export {
177
+ __spreadValues,
178
+ __spreadProps,
179
+ __objRest,
180
+ __commonJS,
181
+ __toESM,
182
+ __async,
183
+ init_react_import,
184
+ get_class_name_factory_default
185
+ };
186
+ /*! Bundled license information:
187
+
188
+ classnames/index.js:
189
+ (*!
190
+ Copyright (c) 2018 Jed Watson.
191
+ Licensed under the MIT License (MIT), see
192
+ http://jedwatson.github.io/classnames
193
+ *)
194
+ */