Comments (4)
Take this with a grain of salt, since I am also not very familiar with the build scripts. But from what I can tell, this should work:
Step 1
Create a file packages/gnome-shell/src/global.d.ts
:
import Shell from "@girs/shell-13";
declare global {
const global: Shell.Global;
}
interface Math {
/**
* Returns {@link x} clamped to the inclusive range of {@link min} and {@link max}.
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/8a8539ee6766058b39d0a5c0961a08f76799f4da/js/ui/environment.js#L357
*
* @param x The value to be clamped.
* @param min The lower bound of the result.
* @param max The upper bound of the result.
*/
clamp(x: number, min: number, max: number): number;
}
// [...] further declarations as you see fit
Step 2
In packages/gnome-shell/scripts/generate-exports.js
, packages/gnome-shell/scripts/generate-files.js
, and packages/gnome-shell/scripts/generate-index.js
you can add global.d.ts
to the IGNORE_FILENAMES
array. This prevents the d.ts file from being exported as gnome resource module etc.
Run yarn run build
. The global.d.ts
file should be part of the dist
folder now and can be imported/referenced from downstream projects.
I haven't gave this much thought. @JumpLink does know the architecture alot better than I do :)
from gnome-shell.
Thank you very much, I will look at this in detail as soon as possible
from gnome-shell.
@JumpLink @schnz I've opened #13 for this 🙂
from gnome-shell.
The global.d.ts file should be part of the dist folder now
However, the document still said import '@girs/gnome-shell/extensions/global';
not import '@girs/gnome-shell/dist/extensions/global';
from gnome-shell.
Related Issues (15)
- Add support for ESM, CJS and globalThis.imports.(ui / misc)
- Usage without bundling? HOT 3
- Return type of `Main.layoutManager.getWorkAreaForMonitor` is incorrect. HOT 1
- When constructing `St.Widget`, specifying `layout_manager` should be reflected in types HOT 3
- `AppIcon.app` should be `Shell13.App` instead of just `any` HOT 1
- Extension.metadata is missing HOT 3
- `_leftBox` and `_rightBox` should exist in `Main.panel` HOT 1
- GNOME 46? HOT 4
- Template for official CLI HOT 1
- Suggestion: move away from Pre-Release to Release HOT 7
- [question] Cannot import Gtk using const { Gtk } = imports.gi; HOT 4
- cannot pass QuickMenuToggle props in constructor/_init HOT 4
- Gnome 45: How to move forward? HOT 15
- Some invalid return types HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gnome-shell.