@plitzi/sdk-shared 0.37.1 → 0.37.3
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/CHANGELOG.md +1288 -0
- package/dist/actions/access.d.ts +12 -0
- package/dist/actions/access.mjs +13 -0
- package/dist/actions/cron.d.ts +21 -12
- package/dist/actions/cron.mjs +48 -17
- package/dist/actions/functions.d.ts +27 -0
- package/dist/actions/functions.mjs +18 -0
- package/dist/actions/index.d.ts +5 -1
- package/dist/actions/index.mjs +9 -7
- package/dist/actions/triggers.d.ts +4 -0
- package/dist/actions/triggers.mjs +4 -1
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.mjs +2 -1
- package/dist/auth/visitorRoles.d.ts +27 -0
- package/dist/auth/visitorRoles.mjs +48 -0
- package/dist/authoring/builder.mjs +1 -0
- package/dist/authoring/declare.d.ts +74 -0
- package/dist/authoring/declare.mjs +2 -2
- package/dist/authoring/index.mjs +5 -5
- package/dist/authoring/paramSpec.d.ts +1 -1
- package/dist/authoring/paramSpec.mjs +1 -0
- package/dist/authoring/spaceCallbacks.mjs +2 -2
- package/dist/dataSource/computed.d.ts +21 -0
- package/dist/dataSource/computed.mjs +45 -0
- package/dist/dataSource/getBindingsDetails.mjs +35 -33
- package/dist/dataSource/index.d.ts +1 -0
- package/dist/dataSource/index.mjs +7 -6
- package/dist/dataSource/utility/checkboxParams.d.ts +11 -0
- package/dist/dataSource/utility/checkboxParams.mjs +12 -0
- package/dist/dataSource/utility/not.mjs +4 -7
- package/dist/dataSource/utility/stringToArray.mjs +1 -1
- package/dist/dataSource/utility/truthiness.d.ts +1 -0
- package/dist/dataSource/utility/truthiness.mjs +8 -0
- package/dist/dataSource/utility/twigTemplate.d.ts +2 -1
- package/dist/dataSource/utility/twigTemplate.mjs +29 -17
- package/dist/devTools/utils/PlitziConsole.mjs +22 -22
- package/dist/helpers/cookies.d.ts +10 -0
- package/dist/helpers/cookies.mjs +19 -0
- package/dist/helpers/fetchManifest.d.ts +9 -0
- package/dist/helpers/fetchManifest.mjs +3 -6
- package/dist/helpers/formatDate.d.ts +5 -3
- package/dist/helpers/formatDate.mjs +34 -36
- package/dist/helpers/index.d.ts +2 -0
- package/dist/helpers/index.mjs +18 -13
- package/dist/helpers/isDate.d.ts +7 -0
- package/dist/helpers/isDate.mjs +15 -0
- package/dist/helpers/keys.d.ts +42 -0
- package/dist/helpers/keys.mjs +91 -0
- package/dist/helpers/twigWrapper/AST.d.ts +2 -2
- package/dist/helpers/twigWrapper/Evaluator/Evaluator.d.ts +12 -2
- package/dist/helpers/twigWrapper/Evaluator/Evaluator.mjs +69 -31
- package/dist/helpers/twigWrapper/Evaluator/index.d.ts +1 -1
- package/dist/helpers/twigWrapper/Evaluator/index.mjs +2 -2
- package/dist/helpers/twigWrapper/Parser/ExpressionParser.d.ts +2 -2
- package/dist/helpers/twigWrapper/Parser/ExpressionParser.mjs +147 -34
- package/dist/helpers/twigWrapper/Parser/Parser.d.ts +2 -1
- package/dist/helpers/twigWrapper/Parser/Parser.mjs +21 -20
- package/dist/helpers/twigWrapper/filters/filters.mjs +134 -111
- package/dist/helpers/twigWrapper/index.d.ts +6 -2
- package/dist/helpers/twigWrapper/index.mjs +7 -4
- package/dist/helpers/twigWrapper/inspectTemplate.d.ts +23 -0
- package/dist/helpers/twigWrapper/inspectTemplate.mjs +110 -0
- package/dist/helpers/twigWrapper/processTwig/helpers.d.ts +7 -0
- package/dist/helpers/twigWrapper/processTwig/helpers.mjs +2 -1
- package/dist/helpers/twigWrapper/processTwig/index.d.ts +2 -1
- package/dist/helpers/twigWrapper/processTwig/index.mjs +3 -2
- package/dist/helpers/twigWrapper/processTwig/processTwig.d.ts +28 -0
- package/dist/helpers/twigWrapper/processTwig/processTwig.mjs +73 -16
- package/dist/helpers/twigWrapper/processTwig/resolveStepParam.d.ts +17 -0
- package/dist/helpers/twigWrapper/processTwig/resolveStepParam.mjs +14 -0
- package/dist/helpers/twigWrapper/templateRoots.d.ts +11 -0
- package/dist/helpers/twigWrapper/templateRoots.mjs +4 -4
- package/dist/helpers/twigWrapper/tokens/hasTemplateSyntax.d.ts +9 -0
- package/dist/helpers/twigWrapper/tokens/hasTemplateSyntax.mjs +4 -0
- package/dist/history/describe.d.ts +29 -0
- package/dist/history/describe.mjs +93 -0
- package/dist/history/diff.d.ts +33 -0
- package/dist/history/diff.mjs +73 -0
- package/dist/history/index.d.ts +3 -0
- package/dist/history/index.mjs +3 -0
- package/dist/history/types.d.ts +48 -0
- package/dist/history/types.mjs +0 -0
- package/dist/hooks/usePlitziServiceContext.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +77 -65
- package/dist/navigation/index.d.ts +1 -1
- package/dist/navigation/index.mjs +2 -2
- package/dist/navigation/routes.d.ts +11 -1
- package/dist/navigation/routes.mjs +35 -30
- package/dist/network/graphql/builder/Mutations/Space/SpaceFixIssuesMutation.d.ts +14 -0
- package/dist/network/graphql/builder/Mutations/Space/SpaceFixIssuesMutation.mjs +16 -0
- package/dist/network/graphql/builder/Mutations/Space/SpaceUpdatePluginMutation.d.ts +4 -0
- package/dist/network/graphql/builder/Mutations/Space/SpaceUpdatePluginMutation.mjs +2 -2
- package/dist/network/graphql/builder/Mutations/Space/actions/SpaceRunActionMutation.mjs +1 -0
- package/dist/network/graphql/builder/Mutations/Space/functions/SpaceRemoveFunctionsMutation.d.ts +3 -0
- package/dist/network/graphql/builder/Mutations/Space/functions/SpaceRemoveFunctionsMutation.mjs +9 -0
- package/dist/network/graphql/builder/Mutations/Space/functions/SpaceSaveFunctionsMutation.d.ts +11 -0
- package/dist/network/graphql/builder/Mutations/Space/functions/SpaceSaveFunctionsMutation.mjs +24 -0
- package/dist/network/graphql/builder/Mutations/Space/functions/SpaceTryFunctionMutation.d.ts +4 -0
- package/dist/network/graphql/builder/Mutations/Space/functions/SpaceTryFunctionMutation.mjs +15 -0
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeMutation.mjs +9 -0
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeVariableMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeVariableMutation.mjs +9 -0
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeSizeMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeSizeMutation.mjs +9 -0
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeVariableMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeVariableMutation.mjs +9 -0
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStartRuntimeMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStartRuntimeMutation.mjs +9 -0
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStopRuntimeMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStopRuntimeMutation.mjs +9 -0
- package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceAddVisitorMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceAddVisitorMutation.mjs +11 -0
- package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceRemoveVisitorMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceRemoveVisitorMutation.mjs +11 -0
- package/dist/network/graphql/builder/Mutations/index.d.ts +28 -0
- package/dist/network/graphql/builder/Mutations/index.mjs +108 -84
- package/dist/network/graphql/builder/Queries/Space/SpaceChangesQuery.d.ts +23 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceChangesQuery.mjs +49 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceFunctionsQuery.d.ts +6 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceFunctionsQuery.mjs +13 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.d.ts +17 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.mjs +22 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceRuntimeQuery.d.ts +6 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceRuntimeQuery.mjs +32 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceVisitorsQuery.d.ts +6 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceVisitorsQuery.mjs +16 -0
- package/dist/network/graphql/builder/Queries/index.d.ts +17 -3
- package/dist/network/graphql/builder/Queries/index.mjs +30 -22
- package/dist/network/graphql/sdk/Mutations/index.d.ts +1 -1
- package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +1 -1
- package/dist/network/graphql/sdk/Queries/InitQuery.mjs +2 -91
- package/dist/network/graphql/sdk/Queries/Segment/SegmentQuery.d.ts +1 -1
- package/dist/network/graphql/sdk/Queries/Segment/SegmentQuery.mjs +2 -44
- package/dist/network/graphql/sdk/Queries/Segment/SegmentsQuery.d.ts +1 -1
- package/dist/network/graphql/sdk/Queries/Segment/SegmentsQuery.mjs +2 -55
- package/dist/network/graphql/sdk/Queries/index.d.ts +1 -5
- package/dist/network/index.mjs +7 -7
- package/dist/network/spaceEvents.d.ts +33 -3
- package/dist/network/spaceEvents.mjs +102 -89
- package/dist/realtime/client.d.ts +46 -0
- package/dist/realtime/client.mjs +192 -0
- package/dist/realtime/index.d.ts +6 -0
- package/dist/realtime/index.mjs +4 -0
- package/dist/realtime/presence.d.ts +38 -0
- package/dist/realtime/presence.mjs +70 -0
- package/dist/realtime/topics.d.ts +36 -0
- package/dist/realtime/topics.mjs +25 -0
- package/dist/schema/serverElements.d.ts +5 -0
- package/dist/schema/serverElements.mjs +15 -14
- package/dist/server/actions/useRealtimeSync.d.ts +9 -0
- package/dist/server/actions/useRealtimeSync.mjs +7 -0
- package/dist/state/index.d.ts +1 -0
- package/dist/state/index.mjs +3 -2
- package/dist/state/paintedState.d.ts +52 -0
- package/dist/state/paintedState.mjs +37 -0
- package/dist/state/runtimeStatePersist.d.ts +24 -0
- package/dist/state/runtimeStatePersist.mjs +113 -10
- package/dist/store/index.d.ts +45 -45
- package/dist/store/renderSettings.d.ts +6 -3
- package/dist/store/tracing/index.d.ts +1 -0
- package/dist/store/tracing/tracingCollector.d.ts +17 -1
- package/dist/store/tracing/tracingCollector.mjs +5 -0
- package/dist/style/index.d.ts +1 -0
- package/dist/style/index.mjs +3 -2
- package/dist/style/runtimeStyle.d.ts +29 -0
- package/dist/style/runtimeStyle.mjs +7 -0
- package/dist/style/styleConstants.d.ts +3 -2
- package/dist/style/styleConstants.mjs +2 -0
- package/dist/style/styleStates.d.ts +14 -1
- package/dist/style/styleStates.mjs +10 -7
- package/dist/theme/ThemeProvider.d.ts +1 -1
- package/dist/theme/ThemeProvider.mjs +35 -29
- package/dist/theme/themeCookie.mjs +11 -15
- package/dist/types/ActionTypes.d.ts +193 -0
- package/dist/types/AuthTypes.d.ts +11 -1
- package/dist/types/CommonTypes.d.ts +6 -0
- package/dist/types/FunctionTypes.d.ts +52 -0
- package/dist/types/FunctionTypes.mjs +0 -0
- package/dist/types/PluginTypes.d.ts +0 -1
- package/dist/types/RealtimeTypes.d.ts +94 -0
- package/dist/types/RealtimeTypes.mjs +0 -0
- package/dist/types/SchemaTypes.d.ts +54 -0
- package/dist/types/SchemaTypes.mjs +8 -0
- package/dist/types/ServerTypes.d.ts +310 -15
- package/dist/types/SpaceTypes.d.ts +53 -0
- package/dist/types/StateTypes.d.ts +6 -0
- package/dist/types/StoreTypes.d.ts +12 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.mjs +3 -2
- package/package.json +190 -21
- package/vite.config.ts +0 -12
- package/dist/network/graphql/builder/Queries/PluginsQuery.d.ts +0 -9
- package/dist/network/graphql/builder/Queries/PluginsQuery.mjs +0 -54
|
@@ -3,18 +3,18 @@ import { reconstructSource as n, reconstructToken as r } from "../Lexer/types.mj
|
|
|
3
3
|
import { parseApplyFilters as i, parseExpression as a } from "./ExpressionParser.mjs";
|
|
4
4
|
import { extractFirstWord as o, splitRange as s } from "./helpers.mjs";
|
|
5
5
|
//#region src/helpers/twigWrapper/Parser/Parser.ts
|
|
6
|
-
var c = (e, t = !1) => {
|
|
7
|
-
let
|
|
8
|
-
if (!
|
|
9
|
-
let e =
|
|
6
|
+
var c = (e, t = !1, n) => {
|
|
7
|
+
let r = new f(e, t, n), i = r.parseBody();
|
|
8
|
+
if (!r.error) {
|
|
9
|
+
let e = r.peek();
|
|
10
10
|
if (e && e.type === "tag") {
|
|
11
11
|
let t = o(e.content.trim());
|
|
12
|
-
l.has(t) && (
|
|
12
|
+
l.has(t) && (r.error = `Orphan closing tag: {% ${t} %} without matching opening tag`);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
return {
|
|
16
|
-
nodes:
|
|
17
|
-
error:
|
|
16
|
+
nodes: i,
|
|
17
|
+
error: r.error
|
|
18
18
|
};
|
|
19
19
|
}, l = /* @__PURE__ */ new Set([
|
|
20
20
|
"endif",
|
|
@@ -45,10 +45,11 @@ var c = (e, t = !1) => {
|
|
|
45
45
|
}), f = class {
|
|
46
46
|
tokens;
|
|
47
47
|
keepEmptyTokens;
|
|
48
|
+
issues;
|
|
48
49
|
pos = 0;
|
|
49
50
|
error = null;
|
|
50
|
-
constructor(e, t = !1) {
|
|
51
|
-
this.tokens = e, this.keepEmptyTokens = t;
|
|
51
|
+
constructor(e, t = !1, n) {
|
|
52
|
+
this.tokens = e, this.keepEmptyTokens = t, this.issues = n;
|
|
52
53
|
}
|
|
53
54
|
peek() {
|
|
54
55
|
return this.tokens[this.pos];
|
|
@@ -101,7 +102,7 @@ var c = (e, t = !1) => {
|
|
|
101
102
|
},
|
|
102
103
|
source: i
|
|
103
104
|
};
|
|
104
|
-
let o = a(r);
|
|
105
|
+
let o = a(r, this.issues);
|
|
105
106
|
return {
|
|
106
107
|
type: "variable",
|
|
107
108
|
raw: t.raw,
|
|
@@ -112,15 +113,15 @@ var c = (e, t = !1) => {
|
|
|
112
113
|
parseTag() {
|
|
113
114
|
let e = this.peek();
|
|
114
115
|
if (!e || e.type !== "tag") return null;
|
|
115
|
-
let t = e.content.trim();
|
|
116
|
-
switch (
|
|
116
|
+
let t = e.content.trim(), n = o(t);
|
|
117
|
+
switch (n) {
|
|
117
118
|
case "if": return this.parseIf();
|
|
118
119
|
case "for": return this.parseFor();
|
|
119
120
|
case "set": return this.parseSet();
|
|
120
121
|
case "apply": return this.parseApply();
|
|
121
122
|
case "break": return this.advance(), { type: "break" };
|
|
122
123
|
case "continue": return this.advance(), { type: "continue" };
|
|
123
|
-
default: return this.advance(), null;
|
|
124
|
+
default: return this.issues?.push(`Unknown tag {% ${n} %}: the tags are if, for, set, apply, break and continue`), this.advance(), null;
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
parseIf() {
|
|
@@ -129,14 +130,14 @@ var c = (e, t = !1) => {
|
|
|
129
130
|
if (e.type !== "tag") return this.error = "Malformed {% if %} tag", u();
|
|
130
131
|
let t = e.content.trim(), n = t.indexOf(" ") === -1 ? "" : t.slice(t.indexOf(" ") + 1).trim();
|
|
131
132
|
if (!n) return this.error = "Malformed {% if %} tag: missing condition", u();
|
|
132
|
-
let r = a(n), i = this.parseBody(), s = [], c = null, l = !1;
|
|
133
|
+
let r = a(n, this.issues), i = this.parseBody(), s = [], c = null, l = !1;
|
|
133
134
|
for (; this.peek();) {
|
|
134
135
|
let e = this.peek();
|
|
135
136
|
if (!e || e.type !== "tag") break;
|
|
136
137
|
let t = o(e.content.trim());
|
|
137
138
|
if (t === "elseif") {
|
|
138
139
|
this.advance();
|
|
139
|
-
let t = e.content.trim(), n = t.slice(t.indexOf(" ") + 1).trim(), r = a(n), i = this.parseBody();
|
|
140
|
+
let t = e.content.trim(), n = t.slice(t.indexOf(" ") + 1).trim(), r = a(n, this.issues), i = this.parseBody();
|
|
140
141
|
s.push({
|
|
141
142
|
condition: r,
|
|
142
143
|
body: i
|
|
@@ -164,9 +165,9 @@ var c = (e, t = !1) => {
|
|
|
164
165
|
if (!c) return this.error = "Invalid {% for %} syntax: missing the `in` keyword", d();
|
|
165
166
|
let l = i.slice(0, c.index).trim(), u = i.slice(c.index + c[0].length).trim(), f = s(u), p = f ? {
|
|
166
167
|
type: "range",
|
|
167
|
-
start: a(f[0]),
|
|
168
|
-
end: a(f[1])
|
|
169
|
-
} : a(u), m = l.indexOf(","), h = m === -1 ? null : l.slice(0, m).trim(), g = m === -1 ? l : l.slice(m + 1).trim();
|
|
168
|
+
start: a(f[0], this.issues),
|
|
169
|
+
end: a(f[1], this.issues)
|
|
170
|
+
} : a(u, this.issues), m = l.indexOf(","), h = m === -1 ? null : l.slice(0, m).trim(), g = m === -1 ? l : l.slice(m + 1).trim();
|
|
170
171
|
if (!t(g)) return this.error = `Invalid {% for %} variable name: "${g}"`, d();
|
|
171
172
|
if (h !== null && !t(h)) return this.error = `Invalid {% for %} key variable name: "${h}"`, d();
|
|
172
173
|
let _ = this.parseBody(), v = null;
|
|
@@ -216,7 +217,7 @@ var c = (e, t = !1) => {
|
|
|
216
217
|
return {
|
|
217
218
|
type: "set",
|
|
218
219
|
name: i,
|
|
219
|
-
value: a(o)
|
|
220
|
+
value: a(o, this.issues)
|
|
220
221
|
};
|
|
221
222
|
}
|
|
222
223
|
parseApply() {
|
|
@@ -227,7 +228,7 @@ var c = (e, t = !1) => {
|
|
|
227
228
|
filters: [],
|
|
228
229
|
body: []
|
|
229
230
|
};
|
|
230
|
-
let t = e.content.trim(), n = t.slice(t.indexOf(" ") + 1).trim(), r = i(n), a = this.parseBody(), o = this.peek();
|
|
231
|
+
let t = e.content.trim(), n = t.slice(t.indexOf(" ") + 1).trim(), r = i(n, this.issues), a = this.parseBody(), o = this.peek();
|
|
231
232
|
return o && o.type === "tag" && this.advance(), {
|
|
232
233
|
type: "apply",
|
|
233
234
|
filters: r,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
//#region src/helpers/twigWrapper/filters/filters.ts
|
|
2
|
-
var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t) => e === t ? 0 : e == null ? -1 : t == null ? 1 : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t)), r = (e) => e == null ? "" : String(e),
|
|
2
|
+
var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t) => e === t ? 0 : e == null ? -1 : t == null ? 1 : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t)), r = (e) => e === void 0 || typeof e == "function" || typeof e == "symbol" ? "null" : typeof e == "bigint" ? e.toString() : JSON.stringify(e), i = (e) => e == null ? "" : String(e), a = (e) => {
|
|
3
3
|
let t = new TextEncoder().encode(e), n = "";
|
|
4
4
|
for (let e = 0; e < t.length; e++) n += String.fromCharCode(t[e]);
|
|
5
5
|
return btoa(n);
|
|
6
|
-
},
|
|
6
|
+
}, o = (e) => {
|
|
7
7
|
let t = atob(e), n = new Uint8Array(t.length);
|
|
8
8
|
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
9
9
|
return new TextDecoder().decode(n);
|
|
10
|
-
},
|
|
10
|
+
}, s = (e) => {
|
|
11
11
|
let t = [
|
|
12
12
|
7,
|
|
13
13
|
12,
|
|
@@ -96,10 +96,10 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
96
96
|
return t;
|
|
97
97
|
};
|
|
98
98
|
return p(c) + p(l) + p(u) + p(d);
|
|
99
|
-
},
|
|
99
|
+
}, c = "__PLITZI_RAW__", l = (e) => typeof e == "object" && !!e && e.__marker === "__PLITZI_RAW__", u = (e) => ({
|
|
100
100
|
__raw: e,
|
|
101
|
-
__marker:
|
|
102
|
-
}),
|
|
101
|
+
__marker: c
|
|
102
|
+
}), d = (e) => l(e) ? e.__raw : e, f = [
|
|
103
103
|
"Sun",
|
|
104
104
|
"Mon",
|
|
105
105
|
"Tue",
|
|
@@ -107,9 +107,9 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
107
107
|
"Thu",
|
|
108
108
|
"Fri",
|
|
109
109
|
"Sat"
|
|
110
|
-
],
|
|
111
|
-
if (!
|
|
112
|
-
|
|
110
|
+
], p = /* @__PURE__ */ new Map(), m = (e) => {
|
|
111
|
+
if (!p.has(e)) try {
|
|
112
|
+
p.set(e, new Intl.DateTimeFormat("en-US", {
|
|
113
113
|
timeZone: e,
|
|
114
114
|
hourCycle: "h23",
|
|
115
115
|
year: "numeric",
|
|
@@ -121,10 +121,15 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
121
121
|
weekday: "short"
|
|
122
122
|
}));
|
|
123
123
|
} catch {
|
|
124
|
-
|
|
124
|
+
p.set(e, null);
|
|
125
125
|
}
|
|
126
|
-
return
|
|
127
|
-
},
|
|
126
|
+
return p.get(e) ?? null;
|
|
127
|
+
}, h = (e) => {
|
|
128
|
+
if (e instanceof Date) return e;
|
|
129
|
+
if (typeof e == "number") return new Date(e);
|
|
130
|
+
let t = String(e).trim();
|
|
131
|
+
return /^-?\d+$/.test(t) ? new Date(Number(t)) : new Date(t);
|
|
132
|
+
}, g = (e, t) => {
|
|
128
133
|
if (!t) return {
|
|
129
134
|
year: e.getFullYear(),
|
|
130
135
|
month: e.getMonth() + 1,
|
|
@@ -134,7 +139,7 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
134
139
|
seconds: e.getSeconds(),
|
|
135
140
|
weekday: e.getDay()
|
|
136
141
|
};
|
|
137
|
-
let n =
|
|
142
|
+
let n = m(t);
|
|
138
143
|
if (!n) return;
|
|
139
144
|
let r = n.formatToParts(e), i = (e) => r.find((t) => t.type === e)?.value ?? "";
|
|
140
145
|
return {
|
|
@@ -144,12 +149,12 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
144
149
|
hours: Number(i("hour")),
|
|
145
150
|
minutes: Number(i("minute")),
|
|
146
151
|
seconds: Number(i("second")),
|
|
147
|
-
weekday:
|
|
152
|
+
weekday: f.indexOf(i("weekday"))
|
|
148
153
|
};
|
|
149
|
-
},
|
|
150
|
-
raw: (e) =>
|
|
151
|
-
to_json: (e) =>
|
|
152
|
-
json_encode: (e) =>
|
|
154
|
+
}, _ = {
|
|
155
|
+
raw: (e) => u(e),
|
|
156
|
+
to_json: (e) => r(e),
|
|
157
|
+
json_encode: (e) => r(e),
|
|
153
158
|
object_as_json: (e) => typeof e == "object" && e ? JSON.stringify(e) : e,
|
|
154
159
|
default: (e, n) => t(e) ? n[0] : e,
|
|
155
160
|
upper: (e) => typeof e == "string" ? e.toUpperCase() : e,
|
|
@@ -164,21 +169,21 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
164
169
|
rtrim: (e) => typeof e == "string" ? e.trimEnd() : e,
|
|
165
170
|
pad: (e, t) => {
|
|
166
171
|
if (typeof e != "string") return e;
|
|
167
|
-
let n = Number(t[0]) || 0,
|
|
168
|
-
if (
|
|
172
|
+
let n = Number(t[0]) || 0, r = t.length > 1 ? i(t[1]) : " ";
|
|
173
|
+
if (r === "") return e;
|
|
169
174
|
let a = n - e.length;
|
|
170
175
|
if (a <= 0) return e;
|
|
171
|
-
let o = Math.ceil(a /
|
|
172
|
-
return
|
|
176
|
+
let o = Math.ceil(a / r.length);
|
|
177
|
+
return r.repeat(o).slice(0, a) + e;
|
|
173
178
|
},
|
|
174
179
|
padRight: (e, t) => {
|
|
175
180
|
if (typeof e != "string") return e;
|
|
176
|
-
let n = Number(t[0]) || 0,
|
|
177
|
-
if (
|
|
181
|
+
let n = Number(t[0]) || 0, r = t.length > 1 ? i(t[1]) : " ";
|
|
182
|
+
if (r === "") return e;
|
|
178
183
|
let a = n - e.length;
|
|
179
184
|
if (a <= 0) return e;
|
|
180
|
-
let o = Math.ceil(a /
|
|
181
|
-
return e +
|
|
185
|
+
let o = Math.ceil(a / r.length);
|
|
186
|
+
return e + r.repeat(o).slice(0, a);
|
|
182
187
|
},
|
|
183
188
|
number: (e, t) => {
|
|
184
189
|
if (typeof e == "number") {
|
|
@@ -189,31 +194,31 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
189
194
|
let n = e.match(/-?\d+(?:\.\d+)?/);
|
|
190
195
|
return n ? Number(n[0]) : 0;
|
|
191
196
|
},
|
|
192
|
-
replace: (e, t) => typeof e != "string" || t.length === 0 ? e : e.split(
|
|
197
|
+
replace: (e, t) => typeof e != "string" || t.length === 0 ? e : e.split(i(t[0])).join(i(t[1])),
|
|
193
198
|
slice: (e, t) => {
|
|
194
199
|
if (t.length === 0) return e;
|
|
195
200
|
let n = Number(t[0]) || 0, r = t.length > 1 && Number.isFinite(Number(t[1])) ? n + Number(t[1]) : void 0;
|
|
196
201
|
return typeof e == "string" || Array.isArray(e) ? e.slice(n, r) : e;
|
|
197
202
|
},
|
|
198
|
-
split: (e, t) => typeof e == "string" && t.length > 0 ? e.split(
|
|
199
|
-
join: (e, t) => Array.isArray(e) ? e.join(t.length === 0 ? "" :
|
|
203
|
+
split: (e, t) => typeof e == "string" && t.length > 0 ? e.split(i(t[0])) : e,
|
|
204
|
+
join: (e, t) => Array.isArray(e) ? e.join(t.length === 0 ? "" : i(t[0])) : e,
|
|
200
205
|
reverse: (e) => typeof e == "string" ? e.split("").reverse().join("") : Array.isArray(e) ? [...e].reverse() : e,
|
|
201
|
-
length: (e) => typeof e == "string" || Array.isArray(e) ? e.length : typeof e == "number" ?
|
|
206
|
+
length: (e) => typeof e == "string" || Array.isArray(e) ? e.length : typeof e == "number" ? i(e).length : typeof e == "object" && e ? Object.keys(e).length : 0,
|
|
202
207
|
first: (e) => typeof e == "string" ? e.length > 0 ? e[0] : "" : Array.isArray(e) ? e.length > 0 ? e[0] : void 0 : e,
|
|
203
208
|
last: (e) => typeof e == "string" ? e.length > 0 ? e[e.length - 1] : "" : Array.isArray(e) ? e.length > 0 ? e[e.length - 1] : void 0 : e,
|
|
204
209
|
contains: (e, t) => {
|
|
205
210
|
if (t.length === 0) return !1;
|
|
206
211
|
let n = t[0];
|
|
207
|
-
return typeof e == "string" ? e.includes(
|
|
212
|
+
return typeof e == "string" ? e.includes(i(n)) : Array.isArray(e) ? e.includes(n) : !1;
|
|
208
213
|
},
|
|
209
|
-
startswith: (e, t) => typeof e == "string" && t.length > 0 && e.startsWith(
|
|
210
|
-
endswith: (e, t) => typeof e == "string" && t.length > 0 && e.endsWith(
|
|
214
|
+
startswith: (e, t) => typeof e == "string" && t.length > 0 && e.startsWith(i(t[0])),
|
|
215
|
+
endswith: (e, t) => typeof e == "string" && t.length > 0 && e.endsWith(i(t[0])),
|
|
211
216
|
number_format: (e, t) => {
|
|
212
217
|
if (typeof e != "number") return e;
|
|
213
|
-
let n = Number(t[0]) || 0,
|
|
214
|
-
if (a === "") return o.replace(".",
|
|
218
|
+
let n = Number(t[0]) || 0, r = t[1] == null ? "." : i(t[1]), a = t[2] == null ? "" : i(t[2]), o = e.toFixed(n);
|
|
219
|
+
if (a === "") return o.replace(".", r);
|
|
215
220
|
let s = o.split(".");
|
|
216
|
-
return s[0] = s[0].replace(/\B(?=(\d{3})+(?!\d))/g, a), s.join(
|
|
221
|
+
return s[0] = s[0].replace(/\B(?=(\d{3})+(?!\d))/g, a), s.join(r);
|
|
217
222
|
},
|
|
218
223
|
sort: (t, r) => {
|
|
219
224
|
if (!Array.isArray(t)) return t;
|
|
@@ -260,10 +265,10 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
260
265
|
if (t.length === 0) return e.filter(Boolean);
|
|
261
266
|
let n = t[0];
|
|
262
267
|
if (typeof n == "function") return e.filter((e, t) => n(e, t));
|
|
263
|
-
let
|
|
268
|
+
let r = i(n);
|
|
264
269
|
return e.filter((e) => {
|
|
265
270
|
if (typeof e == "object" && e) {
|
|
266
|
-
let t = e[
|
|
271
|
+
let t = e[r];
|
|
267
272
|
return t != null && t !== !1 && t !== "";
|
|
268
273
|
}
|
|
269
274
|
return !!e;
|
|
@@ -271,14 +276,14 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
271
276
|
},
|
|
272
277
|
column: (e, t) => {
|
|
273
278
|
if (!Array.isArray(e) || t.length === 0) return e;
|
|
274
|
-
let n =
|
|
279
|
+
let n = i(t[0]);
|
|
275
280
|
return e.map((e) => typeof e == "object" && e ? e[n] : void 0);
|
|
276
281
|
},
|
|
277
|
-
url_encode: (e) => typeof e == "string" ? encodeURIComponent(e) : typeof e == "object" && e && !Array.isArray(e) ? new URLSearchParams(Object.fromEntries(Object.entries(e).map(([e, t]) => [e,
|
|
282
|
+
url_encode: (e) => typeof e == "string" ? encodeURIComponent(e) : typeof e == "object" && e && !Array.isArray(e) ? new URLSearchParams(Object.fromEntries(Object.entries(e).map(([e, t]) => [e, i(t)]))).toString() : e,
|
|
278
283
|
nl2br: (e) => typeof e == "string" ? e.replace(/\n/g, "<br>") : e,
|
|
279
284
|
striptags: (e, t) => {
|
|
280
285
|
if (typeof e != "string") return e;
|
|
281
|
-
let n = t.length > 0 ?
|
|
286
|
+
let n = t.length > 0 ? i(t[0]).trim() : "";
|
|
282
287
|
if (n) {
|
|
283
288
|
let t = n.split(/(?:\s*>\s*<\s*|<\s*|>\s*)/).filter(Boolean).map((e) => e.replace(/[/>]/g, "").trim());
|
|
284
289
|
if (t.length > 0) {
|
|
@@ -291,106 +296,124 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
291
296
|
abs: (e) => typeof e == "number" ? Math.abs(e) : e,
|
|
292
297
|
round: (e, t) => {
|
|
293
298
|
if (typeof e != "number") return e;
|
|
294
|
-
let n = Number(t[0]) || 0,
|
|
295
|
-
return
|
|
299
|
+
let n = Number(t[0]) || 0, r = t[1] == null ? "common" : i(t[1]), a = 10 ** n;
|
|
300
|
+
return r === "ceil" ? Math.ceil(e * a) / a : r === "floor" ? Math.floor(e * a) / a : Math.round(e * a) / a;
|
|
296
301
|
},
|
|
297
302
|
format: (e, t) => {
|
|
298
303
|
if (typeof e != "string") return e;
|
|
299
304
|
let n = 0;
|
|
300
|
-
return e.replace(/%
|
|
301
|
-
if (
|
|
302
|
-
let
|
|
303
|
-
|
|
305
|
+
return e.replace(/%((?:[-+ 0]|'.)*)(\d*)(?:\.(\d+))?([sdf%])/g, (e, r, a, o, s) => {
|
|
306
|
+
if (s === "%") return "%";
|
|
307
|
+
let c = t[n];
|
|
308
|
+
if (n++, c === void 0) return e;
|
|
309
|
+
let l = r.includes("+"), u;
|
|
310
|
+
if (s === "d") {
|
|
311
|
+
let e = Math.trunc(Number(c));
|
|
312
|
+
u = `${l && e >= 0 ? "+" : ""}${e}`;
|
|
313
|
+
} else if (s === "f") {
|
|
314
|
+
let e = Number(c);
|
|
315
|
+
u = `${l && e >= 0 ? "+" : ""}${o === void 0 ? String(e) : e.toFixed(Number(o))}`;
|
|
316
|
+
} else u = i(c), u = o === void 0 ? u : u.slice(0, Number(o));
|
|
317
|
+
let d = Number(a || 0);
|
|
318
|
+
if (u.length >= d) return u;
|
|
319
|
+
let f = /'(.)/.exec(r), p = f ? f[1] : r.includes("0") ? "0" : " ";
|
|
320
|
+
return r.includes("-") ? u.padEnd(d, p === "0" ? " " : p) : p === "0" && s !== "s" && /^[+-]/.test(u) ? u[0] + u.slice(1).padStart(d - 1, "0") : u.padStart(d, p);
|
|
304
321
|
});
|
|
305
322
|
},
|
|
306
323
|
spaceless: (e) => typeof e == "string" ? e.replace(/>\s+</g, "><").trim() : e,
|
|
307
324
|
random: (e) => Array.isArray(e) ? e.length > 0 ? e[Math.floor(Math.random() * e.length)] : void 0 : typeof e == "string" ? e.length > 0 ? e[Math.floor(Math.random() * e.length)] : "" : typeof e == "number" ? Math.floor(Math.random() * e) : e,
|
|
308
325
|
date: (e, t) => {
|
|
309
326
|
if (t.length === 0) return e;
|
|
310
|
-
let n =
|
|
311
|
-
if (Number.isNaN(
|
|
312
|
-
let a =
|
|
327
|
+
let n = i(t[0]), r = h(e);
|
|
328
|
+
if (Number.isNaN(r.getTime())) return "";
|
|
329
|
+
let a = g(r, t.length > 1 ? i(t[1]) : "");
|
|
313
330
|
if (!a) return "";
|
|
314
|
-
let o = (e) => String(e).padStart(2, "0"), s =
|
|
331
|
+
let o = (e) => String(e).padStart(2, "0"), s = [
|
|
332
|
+
"January",
|
|
333
|
+
"February",
|
|
334
|
+
"March",
|
|
335
|
+
"April",
|
|
336
|
+
"May",
|
|
337
|
+
"June",
|
|
338
|
+
"July",
|
|
339
|
+
"August",
|
|
340
|
+
"September",
|
|
341
|
+
"October",
|
|
342
|
+
"November",
|
|
343
|
+
"December"
|
|
344
|
+
], c = [
|
|
345
|
+
"Jan",
|
|
346
|
+
"Feb",
|
|
347
|
+
"Mar",
|
|
348
|
+
"Apr",
|
|
349
|
+
"May",
|
|
350
|
+
"Jun",
|
|
351
|
+
"Jul",
|
|
352
|
+
"Aug",
|
|
353
|
+
"Sep",
|
|
354
|
+
"Oct",
|
|
355
|
+
"Nov",
|
|
356
|
+
"Dec"
|
|
357
|
+
], l = [
|
|
358
|
+
"Sunday",
|
|
359
|
+
"Monday",
|
|
360
|
+
"Tuesday",
|
|
361
|
+
"Wednesday",
|
|
362
|
+
"Thursday",
|
|
363
|
+
"Friday",
|
|
364
|
+
"Saturday"
|
|
365
|
+
], u = {
|
|
315
366
|
Y: String(a.year),
|
|
367
|
+
y: o(a.year % 100),
|
|
316
368
|
m: o(a.month),
|
|
317
369
|
n: String(a.month),
|
|
318
370
|
d: o(a.day),
|
|
319
371
|
j: String(a.day),
|
|
320
372
|
H: o(a.hours),
|
|
321
373
|
G: String(a.hours),
|
|
374
|
+
h: o(a.hours % 12 || 12),
|
|
375
|
+
g: String(a.hours % 12 || 12),
|
|
376
|
+
A: a.hours < 12 ? "AM" : "PM",
|
|
377
|
+
a: a.hours < 12 ? "am" : "pm",
|
|
322
378
|
i: o(a.minutes),
|
|
323
379
|
s: o(a.seconds),
|
|
324
380
|
w: String(a.weekday),
|
|
325
381
|
N: String(a.weekday === 0 ? 7 : a.weekday),
|
|
326
|
-
U: String(Math.floor(
|
|
327
|
-
l: [
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
"Saturday"
|
|
335
|
-
][a.weekday],
|
|
336
|
-
F: [
|
|
337
|
-
"January",
|
|
338
|
-
"February",
|
|
339
|
-
"March",
|
|
340
|
-
"April",
|
|
341
|
-
"May",
|
|
342
|
-
"June",
|
|
343
|
-
"July",
|
|
344
|
-
"August",
|
|
345
|
-
"September",
|
|
346
|
-
"October",
|
|
347
|
-
"November",
|
|
348
|
-
"December"
|
|
349
|
-
][a.month - 1],
|
|
350
|
-
M: [
|
|
351
|
-
"Jan",
|
|
352
|
-
"Feb",
|
|
353
|
-
"Mar",
|
|
354
|
-
"Apr",
|
|
355
|
-
"May",
|
|
356
|
-
"Jun",
|
|
357
|
-
"Jul",
|
|
358
|
-
"Aug",
|
|
359
|
-
"Sep",
|
|
360
|
-
"Oct",
|
|
361
|
-
"Nov",
|
|
362
|
-
"Dec"
|
|
363
|
-
][a.month - 1]
|
|
364
|
-
}, c = "";
|
|
365
|
-
for (let e of n) c += Object.prototype.hasOwnProperty.call(s, e) ? s[e] : e;
|
|
366
|
-
return c;
|
|
382
|
+
U: String(Math.floor(r.getTime() / 1e3)),
|
|
383
|
+
l: l[a.weekday],
|
|
384
|
+
D: l[a.weekday].slice(0, 3),
|
|
385
|
+
F: s[a.month - 1],
|
|
386
|
+
M: c[a.month - 1]
|
|
387
|
+
}, d = "", f = !1;
|
|
388
|
+
for (let e of n) f ? (d += e, f = !1) : e === "\\" ? f = !0 : d += Object.prototype.hasOwnProperty.call(u, e) ? u[e] : e;
|
|
389
|
+
return d;
|
|
367
390
|
},
|
|
368
|
-
base64_encode: (e) => typeof e == "string" ?
|
|
369
|
-
base64_decode: (e) => typeof e == "string" ?
|
|
370
|
-
md5: (e) => typeof e == "string" ?
|
|
391
|
+
base64_encode: (e) => typeof e == "string" ? a(e) : e,
|
|
392
|
+
base64_decode: (e) => typeof e == "string" ? o(e) : e,
|
|
393
|
+
md5: (e) => typeof e == "string" ? s(e) : e,
|
|
371
394
|
without: (e, t) => {
|
|
372
395
|
if (typeof e != "object" || !e || Array.isArray(e)) return e;
|
|
373
|
-
let n = t.map(
|
|
374
|
-
for (let [t,
|
|
375
|
-
return
|
|
396
|
+
let n = t.map(i), r = {};
|
|
397
|
+
for (let [t, i] of Object.entries(e)) n.includes(t) || (r[t] = i);
|
|
398
|
+
return r;
|
|
376
399
|
},
|
|
377
400
|
only: (e, t) => {
|
|
378
401
|
if (typeof e != "object" || !e || Array.isArray(e)) return e;
|
|
379
|
-
let n = t.map(
|
|
380
|
-
for (let [t,
|
|
381
|
-
return
|
|
402
|
+
let n = t.map(i), r = {};
|
|
403
|
+
for (let [t, i] of Object.entries(e)) n.includes(t) && (r[t] = i);
|
|
404
|
+
return r;
|
|
382
405
|
},
|
|
383
406
|
find: (e, t) => {
|
|
384
407
|
if (!Array.isArray(e) || t.length === 0) return;
|
|
385
408
|
let n = t[0];
|
|
386
409
|
if (typeof n == "function") return e.find((e, t) => n(e, t));
|
|
387
410
|
if (t.length < 2) return;
|
|
388
|
-
let
|
|
389
|
-
return e.find((e) => typeof e == "object" && e ? e[
|
|
411
|
+
let r = i(n), a = t[1];
|
|
412
|
+
return e.find((e) => typeof e == "object" && e ? e[r] === a : e === a);
|
|
390
413
|
},
|
|
391
414
|
pluck: (e, t) => {
|
|
392
415
|
if (!Array.isArray(e) || t.length === 0) return e;
|
|
393
|
-
let n =
|
|
416
|
+
let n = i(t[0]);
|
|
394
417
|
return e.map((e) => typeof e == "object" && e ? e[n] : void 0);
|
|
395
418
|
},
|
|
396
419
|
unique: (e) => Array.isArray(e) ? [...new Set(e)] : e,
|
|
@@ -406,22 +429,22 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
406
429
|
},
|
|
407
430
|
index_by: (e, t) => {
|
|
408
431
|
if (!Array.isArray(e) || t.length === 0) return e;
|
|
409
|
-
let n =
|
|
432
|
+
let n = i(t[0]), r = {};
|
|
410
433
|
for (let t of e) if (typeof t == "object" && t) {
|
|
411
434
|
let e = String(t[n] ?? "");
|
|
412
|
-
|
|
435
|
+
r[e] = t;
|
|
413
436
|
}
|
|
414
|
-
return
|
|
437
|
+
return r;
|
|
415
438
|
},
|
|
416
439
|
group_by: (e, t) => {
|
|
417
440
|
if (!Array.isArray(e) || t.length === 0) return e;
|
|
418
|
-
let n =
|
|
441
|
+
let n = i(t[0]), r = {};
|
|
419
442
|
for (let t of e) if (typeof t == "object" && t) {
|
|
420
443
|
let e = String(t[n] ?? "");
|
|
421
|
-
|
|
444
|
+
r[e] = r[e] ?? [], r[e].push(t);
|
|
422
445
|
}
|
|
423
|
-
return
|
|
446
|
+
return r;
|
|
424
447
|
}
|
|
425
448
|
};
|
|
426
449
|
//#endregion
|
|
427
|
-
export { e as ARROW_PARAMS,
|
|
450
|
+
export { e as ARROW_PARAMS, c as RAW_MARKER, _ as filters, l as isRawMarker, d as unwrapRaw, u as wrapRaw };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
export { processTwig } from './processTwig';
|
|
1
|
+
export { processTwig, processTwigParam, processTwigValue } from './processTwig';
|
|
2
|
+
export { MAX_PARAM_PASSES, resolveStepParam } from './processTwig/resolveStepParam';
|
|
3
|
+
export { hasTemplateSyntax } from './tokens/hasTemplateSyntax';
|
|
2
4
|
export { hasValidToken } from './tokens/hasValidToken';
|
|
3
|
-
export {
|
|
5
|
+
export { inspectTemplate } from './inspectTemplate';
|
|
6
|
+
export { templatePaths, templateRootNames } from './templateRoots';
|
|
4
7
|
export { filters } from './filters/filters';
|
|
5
8
|
export type { ASTNode, Expression } from './AST';
|
|
9
|
+
export type { TemplateInspection } from './inspectTemplate';
|
|
6
10
|
export type { TwigFilter } from './filters/filters';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { filters as e } from "./filters/filters.mjs";
|
|
2
|
-
import { processTwig as t } from "./processTwig/processTwig.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { processTwig as t, processTwigParam as n, processTwigValue as r } from "./processTwig/processTwig.mjs";
|
|
3
|
+
import { hasTemplateSyntax as i } from "./tokens/hasTemplateSyntax.mjs";
|
|
4
|
+
import { hasValidToken as a } from "./tokens/hasValidToken.mjs";
|
|
5
|
+
import { MAX_PARAM_PASSES as o, resolveStepParam as s } from "./processTwig/resolveStepParam.mjs";
|
|
6
|
+
import { inspectTemplate as c } from "./inspectTemplate.mjs";
|
|
7
|
+
import { templatePaths as l, templateRootNames as u } from "./templateRoots.mjs";
|
|
8
|
+
export { o as MAX_PARAM_PASSES, e as filters, i as hasTemplateSyntax, a as hasValidToken, c as inspectTemplate, t as processTwig, n as processTwigParam, r as processTwigValue, s as resolveStepParam, l as templatePaths, u as templateRootNames };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type TemplateInspection = {
|
|
2
|
+
/**
|
|
3
|
+
* Everything the interpreter would read past rather than understand, in words: a character it skipped, an operator
|
|
4
|
+
* it does not implement, a filter or function it does not have, a tag it drops. Empty for a template that renders
|
|
5
|
+
* what it says.
|
|
6
|
+
*/
|
|
7
|
+
issues: string[];
|
|
8
|
+
/**
|
|
9
|
+
* The names the template reads from its context — the first segment of every path that is not bound by the
|
|
10
|
+
* template itself (a `set`, a `for` variable, an arrow's parameter). What a caller checks against what will be in
|
|
11
|
+
* scope when it renders.
|
|
12
|
+
*/
|
|
13
|
+
freeNames: string[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* What a template would do that its author did not write — read at author time, with the parser the runtime uses.
|
|
17
|
+
*
|
|
18
|
+
* The interpreter is forgiving on purpose: a page renders what it can rather than throwing. That same forgiveness is
|
|
19
|
+
* what turns a typo into a plausible wrong value — `s starts with 'x'` evaluated to `s` before the test existed, and a
|
|
20
|
+
* value in a condition is true. Anything that authors templates (the authoring surface, the builder) asks this first
|
|
21
|
+
* and refuses what it reports.
|
|
22
|
+
*/
|
|
23
|
+
export declare const inspectTemplate: (template: string) => TemplateInspection;
|