tess_edit 0.5.12 → 0.5.14

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fbe80bedc7281410bc4d08388da4901f5371c3282edc67ef41c8fe1efd4f858
4
- data.tar.gz: 461eed20d4d3a0e860bdcf750162c08b0f31335e35e8d95b7d8554b656d69f6b
3
+ metadata.gz: 97bb49e864a1f6b6a2160a031885aa9243b3777539ebc2ee8539514790607a5e
4
+ data.tar.gz: db45bf62fb64f47d1ad1232fa0b92c524946d2f286112749a09495965a49381a
5
5
  SHA512:
6
- metadata.gz: e355ee3b554123245f5a8cf76ece3a6514e1376b8bc67c9d686143fcc929b2d19e7b8e9b85d98800cda6d321e5f33ed035ee894519122a328b5836fecc9456c7
7
- data.tar.gz: 0fbda871f654a364738555b7655166966f79d85dc0e88ed474cd3a49b459a72f2f4425f93346a4cb6ca0e4e6c4ea6d5f4cd598f91a53b908bd8b791eb29c5407
6
+ metadata.gz: daedafe40b1d4e09904ac960a3a62305fc6155606ba487483137a70ff0ee37e53d9085f0ce04f28f587951d28e0a43c9e61edd4ec70a64513f8fa093bfb86171
7
+ data.tar.gz: 3575c9541577ec1915579308e6a46e85ae6d5935130dc6bc53b9c6a0651cb022ae0016c8929ab7778b7f34e5b572d4e75f150c8e700aa6a45a10beb394460a2e
data/README.md CHANGED
@@ -18,7 +18,7 @@ It completes Liquid tags and variables as you type, making it easier to work wit
18
18
  - **Tables**: Table, Row and Cell blocks, a cell holding any blocks, with Loops and Conditions (and Assigns) between the rows. On the canvas a cell's menu adds and deletes rows and columns and puts its row in a Loop or Condition, a column's border is dragged to set its width, Tab goes from cell to cell (adding a row after the last), and a bracket by a Loop's or Condition's rows shows what they are.
19
19
  - Drag from the Blocks panel onto the canvas or into the Layers tree; move blocks on the canvas (drag handle) or in the tree; plus buttons and empty-column placeholders open an "Add block" menu.
