@saltcorn/markup 1.6.1-beta.0 → 1.7.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/builder.cjs +10 -0
- package/cjs/layout.cjs +10 -0
- package/cjs/mktag.cjs +10 -0
- package/cjs/table.cjs +10 -0
- package/cjs/tabs.cjs +10 -0
- package/cjs/workflow.cjs +10 -0
- package/dist/builder.d.ts +1 -1
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +13 -3
- package/dist/builder.js.map +1 -1
- package/dist/emergency_layout.d.ts +30 -3
- package/dist/emergency_layout.d.ts.map +1 -1
- package/dist/emergency_layout.js +5 -6
- package/dist/emergency_layout.js.map +1 -1
- package/dist/extra_tags.d.ts +31 -0
- package/dist/extra_tags.d.ts.map +1 -0
- package/dist/extra_tags.js +54 -0
- package/dist/extra_tags.js.map +1 -0
- package/dist/form.d.ts +21 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +13 -14
- package/dist/form.js.map +1 -1
- package/dist/form.test.js +48 -84
- package/dist/form.test.js.map +1 -1
- package/dist/generated_tags.d.ts +127 -0
- package/dist/generated_tags.d.ts.map +1 -0
- package/dist/generated_tags.js +253 -0
- package/dist/generated_tags.js.map +1 -0
- package/dist/helpers.d.ts +95 -53
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +3 -3
- package/dist/helpers.js.map +1 -1
- package/dist/helpers.test.js +123 -127
- package/dist/helpers.test.js.map +1 -1
- package/dist/index.d.ts +95 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +29 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +24 -10
- package/dist/internal.js.map +1 -1
- package/dist/layout.d.ts +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +124 -97
- package/dist/layout.js.map +1 -1
- package/dist/layout.test.js +130 -167
- package/dist/layout.test.js.map +1 -1
- package/dist/layout_utils.d.ts +142 -2
- package/dist/layout_utils.d.ts.map +1 -1
- package/dist/layout_utils.js +7 -4
- package/dist/layout_utils.js.map +1 -1
- package/dist/layout_utils.test.js +49 -53
- package/dist/layout_utils.test.js.map +1 -1
- package/dist/markup.test.js +227 -264
- package/dist/markup.test.js.map +1 -1
- package/dist/mjml-layout.d.ts +31 -1
- package/dist/mjml-layout.d.ts.map +1 -1
- package/dist/mjml-layout.js +4 -4
- package/dist/mjml-layout.js.map +1 -1
- package/dist/mjml-tags.d.ts +40 -4
- package/dist/mjml-tags.d.ts.map +1 -1
- package/dist/mjml-tags.js +31 -21
- package/dist/mjml-tags.js.map +1 -1
- package/dist/mktag.d.ts +2 -2
- package/dist/mktag.d.ts.map +1 -1
- package/dist/mktag.js +1 -2
- package/dist/mktag.js.map +1 -1
- package/dist/table.d.ts +3 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +63 -16
- package/dist/table.js.map +1 -1
- package/dist/tabs.d.ts +1 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +2 -3
- package/dist/tabs.js.map +1 -1
- package/dist/tags.d.ts +7 -2
- package/dist/tags.d.ts.map +1 -1
- package/dist/tags.js +16 -94
- package/dist/tags.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -2
- package/dist/workflow.d.ts +1 -1
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +2 -3
- package/dist/workflow.js.map +1 -1
- package/package.json +46 -12
- /package/{webpack.config.js → webpack.config.cjs} +0 -0
package/cjs/builder.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// CommonJS compatibility shim — DO NOT EDIT.
|
|
2
|
+
//
|
|
3
|
+
// This package is ESM ("type": "module"), but its `builder` module's default export
|
|
4
|
+
// is a bare function. Node's require() of an ESM module returns the namespace
|
|
5
|
+
// ({ default: fn }), not the function, which would break out-of-tree CommonJS
|
|
6
|
+
// plugins doing `const builder = require("@saltcorn/markup/builder")` and calling it.
|
|
7
|
+
//
|
|
8
|
+
// The package's "exports" map routes the "require" condition here so such
|
|
9
|
+
// consumers keep getting the callable, while "import" serves the ESM build.
|
|
10
|
+
module.exports = require("../dist/builder.js").default;
|
package/cjs/layout.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// CommonJS compatibility shim — DO NOT EDIT.
|
|
2
|
+
//
|
|
3
|
+
// This package is ESM ("type": "module"), but its `layout` module's default export
|
|
4
|
+
// is a bare function. Node's require() of an ESM module returns the namespace
|
|
5
|
+
// ({ default: fn }), not the function, which would break out-of-tree CommonJS
|
|
6
|
+
// plugins doing `const layout = require("@saltcorn/markup/layout")` and calling it.
|
|
7
|
+
//
|
|
8
|
+
// The package's "exports" map routes the "require" condition here so such
|
|
9
|
+
// consumers keep getting the callable, while "import" serves the ESM build.
|
|
10
|
+
module.exports = require("../dist/layout.js").default;
|
package/cjs/mktag.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// CommonJS compatibility shim — DO NOT EDIT.
|
|
2
|
+
//
|
|
3
|
+
// This package is ESM ("type": "module"), but its `mktag` module's default export
|
|
4
|
+
// is a bare function. Node's require() of an ESM module returns the namespace
|
|
5
|
+
// ({ default: fn }), not the function, which would break out-of-tree CommonJS
|
|
6
|
+
// plugins doing `const mktag = require("@saltcorn/markup/mktag")` and calling it.
|
|
7
|
+
//
|
|
8
|
+
// The package's "exports" map routes the "require" condition here so such
|
|
9
|
+
// consumers keep getting the callable, while "import" serves the ESM build.
|
|
10
|
+
module.exports = require("../dist/mktag.js").default;
|
package/cjs/table.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// CommonJS compatibility shim — DO NOT EDIT.
|
|
2
|
+
//
|
|
3
|
+
// This package is ESM ("type": "module"), but its `table` module's default export
|
|
4
|
+
// is a bare function. Node's require() of an ESM module returns the namespace
|
|
5
|
+
// ({ default: fn }), not the function, which would break out-of-tree CommonJS
|
|
6
|
+
// plugins doing `const table = require("@saltcorn/markup/table")` and calling it.
|
|
7
|
+
//
|
|
8
|
+
// The package's "exports" map routes the "require" condition here so such
|
|
9
|
+
// consumers keep getting the callable, while "import" serves the ESM build.
|
|
10
|
+
module.exports = require("../dist/table.js").default;
|
package/cjs/tabs.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// CommonJS compatibility shim — DO NOT EDIT.
|
|
2
|
+
//
|
|
3
|
+
// This package is ESM ("type": "module"), but its `tabs` module's default export
|
|
4
|
+
// is a bare function. Node's require() of an ESM module returns the namespace
|
|
5
|
+
// ({ default: fn }), not the function, which would break out-of-tree CommonJS
|
|
6
|
+
// plugins doing `const tabs = require("@saltcorn/markup/tabs")` and calling it.
|
|
7
|
+
//
|
|
8
|
+
// The package's "exports" map routes the "require" condition here so such
|
|
9
|
+
// consumers keep getting the callable, while "import" serves the ESM build.
|
|
10
|
+
module.exports = require("../dist/tabs.js").default;
|
package/cjs/workflow.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// CommonJS compatibility shim — DO NOT EDIT.
|
|
2
|
+
//
|
|
3
|
+
// This package is ESM ("type": "module"), but its `workflow` module's default export
|
|
4
|
+
// is a bare function. Node's require() of an ESM module returns the namespace
|
|
5
|
+
// ({ default: fn }), not the function, which would break out-of-tree CommonJS
|
|
6
|
+
// plugins doing `const workflow = require("@saltcorn/markup/workflow")` and calling it.
|
|
7
|
+
//
|
|
8
|
+
// The package's "exports" map routes the "require" condition here so such
|
|
9
|
+
// consumers keep getting the callable, while "import" serves the ESM build.
|
|
10
|
+
module.exports = require("../dist/workflow.js").default;
|
package/dist/builder.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @module builder
|
|
4
4
|
*/
|
|
5
5
|
declare const _default: ({ options, context, action, stepName, layout, mode, version_tag, }: any, csrfToken: any) => string;
|
|
6
|
-
export
|
|
6
|
+
export default /**
|
|
7
7
|
* @param {object} opts
|
|
8
8
|
* @param {object} opts.options
|
|
9
9
|
* @param {object} opts.context
|
package/dist/builder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;yBAkDD,oEAQG,GAAG,EACN,WAAW,GAAG,KACb,MAAM;AAvBT,
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;yBAkDD,oEAQG,GAAG,EACN,WAAW,GAAG,KACb,MAAM;AAvBT,eAAe;;;;;;;;;;;GAWZ,UAqEC"}
|
package/dist/builder.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @category saltcorn-markup
|
|
4
3
|
* @module builder
|
|
5
4
|
*/
|
|
6
|
-
|
|
5
|
+
import tags from "./tags.js";
|
|
7
6
|
const { p, div, i, label, text, button, a, h4, span, script, style, input, link, form, domReady, } = tags;
|
|
8
7
|
/**
|
|
9
8
|
* @param {object} rec
|
|
@@ -19,7 +18,18 @@ const addCsrf = (rec, csrf) => {
|
|
|
19
18
|
* @returns {string}
|
|
20
19
|
*/
|
|
21
20
|
const encode = (x) => encodeURIComponent(JSON.stringify(x));
|
|
22
|
-
|
|
21
|
+
export default /**
|
|
22
|
+
* @param {object} opts
|
|
23
|
+
* @param {object} opts.options
|
|
24
|
+
* @param {object} opts.context
|
|
25
|
+
* @param {object} opts.action
|
|
26
|
+
* @param {string} opts.stepName
|
|
27
|
+
* @param {object} opts.layout
|
|
28
|
+
* @param {string} [opts.mode = "show"]
|
|
29
|
+
* @param {object} opts
|
|
30
|
+
* @param {object} csrfToken
|
|
31
|
+
* @returns {div}
|
|
32
|
+
*/ ({ options, context, action, stepName, layout, mode = "show", version_tag, }, csrfToken) => div(script({
|
|
23
33
|
src: version_tag
|
|
24
34
|
? `/static_assets/${version_tag}/builder_bundle.js`
|
|
25
35
|
: "/builder_bundle.js",
|
package/dist/builder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,MAAM,EACJ,CAAC,EACD,GAAG,EACH,CAAC,EACD,KAAK,EACL,IAAI,EACJ,MAAM,EACN,CAAC,EACD,EAAE,EACF,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,QAAQ,GACT,GAAG,IAAI,CAAC;AAET;;;;GAIG;AACH,MAAM,OAAO,GAAG,CAAC,GAAQ,EAAE,IAAS,EAAO,EAAE;IAC3C,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC;IACrB,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,GAAG,CAAC,CAAM,EAAU,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzE,eAAe;;;;;;;;;;;GAWZ,CACH,CACE,EACE,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,GAAG,MAAM,EACb,WAAW,GACP,EACN,SAAc,EACN,EAAE,CACV,GAAG,CACD,MAAM,CAAC;IACL,GAAG,EAAE,WAAW;QACd,CAAC,CAAC,kBAAkB,WAAW,oBAAoB;QACnD,CAAC,CAAC,oBAAoB;CACzB,CAAC,EACF,MAAM,CAAC;IACL,GAAG,EAAE,WAAW;QACd,CAAC,CAAC,kBAAkB,WAAW,uBAAuB;QACtD,CAAC,CAAC,uBAAuB;CAC5B,CAAC,EACF,IAAI,CAAC;IACH,GAAG,EAAE,YAAY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AC,EACJ,MAAM,CACJ,QAAQ,CAAC;;;;;;;QAOP,CAAC,CACJ,CACF,CAAC"}
|
|
@@ -2,12 +2,25 @@
|
|
|
2
2
|
* @category saltcorn-markup
|
|
3
3
|
* @module emergency_layout
|
|
4
4
|
*/
|
|
5
|
+
import { Req } from "@saltcorn/types/base_types";
|
|
6
|
+
/**
|
|
7
|
+
* @param {string} title
|
|
8
|
+
* @param {string|object} body
|
|
9
|
+
* @param {object[]} alerts
|
|
10
|
+
* @returns {string}
|
|
11
|
+
*/
|
|
12
|
+
declare const renderBody: ({ title, body, alerts, req, }: {
|
|
13
|
+
title: string;
|
|
14
|
+
body: string | any;
|
|
15
|
+
alerts: any[];
|
|
16
|
+
req: Req;
|
|
17
|
+
}) => string;
|
|
5
18
|
declare namespace EmergencyLayoutExports {
|
|
6
19
|
type WrapParams = {
|
|
7
20
|
title: string;
|
|
8
21
|
menu: any;
|
|
9
22
|
brand: any;
|
|
10
|
-
req:
|
|
23
|
+
req: Req;
|
|
11
24
|
alerts: any[];
|
|
12
25
|
currentUrl: string;
|
|
13
26
|
body: string | any;
|
|
@@ -15,14 +28,28 @@ declare namespace EmergencyLayoutExports {
|
|
|
15
28
|
};
|
|
16
29
|
}
|
|
17
30
|
type WrapParams = EmergencyLayoutExports.WrapParams;
|
|
31
|
+
/**
|
|
32
|
+
* @param {object} opts
|
|
33
|
+
* @param {string} opts.title
|
|
34
|
+
* @param {object} opts.menu
|
|
35
|
+
* @param {object} opts.brand
|
|
36
|
+
* @param {object[]} opts.alerts
|
|
37
|
+
* @param {string} opts.currentUrl
|
|
38
|
+
* @param {string|object} opts.body
|
|
39
|
+
* @param {object[]} opts.headers
|
|
40
|
+
* @param {object} opts.req
|
|
41
|
+
* @returns {string}
|
|
42
|
+
*/
|
|
43
|
+
declare const wrap: ({ title, menu, brand, alerts, currentUrl, body, headers, req, }: WrapParams) => string;
|
|
18
44
|
declare const EmergencyLayoutExports: {
|
|
19
45
|
wrap: ({ title, menu, brand, alerts, currentUrl, body, headers, req, }: WrapParams) => string;
|
|
20
46
|
renderBody: ({ title, body, alerts, req, }: {
|
|
21
47
|
title: string;
|
|
22
48
|
body: string | any;
|
|
23
49
|
alerts: any[];
|
|
24
|
-
req:
|
|
50
|
+
req: Req;
|
|
25
51
|
}) => string;
|
|
26
52
|
};
|
|
27
|
-
export
|
|
53
|
+
export { wrap, renderBody };
|
|
54
|
+
export default EmergencyLayoutExports;
|
|
28
55
|
//# sourceMappingURL=emergency_layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emergency_layout.d.ts","sourceRoot":"","sources":["../emergency_layout.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"emergency_layout.d.ts","sourceRoot":"","sources":["../emergency_layout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAGjD;;;;;GAKG;AACH,QAAA,MAAM,UAAU,GAAI,+BAKjB;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,GAAG,EAAE,GAAG,CAAC;CACV,KAAG,MAOA,CAAC;AAGL,kBAAU,sBAAsB,CAAC;IAC/B,KAAY,UAAU,GAAG;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,GAAG,CAAC;QACV,KAAK,EAAE,GAAG,CAAC;QACX,GAAG,EAAE,GAAG,CAAC;QACT,MAAM,EAAE,GAAG,EAAE,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,CAAC;CACH;AACD,KAAK,UAAU,GAAG,sBAAsB,CAAC,UAAU,CAAC;AAEpD;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,IAAI,GAAI,iEASX,UAAU,KAAG,MAC4D,CAAC;AAE7E,QAAA,MAAM,sBAAsB;4EAHzB,UAAU,KAAG,MAAM;gDAlDnB;QACD,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;QACnB,MAAM,EAAE,GAAG,EAAE,CAAC;QACd,GAAG,EAAE,GAAG,CAAC;KACV,KAAG,MAAM;CAgDyC,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC5B,eAAe,sBAAsB,CAAC"}
|
package/dist/emergency_layout.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @category saltcorn-markup
|
|
4
3
|
* @module emergency_layout
|
|
5
4
|
*/
|
|
6
|
-
|
|
5
|
+
import tags from "./tags.js";
|
|
7
6
|
const { ul, li, a, span, hr, div, text, i, h6, h1, p, header, img, footer } = tags;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const layoutUtils = require("./layout_utils");
|
|
7
|
+
import renderLayout from "./layout.js";
|
|
8
|
+
import layoutUtils from "./layout_utils.js";
|
|
11
9
|
const { navbar, alert } = layoutUtils;
|
|
12
10
|
/**
|
|
13
11
|
* @param {string} title
|
|
@@ -35,5 +33,6 @@ const renderBody = ({ title, body, alerts, req, }) => renderLayout({
|
|
|
35
33
|
*/
|
|
36
34
|
const wrap = ({ title, menu, brand, alerts, currentUrl, body, headers, req, }) => navbar(brand, menu, currentUrl) + renderBody({ title, body, alerts, req });
|
|
37
35
|
const EmergencyLayoutExports = { wrap, renderBody };
|
|
38
|
-
|
|
36
|
+
export { wrap, renderBody };
|
|
37
|
+
export default EmergencyLayoutExports;
|
|
39
38
|
//# sourceMappingURL=emergency_layout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emergency_layout.js","sourceRoot":"","sources":["../emergency_layout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emergency_layout.js","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-0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-markup
|
|
3
|
+
* @module tags
|
|
4
|
+
*/
|
|
5
|
+
import type { Element, Attributes } from "./types.js";
|
|
6
|
+
import type { IWhiteList } from "xss";
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} js
|
|
9
|
+
* @returns {string}
|
|
10
|
+
*/
|
|
11
|
+
export declare const domReady: (js: string) => string;
|
|
12
|
+
export declare const with_curScript: (js: string) => string;
|
|
13
|
+
/**
|
|
14
|
+
* @param {string|number} t
|
|
15
|
+
* @returns {string}
|
|
16
|
+
*/
|
|
17
|
+
export declare const text: (t: string | number, customWhiteList?: IWhiteList) => string;
|
|
18
|
+
/**
|
|
19
|
+
* @param {string|number} t
|
|
20
|
+
* @returns {string}
|
|
21
|
+
*/
|
|
22
|
+
export declare const text_attr: (t: string | number) => string;
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} tagName
|
|
25
|
+
* @param {...*} rest
|
|
26
|
+
* @returns {string}
|
|
27
|
+
*/
|
|
28
|
+
export declare const genericElement: (tagName: string, attributes_or_first_child?: Attributes | Element, ...children: Element[]) => string;
|
|
29
|
+
/** @type {string} */
|
|
30
|
+
export declare const nbsp = " ";
|
|
31
|
+
//# sourceMappingURL=extra_tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extra_tags.d.ts","sourceRoot":"","sources":["../extra_tags.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAKtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAItC;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,IAAI,MAAM,KAAG,MACwH,CAAC;AAE/J,eAAO,MAAM,cAAc,GAAI,IAAI,MAAM,KAAG,MACM,CAAC;AAiBnD;;;GAGG;AACH,eAAO,MAAM,IAAI,GACf,GAAG,MAAM,GAAG,MAAM,EAClB,kBAAkB,UAAU,KAC3B,MAQI,CAAC;AAER;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,GAAG,MAAM,WACT,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,SAAS,MAAM,EACf,4BAA4B,UAAU,GAAG,OAAO,EAChD,GAAG,UAAU,OAAO,EAAE,KACrB,MAAuE,CAAC;AAE3E,qBAAqB;AACrB,eAAO,MAAM,IAAI,WAAW,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-markup
|
|
3
|
+
* @module tags
|
|
4
|
+
*/
|
|
5
|
+
import mkTag from "./mktag.js";
|
|
6
|
+
import xss from "xss";
|
|
7
|
+
import escape from "escape-html";
|
|
8
|
+
const whiteList = xss.whiteList;
|
|
9
|
+
//https://stackoverflow.com/a/59220393
|
|
10
|
+
/**
|
|
11
|
+
* @param {string} js
|
|
12
|
+
* @returns {string}
|
|
13
|
+
*/
|
|
14
|
+
export const domReady = (js) => `(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){${js}});`;
|
|
15
|
+
export const with_curScript = (js) => `((curScript)=>{${js}})(document.currentScript)`;
|
|
16
|
+
whiteList.kbd = [];
|
|
17
|
+
whiteList.span = ["style"];
|
|
18
|
+
whiteList.div = ["style"];
|
|
19
|
+
whiteList.td = ["style"];
|
|
20
|
+
const mergeWhiteList = (customWhiteList) => {
|
|
21
|
+
const res = JSON.parse(JSON.stringify(whiteList));
|
|
22
|
+
for (const [k, v] of Object.entries(customWhiteList)) {
|
|
23
|
+
if (!v)
|
|
24
|
+
continue;
|
|
25
|
+
if (res[k])
|
|
26
|
+
res[k].push(...v);
|
|
27
|
+
else
|
|
28
|
+
res[k] = v;
|
|
29
|
+
}
|
|
30
|
+
return res;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @param {string|number} t
|
|
34
|
+
* @returns {string}
|
|
35
|
+
*/
|
|
36
|
+
export const text = (t, customWhiteList) => t === 0
|
|
37
|
+
? "0"
|
|
38
|
+
: xss(t, customWhiteList
|
|
39
|
+
? { whiteList: mergeWhiteList(customWhiteList) }
|
|
40
|
+
: undefined);
|
|
41
|
+
/**
|
|
42
|
+
* @param {string|number} t
|
|
43
|
+
* @returns {string}
|
|
44
|
+
*/
|
|
45
|
+
export const text_attr = (t) => t === 0 ? "0" : escape(t);
|
|
46
|
+
/**
|
|
47
|
+
* @param {string} tagName
|
|
48
|
+
* @param {...*} rest
|
|
49
|
+
* @returns {string}
|
|
50
|
+
*/
|
|
51
|
+
export const genericElement = (tagName, attributes_or_first_child, ...children) => mkTag(tagName, false)(attributes_or_first_child, ...children);
|
|
52
|
+
/** @type {string} */
|
|
53
|
+
export const nbsp = " ";
|
|
54
|
+
//# sourceMappingURL=extra_tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extra_tags.js","sourceRoot":"","sources":["../extra_tags.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,MAAM,MAAM,aAAa,CAAC;AAOjC,MAAM,SAAS,GAAgB,GAAW,CAAC,SAAS,CAAC;AAErD,sCAAsC;AACtC;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAU,EAAU,EAAE,CAC7C,qJAAqJ,EAAE,KAAK,CAAC;AAE/J,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAU,EAAU,EAAE,CACnD,kBAAkB,EAAE,4BAA4B,CAAC;AAEnD,SAAS,CAAC,GAAG,GAAG,EAAE,CAAC;AACnB,SAAS,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;AAC3B,SAAS,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC;AAC1B,SAAS,C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QAAQ,CAAC"}
|
package/dist/form.d.ts
CHANGED
|
@@ -3,11 +3,31 @@
|
|
|
3
3
|
* @module form
|
|
4
4
|
*/
|
|
5
5
|
import type { AbstractForm as Form } from "@saltcorn/types/model-abstracts/abstract_form";
|
|
6
|
+
/**
|
|
7
|
+
* @param form
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
declare const renderFormLayout: (form: Form) => string;
|
|
11
|
+
/**
|
|
12
|
+
* @param form
|
|
13
|
+
* @param csrfToken0
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
declare const renderForm: (form: Form | string, csrfToken0: string | boolean) => string;
|
|
17
|
+
declare const mkFormContentNoLayout: (form: Form, errors?: any) => string;
|
|
18
|
+
/**
|
|
19
|
+
* @param form
|
|
20
|
+
* @param csrfToken
|
|
21
|
+
* @param errors
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
declare const mkForm: (form: Form, csrfToken: string | boolean, errors?: any) => string;
|
|
25
|
+
export { renderForm, mkFormContentNoLayout, mkForm, renderFormLayout };
|
|
6
26
|
declare const _default: {
|
|
7
27
|
renderForm: (form: Form | string, csrfToken0: string | boolean) => string;
|
|
8
28
|
mkFormContentNoLayout: (form: Form, errors?: any) => string;
|
|
9
29
|
mkForm: (form: Form, csrfToken: string | boolean, errors?: any) => string;
|
|
10
30
|
renderFormLayout: (form: Form) => string;
|
|
11
31
|
};
|
|
12
|
-
export
|
|
32
|
+
export default _default;
|
|
13
33
|
//# sourceMappingURL=form.d.ts.map
|
package/dist/form.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../form.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4BH,OAAO,KAAK,EAAE,YAAY,IAAI,IAAI,EAAE,MAAM,+CAA+C,CAAC;;
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../form.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4BH,OAAO,KAAK,EAAE,YAAY,IAAI,IAAI,EAAE,MAAM,+CAA+C,CAAC;AAwsC1F;;;GAGG;AACH,QAAA,MAAM,gBAAgB,GAAI,MAAM,IAAI,KAAG,MAwTtC,CAAC;AAYF;;;;GAIG;AACH,QAAA,MAAM,UAAU,GACd,MAAM,IAAI,GAAG,MAAM,EACnB,YAAY,MAAM,GAAG,OAAO,KAC3B,MAWF,CAAC;AAmHF,QAAA,MAAM,qBAAqB,GAAI,MAAM,IAAI,EAAE,SAAQ,GAAQ,WAkD1D,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,MAAM,GACV,MAAM,IAAI,EACV,WAAW,MAAM,GAAG,OAAO,EAC3B,SAAQ,GAAQ,KACf,MA4EF,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;;uBA5Q/D,IAAI,GAAG,MAAM,cACP,MAAM,GAAG,OAAO,KAC3B,MAAM;kCA8H4B,IAAI,WAAU,GAAG;mBA2D9C,IAAI,aACC,MAAM,GAAG,OAAO,WACnB,GAAG,KACV,MAAM;6BAxgBuB,IAAI,KAAG,MAAM;;AAulB7C,wBAA+E"}
|
package/dist/form.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @category saltcorn-markup
|
|
4
3
|
* @module form
|
|
5
4
|
*/
|
|
6
|
-
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
const tags = require("./tags");
|
|
5
|
+
import tags from "./tags.js";
|
|
10
6
|
const { p, div, i, label, text, text_attr, button, a, h5, span, script, domReady, ul, li, input, pre, select, textarea, option, escape, } = tags;
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import renderLayout from "./layout.js";
|
|
8
|
+
import helpers from "./helpers.js";
|
|
13
9
|
const { isdef, select_options, search_bar } = helpers;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const { renderTabs } =
|
|
10
|
+
import { instanceOfField, } from "@saltcorn/types/model-abstracts/abstract_field";
|
|
11
|
+
import layout_utils from "./layout_utils.js";
|
|
12
|
+
const { renderTabs } = layout_utils;
|
|
17
13
|
const isNode = typeof window === "undefined";
|
|
18
14
|
/**
|
|
19
15
|
* @param s
|
|
@@ -837,10 +833,10 @@ const renderFormLayout = (form) => {
|
|
|
837
833
|
? form.fields.find((f) => f.name === repeat_name)
|
|
838
834
|
: null;
|
|
839
835
|
const field = { ...field0 };
|
|
840
|
-
if (
|
|
836
|
+
if (instanceOfField(field) && field.input_type !== "hidden") {
|
|
841
837
|
if (field.sourceURL)
|
|
842
838
|
return div({ "data-source-url": field.sourceURL });
|
|
843
|
-
if (
|
|
839
|
+
if (instanceOfField(field0))
|
|
844
840
|
field.form_name = field0.form_name;
|
|
845
841
|
const errorFeedback = form.errors[field.name]
|
|
846
842
|
? div({
|
|
@@ -993,7 +989,9 @@ const renderForm = (form, csrfToken0) => {
|
|
|
993
989
|
return form;
|
|
994
990
|
const csrfToken = csrfToken0 === false || csrfToken0 === ""
|
|
995
991
|
? csrfToken0
|
|
996
|
-
: csrfToken0 ||
|
|
992
|
+
: csrfToken0 ||
|
|
993
|
+
(form.req && form.req.csrfToken && form.req.csrfToken()) ||
|
|
994
|
+
"";
|
|
997
995
|
if (form.layout)
|
|
998
996
|
return mkFormWithLayout(form, csrfToken);
|
|
999
997
|
else
|
|
@@ -1183,5 +1181,6 @@ const mkForm = (form, csrfToken, errors = {}) => {
|
|
|
1183
1181
|
splitSnippet(form) +
|
|
1184
1182
|
"</form>");
|
|
1185
1183
|
};
|
|
1186
|
-
|
|
1184
|
+
export { renderForm, mkFormContentNoLayout, mkForm, renderFormLayout };
|
|
1185
|
+
export default { renderForm, mkFormContentNoLayout, mkForm, renderFormLayout };
|
|
1187
1186
|
//# sourceMappingURL=form.js.map
|