@pageboard/html 0.13.7 → 0.14.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/elements/embed.js CHANGED
@@ -53,4 +53,4 @@ exports.embed = {
53
53
  '../ui/linkable.css'
54
54
  ]
55
55
  };
56
- exports.editor.scripts.push('../ui/embed-helper.js');
56
+ exports.editor?.scripts.push('../ui/embed-helper.js');
package/elements/form.js CHANGED
@@ -80,7 +80,7 @@ exports.api_form = {
80
80
  properties: {
81
81
  name: {
82
82
  title: 'Name',
83
- description: '<action>=<name> where action=submit or toggle',
83
+ description: 'Trigger query submit|toggle=<name>\nExpose endpoint /.api/form/<name>',
84
84
  type: 'string',
85
85
  format: 'id',
86
86
  nullable: true
@@ -71,7 +71,7 @@ exports.heading = {
71
71
  '../ui/heading.js'
72
72
  ]
73
73
  };
74
- exports.editor.scripts.push('../ui/heading-helper.js');
74
+ exports.editor?.scripts.push('../ui/heading-helper.js');
75
75
 
76
76
  exports.heading_nolink = {
77
77
  ...exports.heading,
@@ -181,20 +181,27 @@ exports.style = {
181
181
  title: "Purple",
182
182
  icon: '<i class="icon color" style="color:purple">P</i>'
183
183
  }]
184
+ },
185
+ idiom: {
186
+ title: 'Untranslatable',
187
+ type: 'boolean',
188
+ default: false,
189
+ nullable: true
184
190
  }
185
191
  },
