2021-01-19 05:12:45 +08:00
|
|
|
{
|
|
|
|
"name": "discourse",
|
|
|
|
"version": "0.0.0",
|
|
|
|
"private": true,
|
2022-08-18 06:27:16 +08:00
|
|
|
"description": "A platform for community discussion. Free, open, simple.",
|
|
|
|
"license": "GPL-2.0-only",
|
|
|
|
"author": "Discourse",
|
2021-01-19 05:12:45 +08:00
|
|
|
"directories": {
|
|
|
|
"doc": "doc",
|
|
|
|
"test": "tests"
|
|
|
|
},
|
|
|
|
"scripts": {
|
|
|
|
"build": "ember build",
|
|
|
|
"start": "ember serve",
|
2023-04-12 20:15:53 +08:00
|
|
|
"test": "ember test",
|
2023-09-14 19:25:06 +08:00
|
|
|
"postinstall": "../run-patch-package"
|
2021-01-19 05:12:45 +08:00
|
|
|
},
|
2021-08-27 05:19:44 +08:00
|
|
|
"dependencies": {
|
2023-03-24 06:20:33 +08:00
|
|
|
"@glimmer/syntax": "^0.84.3",
|
2022-11-16 16:10:58 +08:00
|
|
|
"discourse-hbr": "1.0.0",
|
|
|
|
"discourse-widget-hbs": "1.0.0",
|
2023-09-25 21:14:24 +08:00
|
|
|
"ember-route-template": "^1.0.1",
|
2023-05-05 07:02:51 +08:00
|
|
|
"ember-source": "~3.28.12",
|
2023-08-02 07:07:36 +08:00
|
|
|
"handlebars": "^4.7.8",
|
2023-06-30 19:01:45 +08:00
|
|
|
"pretty-text": "1.0.0"
|
2023-04-20 20:57:40 +08:00
|
|
|
},
|
|
|
|
"devDependencies": {
|
2023-10-13 06:08:07 +08:00
|
|
|
"@babel/core": "^7.23.2",
|
2023-10-12 18:02:35 +08:00
|
|
|
"@babel/standalone": "^7.23.2",
|
2023-08-25 19:44:26 +08:00
|
|
|
"@colors/colors": "^1.6.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"@discourse/backburner.js": "^2.7.1-0",
|
|
|
|
"@discourse/itsatrap": "^2.0.10",
|
|
|
|
"@ember-compat/tracked-built-ins": "^0.9.1",
|
2023-10-12 18:02:08 +08:00
|
|
|
"@ember/legacy-built-in-components": "^0.5.0",
|
2023-05-03 16:25:13 +08:00
|
|
|
"@ember/optional-features": "^2.0.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"@ember/render-modifiers": "^2.1.0",
|
|
|
|
"@ember/string": "^3.1.1",
|
|
|
|
"@ember/test-helpers": "^2.9.4",
|
2023-10-09 08:32:47 +08:00
|
|
|
"@embroider/compat": "^3.2.3",
|
2023-09-30 01:00:33 +08:00
|
|
|
"@embroider/core": "^3.3.0",
|
2023-08-09 19:04:41 +08:00
|
|
|
"@embroider/macros": "^1.13.1",
|
2023-09-30 01:00:33 +08:00
|
|
|
"@embroider/webpack": "^3.2.0",
|
DEV: FloatKit (#23650)
This PR introduces three new concepts to Discourse codebase through an addon called "FloatKit":
- menu
- tooltip
- toast
## Tooltips
### Component
Simple cases can be express with an API similar to DButton:
```hbs
<DTooltip
@Label={{i18n "foo.bar"}}
@ICON="check"
@content="Something"
/>
```
More complex cases can use blocks:
```hbs
<DTooltip>
<:trigger>
{{d-icon "check"}}
<span>{{i18n "foo.bar"}}</span>
</:trigger>
<:content>
Something
</:content>
</DTooltip>
```
### Service
You can manually show a tooltip using the `tooltip` service:
```javascript
const tooltipInstance = await this.tooltip.show(
document.querySelector(".my-span"),
options
)
// and later manual close or destroy it
tooltipInstance.close();
tooltipInstance.destroy();
// you can also just close any open tooltip through the service
this.tooltip.close();
```
The service also allows you to register event listeners on a trigger, it removes the need for you to manage open/close of a tooltip started through the service:
```javascript
const tooltipInstance = this.tooltip.register(
document.querySelector(".my-span"),
options
)
// when done you can destroy the instance to remove the listeners
tooltipInstance.destroy();
```
Note that the service also allows you to use a custom component as content which will receive `@data` and `@close` as args:
```javascript
const tooltipInstance = await this.tooltip.show(
document.querySelector(".my-span"),
{
component: MyComponent,
data: { foo: 1 }
}
)
```
## Menus
Menus are very similar to tooltips and provide the same kind of APIs:
### Component
```hbs
<DMenu @ICON="plus" @Label={{i18n "foo.bar"}}>
<ul>
<li>Foo</li>
<li>Bat</li>
<li>Baz</li>
</ul>
</DMenu>
```
They also support blocks:
```hbs
<DMenu>
<:trigger>
{{d-icon "plus"}}
<span>{{i18n "foo.bar"}}</span>
</:trigger>
<:content>
<ul>
<li>Foo</li>
<li>Bat</li>
<li>Baz</li>
</ul>
</:content>
</DMenu>
```
### Service
You can manually show a menu using the `menu` service:
```javascript
const menuInstance = await this.menu.show(
document.querySelector(".my-span"),
options
)
// and later manual close or destroy it
menuInstance.close();
menuInstance.destroy();
// you can also just close any open tooltip through the service
this.menu.close();
```
The service also allows you to register event listeners on a trigger, it removes the need for you to manage open/close of a tooltip started through the service:
```javascript
const menuInstance = this.menu.register(
document.querySelector(".my-span"),
options
)
// when done you can destroy the instance to remove the listeners
menuInstance.destroy();
```
Note that the service also allows you to use a custom component as content which will receive `@data` and `@close` as args:
```javascript
const menuInstance = await this.menu.show(
document.querySelector(".my-span"),
{
component: MyComponent,
data: { foo: 1 }
}
)
```
## Toasts
Interacting with toasts is made only through the `toasts` service.
A default component is provided (DDefaultToast) and can be used through dedicated service methods:
- this.toasts.success({ ... });
- this.toasts.warning({ ... });
- this.toasts.info({ ... });
- this.toasts.error({ ... });
- this.toasts.default({ ... });
```javascript
this.toasts.success({
data: {
title: "Foo",
message: "Bar",
actions: [
{
label: "Ok",
class: "btn-primary",
action: (componentArgs) => {
// eslint-disable-next-line no-alert
alert("Closing toast:" + componentArgs.data.title);
componentArgs.close();
},
}
]
},
});
```
You can also provide your own component:
```javascript
this.toasts.show(MyComponent, {
autoClose: false,
class: "foo",
data: { baz: 1 },
})
```
Co-authored-by: Martin Brennan <mjrbrennan@gmail.com>
Co-authored-by: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com>
Co-authored-by: David Taylor <david@taylorhq.com>
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2023-09-26 19:39:52 +08:00
|
|
|
"@floating-ui/dom": "^1.5.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"@glimmer/component": "^1.1.2",
|
|
|
|
"@glimmer/tracking": "^1.1.2",
|
|
|
|
"@popperjs/core": "^2.11.8",
|
2023-10-19 06:22:30 +08:00
|
|
|
"@types/ember": "^4.0.8",
|
2023-10-18 19:13:20 +08:00
|
|
|
"@types/ember-resolver": "^9.0.0",
|
2023-10-19 06:22:30 +08:00
|
|
|
"@types/ember__application": "^4.0.9",
|
|
|
|
"@types/ember__array": "^4.0.7",
|
|
|
|
"@types/ember__component": "^4.0.19",
|
2023-10-18 19:13:20 +08:00
|
|
|
"@types/ember__controller": "^4.0.8",
|
|
|
|
"@types/ember__debug": "^4.0.5",
|
|
|
|
"@types/ember__destroyable": "^4.0.2",
|
2023-10-19 06:22:30 +08:00
|
|
|
"@types/ember__engine": "^4.0.8",
|
2023-10-18 19:13:20 +08:00
|
|
|
"@types/ember__error": "^4.0.3",
|
2023-10-19 06:22:30 +08:00
|
|
|
"@types/ember__object": "^4.0.9",
|
2023-10-18 19:13:20 +08:00
|
|
|
"@types/ember__polyfills": "^4.0.3",
|
2023-10-19 06:22:30 +08:00
|
|
|
"@types/ember__routing": "^4.0.17",
|
|
|
|
"@types/ember__runloop": "^4.0.7",
|
2023-10-18 19:13:20 +08:00
|
|
|
"@types/ember__service": "^4.0.5",
|
|
|
|
"@types/ember__string": "^3.0.11",
|
|
|
|
"@types/ember__template": "^4.0.3",
|
2023-10-19 06:22:30 +08:00
|
|
|
"@types/ember__test": "^4.0.4",
|
2023-10-18 19:13:20 +08:00
|
|
|
"@types/ember__utils": "^4.0.4",
|
2023-10-24 05:29:40 +08:00
|
|
|
"@types/jquery": "^3.5.25",
|
2023-10-19 06:22:30 +08:00
|
|
|
"@types/qunit": "^2.19.7",
|
|
|
|
"@types/rsvp": "^4.0.6",
|
2023-07-03 08:07:34 +08:00
|
|
|
"@uppy/aws-s3": "3.0.6",
|
2023-06-30 12:05:19 +08:00
|
|
|
"@uppy/aws-s3-multipart": "3.1.3",
|
2023-06-29 23:08:33 +08:00
|
|
|
"@uppy/core": "3.0.4",
|
|
|
|
"@uppy/drop-target": "2.0.1",
|
2023-08-30 10:50:46 +08:00
|
|
|
"@uppy/utils": "5.4.3",
|
2023-06-29 23:08:33 +08:00
|
|
|
"@uppy/xhr-upload": "3.1.1",
|
2023-10-03 17:08:46 +08:00
|
|
|
"a11y-dialog": "8.0.4",
|
2023-06-30 19:01:45 +08:00
|
|
|
"admin": "1.0.0",
|
2023-09-26 07:47:26 +08:00
|
|
|
"babel-import-util": "^2.0.1",
|
2023-08-24 22:36:22 +08:00
|
|
|
"babel-plugin-ember-template-compilation": "^2.2.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"bootstrap": "3.4.1",
|
|
|
|
"bootstrap-json": "1.0.0",
|
2023-05-03 16:25:13 +08:00
|
|
|
"broccoli-asset-rev": "^3.0.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"deepmerge": "^4.3.1",
|
2023-07-19 02:07:20 +08:00
|
|
|
"deprecation-silencer": "1.0.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"dialog-holder": "1.0.0",
|
|
|
|
"discourse-common": "1.0.0",
|
DEV: convert I18n pseudo package into real package (discourse-i18n) (#23867)
Currently, `window.I18n` is defined in an old school hand written
script, inlined into locale/*.js by the Rails asset pipeline, and
then the global variable is shimmed into a pseudo AMD module later
in `module-shims.js`.
This approach has some problems – for one thing, when we add a new
V2 addon (e.g. in #23859), Embroider/Webpack is stricter about its
dependencies and won't let you `import from "I18n";` when `"I18n"`
isn't listed as one of its `dependencies` or `peerDependencies`.
This moves `I18n` into a real package – `discourse-i18n`. (I was
originally planning to keep the `I18n` name since it's a private
package anyway, but NPM packages are supposed to have lower case
names and that may cause problems with other tools.)
This package defines and exports a regular class, but also defines
the default global instance for backwards compatibility. We should
use the exported class in tests to make one-off instances without
mutating the global instance and having to clean it up after the
test run. However, I did not attempt that refactor in this PR.
Since `discourse-i18n` is now included by the app, the locale
scripts needs to be loaded after the app chunks. Since no "real"
work happens until later on when we kick things off in the boot
script, the order in which the script tags appear shouldn't be a
problem. Alternatively, we can rework the locale bundles to be more
lazy like everything else, and require/import them into the app.
I avoided renaming the imports in this commit since that would be
quite noisy and drowns out the actual changes here. Instead, I used
a Webpack alias to redirect the current `"I18n"` import to the new
package for the time being. In a separate commit later on, I'll
rename all the imports in oneshot and remove the alias. As always,
plugins and the legacy bundles (admin/wizard) still relies on the
runtime AMD shims regardless.
For the most part, I avoided refactoring the actual I18n code too
much other than making it a class, and some light stuff like `var`
into `let`.
However, now that it is in a reasonable format to work with (no
longer inside the global script context!) it may also be a good
opportunity to refactor and make clear what is intended to be
public API vs internal implementation details.
Speaking of, I took the librety to make `PLACEHOLDER`, `SEPARATOR`
and `I18nMissingInterpolationArgument` actual constants since it
seemed pretty clear to me those were just previously stashed on to
the `I18n` global to avoid polluting the global namespace, rather
than something we expect the consumers to set/replace.
2023-10-12 21:44:01 +08:00
|
|
|
"discourse-i18n": "1.0.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"discourse-plugins": "1.0.0",
|
2023-05-03 16:25:13 +08:00
|
|
|
"ember-auto-import": "^2.6.3",
|
2023-06-30 19:01:45 +08:00
|
|
|
"ember-buffered-proxy": "^2.1.1",
|
2023-07-27 10:56:03 +08:00
|
|
|
"ember-cached-decorator-polyfill": "^1.0.2",
|
2023-06-26 23:15:59 +08:00
|
|
|
"ember-cli": "~5.0.0",
|
2023-06-16 07:38:49 +08:00
|
|
|
"ember-cli-app-version": "^6.0.1",
|
2023-10-11 06:18:58 +08:00
|
|
|
"ember-cli-babel": "^8.2.0",
|
2023-04-20 20:57:40 +08:00
|
|
|
"ember-cli-deprecation-workflow": "^2.1.0",
|
2023-08-09 17:26:42 +08:00
|
|
|
"ember-cli-htmlbars": "^6.3.0",
|
2023-05-03 16:25:13 +08:00
|
|
|
"ember-cli-inject-live-reload": "^2.1.0",
|
|
|
|
"ember-cli-progress-ci": "1.0.0",
|
|
|
|
"ember-cli-sri": "^2.1.1",
|
|
|
|
"ember-cli-terser": "^4.0.2",
|
2023-06-30 19:01:45 +08:00
|
|
|
"ember-decorators": "^6.1.1",
|
2023-06-23 04:54:46 +08:00
|
|
|
"ember-exam": "^8.0.0",
|
2023-08-04 07:04:09 +08:00
|
|
|
"ember-functions-as-helper-polyfill": "^2.1.2",
|
2023-06-30 19:01:45 +08:00
|
|
|
"ember-load-initializers": "^2.1.1",
|
|
|
|
"ember-modifier": "^4.1.0",
|
Upgrade ember-on-resize-modifier (#23045)
The previous version of ember-on-resize-modifier depended on
ember-modifier@^3.2.7 while discourse had ember-modifier@^4.1.0.
As far as Yarn is concerned, it can accomplish this with:
node_modules
...
ember-modifier 4.1.0
...
ember-on-resize-modifier 1.1.0
...
ember-modifier 3.2.7
...
...
This does NOT work!
In a classic build everything is compiled down to AMD modules and
at runtime there can only be one uniquely named "ember-modifier"
module. When we have duplicates, depending on activation ordering,
one of them will randomly win.
In practice, it seems like ember-modifier 3.2.7 had "won" in the
current build, and we are shipping it to production, you can find
these modules in vendor.js like:
```js
;define("ember-modifier/-private/class/modifier", /* ... */, function(/* ... */) {
/* the 3.2.7 version with deprecations, etc */
})
/* ... */
;define("ember-modifier/index", /* ... */)
```
However, ember-auto-import also "found" the 4.1.0 version and in
one of the chunk.app.js:
```js
d('ember-modifier', /* ... */, function() { return __webpack_require__(/*! ember-modifier */ 227); });
```
...and in one of the chunk.vendors.js...
```js
/* 227 */
/*!****************************************************!*\
!*** ../node_modules/ember-modifier/dist/index.js ***!
\****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
/* ...the 4.1.0 version... */
}),
```
So, in practice:
* We are brining both copies into the production build
* The 3.2.7 modules are available in the AMD loader as "ember-modifier/..."
* But 4.1.0 modules are available in the AMD loader as "ember-modifier"
* Because mostly it's consumed as `import ... from "ember-modifier";`, the
latter end up actually winning
* Because the newer code is compatible enough, and the deprecated features
are unused, it seems to work ok..?
But in the Embroider build, ember-auto-import doesn't emit those shims
anymore. It does process most of the core modules through Webpack so the
imports get correctly wired up to the 4.1.0 as expected, as they no longer
go through/need the runtime AMD loader.js.
The older 3.2.7 copy is _still_ shipped in the vendor bundle and registered
the same, but not "stomped over" by the EAI shims anymore. Our manual shims
(#22703, merged yesterday) are more "polite" and check `require.has(...)`
before defining the module, and since `require.has(...)` check for the
`/index` alias and returns `true`, our shim does not stomp the 3.2.7 modules
either.
So then, when our "auxilary bundles" (admin, plugins, etc) tries to import
`"ember-modifier", they get the 3.2.7 version.
2023-08-10 17:28:39 +08:00
|
|
|
"ember-on-resize-modifier": "^2.0.2",
|
2023-06-30 19:01:45 +08:00
|
|
|
"ember-production-deprecations": "1.0.0",
|
2023-05-03 16:25:13 +08:00
|
|
|
"ember-qunit": "^6.2.0",
|
2023-08-25 16:32:54 +08:00
|
|
|
"ember-router-service-refresh-polyfill": "^1.1.0",
|
2023-10-18 19:42:26 +08:00
|
|
|
"ember-template-imports": "^4.0.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"ember-test-selectors": "^6.0.0",
|
2023-10-02 18:36:06 +08:00
|
|
|
"float-kit": "1.0.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"html-entities": "^2.4.0",
|
2023-05-03 16:25:13 +08:00
|
|
|
"imports-loader": "^4.0.1",
|
2023-10-26 06:39:40 +08:00
|
|
|
"jquery": "^3.7.1",
|
2023-06-30 19:01:45 +08:00
|
|
|
"js-yaml": "^4.1.0",
|
|
|
|
"jsdom": "^22.1.0",
|
2023-05-03 16:25:13 +08:00
|
|
|
"loader.js": "^4.7.0",
|
2023-08-15 10:20:55 +08:00
|
|
|
"message-bus-client": "^4.3.8",
|
2023-06-30 19:01:45 +08:00
|
|
|
"messageformat": "0.1.5",
|
2023-05-03 16:25:13 +08:00
|
|
|
"pretender": "^3.4.7",
|
2023-09-25 16:14:21 +08:00
|
|
|
"qunit": "^2.20.0",
|
2023-10-13 09:00:58 +08:00
|
|
|
"qunit-dom": "^3.0.0",
|
2023-10-27 05:53:08 +08:00
|
|
|
"sass": "^1.69.5",
|
2023-06-30 19:01:45 +08:00
|
|
|
"select-kit": "1.0.0",
|
2023-10-23 18:31:18 +08:00
|
|
|
"sinon": "^17.0.0",
|
2023-05-03 16:25:13 +08:00
|
|
|
"source-map": "^0.7.4",
|
2023-11-01 18:23:10 +08:00
|
|
|
"terser": "^5.24.0",
|
2023-07-21 04:01:12 +08:00
|
|
|
"truth-helpers": "1.0.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"util": "^0.12.5",
|
|
|
|
"virtual-dom": "^2.1.1",
|
2023-10-16 17:23:00 +08:00
|
|
|
"webpack": "^5.89.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"wizard": "1.0.0",
|
2023-06-12 19:28:40 +08:00
|
|
|
"workbox-cacheable-response": "^7.0.0",
|
|
|
|
"workbox-core": "^7.0.0",
|
|
|
|
"workbox-expiration": "^7.0.0",
|
|
|
|
"workbox-routing": "^7.0.0",
|
|
|
|
"workbox-strategies": "^7.0.0",
|
DEV: move xss dependency into core (#23094)
This resolves the issue in #23064.
This issue arises because we need to produce the trees for the
auxilary bundles in `ember-cli-build.js` to pass these trees as
argument to `app.toTree()`. In order to produce these trees, the
code internally need to set up babel, which deep-clones the addons'
babel configs.
When using `@embroider/macros`, the addon's babel config includes a
`MacrosConfig` object which is not supposed to be touched until the
configs are "finalized". In a classic build, the finalization step
happens when `app.toTree()` is called. In Embroider, this happens
somewhere deeper inside `CompatApp`.
We need to produce these auxilary bundle trees before we call
`app.toTree()` or before constructing `CompatApp` because they
need to be passed as arguments to these functions. So this poses a
tricky chicken-and-egg timing issue. It was difficult to find a
workaround for this that works for both the classic and Embroider
build pipeline.
Of all the internal addons that uses the auxilary bundle pattern,
this only affets `pretty-text` as it is (for now, at least) the
only addon that uses `@embroider/macros`.
Taking a step back, the only reason (for now, at least) it was
introduced was for the loader shim for the `xss` package. This
package is actually used inside the lazily loaded markdown-it
bundle. However, we didn't have a better way to include the dep
into the lazy bundle directly, so it ends up going into the main
addon tree, and, inturns, the discourse core bundle.
In core's main loader shim manifest, we already have an entry for
`xss`. This was perhaps a mistake at the time, but it doesn't make
a difference – as mentioned above, `xss` needs to be included into
the main bundle anyway.
So, for now, the simpliest solution is to avoid `@embroider/macros`
in these internal addons for the time being. Ideally we would soon
absorb these back into core as lazily loaded (`import()`-ed) code
managed by Webpack when we fully switch over to Embroider.
2023-08-15 23:13:26 +08:00
|
|
|
"workbox-sw": "^7.0.0",
|
|
|
|
"xss": "^1.0.14"
|
2023-06-30 19:01:45 +08:00
|
|
|
},
|
|
|
|
"engines": {
|
|
|
|
"node": "16.* || >= 18",
|
|
|
|
"npm": "please-use-yarn",
|
|
|
|
"yarn": ">= 1.21.1"
|
|
|
|
},
|
|
|
|
"ember": {
|
2023-07-18 17:00:19 +08:00
|
|
|
"edition": "octane"
|
2021-01-19 05:12:45 +08:00
|
|
|
}
|
|
|
|
}
|