buninu-browser 0.3.0 → 0.5.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/LICENSES/jsmdcui.txt +22 -0
- package/README.md +40 -4
- package/frontends/wayland/LICENSE-land +21 -0
- package/frontends/wayland/README.md +152 -0
- package/frontends/wayland/casty/LICENSE +21 -0
- package/frontends/wayland/casty/bookmarks.js +32 -0
- package/frontends/wayland/casty/click.js +96 -0
- package/frontends/wayland/casty/commands.js +61 -0
- package/frontends/wayland/casty/config.js +45 -0
- package/frontends/wayland/casty/download-directory.js +28 -0
- package/frontends/wayland/casty/download.js +49 -0
- package/frontends/wayland/casty/hints.js +334 -0
- package/frontends/wayland/casty/keys.js +56 -0
- package/frontends/wayland/casty/page-commands.js +80 -0
- package/frontends/wayland/casty/prompt-width.js +148 -0
- package/frontends/wayland/casty/urlbar.js +606 -0
- package/frontends/wayland/client.js +88 -0
- package/frontends/wayland/clipboard.js +80 -0
- package/frontends/wayland/index.js +130 -0
- package/frontends/wayland/input.js +75 -0
- package/frontends/wayland/protocol.js +55 -0
- package/frontends/wayland/protocols/wayland.xml +3248 -0
- package/frontends/wayland/protocols/xdg-shell.xml +1415 -0
- package/frontends/wayland/transport.js +120 -0
- package/frontends/wayland/urlbar.js +162 -0
- package/index.js +28 -1
- package/lib/audio/shared-connection.js +31 -0
- package/lib/cdp-server.js +15 -2
- package/lib/clipboard-command.js +10 -0
- package/lib/clipboard-powershell.js +22 -0
- package/lib/clipboard.js +37 -2
- package/lib/document-types.js +11 -0
- package/lib/headless-shell.js +54 -12
- package/lib/layout/text-layout.js +17 -9
- package/lib/paint/display-list.js +6 -1
- package/lib/qml/README.md +1427 -0
- package/lib/qml/builtins.js +771 -0
- package/lib/qml/canvas-dom.js +115 -0
- package/lib/qml/canvas.js +76 -0
- package/lib/qml/document.js +1199 -0
- package/lib/qml/fonts.js +69 -0
- package/lib/qml/format.js +9 -0
- package/lib/qml/host.js +352 -0
- package/lib/qml/images.js +199 -0
- package/lib/qml/launcher.js +132 -0
- package/lib/qml/loader.js +521 -0
- package/lib/qml/media-renderer.js +49 -0
- package/lib/qml/media.js +86 -0
- package/lib/qml/models.js +622 -0
- package/lib/qml/parser.js +381 -0
- package/lib/qml/qs +5 -0
- package/lib/qml/qscasty +3 -0
- package/lib/qml/qsheadless +3 -0
- package/lib/qml/qswayland +3 -0
- package/lib/qml/reactive.js +182 -0
- package/lib/qml/runtime.js +3603 -0
- package/lib/qml/shader/fragment.js +83 -0
- package/lib/qml/shader/qsb.js +27 -0
- package/lib/qml/shader/renderer.js +39 -0
- package/lib/qml/shader/runtime.js +61 -0
- package/lib/qml/shapes.js +251 -0
- package/lib/qml/shortcuts.js +65 -0
- package/lib/qml/text.js +109 -0
- package/lib/qml/textures.js +126 -0
- package/lib/qml/wayland-clipboard.js +32 -0
- package/lib/qml/window-constraints.js +16 -0
- package/lib/qml/worker-thread.js +70 -0
- package/lib/render-tree/index.js +16 -1
- package/lib/renderer/bindings.js +16 -1
- package/lib/renderer/canvas-2d.js +29 -0
- package/lib/renderer/document-selection.js +19 -0
- package/lib/renderer/host.js +45 -17
- package/lib/renderer/main.js +21 -6
- package/lib/renderer/page-realm.js +20 -10
- package/lib/renderer/page-renderer.js +497 -42
- package/lib/renderer/pointer-move.js +5 -3
- package/lib/renderer/render-interval.js +9 -0
- package/lib/renderer/text-input-paint.js +54 -0
- package/lib/renderer/text-input.js +57 -0
- package/lib/style/computed-style.js +10 -4
- package/package.json +1 -1
- package/test/audio-connection-lifetime.test.js +46 -0
- package/test/canvas-paint.test.js +8 -0
- package/test/clipboard.test.js +19 -0
- package/test/computed-style.test.js +12 -0
- package/test/document-selection.test.js +27 -0
- package/test/double-click.test.js +85 -0
- package/test/fixtures/canvas-damage.js +40 -0
- package/test/fixtures/fake-renderer.js +1 -0
- package/test/fixtures/flea-helpers/Dockerfile +36 -0
- package/test/fixtures/flea-helpers/bat.mjs +43 -0
- package/test/fixtures/flea-helpers/bin/bat +3 -0
- package/test/fixtures/flea-helpers/bin/bwrap +10 -0
- package/test/fixtures/flea-helpers/bin/bwrap-real-filter +9 -0
- package/test/fixtures/flea-helpers/bin/glow +3 -0
- package/test/fixtures/flea-helpers/bin/qs +3 -0
- package/test/fixtures/flea-helpers/bin/unsupported +3 -0
- package/test/fixtures/flea-helpers/check-highlighting.mjs +47 -0
- package/test/fixtures/flea-helpers/check-media.mjs +29 -0
- package/test/fixtures/flea-helpers/check-preview.mjs +27 -0
- package/test/fixtures/flea-helpers/check.mjs +36 -0
- package/test/fixtures/flea-helpers/highlight-cases.json +227 -0
- package/test/fixtures/flea-helpers/source-mime.xml +28 -0
- package/test/fixtures/flea-helpers/syntax-compat.mjs +23 -0
- package/test/fixtures/flea-thumbnail-stub/flea-placeholder.thumbnailer +4 -0
- package/test/fixtures/flea-thumbnail-stub/flea-thumbnail-stub +3 -0
- package/test/fixtures/omastorm-helpers/Dockerfile +35 -0
- package/test/fixtures/omastorm-helpers/check.mjs +56 -0
- package/test/fixtures/omastorm-helpers/launch.mjs +24 -0
- package/test/fixtures/omastorm-helpers/prepare.mjs +17 -0
- package/test/fixtures/omastorm-helpers/runtime.mjs +32 -0
- package/test/fixtures/pointer-paint-batching.js +23 -0
- package/test/fixtures/qml/flea/EscapeHint.qml +11 -0
- package/test/fixtures/qml/flea/LICENSE +21 -0
- package/test/fixtures/qml/flea/README.md +25 -0
- package/test/fixtures/qml/flea/Theme.qml +8 -0
- package/test/fixtures/qml/flea/demo.qml +24 -0
- package/test/fixtures/qml/flea/qmldir +3 -0
- package/test/fixtures/qml/flea-theme/LICENSE-Flea +21 -0
- package/test/fixtures/qml/flea-theme/LICENSE-Omarchy +20 -0
- package/test/fixtures/qml/flea-theme/README.md +70 -0
- package/test/fixtures/qml/flea-theme/button.qml +17 -0
- package/test/fixtures/qml/flea-theme/demo.qml +27 -0
- package/test/fixtures/qml/flea-theme/field.qml +21 -0
- package/test/fixtures/qml/flea-theme/imports/qs/Commons/BorderGeometry.js +373 -0
- package/test/fixtures/qml/flea-theme/imports/qs/Commons/Color.qml +258 -0
- package/test/fixtures/qml/flea-theme/imports/qs/Commons/I18n.qml +118 -0
- package/test/fixtures/qml/flea-theme/imports/qs/Commons/Numbers.js +19 -0
- package/test/fixtures/qml/flea-theme/imports/qs/Commons/Plural.js +91 -0
- package/test/fixtures/qml/flea-theme/imports/qs/Commons/Style.qml +561 -0
- package/test/fixtures/qml/flea-theme/imports/qs/Commons/Util.qml +188 -0
- package/test/fixtures/qml/flea-theme/imports/qs/Commons/qmldir +13 -0
- package/test/fixtures/qml/flea-theme/segment.qml +17 -0
- package/test/fixtures/qml/flea-theme/settings.qml +58 -0
- package/test/fixtures/qml/flea-theme/text-metrics.qml +10 -0
- package/test/fixtures/qml/flea-theme/ui/DialogButton.qml +150 -0
- package/test/fixtures/qml/flea-theme/ui/DialogField.qml +147 -0
- package/test/fixtures/qml/flea-theme/ui/EscapeHint.qml +11 -0
- package/test/fixtures/qml/flea-theme/ui/Glass.qml +114 -0
- package/test/fixtures/qml/flea-theme/ui/Glyph.qml +54 -0
- package/test/fixtures/qml/flea-theme/ui/GlyphSolid.qml +22 -0
- package/test/fixtures/qml/flea-theme/ui/Reveal.qml +54 -0
- package/test/fixtures/qml/flea-theme/ui/SettingsRuler.qml +85 -0
- package/test/fixtures/qml/flea-theme/ui/SettingsSegment.qml +85 -0
- package/test/fixtures/qml/flea-theme/ui/StableModel.qml +89 -0
- package/test/fixtures/qml/flea-theme/ui/Theme.qml +460 -0
- package/test/fixtures/qml/flea-theme/ui/ThemeColors.qml +43 -0
- package/test/fixtures/qml/flea-theme/ui/ViewState.qml +565 -0
- package/test/fixtures/qml/flea-theme/ui/js/Anchor.js +379 -0
- package/test/fixtures/qml/flea-theme/ui/js/AnchorHold.js +162 -0
- package/test/fixtures/qml/flea-theme/ui/js/Archive.js +157 -0
- package/test/fixtures/qml/flea-theme/ui/js/BackReturn.js +110 -0
- package/test/fixtures/qml/flea-theme/ui/js/Buttons.js +54 -0
- package/test/fixtures/qml/flea-theme/ui/js/ColumnMenu.js +111 -0
- package/test/fixtures/qml/flea-theme/ui/js/Columns.js +298 -0
- package/test/fixtures/qml/flea-theme/ui/js/Contrast.js +157 -0
- package/test/fixtures/qml/flea-theme/ui/js/Density.js +44 -0
- package/test/fixtures/qml/flea-theme/ui/js/DirSizes.js +129 -0
- package/test/fixtures/qml/flea-theme/ui/js/ExtThumbs.js +115 -0
- package/test/fixtures/qml/flea-theme/ui/js/Filter.js +284 -0
- package/test/fixtures/qml/flea-theme/ui/js/FolderSorts.js +108 -0
- package/test/fixtures/qml/flea-theme/ui/js/Format.js +305 -0
- package/test/fixtures/qml/flea-theme/ui/js/Icons.js +206 -0
- package/test/fixtures/qml/flea-theme/ui/js/Input.js +39 -0
- package/test/fixtures/qml/flea-theme/ui/js/KeyName.js +64 -0
- package/test/fixtures/qml/flea-theme/ui/js/Keymap.js +370 -0
- package/test/fixtures/qml/flea-theme/ui/js/Kinds.js +145 -0
- package/test/fixtures/qml/flea-theme/ui/js/Lists.js +11 -0
- package/test/fixtures/qml/flea-theme/ui/js/MakeDefault.js +186 -0
- package/test/fixtures/qml/flea-theme/ui/js/Match.js +27 -0
- package/test/fixtures/qml/flea-theme/ui/js/Material.js +109 -0
- package/test/fixtures/qml/flea-theme/ui/js/Menu.js +513 -0
- package/test/fixtures/qml/flea-theme/ui/js/Motion.js +16 -0
- package/test/fixtures/qml/flea-theme/ui/js/Mounts.js +320 -0
- package/test/fixtures/qml/flea-theme/ui/js/MouseNav.js +13 -0
- package/test/fixtures/qml/flea-theme/ui/js/Nav.js +328 -0
- package/test/fixtures/qml/flea-theme/ui/js/Palette.js +33 -0
- package/test/fixtures/qml/flea-theme/ui/js/Places.js +236 -0
- package/test/fixtures/qml/flea-theme/ui/js/Protocols.js +296 -0
- package/test/fixtures/qml/flea-theme/ui/js/RecentMode.js +154 -0
- package/test/fixtures/qml/flea-theme/ui/js/Search.js +396 -0
- package/test/fixtures/qml/flea-theme/ui/js/Settings.js +476 -0
- package/test/fixtures/qml/flea-theme/ui/js/SettingsAbout.js +99 -0
- package/test/fixtures/qml/flea-theme/ui/js/SettingsShelf.js +52 -0
- package/test/fixtures/qml/flea-theme/ui/js/Sort.js +127 -0
- package/test/fixtures/qml/flea-theme/ui/js/StateWords.js +42 -0
- package/test/fixtures/qml/flea-theme/ui/js/Swap.js +166 -0
- package/test/fixtures/qml/flea-theme/ui/js/TextSize.js +107 -0
- package/test/fixtures/qml/flea-theme/ui/js/Thumbs.js +158 -0
- package/test/fixtures/qml/flea-theme/ui/js/UiState.js +438 -0
- package/test/fixtures/qml/flea-theme/ui/js/Update.js +132 -0
- package/test/fixtures/qml/flea-theme/ui/js/UserDirs.js +56 -0
- package/test/fixtures/qml/flea-theme/ui/qmldir +227 -0
- package/test/fixtures/qml/hello.qml +26 -0
- package/test/fixtures/qml/imports/Demo/Toolkit/VersionLabel.qml +2 -0
- package/test/fixtures/qml/imports/Demo/Toolkit/VersionLabelNew.qml +2 -0
- package/test/fixtures/qml/imports/Demo/Toolkit/qmldir +3 -0
- package/test/fixtures/qml/imports/components/Badge.qml +15 -0
- package/test/fixtures/qml/imports/logic/base.js +2 -0
- package/test/fixtures/qml/imports/logic/counter.js +4 -0
- package/test/fixtures/qml/imports/logic/math.js +3 -0
- package/test/fixtures/qml/imports/logic/shared.js +3 -0
- package/test/fixtures/qml/imports/main.qml +21 -0
- package/test/fixtures/qml/imports/theme/Theme.qml +8 -0
- package/test/fixtures/qml/imports/theme/qmldir +2 -0
- package/test/fixtures/qml/multiply.qml +61 -0
- package/test/fixtures/qml-canvas-dom.js +90 -0
- package/test/fixtures/qml-fonts/main.qml +10 -0
- package/test/fixtures/qml-locale/check.mjs +6 -0
- package/test/fixtures/qml-locale/main.qml +8 -0
- package/test/fixtures/qml-media-audio.js +39 -0
- package/test/fixtures/qml-shader/grab.qml +14 -0
- package/test/fixtures/qml-shader/gradient.frag +5 -0
- package/test/fixtures/qml-shader/main.qml +14 -0
- package/test/fixtures/qml-shader/texture-grab.qml +25 -0
- package/test/fixtures/qml-shader/texture-size.frag +5 -0
- package/test/fixtures/qml-shader-check.mjs +24 -0
- package/test/fixtures/title-no-paint.js +20 -0
- package/test/helpers/flea-sandbox.js +48 -0
- package/test/helpers/quickshell-fixture.js +125 -0
- package/test/html-clipboard-wayland.test.js +47 -0
- package/test/index.test.js +13 -0
- package/test/manual-casty-without-qml.js +87 -0
- package/test/manual-double-click.html +21 -0
- package/test/manual-flea-application.js +49 -0
- package/test/manual-flea-binary.js +62 -0
- package/test/manual-flea-qml.js +9 -0
- package/test/manual-flea-settings.js +40 -0
- package/test/manual-flea-theme.js +40 -0
- package/test/manual-mouse-buttons.html +18 -0
- package/test/manual-omastorm-engine.mjs +19 -0
- package/test/manual-omastorm-shaders.mjs +28 -0
- package/test/manual-omastorm-software.mjs +25 -0
- package/test/manual-pointer-scroll.html +43 -0
- package/test/manual-qml-removal.js +46 -0
- package/test/manual-without-qml.js +45 -0
- package/test/pointer-drag.test.js +104 -0
- package/test/qml-canvas-dom.test.js +37 -0
- package/test/qml-canvas.test.js +21 -0
- package/test/qml-clipboard-bridge.test.js +25 -0
- package/test/qml-clipboard-wayland.test.js +40 -0
- package/test/qml-connections-timing.test.js +95 -0
- package/test/qml-controls-window.test.js +182 -0
- package/test/qml-dynamic.test.js +401 -0
- package/test/qml-flea-app.test.js +146 -0
- package/test/qml-flea-backend.test.js +78 -0
- package/test/qml-flea-columns-backend.test.js +38 -0
- package/test/qml-flea-compile.test.js +78 -0
- package/test/qml-flea-launcher.test.js +88 -0
- package/test/qml-flea-markdown-backend.test.js +31 -0
- package/test/qml-flea-media.test.js +28 -0
- package/test/qml-flea-navigation-backend.test.js +35 -0
- package/test/qml-flea-navigation-timing.test.js +147 -0
- package/test/qml-flea-preview-backend.test.js +53 -0
- package/test/qml-flea-previews.test.js +163 -0
- package/test/qml-flea-rows.test.js +101 -0
- package/test/qml-flea-textures.test.js +59 -0
- package/test/qml-flea-view-switch.test.js +33 -0
- package/test/qml-flea-wayland.test.js +68 -0
- package/test/qml-flea.test.js +34 -0
- package/test/qml-fonts.test.js +31 -0
- package/test/qml-grid-multiline.test.js +48 -0
- package/test/qml-host.test.js +238 -0
- package/test/qml-imports.test.js +102 -0
- package/test/qml-inherited-handlers.test.js +51 -0
- package/test/qml-input-selection.test.js +66 -0
- package/test/qml-interactions.test.js +309 -0
- package/test/qml-language.test.js +167 -0
- package/test/qml-launcher.test.js +54 -0
- package/test/qml-layout-text.test.js +205 -0
- package/test/qml-locale.test.js +45 -0
- package/test/qml-media.test.js +63 -0
- package/test/qml-nonvisual-visible.test.js +19 -0
- package/test/qml-persisted-delegates.test.js +45 -0
- package/test/qml-quickshell-controls.test.js +65 -0
- package/test/qml-quickshell-settings.test.js +62 -0
- package/test/qml-repeater.test.js +72 -0
- package/test/qml-shader-runtime.test.js +6 -0
- package/test/qml-shortcuts.test.js +39 -0
- package/test/qml-socket.test.js +60 -0
- package/test/qml-software-shader.test.js +55 -0
- package/test/qml-style-updates.test.js +124 -0
- package/test/qml-textures.test.js +66 -0
- package/test/qml-views.test.js +332 -0
- package/test/qml-window-update.test.js +36 -0
- package/test/qml-worker.test.js +69 -0
- package/test/qml.test.js +83 -0
- package/test/render-interval.test.js +33 -0
- package/test/renderer-host.test.js +11 -0
- package/test/text-input-pointer.test.js +31 -0
- package/test/text-input-scroll.test.js +29 -0
- package/test/text-input.test.js +47 -0
- package/test/title-no-paint.test.js +6 -0
- package/test/wayland-frontend.test.js +83 -0
- package/test/wayland-scroll.test.js +40 -0
- package/test/wayland-urlbar.test.js +61 -0
|
@@ -0,0 +1,771 @@
|
|
|
1
|
+
export const nonvisualTypes = new Set([
|
|
2
|
+
'MediaPlayer','AudioOutput','IdleInhibitor',
|
|
3
|
+
'LinearGradient',
|
|
4
|
+
'XmlListModel',
|
|
5
|
+
'XmlListModelRole',
|
|
6
|
+
'WorkerScript',
|
|
7
|
+
'LoggingCategory',
|
|
8
|
+
'ListModel',
|
|
9
|
+
'DelegateModel',
|
|
10
|
+
'DelegateModelGroup',
|
|
11
|
+
'PointHandler',
|
|
12
|
+
'Binding',
|
|
13
|
+
'Gradient',
|
|
14
|
+
'GradientStop',
|
|
15
|
+
'IpcHandler',
|
|
16
|
+
'DragHandler',
|
|
17
|
+
'FrameAnimation',
|
|
18
|
+
'ShellRoot',
|
|
19
|
+
'Behavior',
|
|
20
|
+
'NumberAnimation',
|
|
21
|
+
'PropertyAnimation',
|
|
22
|
+
'PauseAnimation',
|
|
23
|
+
'SequentialAnimation',
|
|
24
|
+
'ParallelAnimation',
|
|
25
|
+
'ScriptAction',
|
|
26
|
+
'PropertyAction',
|
|
27
|
+
'Component',
|
|
28
|
+
'Scale',
|
|
29
|
+
'Translate',
|
|
30
|
+
'Shortcut', 'Instantiator', 'Repeater',
|
|
31
|
+
'TapHandler',
|
|
32
|
+
'HoverHandler',
|
|
33
|
+
'QtObject',
|
|
34
|
+
'Singleton',
|
|
35
|
+
'Timer',
|
|
36
|
+
'Connections',
|
|
37
|
+
'FileView',
|
|
38
|
+
'Socket',
|
|
39
|
+
'Process',
|
|
40
|
+
'StdioCollector',
|
|
41
|
+
'SplitParser',
|
|
42
|
+
'TextMetrics',
|
|
43
|
+
'FontMetrics',
|
|
44
|
+
]);
|
|
45
|
+
export const typeProperties = {
|
|
46
|
+
FloatingWindow:['minimumSize','maximumSize'],
|
|
47
|
+
Button:['padding','contentItem','background','focusPolicy','hovered','pressed','down'],
|
|
48
|
+
MediaPlayer:['source','autoPlay','audioOutput','videoOutput','position','duration','playbackState','playing','mediaStatus','error','errorString','hasAudio','hasVideo','seekable','bufferProgress','loops','play','pause','stop'],
|
|
49
|
+
AudioOutput:['muted','volume'],
|
|
50
|
+
VideoOutput:['fillMode','sourceRect','contentRect'],
|
|
51
|
+
IdleInhibitor:['enabled','window','supported'],
|
|
52
|
+
|
|
53
|
+
LinearGradient: ['x1', 'y1', 'x2', 'y2', 'stops'],
|
|
54
|
+
XmlListModel: [
|
|
55
|
+
'source',
|
|
56
|
+
'xml',
|
|
57
|
+
'query',
|
|
58
|
+
'status',
|
|
59
|
+
'progress',
|
|
60
|
+
'count',
|
|
61
|
+
'reload',
|
|
62
|
+
'get',
|
|
63
|
+
'index',
|
|
64
|
+
'data',
|
|
65
|
+
'errorString',
|
|
66
|
+
],
|
|
67
|
+
XmlListModelRole: ['name', 'elementName', 'attributeName'],
|
|
68
|
+
WorkerScript: ['source', 'ready', 'sendMessage'],
|
|
69
|
+
LoggingCategory: ['name', 'defaultLogLevel'],
|
|
70
|
+
ListView: [
|
|
71
|
+
'footer',
|
|
72
|
+
'header',
|
|
73
|
+
'footerItem',
|
|
74
|
+
'headerItem',
|
|
75
|
+
'model',
|
|
76
|
+
'delegate',
|
|
77
|
+
'count',
|
|
78
|
+
'currentIndex',
|
|
79
|
+
'currentItem',
|
|
80
|
+
'contentItem',
|
|
81
|
+
'itemAtIndex',
|
|
82
|
+
'itemAt',
|
|
83
|
+
'indexAt',
|
|
84
|
+
'positionViewAtIndex',
|
|
85
|
+
'positionViewAtBeginning',
|
|
86
|
+
'positionViewAtEnd',
|
|
87
|
+
'forceLayout',
|
|
88
|
+
'cacheBuffer',
|
|
89
|
+
'displayMarginBeginning',
|
|
90
|
+
'displayMarginEnd',
|
|
91
|
+
'reuseItems',
|
|
92
|
+
'keyNavigationEnabled',
|
|
93
|
+
'keyNavigationWraps',
|
|
94
|
+
'highlightMoveDuration',
|
|
95
|
+
'highlightRangeMode',
|
|
96
|
+
'highlightFollowsCurrentItem',
|
|
97
|
+
'preferredHighlightBegin',
|
|
98
|
+
'preferredHighlightEnd',
|
|
99
|
+
'orientation',
|
|
100
|
+
'section',
|
|
101
|
+
],
|
|
102
|
+
GridView: [
|
|
103
|
+
'highlightFollowsCurrentItem',
|
|
104
|
+
'highlightRangeMode',
|
|
105
|
+
'preferredHighlightBegin',
|
|
106
|
+
'preferredHighlightEnd',
|
|
107
|
+
'footer',
|
|
108
|
+
'header',
|
|
109
|
+
'footerItem',
|
|
110
|
+
'headerItem',
|
|
111
|
+
'model',
|
|
112
|
+
'delegate',
|
|
113
|
+
'count',
|
|
114
|
+
'currentIndex',
|
|
115
|
+
'currentItem',
|
|
116
|
+
'itemAtIndex',
|
|
117
|
+
'itemAt',
|
|
118
|
+
'indexAt',
|
|
119
|
+
'positionViewAtIndex',
|
|
120
|
+
'positionViewAtBeginning',
|
|
121
|
+
'positionViewAtEnd',
|
|
122
|
+
'forceLayout',
|
|
123
|
+
'cacheBuffer',
|
|
124
|
+
'displayMarginBeginning',
|
|
125
|
+
'displayMarginEnd',
|
|
126
|
+
'reuseItems',
|
|
127
|
+
'keyNavigationEnabled',
|
|
128
|
+
'keyNavigationWraps',
|
|
129
|
+
'highlightMoveDuration',
|
|
130
|
+
'cellWidth',
|
|
131
|
+
'cellHeight',
|
|
132
|
+
'flow',
|
|
133
|
+
],
|
|
134
|
+
ListModel: [
|
|
135
|
+
'count',
|
|
136
|
+
'get',
|
|
137
|
+
'append',
|
|
138
|
+
'insert',
|
|
139
|
+
'remove',
|
|
140
|
+
'clear',
|
|
141
|
+
'set',
|
|
142
|
+
'setProperty',
|
|
143
|
+
'move',
|
|
144
|
+
'dynamicRoles',
|
|
145
|
+
],
|
|
146
|
+
DelegateModel: [
|
|
147
|
+
'model',
|
|
148
|
+
'delegate',
|
|
149
|
+
'groups',
|
|
150
|
+
'items',
|
|
151
|
+
'persistedItems',
|
|
152
|
+
'filterOnGroup',
|
|
153
|
+
'count',
|
|
154
|
+
],
|
|
155
|
+
DelegateModelGroup: [
|
|
156
|
+
'name',
|
|
157
|
+
'includeByDefault',
|
|
158
|
+
'count',
|
|
159
|
+
'get',
|
|
160
|
+
'addGroups',
|
|
161
|
+
'removeGroups',
|
|
162
|
+
'create',
|
|
163
|
+
'insert',
|
|
164
|
+
'remove',
|
|
165
|
+
'move',
|
|
166
|
+
],
|
|
167
|
+
IpcHandler: ['target', 'enabled'],
|
|
168
|
+
Binding: ['target', 'property', 'value', 'when', 'delayed', 'restoreMode'],
|
|
169
|
+
Gradient: ['orientation', 'stops'],
|
|
170
|
+
GradientStop: ['position', 'color'],
|
|
171
|
+
PathRectangle: [
|
|
172
|
+
'x',
|
|
173
|
+
'y',
|
|
174
|
+
'width',
|
|
175
|
+
'height',
|
|
176
|
+
'radius',
|
|
177
|
+
'topLeftRadius',
|
|
178
|
+
'topRightRadius',
|
|
179
|
+
'bottomLeftRadius',
|
|
180
|
+
'bottomRightRadius',
|
|
181
|
+
],
|
|
182
|
+
PointHandler: [
|
|
183
|
+
'enabled',
|
|
184
|
+
'acceptedButtons',
|
|
185
|
+
'active',
|
|
186
|
+
'point',
|
|
187
|
+
'target',
|
|
188
|
+
'grabPermissions',
|
|
189
|
+
],
|
|
190
|
+
DropArea: ['keys', 'containsDrag', 'drag'],
|
|
191
|
+
DragHandler: [
|
|
192
|
+
'target',
|
|
193
|
+
'enabled',
|
|
194
|
+
'acceptedButtons',
|
|
195
|
+
'active',
|
|
196
|
+
'dragThreshold',
|
|
197
|
+
'persistentTranslation',
|
|
198
|
+
'activeTranslation',
|
|
199
|
+
'centroid',
|
|
200
|
+
'xAxis',
|
|
201
|
+
'yAxis',
|
|
202
|
+
'grabPermissions',
|
|
203
|
+
],
|
|
204
|
+
FrameAnimation: [
|
|
205
|
+
'running',
|
|
206
|
+
'paused',
|
|
207
|
+
'frameTime',
|
|
208
|
+
'smoothFrameTime',
|
|
209
|
+
'elapsedTime',
|
|
210
|
+
'currentFrame',
|
|
211
|
+
'start',
|
|
212
|
+
'stop',
|
|
213
|
+
'restart',
|
|
214
|
+
],
|
|
215
|
+
Image: [
|
|
216
|
+
'source',
|
|
217
|
+
'sourceSize',
|
|
218
|
+
'sourceClipRect',
|
|
219
|
+
'fillMode',
|
|
220
|
+
'asynchronous',
|
|
221
|
+
'cache',
|
|
222
|
+
'status',
|
|
223
|
+
'progress',
|
|
224
|
+
'smooth',
|
|
225
|
+
'mipmap',
|
|
226
|
+
'paintedWidth',
|
|
227
|
+
'paintedHeight',
|
|
228
|
+
'mirror',
|
|
229
|
+
'autoTransform',
|
|
230
|
+
'retainWhileLoading',
|
|
231
|
+
],
|
|
232
|
+
Flickable: [
|
|
233
|
+
'contentX',
|
|
234
|
+
'contentY',
|
|
235
|
+
'contentWidth',
|
|
236
|
+
'contentHeight',
|
|
237
|
+
'contentItem',
|
|
238
|
+
'interactive',
|
|
239
|
+
'boundsBehavior',
|
|
240
|
+
'boundsMovement',
|
|
241
|
+
'flickableDirection',
|
|
242
|
+
'moving',
|
|
243
|
+
'flicking',
|
|
244
|
+
'dragging',
|
|
245
|
+
'originX',
|
|
246
|
+
'originY',
|
|
247
|
+
'leftMargin',
|
|
248
|
+
'rightMargin',
|
|
249
|
+
'topMargin',
|
|
250
|
+
'bottomMargin',
|
|
251
|
+
'atXBeginning',
|
|
252
|
+
'atXEnd',
|
|
253
|
+
'atYBeginning',
|
|
254
|
+
'atYEnd',
|
|
255
|
+
'cancelFlick',
|
|
256
|
+
'returnToBounds',
|
|
257
|
+
'flick',
|
|
258
|
+
'pressDelay',
|
|
259
|
+
'pixelAligned',
|
|
260
|
+
'maximumFlickVelocity',
|
|
261
|
+
'flickDeceleration',
|
|
262
|
+
],
|
|
263
|
+
TextInput: [
|
|
264
|
+
'text',
|
|
265
|
+
'font',
|
|
266
|
+
'color',
|
|
267
|
+
'cursorPosition',
|
|
268
|
+
'cursorVisible','cursorDelegate',
|
|
269
|
+
'selectionStart',
|
|
270
|
+
'selectionEnd',
|
|
271
|
+
'selectedText',
|
|
272
|
+
'select',
|
|
273
|
+
'selectAll',
|
|
274
|
+
'deselect',
|
|
275
|
+
'insert',
|
|
276
|
+
'remove',
|
|
277
|
+
'positionAt',
|
|
278
|
+
'positionToRectangle',
|
|
279
|
+
'cursorRectangle',
|
|
280
|
+
'contentWidth',
|
|
281
|
+
'contentHeight',
|
|
282
|
+
'echoMode',
|
|
283
|
+
'passwordCharacter',
|
|
284
|
+
'maximumLength',
|
|
285
|
+
'inputMethodHints',
|
|
286
|
+
'inputMethodComposing',
|
|
287
|
+
'acceptableInput',
|
|
288
|
+
'validator',
|
|
289
|
+
'autoScroll',
|
|
290
|
+
'persistentSelection',
|
|
291
|
+
'renderType',
|
|
292
|
+
'selectionColor',
|
|
293
|
+
'selectedTextColor',
|
|
294
|
+
],
|
|
295
|
+
TextEdit: [
|
|
296
|
+
'text',
|
|
297
|
+
'font',
|
|
298
|
+
'color',
|
|
299
|
+
'cursorPosition',
|
|
300
|
+
'cursorVisible','cursorDelegate',
|
|
301
|
+
'selectionStart',
|
|
302
|
+
'selectionEnd',
|
|
303
|
+
'selectedText',
|
|
304
|
+
'select',
|
|
305
|
+
'selectAll',
|
|
306
|
+
'deselect',
|
|
307
|
+
'insert',
|
|
308
|
+
'remove',
|
|
309
|
+
'contentWidth',
|
|
310
|
+
'contentHeight',
|
|
311
|
+
],
|
|
312
|
+
Behavior: ['enabled', 'targetProperty', 'animation'],
|
|
313
|
+
NumberAnimation: [
|
|
314
|
+
'target',
|
|
315
|
+
'targets',
|
|
316
|
+
'property',
|
|
317
|
+
'properties',
|
|
318
|
+
'from',
|
|
319
|
+
'to',
|
|
320
|
+
'duration',
|
|
321
|
+
'easing',
|
|
322
|
+
'running',
|
|
323
|
+
'loops',
|
|
324
|
+
'alwaysRunToEnd',
|
|
325
|
+
'start',
|
|
326
|
+
'stop',
|
|
327
|
+
'restart',
|
|
328
|
+
'complete',
|
|
329
|
+
],
|
|
330
|
+
PropertyAnimation: [
|
|
331
|
+
'target',
|
|
332
|
+
'targets',
|
|
333
|
+
'property',
|
|
334
|
+
'properties',
|
|
335
|
+
'from',
|
|
336
|
+
'to',
|
|
337
|
+
'duration',
|
|
338
|
+
'easing',
|
|
339
|
+
'running',
|
|
340
|
+
'loops',
|
|
341
|
+
'start',
|
|
342
|
+
'stop',
|
|
343
|
+
'restart',
|
|
344
|
+
'complete',
|
|
345
|
+
],
|
|
346
|
+
PauseAnimation: ['duration', 'running', 'loops', 'start', 'stop', 'restart'],
|
|
347
|
+
SequentialAnimation: ['running', 'loops', 'start', 'stop', 'restart'],
|
|
348
|
+
ParallelAnimation: ['running', 'loops', 'start', 'stop', 'restart'],
|
|
349
|
+
ScriptAction: ['script', 'running'],
|
|
350
|
+
PropertyAction: ['target', 'property', 'value', 'running'],
|
|
351
|
+
Component: ['status', 'createObject', 'errorString'],
|
|
352
|
+
Loader: [
|
|
353
|
+
'source',
|
|
354
|
+
'sourceComponent',
|
|
355
|
+
'active',
|
|
356
|
+
'asynchronous',
|
|
357
|
+
'item',
|
|
358
|
+
'status',
|
|
359
|
+
'progress',
|
|
360
|
+
'setSource',
|
|
361
|
+
],
|
|
362
|
+
|
|
363
|
+
Scale: ['xScale', 'yScale', 'origin'],
|
|
364
|
+
Translate: ['x', 'y'],
|
|
365
|
+
Shape: ['preferredRendererType', 'transform'],
|
|
366
|
+
Canvas: ['loadImage','unloadImage','isImageLoaded','isImageLoading','isImageError','imageLoaded','available','contextType','context','canvasSize','getContext','requestPaint','markDirty','paint','painted','requestAnimationFrame','cancelRequestAnimationFrame'],
|
|
367
|
+
ShaderEffect: ['fragmentShader','vertexShader','status','log','blending','cullMode'],
|
|
368
|
+
ShaderEffectSource: ['mipmap','sourceItem', 'sourceRect', 'textureSize', 'hideSource', 'live', 'scheduleUpdate', 'scheduledUpdateCompleted'],
|
|
369
|
+
ShapePath: [
|
|
370
|
+
'fillItem',
|
|
371
|
+
'fillGradient',
|
|
372
|
+
'strokeColor',
|
|
373
|
+
'fillColor',
|
|
374
|
+
'strokeWidth',
|
|
375
|
+
'capStyle',
|
|
376
|
+
'joinStyle',
|
|
377
|
+
'strokeStyle',
|
|
378
|
+
'dashPattern',
|
|
379
|
+
'dashOffset',
|
|
380
|
+
'fillRule',
|
|
381
|
+
],
|
|
382
|
+
PathSvg: ['path'],
|
|
383
|
+
Row: ['spacing'],
|
|
384
|
+
Flow: ['flow', 'spacing', 'layoutDirection'],
|
|
385
|
+
RowLayout: ['spacing', 'layoutDirection', 'uniformCellSizes'],
|
|
386
|
+
ColumnLayout: ['spacing', 'uniformCellSizes'],
|
|
387
|
+
GridLayout: ['columns','rows','rowSpacing','columnSpacing'],
|
|
388
|
+
PathMultiline: ['paths'],
|
|
389
|
+
Grid: ['columns', 'rows', 'spacing', 'rowSpacing', 'columnSpacing'],
|
|
390
|
+
|
|
391
|
+
Shortcut: ['sequence','sequences','enabled','autoRepeat','context','portableText','nativeText','activated','activatedAmbiguously'],
|
|
392
|
+
Instantiator: ['model','delegate','count','active','asynchronous','object','objectAt','objectAdded','objectRemoved'],
|
|
393
|
+
Repeater: ['model', 'delegate', 'count', 'itemAt'],
|
|
394
|
+
MouseArea: [
|
|
395
|
+
'acceptedButtons',
|
|
396
|
+
'hoverEnabled',
|
|
397
|
+
'pressed',
|
|
398
|
+
'containsMouse',
|
|
399
|
+
'mouseX',
|
|
400
|
+
'mouseY',
|
|
401
|
+
'preventStealing',
|
|
402
|
+
'propagateComposedEvents',
|
|
403
|
+
'cursorShape',
|
|
404
|
+
],
|
|
405
|
+
TapHandler: [
|
|
406
|
+
'enabled',
|
|
407
|
+
'acceptedButtons',
|
|
408
|
+
'gesturePolicy',
|
|
409
|
+
'tapped',
|
|
410
|
+
'pressed',
|
|
411
|
+
'point',
|
|
412
|
+
'tapCount',
|
|
413
|
+
],
|
|
414
|
+
HoverHandler: ['enabled', 'cursorShape', 'hovered', 'point'],
|
|
415
|
+
Timer: [
|
|
416
|
+
'interval',
|
|
417
|
+
'running',
|
|
418
|
+
'repeat',
|
|
419
|
+
'triggeredOnStart',
|
|
420
|
+
'start',
|
|
421
|
+
'stop',
|
|
422
|
+
'restart',
|
|
423
|
+
'triggered',
|
|
424
|
+
],
|
|
425
|
+
Connections: ['target', 'enabled', 'ignoreUnknownSignals'],
|
|
426
|
+
FileView: [
|
|
427
|
+
'atomicWrites',
|
|
428
|
+
'setText',
|
|
429
|
+
'setData',
|
|
430
|
+
'path',
|
|
431
|
+
'blockLoading',
|
|
432
|
+
'preload',
|
|
433
|
+
'watchChanges',
|
|
434
|
+
'printErrors',
|
|
435
|
+
'loaded',
|
|
436
|
+
'text',
|
|
437
|
+
'data',
|
|
438
|
+
'reload',
|
|
439
|
+
'waitForJob',
|
|
440
|
+
'loadedChanged',
|
|
441
|
+
'fileChanged',
|
|
442
|
+
'loadFailed',
|
|
443
|
+
],
|
|
444
|
+
Socket: ['path', 'connected', 'parser', 'write', 'flush', 'error'],
|
|
445
|
+
Process: [
|
|
446
|
+
'running',
|
|
447
|
+
'command',
|
|
448
|
+
'stdout',
|
|
449
|
+
'stderr',
|
|
450
|
+
'exited',
|
|
451
|
+
'startDetached',
|
|
452
|
+
'stdinEnabled',
|
|
453
|
+
'write',
|
|
454
|
+
'signal',
|
|
455
|
+
'closeWriteChannel',
|
|
456
|
+
'workingDirectory',
|
|
457
|
+
'environment',
|
|
458
|
+
'clearEnvironment',
|
|
459
|
+
'processId',
|
|
460
|
+
],
|
|
461
|
+
SplitParser: ['splitMarker', 'read'],
|
|
462
|
+
StdioCollector: ['text', 'data', 'waitForEnd', 'streamFinished'],
|
|
463
|
+
TextMetrics: [
|
|
464
|
+
'elide',
|
|
465
|
+
'elideWidth',
|
|
466
|
+
'elidedText',
|
|
467
|
+
'text',
|
|
468
|
+
'font',
|
|
469
|
+
'advanceWidth',
|
|
470
|
+
'width',
|
|
471
|
+
'height',
|
|
472
|
+
'boundingRect',
|
|
473
|
+
],
|
|
474
|
+
FontMetrics: [
|
|
475
|
+
'elidedText',
|
|
476
|
+
'boundingRect',
|
|
477
|
+
'tightBoundingRect',
|
|
478
|
+
'font',
|
|
479
|
+
'height',
|
|
480
|
+
'ascent',
|
|
481
|
+
'descent',
|
|
482
|
+
'averageCharacterWidth',
|
|
483
|
+
'advanceWidth',
|
|
484
|
+
],
|
|
485
|
+
};
|
|
486
|
+
for (const type of ['ListView', 'GridView'])
|
|
487
|
+
typeProperties[type].push(...typeProperties.Flickable);
|
|
488
|
+
|
|
489
|
+
// Serialized into the page together with the reactive runtime.
|
|
490
|
+
export function createQt(localeEnvironment = null) {
|
|
491
|
+
// Only local QML has the host capability. Never expose process.env to a
|
|
492
|
+
// sandboxed page; accept an explicit snapshot for deterministic tests.
|
|
493
|
+
const localeEnv = localeEnvironment ?? Object.fromEntries(
|
|
494
|
+
['LC_ALL','LC_MESSAGES','LC_TIME','LC_MEASUREMENT','LANG'].map(key =>
|
|
495
|
+
[key, globalThis.__qmlHost?.env(key) || '']));
|
|
496
|
+
const bindingValues = new WeakMap();
|
|
497
|
+
const clamp = (x) => Math.max(0, Math.min(1, Number(x)));
|
|
498
|
+
function rgba(r, g, b, a = 1) {
|
|
499
|
+
r = clamp(r);
|
|
500
|
+
g = clamp(g);
|
|
501
|
+
b = clamp(b);
|
|
502
|
+
a = clamp(a);
|
|
503
|
+
const max = Math.max(r, g, b),
|
|
504
|
+
min = Math.min(r, g, b),
|
|
505
|
+
d = max - min;
|
|
506
|
+
const hue =
|
|
507
|
+
d === 0
|
|
508
|
+
? -1
|
|
509
|
+
: (max === r
|
|
510
|
+
? (g - b) / d + (g < b ? 6 : 0)
|
|
511
|
+
: max === g
|
|
512
|
+
? (b - r) / d + 2
|
|
513
|
+
: (r - g) / d + 4) / 6;
|
|
514
|
+
const hex = (v) =>
|
|
515
|
+
Math.round(v * 255)
|
|
516
|
+
.toString(16)
|
|
517
|
+
.padStart(2, '0');
|
|
518
|
+
return Object.freeze({
|
|
519
|
+
r,
|
|
520
|
+
g,
|
|
521
|
+
b,
|
|
522
|
+
a,
|
|
523
|
+
hsvSaturation: max === 0 ? 0 : d / max,
|
|
524
|
+
hsvValue: max,
|
|
525
|
+
hsvHue: hue,
|
|
526
|
+
toString() {
|
|
527
|
+
return '#' + (a < 1 ? hex(a) : '') + hex(r) + hex(g) + hex(b);
|
|
528
|
+
},
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
function color(value) {
|
|
532
|
+
if (value && typeof value === 'object' && 'r' in value) return value;
|
|
533
|
+
let s = String(value).toLowerCase();
|
|
534
|
+
s =
|
|
535
|
+
{
|
|
536
|
+
black: '#000000',
|
|
537
|
+
white: '#ffffff',
|
|
538
|
+
transparent: '#00000000',
|
|
539
|
+
red: '#ff0000',
|
|
540
|
+
blue: '#0000ff',
|
|
541
|
+
green: '#008000',
|
|
542
|
+
}[s] || s;
|
|
543
|
+
if (/^#[0-9a-f]{3}$/.test(s))
|
|
544
|
+
s = '#' + [...s.slice(1)].map((c) => c + c).join('');
|
|
545
|
+
if (/^#[0-9a-f]{6}$/.test(s))
|
|
546
|
+
return rgba(
|
|
547
|
+
parseInt(s.slice(1, 3), 16) / 255,
|
|
548
|
+
parseInt(s.slice(3, 5), 16) / 255,
|
|
549
|
+
parseInt(s.slice(5, 7), 16) / 255,
|
|
550
|
+
);
|
|
551
|
+
if (/^#[0-9a-f]{8}$/.test(s))
|
|
552
|
+
return rgba(
|
|
553
|
+
parseInt(s.slice(3, 5), 16) / 255,
|
|
554
|
+
parseInt(s.slice(5, 7), 16) / 255,
|
|
555
|
+
parseInt(s.slice(7, 9), 16) / 255,
|
|
556
|
+
parseInt(s.slice(1, 3), 16) / 255,
|
|
557
|
+
);
|
|
558
|
+
throw Error('Unsupported QML color: ' + s);
|
|
559
|
+
}
|
|
560
|
+
const keys = {
|
|
561
|
+
Escape: 0x01000000,
|
|
562
|
+
Tab: 0x01000001,
|
|
563
|
+
Backtab: 0x01000002,
|
|
564
|
+
Backspace: 0x01000003,
|
|
565
|
+
Return: 0x01000004,
|
|
566
|
+
Enter: 0x01000005,
|
|
567
|
+
Insert: 0x01000006,
|
|
568
|
+
Delete: 0x01000007,
|
|
569
|
+
Home: 0x01000010,
|
|
570
|
+
End: 0x01000011,
|
|
571
|
+
Left: 0x01000012,
|
|
572
|
+
Up: 0x01000013,
|
|
573
|
+
Right: 0x01000014,
|
|
574
|
+
Down: 0x01000015,
|
|
575
|
+
PageUp: 0x01000016,
|
|
576
|
+
PageDown: 0x01000017,
|
|
577
|
+
Space: 32,
|
|
578
|
+
AltGr: 0x01001103,
|
|
579
|
+
CapsLock: 0x01000024,
|
|
580
|
+
NumLock: 0x01000025,
|
|
581
|
+
ScrollLock: 0x01000026,
|
|
582
|
+
Menu: 0x01000055,
|
|
583
|
+
};
|
|
584
|
+
Object.assign(keys, {
|
|
585
|
+
Exclam: 33,
|
|
586
|
+
QuoteDbl: 34,
|
|
587
|
+
NumberSign: 35,
|
|
588
|
+
Dollar: 36,
|
|
589
|
+
Percent: 37,
|
|
590
|
+
Ampersand: 38,
|
|
591
|
+
Apostrophe: 39,
|
|
592
|
+
ParenLeft: 40,
|
|
593
|
+
ParenRight: 41,
|
|
594
|
+
Asterisk: 42,
|
|
595
|
+
Plus: 43,
|
|
596
|
+
Comma: 44,
|
|
597
|
+
Minus: 45,
|
|
598
|
+
Period: 46,
|
|
599
|
+
Slash: 47,
|
|
600
|
+
Colon: 58,
|
|
601
|
+
Semicolon: 59,
|
|
602
|
+
Less: 60,
|
|
603
|
+
Equal: 61,
|
|
604
|
+
Greater: 62,
|
|
605
|
+
Question: 63,
|
|
606
|
+
At: 64,
|
|
607
|
+
BracketLeft: 91,
|
|
608
|
+
Backslash: 92,
|
|
609
|
+
BracketRight: 93,
|
|
610
|
+
AsciiCircum: 94,
|
|
611
|
+
Underscore: 95,
|
|
612
|
+
QuoteLeft: 96,
|
|
613
|
+
BraceLeft: 123,
|
|
614
|
+
Bar: 124,
|
|
615
|
+
BraceRight: 125,
|
|
616
|
+
AsciiTilde: 126,
|
|
617
|
+
Shift: 0x01000020,
|
|
618
|
+
Control: 0x01000021,
|
|
619
|
+
Meta: 0x01000022,
|
|
620
|
+
Alt: 0x01000023,
|
|
621
|
+
});
|
|
622
|
+
for (let i = 0; i < 26; i++) keys[String.fromCharCode(65 + i)] = 65 + i;
|
|
623
|
+
for (let i = 0; i < 10; i++) keys[String(i)] = 48 + i;
|
|
624
|
+
for (let i = 1; i <= 35; i++) keys['F' + i] = 0x01000030 + i - 1;
|
|
625
|
+
function localeTag(name) {
|
|
626
|
+
const raw = String(name || 'C');
|
|
627
|
+
const base = raw.split('.')[0].split('@')[0];
|
|
628
|
+
if (/^(C|POSIX)$/i.test(base)) return 'C';
|
|
629
|
+
try {
|
|
630
|
+
const tag = Intl.getCanonicalLocales(base.replaceAll('_','-'))[0];
|
|
631
|
+
return Intl.DateTimeFormat.supportedLocalesOf([tag]).length ? tag : 'C';
|
|
632
|
+
} catch { return 'C'; }
|
|
633
|
+
}
|
|
634
|
+
function systemLocale(category) {
|
|
635
|
+
return localeTag(localeEnv.LC_ALL || localeEnv[category] || localeEnv.LANG || 'C');
|
|
636
|
+
}
|
|
637
|
+
function locale(name) {
|
|
638
|
+
const explicit = name !== undefined && name !== '';
|
|
639
|
+
const actual = explicit ? localeTag(name) : systemLocale('LC_MESSAGES');
|
|
640
|
+
const timeLocale = explicit ? actual : systemLocale('LC_TIME');
|
|
641
|
+
const measurement = explicit ? actual : systemLocale('LC_MEASUREMENT');
|
|
642
|
+
const region = measurement === 'C' ? '' : new Intl.Locale(measurement).maximize().region;
|
|
643
|
+
const pattern = (time, short) => {
|
|
644
|
+
if (timeLocale === 'C') return time ? (short ? 'HH:mm' : 'HH:mm:ss t')
|
|
645
|
+
: (short ? 'd MM yyyy' : 'dddd, d MMMM yyyy');
|
|
646
|
+
const formatter = new Intl.DateTimeFormat(timeLocale, time
|
|
647
|
+
? {hour:'numeric',minute:'2-digit',...(short?{}:{second:'2-digit'})}
|
|
648
|
+
: {dateStyle:short?'short':'full'});
|
|
649
|
+
const twelve = ['h11','h12'].includes(formatter.resolvedOptions().hourCycle);
|
|
650
|
+
return formatter.formatToParts(new Date(2024,10,23,17,45,36)).map(p => {
|
|
651
|
+
switch(p.type) {
|
|
652
|
+
case 'year': return p.value.length === 2 ? 'yy' : 'yyyy';
|
|
653
|
+
case 'month': return /^\d+$/.test(p.value) ? (p.value.length === 2 ? 'MM' : 'M') : 'MMMM';
|
|
654
|
+
case 'day': return p.value.length === 2 ? 'dd' : 'd';
|
|
655
|
+
case 'weekday': return 'dddd';
|
|
656
|
+
case 'hour': return twelve ? 'h' : 'HH';
|
|
657
|
+
case 'minute': return 'mm';
|
|
658
|
+
case 'second': return 'ss';
|
|
659
|
+
case 'dayPeriod': return 'AP';
|
|
660
|
+
default: return /[A-Za-z']/.test(p.value) ? "'"+p.value.replaceAll("'","''")+"'" : p.value;
|
|
661
|
+
}
|
|
662
|
+
}).join('');
|
|
663
|
+
};
|
|
664
|
+
return {name:actual.replaceAll('-','_'),measurementSystem:region==='US'?1:region==='GB'?2:0,
|
|
665
|
+
timeFormat:format=>pattern(true,format===1),dateFormat:format=>pattern(false,format===1)};
|
|
666
|
+
}
|
|
667
|
+
function formatDateTime(input,format='ddd MMM d yyyy HH:mm:ss') {
|
|
668
|
+
const d=input instanceof Date?input:new Date(input);if(!Number.isFinite(d.getTime()))return '';
|
|
669
|
+
const pad=(n,width=2)=>String(n).padStart(width,'0'),hour=/AP|ap/.test(format)?d.getHours()%12||12:d.getHours();
|
|
670
|
+
const localTag=systemLocale('LC_TIME'), intlTag=localTag==='C'?'en-US':localTag;
|
|
671
|
+
const names=(options)=>new Intl.DateTimeFormat(intlTag,options).format(d);
|
|
672
|
+
const values={yyyy:d.getFullYear(),yy:pad(d.getFullYear()%100),MMMM:names({month:'long'}),MMM:names({month:'short'}),MM:pad(d.getMonth()+1),M:d.getMonth()+1,dddd:names({weekday:'long'}),ddd:names({weekday:'short'}),dd:pad(d.getDate()),d:d.getDate(),HH:pad(d.getHours()),H:d.getHours(),hh:pad(hour),h:hour,mm:pad(d.getMinutes()),m:d.getMinutes(),ss:pad(d.getSeconds()),s:d.getSeconds(),zzz:pad(d.getMilliseconds(),3),z:d.getMilliseconds(),AP:d.getHours()<12?'AM':'PM',ap:d.getHours()<12?'am':'pm',t:new Intl.DateTimeFormat(undefined,{timeZoneName:'short'}).formatToParts(d).find(p=>p.type==='timeZoneName')?.value||''};
|
|
673
|
+
return String(format).replace(/'((?:[^']|'')*)'|yyyy|MMMM|dddd|zzz|MMM|ddd|yy|MM|dd|HH|hh|mm|ss|AP|ap|[MdHhmszt]/g,(token,literal)=>literal!==undefined?literal.replaceAll("''", "'"):String(values[token]));
|
|
674
|
+
}
|
|
675
|
+
return {
|
|
676
|
+
locale,formatDateTime,formatTime:(date,format="HH:mm:ss")=>formatDateTime(date,format),formatDate:(date,format="ddd MMM d yyyy")=>formatDateTime(date,format),
|
|
677
|
+
NoFocus:0, TabFocus:1, ClickFocus:2, StrongFocus:3,
|
|
678
|
+
WindowShortcut: 1, ApplicationShortcut: 2,
|
|
679
|
+
...Object.fromEntries(
|
|
680
|
+
Object.entries(keys).map(([name, value]) => ['Key_' + name, value]),
|
|
681
|
+
),
|
|
682
|
+
rgba,
|
|
683
|
+
color,
|
|
684
|
+
darker: (v, f = 2) => {
|
|
685
|
+
const c = color(v);
|
|
686
|
+
return rgba(c.r / f, c.g / f, c.b / f, c.a);
|
|
687
|
+
},
|
|
688
|
+
application: { active: true },
|
|
689
|
+
styleHints: {
|
|
690
|
+
wheelScrollLines: 3,
|
|
691
|
+
mouseDoubleClickInterval: 400,
|
|
692
|
+
startDragDistance: 10,
|
|
693
|
+
startDragTime: 500,
|
|
694
|
+
},
|
|
695
|
+
atob,
|
|
696
|
+
alpha: (value, a) => {
|
|
697
|
+
const c = color(value);
|
|
698
|
+
return rgba(c.r, c.g, c.b, a);
|
|
699
|
+
},
|
|
700
|
+
colorEqual: (a, b) => {
|
|
701
|
+
const x = color(a),
|
|
702
|
+
y = color(b);
|
|
703
|
+
return ['r', 'g', 'b', 'a'].every((k) => Math.abs(x[k] - y[k]) < 1 / 255);
|
|
704
|
+
},
|
|
705
|
+
vector2d: (x,y)=>({x:Number(x),y:Number(y)}),
|
|
706
|
+
vector3d: (x,y,z)=>({x:Number(x),y:Number(y),z:Number(z)}),
|
|
707
|
+
vector4d: (x,y,z,w)=>({x:Number(x),y:Number(y),z:Number(z),w:Number(w)}),
|
|
708
|
+
point: (x, y) => ({ x, y }),
|
|
709
|
+
size: (width, height) => ({ width, height }),
|
|
710
|
+
rect: (x, y, width, height) => ({ x, y, width, height }),
|
|
711
|
+
MouseFocusReason: 0,
|
|
712
|
+
TabFocusReason: 1,
|
|
713
|
+
BacktabFocusReason: 2,
|
|
714
|
+
ActiveWindowFocusReason: 3,
|
|
715
|
+
OtherFocusReason: 7,
|
|
716
|
+
Horizontal: 1,
|
|
717
|
+
Vertical: 2,
|
|
718
|
+
SplitHCursor: 12,
|
|
719
|
+
UserRole: 256,
|
|
720
|
+
AlignLeft: 1,
|
|
721
|
+
AlignRight: 2,
|
|
722
|
+
AlignHCenter: 4,
|
|
723
|
+
AlignTop: 32,
|
|
724
|
+
AlignBottom: 64,
|
|
725
|
+
AlignVCenter: 128,
|
|
726
|
+
AlignBaseline: 256,
|
|
727
|
+
AlignCenter: 132,
|
|
728
|
+
LeftToRight: 0,
|
|
729
|
+
RightToLeft: 1,
|
|
730
|
+
CopyAction: 1,
|
|
731
|
+
MoveAction: 2,
|
|
732
|
+
LinkAction: 4,
|
|
733
|
+
IgnoreAction: 0,
|
|
734
|
+
LeftButton: 1,
|
|
735
|
+
RightButton: 2,
|
|
736
|
+
MiddleButton: 4,
|
|
737
|
+
BackButton: 8,
|
|
738
|
+
ForwardButton: 16,
|
|
739
|
+
ArrowCursor: 0,
|
|
740
|
+
IBeamCursor: 4,
|
|
741
|
+
SizeVerCursor: 5,
|
|
742
|
+
SizeHorCursor: 6,
|
|
743
|
+
OpenHandCursor: 17,
|
|
744
|
+
ClosedHandCursor: 18,
|
|
745
|
+
NoButton: 0,
|
|
746
|
+
AllButtons: 0x07ffffff,
|
|
747
|
+
NoModifier: 0,
|
|
748
|
+
NoScrollPhase: 0,
|
|
749
|
+
ScrollBegin: 1,
|
|
750
|
+
ScrollUpdate: 2,
|
|
751
|
+
ScrollEnd: 3,
|
|
752
|
+
ScrollMomentum: 4,
|
|
753
|
+
ShiftModifier: 0x02000000,
|
|
754
|
+
PointingHandCursor: 13,
|
|
755
|
+
ControlModifier: 0x04000000,
|
|
756
|
+
AltModifier: 0x08000000,
|
|
757
|
+
MetaModifier: 0x10000000,
|
|
758
|
+
binding: (fn) => {
|
|
759
|
+
if (typeof fn !== 'function')
|
|
760
|
+
throw Error('Qt.binding expects a function');
|
|
761
|
+
const value = {};
|
|
762
|
+
bindingValues.set(value, fn);
|
|
763
|
+
return value;
|
|
764
|
+
},
|
|
765
|
+
bindingValue: (value) =>
|
|
766
|
+
value && typeof value === 'object' ? bindingValues.get(value) : undefined,
|
|
767
|
+
createComponent: () => {
|
|
768
|
+
throw Error('Qt.createComponent is not implemented');
|
|
769
|
+
},
|
|
770
|
+
};
|
|
771
|
+
}
|