u2ui 1.5.16 → 1.5.18

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.
@@ -103,6 +103,7 @@ contain: layout style paint; /* Neu ok? */
103
103
  }
104
104
  :host([mode=fade]) .body {
105
105
  display:flex;
106
+ min-width: 0;
106
107
  }
107
108
  :host([mode=fade]) .body::slotted(*) {
108
109
  transition:opacity var(--u2-carousel-animation-speed, .7s) ease-in-out;
package/el/rte/README.md CHANGED
@@ -56,9 +56,6 @@ DOM edited by RTE. They should not be added as aliases or partial parsers.
56
56
 
57
57
  ## TODO
58
58
 
59
- - Add `el/rte` to U2's generated project catalog when the module is ready for
60
- automatic loading. It currently requires the explicit module import shown
61
- above because that catalog lives outside this module.
62
59
  - RTE needs a shared root-aware convention-client entry point before this
63
60
  adapter can support editors placed inside an application ShadowRoot. The
64
61
  current public convenience client owns the document root only.
@@ -12,19 +12,18 @@ function forRoot(root, method, el) {
12
12
  for (const observer of observers) observer.root === root && observer[method](el);
13
13
  }
14
14
  function checkMutations(mutations, root) {
15
- for (const mutation of mutations) {
16
- if (mutation.type==='childList') {
17
- for (const target of mutation.addedNodes) {
18
- target.nodeType === 1 && forRoot(root, '_addTree', target);
19
- }
20
- for (const target of mutation.removedNodes) {
21
- target.nodeType === 1 && forRoot(root, '_removeTree', target);
22
- }
23
- }
24
- if (mutation.type==='attributes') {
25
- forRoot(root, '_treeModified', mutation.target);
26
- }
15
+ const added = new Set(), removed = new Set(), modified = new Set();
16
+ for (const m of mutations) {
17
+ if (m.type === 'attributes') { modified.add(m.target); continue; }
18
+ for (const n of m.removedNodes) n.nodeType === 1 && removed.add(n);
19
+ for (const n of m.addedNodes) n.nodeType === 1 && added.add(n);
27
20
  }
21
+ // a node inside another node of the same batch is covered by that node's subtree
22
+ const top = (n, set) => { for (let p = n.parentNode; p; p = p.parentNode) if (set.has(p)) return false; return true; };
23
+ for (const n of removed) top(n, removed) && forRoot(root, '_removeTree', n);
24
+ // judged by the final state: a node that left again, or was only touched while detached, is not added
25
+ for (const n of added) top(n, added) && root.contains(n) && forRoot(root, '_addTree', n);
26
+ for (const n of modified) root.contains(n) && forRoot(root, '_treeModified', n);
28
27
  }
29
28
 
30
29
 
@@ -140,16 +139,15 @@ export class SelectorObserver {
140
139
  */
141
140
  _addTree(target) {
142
141
  target.matches(this.selector) && this._add(target);
143
- if (document.readyState === 'complete') { // Before domready MutationObserver reports every node, ok?
144
- for (const el of target.querySelectorAll(this.selector)) this._add(el);
145
- }
142
+ // a scripted insert is reported as its root only, even while parsing; nodes found twice are deduped by targets
143
+ for (const el of target.querySelectorAll(this.selector)) this._add(el);
146
144
  }
147
145
 
148
146
  /**
149
147
  * @private
150
148
  */
151
149
  _removeTree(target) {
152
- //if (!this._off) return; // performance
150
+ if (!this.targets.size) return;
153
151
  this._remove(target);
154
152
  for (const el of target.querySelectorAll('*')) this._remove(el);
155
153
  }
package/js/rte/AGENTS.md CHANGED
@@ -15,9 +15,6 @@ earlier RTE draft is not a reason to keep a weaker design.
15
15
  - Read [`README.md`](./README.md) for the architecture and requirements.
16
16
  - Read [`PLAN.md`](./PLAN.md) for implemented phases and the next responsibility.
17
17
  - Read the README beside every responsibility you change.
18
- - Treat `../rte0` as a read-only behavioral reference. Never modify it or any
19
- other file outside `rte` while working on RTE.
20
-
21
18
  ## Priorities
22
19
 
23
20
  - Keep changes focused, compact, readable, and internally consistent.
package/js/rte/PLAN.md CHANGED
@@ -4,12 +4,6 @@ Each phase ends with documentation, dedicated tests for every production file,
4
4
  real-browser verification, and no known failing invariant. Later phases may
5
5
  refine earlier contracts, but may not bypass their responsibility boundaries.
6
6
 
7
- The working `../rte0` is a behavioral reference throughout the project. Existing
8
- behavior, especially host-specific editing, selection handling, and browser
9
- fixes, is first captured as black-box tests. RTE then preserves or deliberately
10
- improves it through smaller responsibilities; structural weaknesses in the old
11
- implementation are not mistaken for behavioral failures.
12
-
13
7
  ## Resume work
14
8
 
15
9
  Phases 0–3 provide the core, selection/range primitives, content model, scoped
package/js/rte/README.md CHANGED
@@ -13,6 +13,7 @@ import * as module from "https://cdn.jsdelivr.net/gh/u2ui/u2@main/js/rte/rte.js"
13
13
 
14
14
  ## Demos
15
15
 
16
+ [webkit-data-image-drag.html](http://gcdn.li/u2ui/u2@main/js/rte/tests/webkit-data-image-drag.html)
16
17
  [index.html](http://gcdn.li/u2ui/u2@main/js/rte/tests/index.html)
17
18
 
18
19
  ## Start here
@@ -35,9 +36,6 @@ normalization interactively at `/u2/js/rte/playground/`. The runner displays
35
36
  its own test count and result. A result is cross-browser evidence only after
36
37
  that exact revision has run in current Chromium, Firefox, and WebKit.
37
38
 
38
- `../rte0` is a read-only behavioral reference. Reuse proven behavior and CSS
39
- configuration ideas, but do not copy its architecture or modify its files.
40
-
41
39
  ## Intended features
42
40
 
43
41
  - Native `contenteditable`, `Selection`, `Range`, `beforeinput`, and Input
@@ -329,7 +327,6 @@ transactional undo/redo.
329
327
  - Exercise the new synchronous extension lifecycle with another contextual UI
330
328
  before adding dependency, ordering, or asynchronous setup concepts.
331
329
  - Build the browser test matrix for current Chromium, Firefox, and WebKit.
332
- - Port only the proven ideas from `../rte0`; keep its implementation untouched.
333
330
 
334
331
  ## About
335
332
 
@@ -4,12 +4,11 @@
4
4
  the currently active surface. It provides the roaming behavior; it does not
5
5
  create buttons, inject styles, choose icons, or define editor commands.
6
6
 
7
- The useful interaction model comes from the original `../rte0` toolbar: one
8
- shared toolbar follows the active editor, its items reflect the current
7
+ One shared toolbar follows the active editor, its items reflect the current
9
8
  selection, pointer interaction keeps the editor selection, and keyboard
10
- shortcuts invoke the same actions. RTE replaces the old global item registry,
11
- `execCommand()`, delayed focus repair, and automatic style injection with the
12
- existing core, surface, and command contracts.
9
+ shortcuts invoke the same actions. The core, surface, and command contracts
10
+ replace global item registries, `execCommand()`, delayed focus repair, and
11
+ automatic style injection.
13
12
 
14
13
  ## Contract
15
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u2ui",
3
- "version": "1.5.16",
3
+ "version": "1.5.18",
4
4
  "description": "HTML Advanced: More Capabilities, Same Feel, Same Simplicity",
5
5
  "keywords": ["web-components","pattern-library","component-library","ui-toolkit","design-system"],
6
6
  "author": "Tobias Buschor",
package/u2/projects.json CHANGED
@@ -196,14 +196,6 @@
196
196
  }
197
197
  },
198
198
  "el": {
199
- "rte0": {
200
- "name": "rte0",
201
- "description": "\"Rich\" Rich Text Editor (alpha)",
202
- "beta": false,
203
- "deprecated": false,
204
- "css": true,
205
- "js": true
206
- },
207
199
  "tabs": {
208
200
  "name": "tabs",
209
201
  "description": "Turns HTML structures with headings into an interactive, tabbed interface, using the content between headings as each tab’s content.",
@@ -568,14 +560,6 @@
568
560
  }
569
561
  },
570
562
  "js": {
571
- "rte0": {
572
- "name": "rte0",
573
- "description": "Easily Make Elements Editable with Intuitive Controls",
574
- "beta": false,
575
- "deprecated": false,
576
- "css": false,
577
- "js": false
578
- },
579
563
  "serviceWorker": {
580
564
  "name": "serviceWorker",
581
565
  "description": "",
@@ -1,6 +1,7 @@
1
1
  // deno run -A --no-lock ./u2/tools/update.repos.json.js
2
2
 
3
3
  const repos = {};
4
+ const HIDDEN = new Set(['rte0']);
4
5
 
5
6
  import * as fs from 'https://deno.land/std@0.100.0/fs/mod.ts';
6
7
 
@@ -13,6 +14,7 @@ base = base.replace(/file:\/\/\//, '/');
13
14
  for await (const entry of Deno.readDir(base+category)) {
14
15
  if (!entry.isDirectory) continue;
15
16
  const name = entry.name;
17
+ if (HIDDEN.has(name)) continue;
16
18
  const data = await writeReadMe(category, entry);
17
19
 
18
20
  const css = fs.existsSync(`${base}${category}/${name}/${name}.css`);
@@ -6,6 +6,7 @@ let base = import.meta.resolve('../../');
6
6
  base = base.replace(/file:\/\/\//, '/');
7
7
 
8
8
  const categories = ['attr', 'class', 'el', 'css', 'js'];
9
+ const HIDDEN = new Set(['rte0']);
9
10
 
10
11
  async function generateSkillMd() {
11
12
  const repos = {};
@@ -16,6 +17,7 @@ async function generateSkillMd() {
16
17
  for await (const entry of Deno.readDir(base + category)) {
17
18
  if (!entry.isDirectory) continue;
18
19
  const name = entry.name;
20
+ if (HIDDEN.has(name)) continue;
19
21
 
20
22
  const readmePath = `${base}${category}/${name}/README.md`;
21
23
  let description = '';
@@ -177,4 +179,4 @@ function trimLines(text) {
177
179
  return lines.join('\n');
178
180
  }
179
181
 
180
- generateSkillMd();
182
+ generateSkillMd();