186
192
  parse: function(dom) {
187
193
  const data = {};
188
194
  for (const [key, schema] of Object.entries(this.properties)) {
189
- for (const item of schema.anyOf) {
195
+ if (schema.anyOf) for (const item of schema.anyOf) {
190
196
  if (item.const && dom.classList.contains(item.const)) {
191
197
  data[key] = item.const;
192
198
  }
193
199
  }
194
200
  }
201
+ if (dom.translate === false) data.idiom = true;
195
202
  return data;
196
203
  },
197
- html: '<span class="style [size] [transform] [color]"></span>',
204
+ html: '<span class="style [size] [transform] [color]" translate="[idiom|alt:no:]"></span>',
198
205
  stylesheets: [
199
206
  '../ui/inlines.css'
200
207
  ]
@@ -19,32 +19,26 @@ exports.sitemap = {
19
19
  scripts: [
20
20
  '../ui/sitemap.js'
21
21
  ],
22
- itemModel: function(name, leaf) {
22
+ itemModel: function(name) {
23
23
  const schema = exports[name];
24
24
  return {
25
25
  title: schema.title,
26
26
  icon: schema.icon,
27
+ properties: schema.properties,
27
28
  standalone: true,
28
- properties: {
29
- leaf: {
30
- type: 'boolean',
31
- default: Boolean(leaf)
32
- },
33
- ...schema.properties
34
- },
35
29
  menu: "link",
36
30
  bundle: 'sitemap',
37
31
  group: 'sitemap_item',
38
32
  virtual: true,
39
- contents: leaf ? undefined : {
33
+ contents: {
40
34
  id: 'children',
41
35
  nodes: "sitemap_item*",
42
36
  virtual: true
43
37
  },
44
38
  alias: name,
45
39
  context: 'sitemap/ | sitepage/',
46
- html: `<element-sitepage class="item [leaf|alt::fold]" data-url="[url]" data-index="[index]">
47
- <div class="title [leaf|alt::caret-icon]">
40
+ html: `<element-sitepage class="item fold" data-url="[url]" data-index="[index]">
41
+ <div class="title caret-icon">
48
42
  <span class="header">[title|or:-]</span>
49
43
  <span class="ui mini type label">[$grants.webmaster|prune:*][$type|slice:4]</span>
50
44
  <span class="ui mini grey label">[$grants.webmaster|prune:*][nositemap|prune:*]no sitemap</span>
@@ -54,11 +48,16 @@ exports.sitemap = {
54
48
  <a href="[url]" class="description">[url|or:-]</a>
55
49
  <a href="[redirect|fail:*]" class="redirection"> ➜ [redirect]</a>
56
50
  </div>
57
- <div class="list content [leaf|not:prune:*]" block-content="children"></div>
51
+ <div class="list content" block-content="children"></div>
58
52
  </element-sitepage>`
59
53
  };
60
54
  }
61
55
  };
62
- exports.editor.scripts.push('../ui/sitemap-helper.js');
63
- exports.sitepage = exports.sitemap.itemModel('page', false);
64
- exports.siteredirection = exports.sitemap.itemModel('redirection', false);
56
+
57
+ if (exports.page) exports.sitepage = exports.sitemap.itemModel('page');
58
+ if (exports.pdf) exports.sitepdf = exports.sitemap.itemModel('pdf');
59
+ if (exports.redirection) exports.siteredirection = exports.sitemap.itemModel('redirection');
60
+ if (exports.mail) exports.sitemail = exports.sitemap.itemModel('mail');
61
+
62
+ exports.editor?.scripts.push('../ui/sitemap-helper.js');
63
+
package/elements/tab.js CHANGED
@@ -32,7 +32,7 @@ exports.tabs = {
32
32
  '../ui/tab.js'
33
33
  ]
34
34
  };
35
- exports.editor.scripts.push('../ui/tab-helper.js');
35
+ exports.editor?.scripts.push('../ui/tab-helper.js');
36
36
 
37
37
  exports.tab_item = {
38
38
  title: "Item",
package/elements/time.js CHANGED
@@ -158,7 +158,7 @@ exports.time = {
158
158
  const format = {};
159
159
  const list = (dom.dataset.format ?? "").split(':');
160
160
  for (const [key, schema] of Object.entries(this.properties.format.properties)) {
161
- for (const tok of list) {
161
+ if (schema.anyOf) for (const tok of list) {
162
162
  if (tok) {
163
163
  const item = schema.anyOf.find(item => item.const === tok);
164
164
  if (item) format[key] = item.const;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.13.7",
3
+ "version": "0.14.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "formdata-polyfill": "^4.0.10",
22
- "nouislider": "^15.6.1",
22
+ "nouislider": "^15.7.1",
23
23
  "object-fit-images": "^3.2.4",
24
24
  "postinstall-bundle": "^0.8.0"
25
25
  },
package/ui/sitemap.js CHANGED
@@ -61,7 +61,7 @@ class HTMLElementSitemap extends Page.Element {
61
61
  const scope = state.scope.copy();
62
62
  await scope.import(res);
63
63
  const tree = this.constructor.transformResponse(res);
64
- const node = scope.render({
64
+ const node = await scope.render({
65
65
  item: tree
66
66
  });
67
67
  // only change block content
package/elements/svg.js DELETED
@@ -1,367 +0,0 @@
1
- exports.svg = {
2
- title: "Svg",
3
- bundle: true,
4
- icon: '<i class="object ungroup icon"></i>',
5
- menu: 'media',
6
- group: "block",
7
- properties: {
8
- viewBox: {
9
- title: 'View Box',
10
- type: 'string',
11
- description: 'Typically "0 0 width height"'
12
- },
13
- width: {
14
- title: 'Width',
15
- type: 'integer'
16
- },
17
- height: {
18
- title: 'Height',
19
- type: 'integer'
20
- }
21
- },
22
- contents: "svg_defs? svg_node+",
23
- ns: "svg",
24
- html: `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="[viewBox]" width="[width]" height="[height]"></svg>`
25
- };
26
-
27
- exports.text.group += ' svg_inline';
28
-
29
- exports.svg_text = {
30
- title: "text",
31
- icon: '<i class="icon font"></i>',
32
- menu: 'media',
33
- group: "svg_node",
34
- properties: {
35
- x: {
36
- title: 'x',
37
- type: 'number',
38
- nullable: true
39
- },
40
- y: {
41
- title: 'y',
42
- type: 'number',
43
- nullable: true
44
- }
45
- },
46
- contents: "svg_inline*",
47
- inplace: true,
48
- ns: "svg",
49
- html: `<text x="[x]" y="[y]">Text</text>`
50
- };
51
-
52
- exports.svg_tspan = {
53
- title: "span",
54
- icon: '<i class="icon font"></i>',
55
- menu: 'media',
56
- group: "svg_inline",
57
- properties: {
58
- },
59
- contents: "text*",
60
- inplace: true,
61
- inline: true,
62
- ns: "svg",
63
- html: `<tspan></tspan>`
64
- };
65
-
66
- exports.svg_defs = {
67
- title: "defs",
68
- icon: '<b class="icon">defs</b>',
69
- menu: 'media',
70
- contents: "svg_node+",
71
- inplace: true,
72
- ns: "svg",
73
- html: `<defs></defs>`
74
- };
75
-
76
- exports.svg_group = {
77
- title: "group",
78
- icon: '<i class="clone outline icon"></i>',
79
- menu: 'media',
80
- group: "svg_node",
81
- properties: {
82
- id: {
83
- title: 'id',
84
- type: 'string',
85
- format: 'id',
86
- nullable: true
87
- },
88
- fill: {
89
- title: 'Fill',
90
- type: 'string',
91
- nullable: true
92
- },
93
- stroke: {
94
- title: 'Stroke',
95
- type: 'string',
96
- nullable: true
97
- },
98
- transform: {
99
- title: 'Transform',
100
- type: 'string',
101
- nullable: true
102
- }
103
- },
104
- contents: "svg_node+",
105
- inplace: true,
106
- ns: "svg",
107
- html: `<g id="[id]" fill="[fill]" stroke="[stroke]" transform="[transform]"></g>`
108
- };
109
-
110
- exports.svg_path = {
111
- title: "path",
112
- icon: '<b class="icon">path</b>',
113
- menu: 'media',
114
- group: "svg_node",
115
- properties: {
116
- d: {
117
- title: 'd',
118
- type: 'string',
119
- nullable: true
120
- }
121
- },
122
- inplace: true,
123
- ns: "svg",
124
- html: `<path d="[d]"></path>`
125
- };
126
-
127
- exports.svg_line = {
128
- title: "line",
129
- icon: '<b class="icon">line</b>',
130
- menu: 'media',
131
- group: "svg_node",
132
- properties: {
133
- x1: {
134
- title: 'x1',
135
- type: 'number',
136
- nullable: true
137
- },
138
- y1: {
139
- title: 'y1',
140
- type: 'number',
141
- nullable: true
142
- },
143
- x2: {
144
- title: 'x2',
145
- type: 'number',
146
- nullable: true
147
- },
148
- y2: {
149
- title: 'y2',
150
- type: 'number',
151
- nullable: true
152
- }
153
- },
154
- inplace: true,
155
- ns: "svg",
156
- html: `<line x1="[x1]" y1="[y1]" x2="[x2]" y2="[y2]"></line>`
157
- };
158
-
159
- exports.svg_rect = {
160
- title: "rect",
161
- icon: '<i class="square outline icon"></i>',
162
- menu: 'media',
163
- group: "svg_node",
164
- properties: {
165
- x: {
166
- title: 'x',
167
- type: 'number',
168
- nullable: true
169
- },
170
- y: {
171
- title: 'y',
172
- type: 'number',
173
- nullable: true
174
- },
175
- width: {
176
- title: 'Width',
177
- type: 'number',
178
- nullable: true
179
- },
180
- height: {
181
- title: 'Height',
182
- type: 'number',
183
- nullable: true
184
- },
185
- rx: {
186
- title: 'rx',
187
- type: 'number',
188
- nullable: true
189
- },
190
- ry: {
191
- title: 'ry',
192
- type: 'number',
193
- nullable: true
194
- }
195
- },
196
- inplace: true,
197
- ns: "svg",
198
- html: `<rect x="[x]" y="[y]" width="[width]" height="[height]" rx="[rx]" ry="[ry]"></rect>`
199
- };
200
-
201
- exports.svg_circle = {
202
- title: "circle",
203
- icon: '<i class="circle outline icon"></i>',
204
- menu: 'media',
205
- group: "svg_node",
206
- properties: {
207
- cx: {
208
- title: 'cx',
209
- type: 'number',
210
- nullable: true
211
- },
212
- cy: {
213
- title: 'cy',
214
- type: 'number',
215
- nullable: true
216
- },
217
- r: {
218
- title: 'r',
219
- type: 'number',
220
- nullable: true
221
- }
222
- },
223
- inplace: true,
224
- ns: "svg",
225
- html: `<circle cx="[cx]" cy="[cy]" r="[r]"></circle>`
226
- };
227
-
228
- exports.svg_ellipse = {
229
- title: "ellipse",
230
- icon: '<i class="circle outline icon"></i>',
231
- menu: 'media',
232
- group: "svg_node",
233
- properties: {
234
- cx: {
235
- title: 'cx',
236
- type: 'number',
237
- nullable: true
238
- },
239
- cy: {
240
- title: 'cy',
241
- type: 'number',
242
- nullable: true
243
- },
244
- rx: {
245
- title: 'rx',
246
- type: 'number',
247
- nullable: true
248
- },
249
- ry: {
250
- title: 'ry',
251
- type: 'number',
252
- nullable: true
253
- }
254
- },
255
- inplace: true,
256
- ns: "svg",
257
- html: `<ellipse cx="[cx]" cy="[cy]" rx="[rx]" ry="[ry]"></ellipse>`
258
- };
259
-
260
- exports.svg_polygon = {
261
- title: "polygon",
262
- icon: '<b class="icon">pgon</b>',
263
- menu: 'media',
264
- group: "svg_node",
265
- properties: {
266
- points: {
267
- title: 'Points',
268
- type: 'string',
269
- nullable: true
270
- }
271
- },
272
- inplace: true,
273
- ns: "svg",
274
- html: `<polygon points="[points]"></polygon>`
275
- };
276
-
277
- exports.svg_polyline = {
278
- title: "polyline",
279
- icon: '<b class="icon">pline</b>',
280
- menu: 'media',
281
- group: "svg_node",
282
- properties: {
283
- points: {
284
- title: 'Points',
285
- type: 'string',
286
- nullable: true
287
- }
288
- },
289
- inplace: true,
290
- ns: "svg",
291
- html: `<polyline points="[points]"></polyline>`
292
- };
293
-
294
- exports.svg_linearGradient = {
295
- title: "gradient",
296
- icon: '<b class="icon">grad</b>',
297
- menu: 'media',
298
- group: "svg_node",
299
- properties: {
300
- id: {
301
- title: 'id',
302
- type: 'string',
303
- format: 'id',
304
- nullable: true
305
- },
306
- gradientUnits: {
307
- title: 'Units',
308
- type: 'string',
309
- nullable: true
310
- },
311
- gradientTransform: {
312
- title: 'Transform',
313
- type: 'string',
314
- nullable: true
315
- },
316
- x1: {
317
- title: 'x1',
318
- type: 'number',
319
- nullable: true
320
- },
321
- y1: {
322
- title: 'y1',
323
- type: 'number',
324
- nullable: true
325
- },
326
- x2: {
327
- title: 'x2',
328
- type: 'number',
329
- nullable: true
330
- },
331
- y2: {
332
- title: 'y2',
333
- type: 'number',
334
- nullable: true
335
- }
336
- },
337
- inplace: true,
338
- contents: "svg_stop+",
339
- ns: "svg",
340
- html: `<linearGradient id="[id]" gradientUnits="[gradientUnits]" x1="[x1]" x2="[x2]" y1="[y1]" y2="[y2]"></linearGradient>`
341
- };
342
-
343
- exports.svg_stop = {
344
- title: "stop",
345
- icon: '<b class="icon">stop</b>',
346
- menu: 'media',
347
- properties: {
348
- offset: {
349
- title: 'Offset',
350
- type: 'string',
351
- nullable: true
352
- },
353
- stopColor: {
354
- title: 'Color',
355
- type: 'string',
356
- nullable: true
357
- },
358
- stopOpacity: {
359
- title: 'Opacity',
360
- type: 'string',
361
- nullable: true
362
- }
363
- },
364
- inplace: true,
365
- ns: "svg",
366
- html: `<stop offset="[offset]" stop-color="[stopColor]" stop-opacity="[stopOpacity]"></stop>`
367
- };