clickgo 6.9.0 → 6.10.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.
Files changed (44) hide show
  1. package/AGENTS.md +16 -0
  2. package/README.md +4 -0
  3. package/dist/app/demo.cga +0 -0
  4. package/dist/app/task.cga +0 -0
  5. package/dist/clickgo.d.ts +2 -1
  6. package/dist/index.js +1 -1
  7. package/dist/lib/command/native.d.ts +18 -0
  8. package/dist/lib/command/palette.d.ts +10 -0
  9. package/dist/lib/command/schema.d.ts +31 -0
  10. package/dist/lib/command.d.ts +218 -0
  11. package/dist/lib/native.d.ts +12 -0
  12. package/dist/lib/task.d.ts +2 -0
  13. package/doc/clickgo-rag.md +2376 -537
  14. package/package.json +9 -3
  15. package/test/core-module-loading.mjs +0 -169
  16. package/test/desktop.mjs +0 -715
  17. package/test/dock-lifecycle.mjs +0 -280
  18. package/test/dom-style.mjs +0 -261
  19. package/test/form-launcher.mjs +0 -177
  20. package/test/form-modal-layer.mjs +0 -75
  21. package/test/form-native-regions.mjs +0 -115
  22. package/test/form-native-style.mjs +0 -80
  23. package/test/form-native.mjs +0 -68
  24. package/test/form-notify-animation.mjs +0 -102
  25. package/test/form-notify.mjs +0 -90
  26. package/test/form-viewport.mjs +0 -127
  27. package/test/iconview.mjs +0 -70
  28. package/test/jodit-lifecycle.mjs +0 -212
  29. package/test/locale-integrity.mjs +0 -189
  30. package/test/pop-max-size.mjs +0 -66
  31. package/test/rtl-archive.mjs +0 -440
  32. package/test/rtl-direction.mjs +0 -193
  33. package/test/scroll.mjs +0 -145
  34. package/test/select.mjs +0 -885
  35. package/test/sidebar-toggle.mjs +0 -75
  36. package/test/task-package-loading.mjs +0 -94
  37. package/test/task-start.mjs +0 -141
  38. package/test/task-tray.mjs +0 -331
  39. package/test/tool-assets.mjs +0 -64
  40. package/test/tool-clone.mjs +0 -42
  41. package/test/toolbox.mjs +0 -88
  42. package/test/tuieditor-locale.mjs +0 -175
  43. package/test/vflow.mjs +0 -122
  44. package/test/web-drag-mask.mjs +0 -96
