Skip to content

Commit

Permalink
build: phoenix build complete
Browse files Browse the repository at this point in the history
  • Loading branch information
devvaannsh authored and abose committed Sep 25, 2024
1 parent ae5a137 commit fecc4b7
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 242 deletions.
10 changes: 2 additions & 8 deletions docs/generatedApiDocs/features/NewFileContentManager-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,13 @@ A promise that resolves with the content text or rejects if there is no content

Returns a promise that resolves to the default text content of the given file after querying
all the content providers. If no text is returned by any providers, it will return an empty string "".
To get the default content given a path
NewFileContentManager.getInitialContentForFile("/path/to/file.jsx");

### Parameters

* `fullPath` **[string][1]**

### Examples

To get the default content given a path

```javascript
NewFileContentManager.getInitialContentForFile("/path/to/file.jsx");
```

Returns **[Promise][2]<[string][1]>** The text contents

[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
Expand Down
6 changes: 3 additions & 3 deletions docs/generatedApiDocs/features/QuickViewManager-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

QuickViewManager provides support to add interactive preview popups on hover over the main editors.
Extensions can register to provide previews with `QuickViewManager.registerQuickViewProvider` API.
![quick-view-image.png][1]
![quick-view-youtube.png][2]
!\[quick-view-image.png]\([https://docs-images.phcode.dev/phcode-sdk/quick-view-image.png][1] alt="quick view image" /)
!\[quick-view-youtube.png]\([https://docs-images.phcode.dev/phcode-sdk/quick-view-youtube.png][2] alt="quick view youtube image" /)

### See Related: SelectionViewManager

Expand All @@ -15,7 +15,7 @@ QuickViewManager API.
* SelectionViews popup only once user selects a text by mouse or hover over a region with text selection.
* Quickviews popup on mouse hover.

![image][4]
!\[image]\([https://user-images.githubusercontent.com/5336369/186434397-3db55789-6077-4d02-b4e2-78ef3f663399.png][4] alt="user image" /)

## Usage

Expand Down
6 changes: 3 additions & 3 deletions docs/generatedApiDocs/features/SelectionViewManager-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ SelectionViewManager provides support to add interactive preview popups on selec
This can be used to provide interactive editor controls on a selected element.

Extensions can register to provide previews with `SelectionViewManager.registerSelectionViewProvider` API.
![image][1]
![selection view][2]
!\[image]\([https://user-images.githubusercontent.com/5336369/186434397-3db55789-6077-4d02-b4e2-78ef3f663399.png][1] alt="user image" /)
!\[selection view]\([https://user-images.githubusercontent.com/5336369/186434671-c1b263e5-19a9-4a9d-8f90-507df5f881b5.gif][2] alt="user gif" /)

### See Related: QuickViewManager

Expand All @@ -17,7 +17,7 @@ SelectionViewManager API.
* SelectionViews popup only once user selects a text by mouse or hover over a region with text selection.
* Quickviews popup on mouse hover.

![quick-view-youtube.png][4]
!\[quick-view-youtube.png]\([https://docs-images.phcode.dev/phcode-sdk/quick-view-youtube.png][4] alt="quick view youtube image" /)

## Usage

Expand Down
94 changes: 39 additions & 55 deletions docs/generatedApiDocs/utils/EventManager-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,24 @@ EventManager.triggerEvent("drawImage-Handler", "someEventName", "param1", "param
Registers a named EventHandler. Event handlers are created using the call:
`EventDispatcher.makeEventDispatcher(Command.prototype);`

Type: [function][1]

### Parameters

* `handlerName` **[string][2]** a unique name of the handler.
* `eventDispatcher` **[object][3]** An EventDispatcher that will be used to trigger events.

### Examples

To register a close dialogue event handler in an extension:

```javascript
// in close-dialogue.js module winthin the extension, do the following:
const EventDispatcher = brackets.getModule("utils/EventDispatcher"),
EventDispatcher.makeEventDispatcher(exports);
const EventManager = brackets.getModule("utils/EventManager");

// Note: for event handler names, please change the <extensionName> to your extension name
// Note: for event handler names, please change the `extensionName` to your extension name
// to prevent collisions. EventHandlers starting with `ph-` and `br-` are reserved as system handlers
// and not available for use in extensions.
EventManager.registerEventHandler("<extensionName>-closeDialogueHandler", exports);
EventManager.registerEventHandler("`extensionName`-closeDialogueHandler", exports);
// Once the event handler is registered, see triggerEvent API on how to raise events
```

Type: [function][1]

### Parameters

* `handlerName` **[string][2]** a unique name of the handler.
* `eventDispatcher` **[object][3]** An EventDispatcher that will be used to trigger events.

Returns **[boolean][4]**

Expand All @@ -76,6 +71,11 @@ Returns **[boolean][4]**

Triggers an event on the named event handler.

To trigger an event to the `closeDialogue` event handler registered above
// anywhere in code, do the following:
const EventManager = brackets.getModule("utils/EventManager");
EventManager.triggerEvent("closeDialogueHandler", "someEvent", "param1", "param2", ...);

Type: [function][1]

### Parameters
Expand All @@ -84,16 +84,6 @@ Type: [function][1]
* `eventName` the event name as recognised by the handler. this is usually a string.
* `eventParams` **...any** Can be a comma seperated list of args or a single argument.

### Examples

To trigger an event to the `closeDialogue` event handler registered above

```javascript
// anywhere in code, do the following:
const EventManager = brackets.getModule("utils/EventManager");
EventManager.triggerEvent("closeDialogueHandler", "someEvent", "param1", "param2", ...);
```

## onmessage

This function acts as a secure event handler for all 'message' events targeted at the window object.
Expand All @@ -103,43 +93,33 @@ Instead of directly overriding window.onmessage, extensions or other elements th
listen to these events should register their named eventHandler with `EventManager`.

By default, only origins part of `window.Phoenix.TRUSTED_ORIGINS` are whitelisted. If your extension is
bringing in a cross-origin ifrmame say `http://mydomain.com`, you should add it to the whitelist by setting
`window.Phoenix.TRUSTED_ORIGINS["http://mydomain.com"]=true;`
bringing in a cross-origin ifrmame say \[`http://mydomain.com`], you should add it to the whitelist by setting
`window.Phoenix.TRUSTED_ORIGINS ["http://mydomain.com"] = true;`

### Parameters

* `event` **[MessageEvent][6]** The 'message' event targeted at the window object. The event's
'data' property should have a 'handlerName' and `eventName` property that will be triggered in phcode.

### Examples

```javascript
// We will try to communicate within an embedded iframe and an extension

// In your extension in phoenix, register a handlerName to process a new kind of event.
const EventDispatcher = brackets.getModule("utils/EventDispatcher"),
EventDispatcher.makeEventDispatcher(exports);
const EventManager = brackets.getModule("utils/EventManager");
// Note: for event handler names, please change the <extensionName> to your extension name
// to prevent collisions. EventHandlers starting with `ph-` and `br-` are reserved as system handlers
// and not available for use in extensions.
window.Phoenix.TRUSTED_ORIGINS["http://mydomain.com"]=true;
EventManager.registerEventHandler("<extensionName>-iframeMessageHandler", exports);
exports.on("iframeHelloEvent", function(_ev, event){
console.log(event.data.message);
});

// Now from your iframe, send a message to the above event handler using:
window.parent.postMessage({
handlerName: "<extensionName>-iframeMessageHandler",
'data' property should have a 'handlerName' and `eventName` property that will be triggered in phcode.// We will try to communicate within an embedded iframe and an extension// In your extension in phoenix, register a handlerName to process a new kind of event.
const EventDispatcher = brackets.getModule("utils/EventDispatcher"),
EventDispatcher.makeEventDispatcher(exports);
const EventManager = brackets.getModule("utils/EventManager");
// Note: for event handler names, please change the `extensionName` to your extension name
// to prevent collisions. EventHandlers starting with `ph-` and `br-` are reserved as system handlers
// and not available for use in extensions.
window.Phoenix.TRUSTED_ORIGINS \["[http://mydomain.com][7]"] = true;
EventManager.registerEventHandler("`extensionName`-iframeMessageHandler", exports);
exports.on("iframeHelloEvent", function(\_ev, event){
console.log(event.data.message);
});// Now from your iframe, send a message to the above event handler using:
window.parent.postMessage({
handlerName: "`extensionName`-iframeMessageHandler",
eventName: "iframeHelloEvent",
message: "hello world"
}, '*');
// `you should replace * with the trusted domains list in production for security.` See how this can be
// done securely with this example: https://github.com/phcode-dev/phcode.live/blob/6d64386fbb9d671cdb64622bc48ffe5f71959bff/docs/virtual-server-loader.js#L43
// Abstract is that, pass in the parentOrigin as a query string parameter in iframe, and validate it against
// a trusted domains list in your iframe.
```
}, '\*');
// `you should replace * with the trusted domains list in production for security.` See how this can be
// done securely with this example: [https://github.com/phcode-dev/phcode.live/blob/6d64386fbb9d671cdb64622bc48ffe5f71959bff/docs/virtual-server-loader.js#L43][8]
// Abstract is that, pass in the parentOrigin as a query string parameter in iframe, and validate it against
// a trusted domains list in your iframe.

[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function

Expand All @@ -152,3 +132,7 @@ window.parent.postMessage({
[5]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

[6]: https://developer.mozilla.org/docs/Web/API/MessageEvent

[7]: http://mydomain.com

[8]: https://github.com/phcode-dev/phcode.live/blob/6d64386fbb9d671cdb64622bc48ffe5f71959bff/docs/virtual-server-loader.js#L43
28 changes: 9 additions & 19 deletions docs/generatedApiDocs/utils/ExtensionInterface-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,16 @@ interface made available.

Registers a named extension interface. Will overwrite if an interface of the same name is already present.

To register an interface `angularCli`
ExtensionInterface.registerExtensionInterface("angularCli", exports);

Type: [function][1]

### Parameters

* `extensionInterfaceName` **[string][2]**
* `interfaceObject` **[Object][3]**

### Examples

To register an interface `angularCli`

```javascript
ExtensionInterface.registerExtensionInterface("angularCli", exports);
```

## isExistsExtensionInterface

Returns true is an interface of the given name exists.
Expand All @@ -74,25 +69,20 @@ Returns **[boolean][4]**
Returns a promise that gets resolved only when an ExtensionInterface of the given name is registered. Use this
getter to get hold of extensions interface predictably.

Type: [function][1]

### Parameters

* `extensionInterfaceName`

### Examples

To get a registered interface `angularCli`

```javascript
let angularCli;
ExtensionInterface.waitAndGetExtensionInterface("angularCli").then(interfaceObj=> angularCli = interfaceObj);
...
if(angularCli){ // check if angular cli is avilable
angularCli.callSomeFunction();
}
...
```

Type: [function][1]

### Parameters

* `extensionInterfaceName`

Returns **[Promise][5]**

Expand Down
28 changes: 8 additions & 20 deletions docs/generatedApiDocs/utils/FeatureGate-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ if(FeatureGate.isFeatureEnabled(FEATURE_NEW_COLORS)){
## registerFeatureGate

Registers a named feature with the default enabled state.
To register a feature gate with name `myExtension.newColors`
const FEATURE_NEW_COLORS = 'myExtension.newColors';
FeatureGate.registerFeatureGate(FEATURE_NEW_COLORS, false); // false is the default value here

Type: [function][1]

Expand All @@ -49,15 +52,6 @@ Type: [function][1]
* `featureName` **[string][2]**
* `enabledDefault` **[boolean][3]**

### Examples

To register a feature gate with name `myExtension.newColors`

```javascript
const FEATURE_NEW_COLORS = 'myExtension.newColors';
FeatureGate.registerFeatureGate(FEATURE_NEW_COLORS, false); // false is the default value here
```

## getAllRegisteredFeatures

Returns an array of all named registered feature gates.
Expand All @@ -69,24 +63,18 @@ Returns **\[[String][2]]** list of registered features
## isFeatureEnabled

Returns true is an featureGate is enabled either by default or overridden by the user using local storage.
To check if the feature `myExtension.newColors` is enabled
const FEATURE_NEW_COLORS = 'myExtension.newColors';
if(FeatureGate.isFeatureEnabled(FEATURE_NEW_COLORS)){
// do fancy colors here
}

Type: [function][1]

### Parameters

* `featureName` **[string][2]**

### Examples

To check if the feature `myExtension.newColors` is enabled

```javascript
const FEATURE_NEW_COLORS = 'myExtension.newColors';
if(FeatureGate.isFeatureEnabled(FEATURE_NEW_COLORS)){
// do fancy colors here
}
```

Returns **[boolean][3]**

## setFeatureEnabled
Expand Down
22 changes: 5 additions & 17 deletions docs/generatedApiDocs/utils/Metrics-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Type: [Object][1]
## countEvent

log a numeric count >=0
To log that user clicked searchButton 5 times:
Metrics.countEvent(Metrics.EVENT_TYPE.UI, "searchButton", "click");
Metrics.countEvent(Metrics.EVENT_TYPE.UI, "searchButton", "click", 5);

Type: [function][2]

Expand All @@ -47,18 +50,11 @@ Type: [function][2]
needs to be logged- should be a js var compatible string
* `count` **[number][5]** > \=0 , optional, if not set defaults to 1 (optional, default `1`)

### Examples

To log that user clicked searchButton 5 times:

```javascript
Metrics.countEvent(Metrics.EVENT_TYPE.UI, "searchButton", "click");
Metrics.countEvent(Metrics.EVENT_TYPE.UI, "searchButton", "click", 5);
```

## valueEvent

log a numeric value (number).
To log that startup time is 200ms:
Metrics.valueEvent(Metrics.EVENT_TYPE.PERFORMANCE, "startupTime", "ms", 200);

Type: [function][2]

Expand All @@ -72,14 +68,6 @@ Type: [function][2]
needs to be logged- should be a js var compatible string
* `value` **[number][5]**

### Examples

To log that startup time is 200ms:

```javascript
Metrics.valueEvent(Metrics.EVENT_TYPE.PERFORMANCE, "startupTime", "ms", 200);
```

## flushMetrics

Send all pending metrics, useful before app quit.
Expand Down
Loading

0 comments on commit fecc4b7

Please sign in to comment.