20
20
  - Rich text editing on the canvas with [Tiptap](https://tiptap.dev): bold, italic, underline, strikethrough, colour, links (Liquid allowed in the URL), alignment, lists and headings. A block can have several texts edited on the canvas, rich or a plain line, such as a question's label and its description.
21
- - Your app's Liquid variables suggested while typing `{{`, in text and in settings, and browsable from `{ }` buttons, including those of the Loop blocks around a block and the Assigns before it; after a `|` your app's filters, with a where's property and the values it can have, and after `==` the values of what's compared.
21
+ - Your app's Liquid variables suggested while typing `{{`, in text and in settings, and browsable from `{ }` buttons, including those of the Loop blocks around a block and the Assigns before it; after a `|` your app's filters, with a where's property and the values it can have, after `==` the values of what's compared, after `{%` the tags, a block with its end tag, and in conditions the operators.
22
22
  - Your app's translations for Liquid's `t` filter (`{{ '.greeting' | t }}`) shown as their text in a language of your choice, with every language's text, missing ones marked, editable when pointed at, and selected text made translatable.
23
23
  - Your app's values for the Liquid in a document (`{{ customer.first_name }}` as "Ada"), shown in its place until the caret goes into it.
24
24
  - Clicking a tile in the Blocks panel adds the block in or after the selection, or else at the end of the last block it fits in.
@@ -253,9 +253,11 @@ The endpoint answers `GET` with the variables at `path` (the roots without one),
253
253
 
254
254
  `children` says a variable has variables of its own, at the path with its name added; a `collection` is a list of them, and its path goes into its elements (`order.order_lines.product`). The editor offers a collection's `first`, `last` and `size`, and inside a Loop block (`{% for line in order.order_lines %}`) its variable, `line`, asking for `order.order_lines.…` for it. An unknown path answers 404. [Liquidum](https://github.com/entdec/liquidum)'s `/liquidum/variables` answers this way from your drops; the dummy app's `VariablesController` is a fixed example (`/?variables=1`).
255
255
 
256
- An Assign block before a block (in its container, or in one around it), and `{% assign %}` or an open `{% for %}` earlier in the same text, are variables there too. An Assign's variable is what its expression comes to: `{% assign lines = order.order_lines | where: "kind", "product" %}` is still order lines, through filters that keep a collection (`where`, `sort`, `reverse`, …), and `| first` makes it one of them, so `{% for line in lines %}` completes `line.` as a line.
256
+ An Assign block before a block (in its container, or in one around it), and `{% assign %}`, an ended `{% capture %}` (a text) or an open `{% for %}` earlier in the same text, are variables there too. An Assign's variable is what its expression comes to: `{% assign lines = order.order_lines | where: "kind", "product" %}` is still order lines, through filters that keep a collection (`where`, `sort`, `reverse`, …), and `| first` makes it one of them, so `{% for line in lines %}` completes `line.` as a line.
257
257
 
258
- A variable with `values` (`"values": [{"value": "shipping", "label": "Shipping"}]`) can only be those: after `line.kind == ` the editor suggests them, quoted.
258
+ A variable with `values` (`"values": [{"value": "shipping", "label": "Shipping"}]`) can only be those: after `line.kind == `, `!=`, `<>` or `contains`, and after `{% when ` in a `{% case line.kind %}`, the editor suggests them, quoted, with `blank` and `empty`. Inside a Loop, or an open `{% for %}`, `forloop` is a variable too, with its `index`, `first`, `last` and the rest.
259
+
260
+ In a condition (`{% if %}`, `{% unless %}`, `{% elsif %}`, a Condition block) a space after a variable or value suggests the operators: `==`, `!=`, `>`, `contains`, `and`, `or`, ….
259
261
 
260
262
  With `data-tess-edit-filters-url-value` the editor also completes filters: after a `|` the filters, each with its label, and choosing one writes `| where: `, going on with its arguments: a property of the collection's items (`"kind"`) and the values it can have (`"shipping"`). The endpoint answers `GET` with:
261
263
 
@@ -263,11 +265,19 @@ With `data-tess-edit-filters-url-value` the editor also completes filters: after
263
265
  {"filters": [{"name": "where", "label": "Those whose property has the value", "arguments": [{"name": "property", "kind": "property"}, {"name": "value", "kind": "value"}], "keeps": "collection"}]}
264
266
  ```
265
267
 
266
- An argument's `kind` is `property`, `value` (one the property before it can have) or anything else, where the editor suggests variables. `keeps` says what a filter on a collection leaves: the same items (`"collection"`) or one of them (`"item"`); without the endpoint Liquid's own are known. Liquidum's `/liquidum/filters` answers this way, with your app's filters as well; the dummy app's `VariablesController#filters` is an example.
268
+ An argument's `kind` is `property`, `value` (one the property before it can have), `format` (a date's: the editor suggests strftime formats, the host's `values` first, as Liquidum gives your app's `date.formats` and `time.formats`, then common ones, each with today in it, in the language a `locale` argument before it names) or anything else, where the editor suggests variables; an argument with `values` (`[{"value": "nl", "label": "nl"}]`, as Liquidum gives `localize`'s locales) gets those, quoted. `keeps` says what a filter on a collection leaves: the same items (`"collection"`) or one of them (`"item"`); without the endpoint Liquid's own are known. Liquidum's `/liquidum/filters` answers this way, with your app's filters as well; the dummy app's `VariablesController#filters` is an example.
269
+
270
+ With `data-tess-edit-tags-url-value` the editor completes tags after `{%`: first what goes in the block it's in (`elsif`, `else`, `when`, `endif`), then the tags, each with its label. Choosing a block writes its end tag too, with the caret where its arguments go: `{% if | %}{% endif %}`. The endpoint answers `GET` with:
271
+
272
+ ```json
273
+ {"tags": [{"name": "if", "label": "Only when a condition holds", "syntax": "if condition", "block": true}]}
274
+ ```
275
+
276
+ A tag whose `syntax` is more than its name takes arguments. Liquidum's `/liquidum/tags` answers this way, with your app's tags as well; the dummy app's `VariablesController#tags` is an example.
267
277
 
268
278
  The endpoint can change while the editor is open, say when the record a template is for changes: set `data-tess-edit-variables-url-value` again and the editor asks the new one.
269
279
 
270
- A field of your own gets the `{ }` button with `liquid: true`, or `liquid: "expression"` (a condition) or `liquid: "collection"` (what a loop goes over) for Liquid without braces.
280
+ A field of your own gets the `{ }` button with `liquid: true`, or `liquid: "expression"` (an Assign's value), `liquid: "condition"` (with its operators) or `liquid: "collection"` (what a loop goes over) for Liquid without braces.
271
281
 
272
282
  ### Translations
273
283
 
@@ -9,7 +9,7 @@ export default {
9
9
  roles: ["body", "content", "row"],
10
10
  accepts: "inherit",
11
11
  defaults: () => ({ data: { expression: "customer.vip" } }),
12
- fields: [{ title: "Condition", fields: [{ key: "data.expression", label: "Show when", type: "text", liquid: "expression", hint: "A Liquid condition, e.g. order.total > 100." }] }],
12
+ fields: [{ title: "Condition", fields: [{ key: "data.expression", label: "Show when", type: "text", liquid: "condition", hint: "A Liquid condition, e.g. order.total > 100." }] }],
13
13
  hint: "Shows its blocks only when the condition is true: {% if expression %}.",
14
14
  label: (node) => `If ${node.data.expression || "…"}`,
15
15
  render: {
@@ -25,6 +25,8 @@
25
25
  // e.g. when the class a template is for changes
26
26
  // filtersUrl the filters a template can use, suggested after a | with their
27
27
  // arguments (see core/variables.js), e.g. Liquidum's /liquidum/filters
28
+ // tagsUrl the tags, suggested after {% (a block with its end tag), e.g.
29
+ // Liquidum's /liquidum/tags
28
30
  // translationsUrl the host's translations for Liquid's t filter ({{ '.greeting' | t }}),
29
31
  // shown in a language chosen in the top bar, listed and edited
30
32
  // while pointed at, and made from selected text (see
@@ -96,7 +98,7 @@ function placed(node, at) {
96
98
  }
97
99
 
98
100
  export default class extends Controller {
99
- static values = { kit: { type: String, default: DEFAULT_KIT }, document: String, sample: { type: Boolean, default: true }, frame: { type: Boolean, default: true }, panels: { type: String, default: "split" }, compileUrl: { type: String, default: COMPILE_URL }, mediaUrl: String, variablesUrl: String, filtersUrl: String, translationsUrl: String, values: String, lock: String, blocks: String, options: String }
101
+ static values = { kit: { type: String, default: DEFAULT_KIT }, document: String, sample: { type: Boolean, default: true }, frame: { type: Boolean, default: true }, panels: { type: String, default: "split" }, compileUrl: { type: String, default: COMPILE_URL }, mediaUrl: String, variablesUrl: String, filtersUrl: String, tagsUrl: String, translationsUrl: String, values: String, lock: String, blocks: String, options: String }
100
102
  static targets = ["jsonInput", "mjmlInput", "htmlInput", "slot", "translations"]
101
103
 
102
104
  connect() {
@@ -126,7 +128,7 @@ export default class extends Controller {
126
128
  this.sheetOpen = false
127
129
  this.requests = {}
128
130
  this.media = { enabled: Boolean(this.mediaUrlValue), images: [], uploading: false, error: null }
129
- this.variables = new Variables(this.variablesUrlValue, { filtersUrl: this.filtersUrlValue })
131
+ this.variables = new Variables(this.variablesUrlValue, { filtersUrl: this.filtersUrlValue, tagsUrl: this.tagsUrlValue })
130
132
  this.translations = new Translations(this.translationsUrlValue)
131
133
  this.translationPopover = this.translations.enabled ? new TranslationPopover(this) : null
132
134
  this.values = new Values()
@@ -166,7 +168,7 @@ export default class extends Controller {
166
168
  // Points the editor at other variables (variablesUrl), once it's connected
167
169
  variablesUrlValueChanged() {
168
170
  if (!this.variables) return
169
- this.variables = new Variables(this.variablesUrlValue, { filtersUrl: this.filtersUrlValue })
171
+ this.variables = new Variables(this.variablesUrlValue, { filtersUrl: this.filtersUrlValue, tagsUrl: this.tagsUrlValue })
170
172
  if (!this.variableMenu && this.variables.enabled) {
171
173
  this.variableMenu = new VariableMenu(this)
172
174
  this.textEditing.menu = this.variableMenu
@@ -7,11 +7,16 @@
7
7
  // "{{ lines | where: \"pa" → { kind: "argument", filter: "where", index: 0, partial: "pa", quote: "\"" }
8
8
  // "{{ lines | where: \"party\", " → { kind: "argument", filter: "where", index: 1, partial: "", args: ["party"] }
9
9
  // "{% if line.party == \"sp" → { kind: "value", of: "line.party", partial: "sp", quote: "\"" }
10
+ // "{% el" → { kind: "tag", partial: "el", open: ["if"] }
11
+ // "{% if line.party " → { kind: "operator", partial: "" }
10
12
  //
11
13
  // each with `start`, where what it replaces starts in the text, and `tag`
12
14
  // ("{{", "{%" or null). In "output" mode (Liquid in text) only inside {{ … }}
13
- // or {% … %}; in "expression" mode (a Loop's collection, a Condition, an
14
- // Assign's value) anywhere. The editor's menu (ui/variable_menu.js) asks the
15
+ // or {% … %}; in "expression" mode (a Loop's collection, an Assign's value)
16
+ // anywhere, and in "condition" mode (a Condition) too, with its operators as
17
+ // in {% if %}. A tag's `open` are the blocks open before it, innermost last,
18
+ // for what can go inside them (elsif, when, endfor); `blocks` says which tags
19
+ // are blocks besides Liquid's. The editor's menu (ui/variable_menu.js) asks the
15
20
  // host for what fits: its variables, its filters and their arguments, the
16
21
  // values a variable can have (core/variables.js).
17
22
  //
@@ -24,6 +29,27 @@ import { find } from "tess_edit/core/document"
24
29
 
25
30
  const PATH = /[A-Za-z_][\w]*(?:\.[\w]*)*/
26
31
  const NAME = /^\w+$/
32
+ // Liquid's tags that are blocks, with an end tag
33
+ export const BLOCKS = ["capture", "case", "comment", "for", "if", "ifchanged", "raw", "tablerow", "unless"]
34
+ // Words in conditions that aren't variables
35
+ const KEYWORDS = new Set(["if", "unless", "elsif", "when", "and", "or", "contains", "in", "blank", "empty", "nil", "null", "true", "false"])
36
+ // An operand in a condition: a variable, a quoted text or a number
37
+ const OPERAND = new RegExp(`(?:${PATH.source}|"[^"]*"|'[^']*'|-?\\d+(?:\\.\\d+)?)`)
38
+
39
+ // The block tags open at the end of a text, outermost first, each { name, expression }
40
+ export function openBlocks(text, blocks = BLOCKS) {
41
+ const open = []
42
+ for (const match of text.matchAll(/\{%-?\s*(\w+)([\s\S]*?)-?%\}/g)) {
43
+ const name = match[1]
44
+ if (name.startsWith("end")) {
45
+ const at = open.map((block) => block.name).lastIndexOf(name.slice(3))
46
+ if (at >= 0) open.splice(at)
47
+ } else if (blocks.includes(name)) {
48
+ open.push({ name, expression: match[2].trim() })
49
+ }
50
+ }
51
+ return open
52
+ }
27
53
 
28
54
  // The parts of a Liquid expression outside quotes, split at `separator`
29
55
  // (| between filters, , between arguments)
@@ -70,20 +96,37 @@ export function unquote(text) {
70
96
  return match ? match[2] : trimmed
71
97
  }
72
98
 
73
- export function liquidContext(before, mode = "output") {
99
+ export function liquidContext(before, mode = "output", { blocks = BLOCKS } = {}) {
74
100
  let expression = before
75
101
  let tag = null
102
+ let opened = 0
76
103
  if (mode === "output") {
77
104
  const output = before.lastIndexOf("{{")
78
105
  const open = Math.max(output, before.lastIndexOf("{%"))
79
106
  if (open < 0 || Math.max(before.lastIndexOf("}}"), before.lastIndexOf("%}")) > open) return null
80
107
  tag = open === output ? "{{" : "{%"
108
+ opened = open
81
109
  expression = before.slice(open + 2).replace(/^-/, "")
82
110
  }
83
111
  const offset = before.length - expression.length
84
112
  const quoted = openQuote(expression)
85
113
  const head = quoted ? expression.slice(0, quoted.at) : expression
86
114
 
115
+ // A tag's name: {% el
116
+ const named = tag === "{%" && !quoted && expression.match(/^\s*(\w*)$/)
117
+ if (named) return { kind: "tag", start: before.length - named[1].length, partial: named[1], open: openBlocks(before.slice(0, opened), blocks).map((block) => block.name), tag }
118
+
119
+ // A case's values: {% when "a", "b
120
+ const when = tag === "{%" && head.match(/^\s*when\s+((?:(?:"[^"]*"|'[^']*'|[\w.]+)\s*(?:,|\bor\b)\s*)*)$/)
121
+ if (when) {
122
+ const kase = openBlocks(before.slice(0, opened), blocks).filter((block) => block.name === "case").at(-1)
123
+ const of = kase?.expression.match(new RegExp(`^${PATH.source}`))?.[0]
124
+ if (!of) return null
125
+ const partial = quoted ? expression.slice(quoted.at + 1) : ""
126
+ if (!quoted && !/(?:\s|,)$/.test(expression)) return null
127
+ return { kind: "value", of, start: quoted ? offset + quoted.at : before.length, partial, quote: quoted?.quote || null, tag }
128
+ }
129
+
87
130
  // In a filter's arguments: | name: a, b, …
88
131
  const filters = splitOutside(head, "|")
89
132
  if (filters.length > 1) {
@@ -112,13 +155,21 @@ export function liquidContext(before, mode = "output") {
112
155
  }
113
156
 
114
157
  // A value compared with a variable: line.party == "sp
115
- const compared = head.match(new RegExp(`(${PATH.source})\\s*(?:==|!=)\\s*$`))
116
- if (compared && (quoted || /(?:==|!=)\s*$/.test(expression))) {
117
- const partial = quoted ? expression.slice(quoted.at + 1) : ""
118
- return { kind: "value", of: compared[1], start: quoted ? offset + quoted.at : before.length, partial, quote: quoted?.quote || null, tag }
158
+ // (unquoted, a word: blank, empty, or a variable's name)
159
+ const compared = quoted
160
+ ? head.match(new RegExp(`(${PATH.source})\\s*(?:==|!=|<>|\\bcontains\\b)\\s*$`))
161
+ : expression.match(new RegExp(`(${PATH.source})\\s*(?:==|!=|<>|\\bcontains)\\s*(\\w*)$`))
162
+ if (compared && !KEYWORDS.has(compared[1])) {
163
+ const partial = quoted ? expression.slice(quoted.at + 1) : compared[2]
164
+ return { kind: "value", of: compared[1], start: quoted ? offset + quoted.at : before.length - partial.length, partial, quote: quoted?.quote || null, tag }
119
165
  }
120
166
  if (quoted) return null
121
167
 
168
+ // An operator after an operand in a condition: {% if line.party co
169
+ const condition = mode === "condition" || (tag === "{%" && /^\s*(?:if|unless|elsif)\b/.test(expression))
170
+ const operator = condition && expression.match(new RegExp(`(?:^|\\s)(${OPERAND.source})\\s+([=!<>]*|[a-z]*)$`))
171
+ if (operator && !KEYWORDS.has(operator[1])) return { kind: "operator", start: before.length - operator[2].length, partial: operator[2], tag }
172
+
122
173
  const match = expression.match(new RegExp(`(?:^|[^\\w.])(${PATH.source})?$`))
123
174
  if (!match) return null
124
175
  const path = match[1] || ""
@@ -159,19 +210,24 @@ export function liquidScope(doc, id) {
159
210
  return scope
160
211
  }
161
212
 
162
- // The assigns ({% assign x = … %}) and loops ({% for x in … %}) earlier in a
163
- // text, before the caret, nearest first, as liquidScope gives them
213
+ // The assigns ({% assign x = … %}), captures ({% capture x %}…{% endcapture %},
214
+ // once ended) and loops ({% for x in … %}, while open) earlier in a text,
215
+ // before the caret, nearest first, as liquidScope gives them
216
+ // [{ variable, captured: true }] a capture's: a text
164
217
  export function textScope(before) {
165
- const scope = []
218
+ const found = []
166
219
  for (const match of before.matchAll(/\{%-?\s*(assign|for)\s+(\w+)\s*(=|in)\s*([\s\S]*?)\s*-?%\}/g)) {
167
- if (match[1] === "assign" && match[3] === "=") scope.unshift({ variable: match[2], expression: match[4] })
220
+ if (match[1] === "assign" && match[3] === "=") found.push([match.index, { variable: match[2], expression: match[4] }])
168
221
  if (match[1] === "for" && match[3] === "in") {
169
222
  // Only while the loop is open
170
223
  const after = before.slice(match.index + match[0].length)
171
- if (!/\{%-?\s*endfor\b/.test(after)) scope.unshift({ variable: match[2], collection: match[4].split(/\s/)[0] })
224
+ if (!/\{%-?\s*endfor\b/.test(after)) found.push([match.index, { variable: match[2], collection: match[4].split(/\s/)[0] }])
172
225
  }
173
226
  }
174
- return scope
227
+ for (const match of before.matchAll(/\{%-?\s*capture\s+(["']?)(\w+)\1\s*-?%\}[\s\S]*?\{%-?\s*endcapture\s*-?%\}/g)) {
228
+ found.push([match.index, { variable: match[2], captured: true }])
229
+ }
230
+ return found.sort((a, b) => b[0] - a[0]).map(([, entry]) => entry)
175
231
  }
176
232
 
177
233
  // What replaces a quoted argument or value, in the quote it was started
@@ -22,6 +22,11 @@
22
22
  //
23
23
  // as Liquidum's FiltersController answers. A variable with `values`
24
24
  // ([{ value, label }]) has those only, for a comparison or a where filter.
25
+ // The tags, for what follows {%, from its tagsUrl:
26
+ //
27
+ // GET → { tags: [{ name, label, syntax, block }] }
28
+ //
29
+ // as Liquidum's TagsController answers. Inside a Loop there's `forloop` too.
25
30
 
26
31
  import { ancestors } from "tess_edit/core/document"
27
32
  import { t } from "tess_edit/core/i18n"
@@ -34,6 +39,17 @@ export const KEEPS = {
34
39
  first: "item", last: "item", find: "item"
35
40
  }
36
41
 
42
+ // What Liquid's forloop has, inside a loop
43
+ export const FORLOOP_MEMBERS = [
44
+ { name: "index", label: "Its number, from 1", type: "integer", children: false },
45
+ { name: "index0", label: "Its number, from 0", type: "integer", children: false },
46
+ { name: "rindex", label: "Its number from the end, to 1", type: "integer", children: false },
47
+ { name: "rindex0", label: "Its number from the end, to 0", type: "integer", children: false },
48
+ { name: "first", label: "Whether it's the first", type: "boolean", children: false },
49
+ { name: "last", label: "Whether it's the last", type: "boolean", children: false },
50
+ { name: "length", label: "Number of items", type: "integer", children: false }
51
+ ]
52
+
37
53
  // The members Liquid gives every collection
38
54
  export const COLLECTION_MEMBERS = [
39
55
  { name: "first", label: "First", type: "object", children: true },
@@ -44,9 +60,10 @@ export const COLLECTION_MEMBERS = [
44
60
  const ELEMENT = new Set(["first", "last"])
45
61
 
46
62
  export class Variables {
47
- constructor(url, { fetch: fetcher = (...args) => fetch(...args), filtersUrl = null } = {}) {
63
+ constructor(url, { fetch: fetcher = (...args) => fetch(...args), filtersUrl = null, tagsUrl = null } = {}) {
48
64
  this.url = url
49
65
  this.filtersUrl = filtersUrl
66
+ this.tagsUrl = tagsUrl
50
67
  this.fetch = fetcher
51
68
  this.levels = new Map()
52
69
  }
@@ -59,6 +76,14 @@ export class Variables {
59
76
  return this.filterList
60
77
  }
61
78
 
79
+ // The host's tags, by name, cached; none without its tagsUrl
80
+ tags() {
81
+ if (!this.tagsUrl) return Promise.resolve(new Map())
82
+ this.tagList ||= this.get(this.tagsUrl, {}).then((body) => new Map((body.tags || []).map((tag) => [tag.name, tag])))
83
+ this.tagList.catch(() => (this.tagList = null))
84
+ return this.tagList
85
+ }
86
+
62
87
  async get(path, params) {
63
88
  const url = new URL(path, window.location.href)
64
89
  for (const [key, value] of Object.entries(params)) url.searchParams.set(key, value)
@@ -123,13 +148,16 @@ export class Variables {
123
148
  if (own.some((variable) => variable.name === entry.variable)) continue
124
149
  // What it stands for, of the scope around it
125
150
  const target = entry.path && (await this.variable(entry.path.split("."), scope.slice(index + 1)))
126
- own.push(entry.path ? { ...(target || { children: false }), name: entry.variable, label: t("Assigned %{path}", { path: entry.path }), assign: true } : loopVariable(entry))
151
+ if (entry.captured) own.push(capturedVariable(entry))
152
+ else own.push(entry.path ? { ...(target || { children: false }), name: entry.variable, label: t("Assigned %{path}", { path: entry.path }), assign: true } : loopVariable(entry))
127
153
  }
154
+ if (scope.some((entry) => entry.collection)) own.push(FORLOOP)
128
155
  return [...own, ...(await this.at(""))]
129
156
  }
130
157
 
131
158
  const variable = await this.variable(names, scope)
132
159
  if (!variable?.children) return []
160
+ if (variable.forloop) return FORLOOP_MEMBERS
133
161
  if (variable.collection) return COLLECTION_MEMBERS
134
162
  return this.at(resolve(names, scope))
135
163
  }
@@ -146,7 +174,9 @@ export class Variables {
146
174
  const parent = names.slice(0, -1)
147
175
  if (!parent.length) {
148
176
  const own = scope.find((entry) => entry.variable === last)
177
+ if (last === "forloop" && !own && scope.some((entry) => entry.collection)) return FORLOOP
149
178
  if (own?.path) return { ...(await this.variable(own.path.split("."), scope.slice(scope.indexOf(own) + 1))), name: last }
179
+ if (own?.captured) return capturedVariable(own)
150
180
  if (own) return loopVariable(own)
151
181
  } else if (ELEMENT.has(last)) {
152
182
  const collection = await this.variable(parent, scope)
@@ -157,6 +187,13 @@ export class Variables {
157
187
  }
158
188
  }
159
189
 
190
+ const FORLOOP = { name: "forloop", label: "This loop", type: "object", children: true, forloop: true }
191
+
192
+ // A {% capture %}'s variable: the text between it and its endcapture
193
+ function capturedVariable({ variable }) {
194
+ return { name: variable, label: t("Captured text"), type: "string", children: false, captured: true }
195
+ }
196
+
160
197
  function loopVariable({ variable, collection }) {
161
198
  return { name: variable, label: t("Each of %{collection}", { collection }), type: "object", children: true, loop: true }
162
199
  }
@@ -342,12 +342,13 @@ export class Inspector {
342
342
 
343
343
  // Suggests the host's Liquid variables (editor.variables) while typing {{ in
344
344
  // a text field. A field's `liquid` also gives it a { } button to browse
345
- // them: true for Liquid in text, "expression" for a condition, "collection"
345
+ // them: true for Liquid in text, "expression" for an expression (an
346
+ // Assign's), "condition" for a condition, with its operators, "collection"
346
347
  // for what a Loop goes over.
347
348
  variables(input, node, field) {
348
349
  this.inputs.set(field.key, input)
349
350
  if (!this.editor.variableMenu) return input
350
- const mode = field.liquid === "expression" || field.liquid === "collection" ? field.liquid : "output"
351
+ const mode = ["expression", "condition", "collection"].includes(field.liquid) ? field.liquid : "output"
351
352
  const adapter = inputAdapter(input, { mode, scope: liquidScope(this.editor.doc, node.id) })
352
353
  suggestIn(this.editor.variableMenu, input, adapter)
353
354
  this.adapters.set(field.key, adapter)
@@ -269,9 +269,11 @@ function tiptapAdapter(editor, scope) {
269
269
  const $to = editor.state.selection.$to
270
270
  return text($to, $to.parentOffset, $to.parent.content.size)
271
271
  },
272
- replace(start, end, value) {
272
+ // `caret`: where in `value` the caret goes, else after it
273
+ replace(start, end, value, { caret = null } = {}) {
273
274
  const base = editor.state.selection.$from.start()
274
275
  dispatch(base + start, base + end, value)
276
+ if (caret !== null) editor.commands.setTextSelection(base + start + caret)
275
277
  },
276
278
  insert(value) {
277
279
  const { from, to } = editor.state.selection
@@ -4,20 +4,25 @@
4
4
  //
5
5
  // before() the text before the caret (in the line or paragraph)
6
6
  // after() the text after it
7
- // replace(start, end, text) replaces part of before() + after(), by offsets in it
7
+ // replace(start, end, text, { caret }) replaces part of before() + after(), by
8
+ // offsets in it, the caret after it or at `caret` in it
8
9
  // rect() where to show the menu, in the page's viewport
9
- // mode "output" (Liquid in text: {{ … }}), "expression" (a
10
- // Condition) or "collection" (a Loop's collection)
10
+ // mode "output" (Liquid in text: {{ … }}), "expression" (an
11
+ // Assign's value), "condition" (a Condition, with its
12
+ // operators) or "collection" (a Loop's collection)
11
13
  // scope the loop variables there (core/variables.js loopScope)
12
14
  //
13
15
  // See inputAdapter below and TextEditing for Tiptap's. With the host's
14
16
  // translations it also suggests their keys while typing {{ '. What it
15
17
  // suggests depends on what's being written (core/liquid.js liquidContext): a
16
18
  // variable; after a |, the host's filters; a filter's argument, a property of
17
- // the collection's items ("party") or a value it can have ("sponsor"); and
18
- // after == or !=, the values of the variable compared.
19
+ // the collection's items ("party") or a value it can have ("sponsor"); after
20
+ // == or !=, the values of the variable compared, and blank and empty; after
21
+ // {%, the tags (a block written with its end tag), and those that go in the
22
+ // blocks open there (elsif, when, endfor); in a condition, its operators; and
23
+ // a date's formats, each shown with today's date in it.
19
24
 
20
- import { expressionParts, liquidContext, quoted, textScope } from "tess_edit/core/liquid"
25
+ import { BLOCKS, expressionParts, liquidContext, quoted, textScope } from "tess_edit/core/liquid"
21
26
  import { keyCompletion, keyToken } from "tess_edit/core/translations"
22
27
  import { completion } from "tess_edit/core/variables"
23
28
  import { t } from "tess_edit/core/i18n"
@@ -52,7 +57,10 @@ export class VariableMenu {
52
57
  const key = this.editor.translations?.enabled && adapter.mode === "output" && keyToken(before)
53
58
  if (key) return this.suggestKeys(adapter, key)
54
59
  if (!this.editor.variables?.enabled) return this.close()
55
- const context = liquidContext(before, adapter.mode === "output" ? "output" : "expression")
60
+ const mode = adapter.mode === "output" || adapter.mode === "condition" ? adapter.mode : "expression"
61
+ const hostTags = adapter.mode === "output" && before.includes("{%") ? await this.editor.variables.tags().catch(() => new Map()) : new Map()
62
+ const blocks = [...BLOCKS, ...[...hostTags.values()].filter((tag) => tag.block).map((tag) => tag.name)]
63
+ const context = liquidContext(before, mode, { blocks })
56
64
  if (!context) return this.close()
57
65
  const scope = [...textScope(before), ...(adapter.scope || [])]
58
66
  const request = ++this.request
@@ -88,8 +96,23 @@ export class VariableMenu {
88
96
  }
89
97
  if (context.kind === "argument") {
90
98
  const filter = (await variables.filters()).get(context.filter)
91
- const kind = filter?.arguments?.[context.index]?.kind
99
+ const argument = filter?.arguments?.[context.index]
100
+ const kind = argument?.kind
92
101
  const more = filter?.arguments?.length > context.index + 1
102
+ if (kind === "format") {
103
+ // In the locale an argument before it names: localize: 'nl', '%B'
104
+ const locale = filter.arguments.slice(0, context.index).map((before, index) => before.kind === "locale" && context.args[index]).find((value) => /^[a-z]{2}(?:-[A-Za-z]{2})?$/.test(value || ""))
105
+ const example = (format) => strftime(new Date(), format, locale || undefined)
106
+ // The host's own formats first (date.formats, time.formats), then the common ones
107
+ const own = (argument.values || []).map((format) => ({ value: format.value, label: `${format.label} · ${example(format.value)}` }))
108
+ const common = DATE_FORMATS.filter((format) => !own.some((mine) => mine.value === format)).map((format) => ({ value: format, label: example(format) }))
109
+ const formats = [...own, ...common]
110
+ return this.quotedOptions({ ...context, quote: context.quote || "'" }, formats, more)
111
+ }
112
+ // Those the host gives, such as its locales
113
+ if (argument?.values && !(context.partial && !context.quote && context.partial.includes("."))) {
114
+ return this.quotedOptions({ ...context, quote: context.quote || "'" }, argument.values, more)
115
+ }
93
116
  if (kind === "property" || kind === "value") {
94
117
  const elements = await this.elements(context.input, scope)
95
118
  if (!elements) return null
@@ -102,11 +125,54 @@ export class VariableMenu {
102
125
  }
103
126
  if (context.kind === "value") {
104
127
  const variable = await variables.lookup(context.of, scope)
105
- return this.quotedOptions(context, variable?.values || [], false)
128
+ const values = this.quotedOptions(context, variable?.values || [], false, context.quote ? [] : LITERALS)
129
+ // Unquoted, it may be another variable: line.total > order.minimum
130
+ return values || context.quote || !context.partial ? values : this.variableOptions(context, context.partial, scope)
131
+ }
132
+ if (context.kind === "tag") return this.tagOptions(context, await variables.tags())
133
+ if (context.kind === "operator") {
134
+ const items = ranked(OPERATORS.map(([name, label]) => ({ name, label })), context.partial)
135
+ if (items.length === 1 && items[0].name === context.partial) return null
136
+ return {
137
+ items,
138
+ choose: async (item) => {
139
+ const adapter = this.state.adapter
140
+ adapter.replace(context.start, adapter.before().length, `${item.name} `)
141
+ await this.suggest(adapter)
142
+ }
143
+ }
106
144
  }
107
145
  return null
108
146
  }
109
147
 
148
+ // After {%: what goes in the innermost open block (elsif, else, its end),
149
+ // then the tags. A block is written with its end tag, the caret where its
150
+ // arguments go; one closed already (%} after the caret) only gets its name.
151
+ tagOptions(context, tags) {
152
+ const inner = context.open.at(-1)
153
+ const inside = (INSIDE[inner] || []).map(([name, label]) => ({ name, label, inside: true }))
154
+ const end = inner ? [{ name: `end${inner}`, label: t("Ends the %{tag}", { tag: inner }), inside: true }] : []
155
+ const own = [...tags.values()].map((tag) => ({ name: tag.name, label: tag.label, hint: tag.syntax, tag }))
156
+ const items = ranked([...inside, ...end, ...own], context.partial)
157
+ if (!items.length) return null
158
+ return {
159
+ items,
160
+ choose: (item) => {
161
+ const adapter = this.state.adapter
162
+ const closed = /^\s*-?%\}/.test(adapter.after())
163
+ const before = adapter.before()
164
+ const takes = item.tag ? item.tag.syntax !== item.name : ["elsif", "when"].includes(item.name)
165
+ const block = item.tag?.block && !closed
166
+ const close = closed ? "" : " %}"
167
+ const head = takes ? `${item.name} ` : `${item.name}${close}`
168
+ const text = takes ? `${head}${close}` : head
169
+ const tail = block ? `{% end${item.name} %}` : ""
170
+ adapter.replace(context.start, before.length, `${text}${tail}`, { caret: takes ? head.length : text.length })
171
+ this.close()
172
+ }
173
+ }
174
+ }
175
+
110
176
  // The variables for a path being typed, from `context.start`
111
177
  async variableOptions(context, path, scope) {
112
178
  const dot = path.lastIndexOf(".")
@@ -130,16 +196,21 @@ export class VariableMenu {
130
196
  return this.editor.variables.options(`${entry.path}.first`, scope)
131
197
  }
132
198
 
133
- // Values in quotes ({ value, label }), then a comma for the next argument
134
- quotedOptions(context, choices, more) {
135
- const items = ranked(choices.map((choice) => ({ name: `"${choice.value}"`, value: choice.value, label: choice.label })), context.partial, (item) => item.value)
199
+ // Values in quotes ({ value, label }), then a comma for the next argument;
200
+ // and `literals` as they are (blank, empty)
201
+ quotedOptions(context, choices, more, literals = []) {
202
+ const mark = context.quote || '"'
203
+ const items = ranked([
204
+ ...choices.map((choice) => ({ name: `${mark}${choice.value}${mark}`, value: choice.value, label: choice.label })),
205
+ ...literals.map(([name, label]) => ({ name, value: name, label, literal: true }))
206
+ ], context.partial, (item) => item.value)
136
207
  if (!items.length || (items.length === 1 && items[0].value === context.partial)) return null
137
208
  return {
138
209
  items,
139
210
  choose: async (item) => {
140
211
  const adapter = this.state.adapter
141
212
  const before = adapter.before()
142
- const { text, through } = quoted(item.value, { quote: context.quote, after: adapter.after() })
213
+ const { text, through } = item.literal ? { text: item.value, through: 0 } : quoted(item.value, { quote: context.quote, after: adapter.after() })
143
214
  adapter.replace(context.start, before.length + through, more ? `${text}, ` : text)
144
215
  more ? await this.suggest(adapter) : this.close()
145
216
  }
@@ -316,8 +387,9 @@ export function inputAdapter(input, { mode = "output", scope = [] } = {}) {
316
387
  scope,
317
388
  before: () => input.value.slice(0, input.selectionStart ?? input.value.length),
318
389
  after: () => input.value.slice(input.selectionEnd ?? input.value.length),
319
- replace(start, end, text) {
390
+ replace(start, end, text, { caret = null } = {}) {
320
391
  input.setRangeText(text, start, end, "end")
392
+ if (caret !== null) input.setSelectionRange(start + caret, start + caret)
321
393
  fire()
322
394
  },
323
395
  insert(text) {
@@ -350,3 +422,43 @@ function signature(filter) {
350
422
  const args = (filter.arguments || []).map((argument) => argument.name)
351
423
  return args.length ? `${filter.name}: ${args.join(", ")}` : filter.name
352
424
  }
425
+
426
+ // The operators in a condition
427
+ const OPERATORS = [
428
+ ["==", "Equals"], ["!=", "Doesn't equal"], [">", "More than"], ["<", "Less than"], [">=", "At least"], ["<=", "At most"],
429
+ ["contains", "Contains"], ["and", "And"], ["or", "Or"]
430
+ ]
431
+
432
+ // What a value can be compared with besides its values
433
+ const LITERALS = [["blank", "Blank: nothing, or only spaces"], ["empty", "Empty: no items or text"]]
434
+
435
+ // The tags inside a block
436
+ const INSIDE = {
437
+ if: [["elsif", "Or else when a condition holds"], ["else", "Otherwise"]],
438
+ unless: [["elsif", "Or else when a condition holds"], ["else", "Otherwise"]],
439
+ case: [["when", "When it's one of these values"], ["else", "Otherwise"]],
440
+ for: [["break", "Stops the loop"], ["continue", "Goes on with the next item"], ["else", "When there are no items"]]
441
+ }
442
+
443
+ // A date's formats, as Ruby's strftime writes them
444
+ const DATE_FORMATS = [
445
+ "%-d %B %Y", "%-d %b %Y", "%A %-d %B %Y", "%-d %B", "%-d %b", "%B %Y", "%A",
446
+ "%d-%m-%Y", "%-d-%-m-%Y", "%Y-%m-%d", "%-m/%-d/%Y",
447
+ "%-d %B %Y %H:%M", "%d-%m-%Y %H:%M", "%H:%M"
448
+ ]
449
+
450
+ // A date in a strftime format, in the page's language, for a format's example
451
+ export function strftime(date, format, locale = document.documentElement?.lang || "en") {
452
+ const part = (options) => new Intl.DateTimeFormat(locale, options).format(date)
453
+ const pad = (number) => String(number).padStart(2, "0")
454
+ const codes = {
455
+ d: pad(date.getDate()), "-d": String(date.getDate()), e: String(date.getDate()).padStart(2, " "),
456
+ m: pad(date.getMonth() + 1), "-m": String(date.getMonth() + 1), Y: String(date.getFullYear()), y: pad(date.getFullYear() % 100),
457
+ B: part({ month: "long" }), b: part({ month: "short" }).replace(/\.$/, ""), A: part({ weekday: "long" }), a: part({ weekday: "short" }),
458
+ H: pad(date.getHours()), "-H": String(date.getHours()), M: pad(date.getMinutes()), S: pad(date.getSeconds()),
459
+ I: pad(date.getHours() % 12 || 12), "-I": String(date.getHours() % 12 || 12), p: date.getHours() < 12 ? "AM" : "PM",
460
+ R: `${pad(date.getHours())}:${pad(date.getMinutes())}`,
461
+ Z: new Intl.DateTimeFormat(locale, { timeZoneName: "short" }).formatToParts(date).find((part) => part.type === "timeZoneName")?.value || ""
462
+ }
463
+ return format.replace(/%(-?[a-zA-Z])/g, (match, code) => codes[code] ?? match)
464
+ }
@@ -38,13 +38,17 @@ en:
38
38
  all_panels_on_the_left: "All panels on the left"
39
39
  all_panels_on_the_right: "All panels on the right"
40
40
  alt_text: "Alt text"
41
+ and: "And"
41
42
  assign: "Assign"
42
43
  assigned_path: "Assigned %{path}"
44
+ at_least: "At least"
45
+ at_most: "At most"
43
46
  auto: "Auto"
44
47
  background: "Background"
45
48
  background_image: "Background image"
46
49
  below_this_width_columns_stack: "Below this width columns stack."
47
50
  between_rows: "Between rows"
51
+ blank_nothing_or_only_spaces: "Blank: nothing, or only spaces"
48
52
  blocks: "Blocks"
49
53
  blocks_on_the_left_inspect_on_the_right: "Blocks on the left, Inspect on the right"
50
54
  bold_b: "Bold (⌘B)"
@@ -57,6 +61,7 @@ en:
57
61
  button: "Button"
58
62
  button_color: "Button color"
59
63
  cancel: "Cancel"
64
+ captured_text: "Captured text"
60
65
  cell: "Cell"
61
66
  cell_padding: "Cell padding"
62
67
  center: "Center"
@@ -73,6 +78,7 @@ en:
73
78
  column_order: "Column order"
74
79
  column_width: "Column width"
75
80
  condition: "Condition"
81
+ contains: "Contains"
76
82
  content: "Content"
77
83
  copied: "Copied."
78
84
  copied_into_the_email_as_is_liquid_works_here_too: "Copied into the email as-is. Liquid works here too."
@@ -86,6 +92,7 @@ en:
86
92
  delete_row: "Delete row"
87
93
  desktop: "Desktop"
88
94
  divider: "Divider"
95
+ doesn_t_equal: "Doesn't equal"
89
96
  done: "Done"
90
97
  dotted: "Dotted"
91
98
  double_click_the_text_on_the_canvas_to_edit_it: "Double-click the text on the canvas to edit it."
@@ -110,6 +117,9 @@ en:
110
117
  email: "Email"
111
118
  empty: "(empty)"
112
119
  empty_for_now_fill_it_in_where_it_comes_from: "Empty for now: fill it in where it comes from"
120
+ empty_no_items_or_text: "Empty: no items or text"
121
+ ends_the: "Ends the %{tag}"
122
+ equals: "Equals"
113
123
  every_other_row: "Every other row"
114
124
  expand: "Expand"
115
125
  find_in_source: "Find in %{source}"
@@ -121,6 +131,7 @@ en:
121
131
  fonts: "Fonts"
122
132
  full: "Full"
123
133
  full_width: "Full width"
134
+ goes_on_with_the_next_item: "Goes on with the next item"
124
135
  hamburger_on_mobile: "Hamburger on mobile"
125
136
  heading: "Heading"
126
137
  heading_level: "Heading %{level}"
@@ -145,6 +156,10 @@ en:
145
156
  inspect: "Inspect"
146
157
  instead_of_the_table_s_cell_padding: "Instead of the table's cell padding."
147
158
  italic_i: "Italic (⌘I)"
159
+ its_number_from_0: "Its number, from 0"
160
+ its_number_from_1: "Its number, from 1"
161
+ its_number_from_the_end_to_0: "Its number from the end, to 0"
162
+ its_number_from_the_end_to_1: "Its number from the end, to 1"
148
163
  key: "Key"
149
164
  key_already_says_current_in_locale: "%{key} already says “%{current}” in %{locale}."
150
165
  key_no_locale_text: "%{key} · no %{locale} text"
@@ -154,6 +169,7 @@ en:
154
169
  layout: "Layout"
155
170
  left: "Left"
156
171
  left_to_right: "Left to right"
172
+ less_than: "Less than"
157
173
  letter_spacing: "Letter spacing"
158
174
  line_above: "Line above"
159
175
  line_height: "Line height"
@@ -181,6 +197,7 @@ en:
181
197
  missing: "missing"
182
198
  mobile: "Mobile"
183
199
  mode: "Mode"
200
+ more_than: "More than"
184
201
  move_up: "Move up"
185
202
  name_can_t_go_here_its_type_blocks_don_t_fit: "%{name} can't go here: its %{type} blocks don't fit."
186
203
  name_canvas: "%{name} canvas"
@@ -202,6 +219,9 @@ en:
202
219
  open_in: "Open in"
203
220
  open_source: "Open %{source}"
204
221
  open_where_it_s_kept: "Open where it's kept"
222
+ or: "Or"
223
+ or_else_when_a_condition_holds: "Or else when a condition holds"
224
+ otherwise: "Otherwise"
205
225
  padding: "Padding"
206
226
  paragraph: "Paragraph"
207
227
  paragraph_style: "Paragraph style"
@@ -240,6 +260,7 @@ en:
240
260
  solid: "Solid"
241
261
  spacer: "Spacer"
242
262
  spans_columns: "Spans columns"
263
+ stops_the_loop: "Stops the loop"
243
264
  strikethrough: "Strikethrough"
244
265
  style: "Style"
245
266
  subject: "Subject"
@@ -260,6 +281,7 @@ en:
260
281
  there_s_nothing_here_yet: "There's nothing here yet."
261
282
  thickness: "Thickness"
262
283
  this: "This"
284
+ this_loop: "This loop"
263
285
  too_narrow_to_split_the_panels: "Too narrow to split the panels"
264
286
  top: "Top"
265
287
  translations: "Translations"
@@ -278,5 +300,9 @@ en:
278
300
  vertical_align: "Vertical align"
279
301
  web: "Web"
280
302
  what_to_loop_over_e_g_invoice_lines: "What to loop over, e.g. invoice.lines."
303
+ when_it_s_one_of_these_values: "When it's one of these values"
304
+ when_there_are_no_items: "When there are no items"
305
+ whether_it_s_the_first: "Whether it's the first"
306
+ whether_it_s_the_last: "Whether it's the last"
281
307
  width: "Width"
282
308
  wrapper: "Wrapper"
@@ -38,13 +38,17 @@ nl:
38
38
  all_panels_on_the_left: "Alle panelen links"
39
39
  all_panels_on_the_right: "Alle panelen rechts"
40
40
  alt_text: "Alternatieve tekst"
41
+ and: "En"
41
42
  assign: "Toekennen"
42
43
  assigned_path: "Toegewezen: %{path}"
44
+ at_least: "Minstens"
45
+ at_most: "Hoogstens"
43
46
  auto: "Automatisch"
44
47
  background: "Achtergrond"
45
48
  background_image: "Achtergrondafbeelding"
46
49
  below_this_width_columns_stack: "Onder deze breedte komen kolommen onder elkaar."
47
50
  between_rows: "Tussen rijen"
51
+ blank_nothing_or_only_spaces: "Leeg: niets, of alleen spaties"
48
52
  blocks: "Blokken"
49
53
  blocks_on_the_left_inspect_on_the_right: "Blokken links, eigenschappen rechts"
50
54
  bold_b: "Vet (⌘B)"
@@ -57,6 +61,7 @@ nl:
57
61
  button: "Knop"
58
62
  button_color: "Knopkleur"
59
63
  cancel: "Annuleren"
64
+ captured_text: "Vastgelegde tekst"
60
65
  cell: "Cel"
61
66
  cell_padding: "Celmarge"
62
67
  center: "Midden"
@@ -73,6 +78,7 @@ nl:
73
78
  column_order: "Kolomvolgorde"
74
79
  column_width: "Kolombreedte"
75
80
  condition: "Voorwaarde"
81
+ contains: "Bevat"
76
82
  content: "Inhoud"
77
83
  copied: "Gekopieerd."
78
84
  copied_into_the_email_as_is_liquid_works_here_too: "Wordt ongewijzigd in de e-mail gezet. Liquid werkt hier ook."
@@ -86,6 +92,7 @@ nl:
86
92
  delete_row: "Rij verwijderen"
87
93
  desktop: "Desktop"
88
94
  divider: "Scheidingslijn"
95
+ doesn_t_equal: "Is niet gelijk aan"
89
96
  done: "Klaar"
90
97
  dotted: "Gestippeld"
91
98
  double_click_the_text_on_the_canvas_to_edit_it: "Dubbelklik op de tekst op het canvas om die te bewerken."
@@ -110,6 +117,9 @@ nl:
110
117
  email: "E-mail"
111
118
  empty: "(leeg)"
112
119
  empty_for_now_fill_it_in_where_it_comes_from: "Nog leeg: vul het in waar het vandaan komt"
120
+ empty_no_items_or_text: "Leeg: geen items of tekst"
121
+ ends_the: "Sluit de %{tag}"
122
+ equals: "Is gelijk aan"
113
123
  every_other_row: "Om de andere rij"
114
124
  expand: "Vergroten"
115
125
  find_in_source: "Zoeken in %{source}"
@@ -121,6 +131,7 @@ nl:
121
131
  fonts: "Lettertypen"
122
132
  full: "Volledig"
123
133
  full_width: "Volle breedte"
134
+ goes_on_with_the_next_item: "Gaat door met het volgende item"
124
135
  hamburger_on_mobile: "Hamburgermenu op mobiel"
125
136
  heading: "Kop"
126
137
  heading_level: "Kop %{level}"
@@ -145,6 +156,10 @@ nl:
145
156
  inspect: "Eigenschappen"
146
157
  instead_of_the_table_s_cell_padding: "In plaats van de celmarge van de tabel."
147
158
  italic_i: "Cursief (⌘I)"
159
+ its_number_from_0: "Het nummer, vanaf 0"
160
+ its_number_from_1: "Het nummer, vanaf 1"
161
+ its_number_from_the_end_to_0: "Het nummer vanaf het eind, tot 0"
162
+ its_number_from_the_end_to_1: "Het nummer vanaf het eind, tot 1"
148
163
  key: "Sleutel"
149
164
  key_already_says_current_in_locale: "%{key} is in het %{locale} al “%{current}”."
150
165
  key_no_locale_text: "%{key} · geen %{locale}-tekst"
@@ -154,6 +169,7 @@ nl:
154
169
  layout: "Layout"
155
170
  left: "Links"
156
171
  left_to_right: "Links naar rechts"
172
+ less_than: "Minder dan"
157
173
  letter_spacing: "Letterafstand"
158
174
  line_above: "Lijn erboven"
159
175
  line_height: "Regelhoogte"
@@ -181,6 +197,7 @@ nl:
181
197
  missing: "ontbreekt"
182
198
  mobile: "Mobiel"
183
199
  mode: "Modus"
200
+ more_than: "Meer dan"
184
201
  move_up: "Omhoog"
185
202
  name_can_t_go_here_its_type_blocks_don_t_fit: "%{name} kan hier niet: de blokken %{type} passen er niet in."
186
203
  name_canvas: "%{name}-canvas"
@@ -202,6 +219,9 @@ nl:
202
219
  open_in: "Openen in"
203
220
  open_source: "%{source} openen"
204
221
  open_where_it_s_kept: "Openen waar het staat"
222
+ or: "Of"
223
+ or_else_when_a_condition_holds: "Of anders als een voorwaarde geldt"
224
+ otherwise: "Anders"
205
225
  padding: "Ruimte"
206
226
  paragraph: "Alinea"
207
227
  paragraph_style: "Alineastijl"
@@ -240,6 +260,7 @@ nl:
240
260
  solid: "Doorgetrokken"
241
261
  spacer: "Witruimte"
242
262
  spans_columns: "Beslaat kolommen"
263
+ stops_the_loop: "Stopt de lus"
243
264
  strikethrough: "Doorhalen"
244
265
  style: "Stijl"
245
266
  subject: "Onderwerp"
@@ -260,6 +281,7 @@ nl:
260
281
  there_s_nothing_here_yet: "Hier staat nog niets."
261
282
  thickness: "Dikte"
262
283
  this: "Dit"
284
+ this_loop: "Deze lus"
263
285
  too_narrow_to_split_the_panels: "Te smal om de panelen te verdelen"
264
286
  top: "Boven"
265
287
  translations: "Vertalingen"
@@ -278,5 +300,9 @@ nl:
278
300
  vertical_align: "Verticale uitlijning"
279
301
  web: "Web"
280
302
  what_to_loop_over_e_g_invoice_lines: "Waarover te herhalen, bijv. invoice.lines."
303
+ when_it_s_one_of_these_values: "Als het een van deze waarden is"
304
+ when_there_are_no_items: "Als er geen items zijn"
305
+ whether_it_s_the_first: "Of het de eerste is"
306
+ whether_it_s_the_last: "Of het de laatste is"
281
307
  width: "Breedte"
282
308
  wrapper: "Kader"
@@ -1,3 +1,3 @@
1
1
  module TessEdit
2
- VERSION = "0.5.12"
2
+ VERSION = "0.5.14"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tess_edit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.12
4
+ version: 0.5.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom de Grunt