package/test/scroll.mjs DELETED
@@ -1,145 +0,0 @@
1
- import assert from 'node:assert/strict';
2
- import { readFile } from 'node:fs/promises';
3
- import vm from 'node:vm';
4
- import { JSDOM } from 'jsdom';
5
- import ts from 'typescript';
6
- import { getClassPrototype, lang } from '../dist/lib/tool.js';
7
-
8
- const dom = new JSDOM('<!doctype html><html><body></body></html>');
9
- for (const name of ['window', 'document', 'Element', 'HTMLElement', 'SVGElement', 'Node']) {
10
- Object.defineProperty(globalThis, name, { configurable: true, value: dom.window[name] });
11
- }
12
- const { createApp, reactive, nextTick, h } = await import('vue');
13
- const style = document.createElement('style');
14
- style.textContent = await readFile(new URL('../dist/sources/control/scroll/style.css', import.meta.url), 'utf8');
15
- document.head.append(style);
16
- const state = reactive({ locale: 'en', direction: 'h', length: 1000, client: 200, offset: 250 });
17
- const errors = [];
18
- const watchers = [];
19
- const rolls = [];
20
- const frames = new Set();
21
- process.on('unhandledRejection', error => { errors.push(error); });
22
- HTMLElement.prototype.getBoundingClientRect = function() {
23
- const length = this.classList.contains('bar') ? 400 : 460;
24
- return { width: state.direction === 'h' ? length : 30, height: state.direction === 'v' ? length : 30, left: 0, top: 0 };
25
- };
26
-
27
- // Retain ClickGo's computed $el getter to exercise the real first-render order.
28
- class AbstractControl {
29
- get element() { return this.$el; }
30
- get refs() { return this.$refs; }
31
- get locale() { return state.locale; }
32
- get localeDirection() { return lang.getDirection(this.locale); }
33
- watch(...args) { return this.$watch(...args); }
34
- emit(...args) { this.$emit(...args); }
35
- propInt(name) { return parseInt(this.props[name]); }
36
- propBoolean(name) { return this.props[name] === true || this.props[name] === 'true'; }
37
- }
38
- const clickgo = {
39
- control: { AbstractControl },
40
- dom: {
41
- isRtl: el => el instanceof Element && dom.window.getComputedStyle(el).direction === 'rtl',
42
- watchSize: (control, el, callback, immediate) => {
43
- assert.ok(el instanceof HTMLElement && el.isConnected);
44
- watchers.push(callback);
45
- if (immediate) callback();
46
- },
47
- },
48
- modules: { pointer: {
49
- hover() {},
50
- down: (event, options) => { options.down(); options.up(); },
51
- } },
52
- task: {
53
- onFrame: (control, callback) => { callback(); frames.add(1); return 1; },
54
- offFrame: (control, id) => { frames.delete(id); },
55
- },
56
- };
57
- const source = await readFile(new URL('../dist/sources/control/scroll/code.ts', import.meta.url), 'utf8');
58
- const exports = {};
59
- vm.runInNewContext(ts.transpileModule(source, {
60
- compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022 },
61
- }).outputText, { exports, require: () => clickgo });
62
- const instance = new exports.default();
63
- const prototype = getClassPrototype(instance);
64
- const Scroll = {
65
- template: await readFile(new URL('../dist/sources/control/scroll/layout.html', import.meta.url), 'utf8'),
66
- props: Object.fromEntries(Object.entries(instance.props).map(([name, value]) => [name, { default: value }])),
67
- emits: instance.emits,
68
- data: () => Object.fromEntries(Object.entries(instance).filter(([name]) => !['props', 'emits'].includes(name))),
69
- computed: prototype.access,
70
- methods: prototype.method,
71
- created() { this.props = this.$props; },
72
- async mounted() { await this.$nextTick(); this.onMounted(); },
73
- };
74
- const host = document.createElement('div');
75
- document.body.append(host);
76
- const app = createApp({
77
- render() {
78
- return h('div', { dir: lang.getDirection(state.locale) }, [h(Scroll, {
79
- ref: 'scroll', direction: state.direction, length: state.length, client: state.client, offset: state.offset,
80
- 'onUpdate:offset': offset => { state.offset = offset; },
81
- onRoll: () => { rolls.push(state.offset); },
82
- })]);
83
- },
84
- });
85
- app.config.errorHandler = error => { errors.push(error); };
86
- const root = app.mount(host);
87
-
88
- /** --- Drain render, mounted watchers and reactive updates. --- */
89
- async function flush() {
90
- for (let i = 0; i < 10; ++i) await nextTick();
91
- await new Promise(resolve => setImmediate(resolve));
92
- assert.deepEqual(errors, [], 'Scroll must mount/update without runtime errors');
93
- }
94
- await flush();
95
- const scroll = root.$refs.scroll;
96
- assert.equal(scroll.element, host.querySelector('.wrap'));
97
- assert.equal(scroll.barPx, 400);
98
- assert.equal(scroll.blockPx, 80);
99
- assert.equal(host.querySelector('.start').style.width, '30px');
100
- assert.equal(host.querySelector('.end').style.width, '30px');
101
- assert.equal(scroll.offsetPx, 100);
102
- assert.match(host.querySelector('.block').style.transform, /translate3d\(100px, 0, 0\)/);
103
- host.querySelector('.end').dispatchEvent(new dom.window.Event('pointerdown', { bubbles: true }));
104
- await flush();
105
- assert.equal(state.offset, 260);
106
- assert.equal(rolls.length, 1);
107
- assert.equal(frames.size, 0, 'pointer release stops the frame timer');
108
- state.locale = 'ar';
109
- await flush();
110
- assert.equal(scroll.isRtl, true);
111
- assert.equal(scroll.offsetPx, 216);
112
- assert.equal(dom.window.getComputedStyle(host.querySelector('.bar')).direction, 'ltr',
113
- 'the track must use a left origin for the physical translateX coordinate');
114
- host.querySelector('.start').dispatchEvent(new dom.window.Event('pointerdown', { bubbles: true }));
115
- await flush();
116
- assert.equal(state.offset, 250);
117
- assert.equal(scroll.offsetPx, 220);
118
- state.direction = 'v';
119
- await flush();
120
- watchers[0]();
121
- await flush();
122
- assert.equal(scroll.isRtl, false);
123
- assert.equal(host.querySelector('.start').style.height, '30px');
124
- assert.equal(host.querySelector('.start').style.width, '');
125
- assert.match(host.querySelector('.block').style.transform, /translate3d\(0, 100px, 0\)/);
126
- state.direction = 'h';
127
- state.locale = 'en';
128
- await flush();
129
- watchers[0]();
130
- await flush();
131
- assert.equal(host.querySelector('.end').style.width, '30px');
132
- assert.equal(scroll.offsetPx, 100);
133
- state.length = 300;
134
- await flush();
135
- assert.equal(state.offset, 100, 'shrinking the range clamps the offset');
136
- state.client = 400;
137
- await flush();
138
- assert.equal(state.offset, 0);
139
- assert.equal(host.querySelector('.wrap').getAttribute('data-cg-disabled'), '');
140
- host.querySelector('.end').dispatchEvent(new dom.window.Event('pointerdown', { bubbles: true }));
141
- await flush();
142
- assert.equal(state.offset, 0);
143
- app.unmount();
144
- await flush();
145
- console.log('Scroll real Vue mount, arrow sizes/events, range changes and live RTL/direction switching passed.');