pupt-lib 1.2.5 → 1.2.6
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.
|
@@ -55,6 +55,7 @@ export declare class AskConfirm extends Component<ConfirmProps, boolean> {
|
|
|
55
55
|
} & {
|
|
56
56
|
default: z.ZodOptional<z.ZodBoolean>;
|
|
57
57
|
}, z.ZodTypeAny, "passthrough">>;
|
|
58
|
+
static implicitDefault: boolean;
|
|
58
59
|
resolve(props: ConfirmProps, context: RenderContext): boolean;
|
|
59
60
|
render(props: ConfirmProps, resolvedValue: boolean | undefined, context: RenderContext): PuptNode;
|
|
60
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Confirm.d.ts","sourceRoot":"","sources":["../../../src/components/ask/Confirm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAG7E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;gCAEb,CAAC;AAEjB,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC;AAGtF,qBAAa,UAAW,SAAQ,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC;IAC9D,MAAM,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;qCAAoB;
|
|
1
|
+
{"version":3,"file":"Confirm.d.ts","sourceRoot":"","sources":["../../../src/components/ask/Confirm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAG7E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;gCAEb,CAAC;AAEjB,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC;AAGtF,qBAAa,UAAW,SAAQ,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC;IAC9D,MAAM,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;qCAAoB;IACjC,MAAM,CAAC,eAAe,UAAS;IAE/B,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO;IAW7D,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,GAAG,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,QAAQ;CA8BlG"}
|
|
@@ -38,7 +38,7 @@ export declare const askRatingSchema: z.ZodObject<{
|
|
|
38
38
|
export type RatingProps = z.infer<typeof askRatingSchema> & {
|
|
39
39
|
children?: PuptNode;
|
|
40
40
|
};
|
|
41
|
-
export declare class AskRating extends Component<RatingProps, number
|
|
41
|
+
export declare class AskRating extends Component<RatingProps, number> {
|
|
42
42
|
static schema: z.ZodObject<{
|
|
43
43
|
name: z.ZodString;
|
|
44
44
|
label: z.ZodString;
|
|
@@ -73,7 +73,7 @@ export declare class AskRating extends Component<RatingProps, number | undefined
|
|
|
73
73
|
max: z.ZodOptional<z.ZodNumber>;
|
|
74
74
|
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
75
75
|
}, z.ZodTypeAny, "passthrough">>;
|
|
76
|
-
resolve(props: RatingProps, context: RenderContext): number
|
|
77
|
-
render(props: RatingProps, resolvedValue: number
|
|
76
|
+
resolve(props: RatingProps, context: RenderContext): number;
|
|
77
|
+
render(props: RatingProps, resolvedValue: number, context: RenderContext): PuptNode;
|
|
78
78
|
}
|
|
79
79
|
//# sourceMappingURL=Rating.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rating.d.ts","sourceRoot":"","sources":["../../../src/components/ask/Rating.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAe,aAAa,EAAoB,MAAM,aAAa,CAAC;AAK1F,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAKZ,CAAC;AAEjB,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC;AAGpF,qBAAa,SAAU,SAAQ,SAAS,CAAC,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Rating.d.ts","sourceRoot":"","sources":["../../../src/components/ask/Rating.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAe,aAAa,EAAoB,MAAM,aAAa,CAAC;AAK1F,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAKZ,CAAC;AAEjB,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC;AAGpF,qBAAa,SAAU,SAAQ,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAC3D,MAAM,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAAmB;IAEhC,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM;IAe3D,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,QAAQ;CAoDpF"}
|
package/dist/index.js
CHANGED
|
@@ -3955,6 +3955,7 @@ async function render(element, options = {}) {
|
|
|
3955
3955
|
resolvedValues: /* @__PURE__ */ new Map(),
|
|
3956
3956
|
pendingResolutions: /* @__PURE__ */ new Map()
|
|
3957
3957
|
};
|
|
3958
|
+
seedAskDefaults(element, context);
|
|
3958
3959
|
const text = await renderNode(element, state);
|
|
3959
3960
|
const trimmedText = trim ? text.trim() : text;
|
|
3960
3961
|
if (errors.length > 0) {
|
|
@@ -4113,6 +4114,33 @@ async function renderElement(element, state) {
|
|
|
4113
4114
|
}
|
|
4114
4115
|
return "";
|
|
4115
4116
|
}
|
|
4117
|
+
function seedAskDefaults(node, context) {
|
|
4118
|
+
if (!node || typeof node !== "object") return;
|
|
4119
|
+
if (Array.isArray(node)) {
|
|
4120
|
+
for (const child of node) {
|
|
4121
|
+
seedAskDefaults(child, context);
|
|
4122
|
+
}
|
|
4123
|
+
return;
|
|
4124
|
+
}
|
|
4125
|
+
if (!isPuptElement(node)) return;
|
|
4126
|
+
const element = node;
|
|
4127
|
+
const type = element[TYPE];
|
|
4128
|
+
const props = element[PROPS];
|
|
4129
|
+
const children = element[CHILDREN];
|
|
4130
|
+
if (typeof props.name === "string" && typeof props.label === "string" && !context.inputs.has(props.name)) {
|
|
4131
|
+
if (props.default !== void 0) {
|
|
4132
|
+
context.inputs.set(props.name, props.default);
|
|
4133
|
+
} else if (isComponentClass(type) && "implicitDefault" in type) {
|
|
4134
|
+
context.inputs.set(
|
|
4135
|
+
props.name,
|
|
4136
|
+
type.implicitDefault
|
|
4137
|
+
);
|
|
4138
|
+
}
|
|
4139
|
+
}
|
|
4140
|
+
for (const child of children) {
|
|
4141
|
+
seedAskDefaults(child, context);
|
|
4142
|
+
}
|
|
4143
|
+
}
|
|
4116
4144
|
function detectEnvironment() {
|
|
4117
4145
|
var _a2;
|
|
4118
4146
|
if (typeof process !== "undefined" && ((_a2 = process.versions) == null ? void 0 : _a2.node)) {
|
|
@@ -43351,6 +43379,7 @@ class AskConfirm extends Component {
|
|
|
43351
43379
|
}
|
|
43352
43380
|
}
|
|
43353
43381
|
__publicField(AskConfirm, "schema", askConfirmSchema);
|
|
43382
|
+
__publicField(AskConfirm, "implicitDefault", false);
|
|
43354
43383
|
const askEditorSchema = askBaseSchema.extend({
|
|
43355
43384
|
default: stringType().optional(),
|
|
43356
43385
|
language: stringType().optional()
|
|
@@ -43770,7 +43799,7 @@ class AskRating extends Component {
|
|
|
43770
43799
|
if (defaultValue !== void 0) {
|
|
43771
43800
|
return defaultValue;
|
|
43772
43801
|
}
|
|
43773
|
-
return
|
|
43802
|
+
return 0;
|
|
43774
43803
|
}
|
|
43775
43804
|
render(props, resolvedValue, context) {
|
|
43776
43805
|
const {
|
|
@@ -43803,7 +43832,7 @@ class AskRating extends Component {
|
|
|
43803
43832
|
return "";
|
|
43804
43833
|
}
|
|
43805
43834
|
const actualValue = resolvedValue ?? this.resolve(props, context);
|
|
43806
|
-
if (actualValue === void 0) {
|
|
43835
|
+
if (actualValue === 0 && defaultValue === void 0) {
|
|
43807
43836
|
return `{${name}}`;
|
|
43808
43837
|
}
|
|
43809
43838
|
const labelText = allLabels[actualValue];
|
package/dist/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAY,YAAY,EAAE,aAAa,EAAmD,MAAM,SAAS,CAAC;AAuInI;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAY,YAAY,EAAE,aAAa,EAAmD,MAAM,SAAS,CAAC;AAuInI;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CA6CvB"}
|