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": {
|
2024-05-09 04:06:59 +08:00
|
|
|
"@discourse/ember-instantsearch": "^1.1.2",
|
2024-04-05 23:57:17 +08:00
|
|
|
"@faker-js/faker": "^8.4.1",
|
2024-04-09 07:15:12 +08:00
|
|
|
"@glimmer/syntax": "^0.92.0",
|
2024-07-08 18:22:41 +08:00
|
|
|
"@highlightjs/cdn-assets": "^11.10.0",
|
2024-07-10 19:41:34 +08:00
|
|
|
"@json-editor/json-editor": "2.15.1",
|
2024-07-10 16:31:28 +08:00
|
|
|
"@messageformat/core": "^3.3.0",
|
2024-06-18 00:21:04 +08:00
|
|
|
"@messageformat/runtime": "^3.0.1",
|
2024-09-02 16:00:46 +08:00
|
|
|
"ace-builds": "^1.36.2",
|
2024-06-18 00:21:04 +08:00
|
|
|
"decorator-transforms": "^2.0.0",
|
2022-11-16 16:10:58 +08:00
|
|
|
"discourse-hbr": "1.0.0",
|
|
|
|
"discourse-widget-hbs": "1.0.0",
|
2023-11-14 20:06:53 +08:00
|
|
|
"ember-route-template": "^1.0.3",
|
2024-01-11 01:30:50 +08:00
|
|
|
"ember-source": "~5.5.0",
|
2023-08-02 07:07:36 +08:00
|
|
|
"handlebars": "^4.7.8",
|
2024-07-08 18:23:00 +08:00
|
|
|
"highlight.js": "^11.10.0",
|
DEV: form-kit
This PR introduces FormKit, a component-based form library designed to simplify form creation and management. This library provides a single `Form` component, various field components, controls, validation mechanisms, and customization options. Additionally, it includes helpers to facilitate testing and writing specifications for forms.
1. **Form Component**:
- The main component that encapsulates form logic and structure.
- Yields various utilities like `Field`, `Submit`, `Alert`, etc.
**Example Usage**:
```gjs
import Form from "discourse/form";
<template>
<Form as |form|>
<form.Field
@name="username"
@title="Username"
@validation="required"
as |field|
>
<field.Input />
</form.Field>
<form.Field @name="age" @title="Age" as |field|>
<field.Input @type="number" />
</form.Field>
<form.Submit />
</Form>
</template>
```
2. **Validation**:
- Built-in validation rules such as `required`, `number`, `length`, and `url`.
- Custom validation callbacks for more complex validation logic.
**Example Usage**:
```javascript
validateUsername(name, value, data, { addError }) {
if (data.bar / 2 === value) {
addError(name, "That's not how maths work.");
}
}
```
```hbs
<form.Field @name="username" @validate={{this.validateUsername}} />
```
3. **Customization**:
- Plugin outlets for extending form functionality.
- Styling capabilities through propagated attributes.
- Custom controls with properties provided by `form` and `field`.
**Example Usage**:
```hbs
<Form class="my-form" as |form|>
<form.Field class="my-field" as |field|>
<MyCustomControl id={{field.id}} @onChange={{field.set}} />
</form.Field>
</Form>
```
4. **Helpers for Testing**:
- Test assertions for form and field validation.
**Example usage**:
```javascript
assert.form().hasErrors("the form shows errors");
assert.form().field("foo").hasValue("bar", "user has set the value");
```
- Helper for interacting with he form
**Example usage**:
```javascript
await formKit().field("foo").fillIn("bar");
```
5. **Page Object for System Specs**:
- Page objects for interacting with forms in system specs.
- Methods for submitting forms, checking alerts, and interacting with fields.
**Example Usage**:
```ruby
form = PageObjects::Components::FormKit.new(".my-form")
form.submit
expect(form).to have_an_alert("message")
```
**Field Interactions**:
```ruby
field = form.field("foo")
expect(field).to have_value("bar")
field.fill_in("bar")
```
6. **Collections handling**:
- A specific component to handle array of objects
**Example Usage**:
```gjs
<Form @data={{hash foo=(array (hash bar=1) (hash bar=2))}} as |form|>
<form.Collection @name="foo" as |collection|>
<collection.Field @name="bar" @title="Bar" as |field|>
<field.Input />
</collection.Field>
</form.Collection>
</Form>
```
2024-07-17 17:59:35 +08:00
|
|
|
"immer": "^10.1.1",
|
2024-01-02 18:47:47 +08:00
|
|
|
"jspreadsheet-ce": "^4.13.4",
|
2024-05-13 11:03:31 +08:00
|
|
|
"morphlex": "^0.0.16",
|
2024-06-18 00:21:04 +08:00
|
|
|
"pretty-text": "1.0.0"
|
2023-04-20 20:57:40 +08:00
|
|
|
},
|
|
|
|
"devDependencies": {
|
2024-08-05 17:35:26 +08:00
|
|
|
"@babel/core": "^7.25.2",
|
2024-08-30 17:55:53 +08:00
|
|
|
"@babel/standalone": "^7.25.6",
|
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",
|
2024-02-22 06:17:02 +08:00
|
|
|
"@ember/optional-features": "^2.1.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"@ember/render-modifiers": "^2.1.0",
|
2024-08-27 20:31:12 +08:00
|
|
|
"@ember/string": "^4.0.0",
|
2024-08-27 21:08:01 +08:00
|
|
|
"@ember/test-helpers": "^4.0.2",
|
2024-09-02 16:06:40 +08:00
|
|
|
"@embroider/compat": "^3.6.1",
|
|
|
|
"@embroider/core": "^3.4.15",
|
2023-08-09 19:04:41 +08:00
|
|
|
"@embroider/macros": "^1.13.1",
|
2024-05-30 21:11:57 +08:00
|
|
|
"@embroider/router": "^2.1.8",
|
2024-09-02 16:06:40 +08:00
|
|
|
"@embroider/webpack": "^4.0.5",
|
2024-08-09 05:25:47 +08:00
|
|
|
"@floating-ui/dom": "^1.6.10",
|
2023-06-30 19:01:45 +08:00
|
|
|
"@glimmer/component": "^1.1.2",
|
|
|
|
"@glimmer/tracking": "^1.1.2",
|
|
|
|
"@popperjs/core": "^2.11.8",
|
2024-09-02 16:06:59 +08:00
|
|
|
"@swc/core": "^1.7.22",
|
2024-05-08 16:40:14 +08:00
|
|
|
"@types/jquery": "^3.5.30",
|
2024-01-17 06:43:19 +08:00
|
|
|
"@types/qunit": "^2.19.10",
|
|
|
|
"@types/rsvp": "^4.0.9",
|
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",
|
2024-02-21 08:13:25 +08:00
|
|
|
"@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",
|
2024-08-20 18:00:41 +08:00
|
|
|
"a11y-dialog": "8.1.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"admin": "1.0.0",
|
2024-03-02 00:20:15 +08:00
|
|
|
"autosize": "^6.0.1",
|
2024-04-29 06:45:54 +08:00
|
|
|
"babel-import-util": "^3.0.0",
|
2024-05-13 11:06:39 +08:00
|
|
|
"babel-plugin-ember-template-compilation": "^2.2.5",
|
2023-06-30 19:01:45 +08:00
|
|
|
"bootstrap": "3.4.1",
|
2023-05-03 16:25:13 +08:00
|
|
|
"broccoli-asset-rev": "^3.0.0",
|
2024-04-25 02:49:05 +08:00
|
|
|
"custom-proxy": "1.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-11-07 00:59:49 +08:00
|
|
|
"discourse-markdown-it": "1.0.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"discourse-plugins": "1.0.0",
|
2024-06-26 07:35:06 +08:00
|
|
|
"ember-auto-import": "^2.7.4",
|
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",
|
2024-08-21 06:54:06 +08:00
|
|
|
"ember-cli": "~5.11.0",
|
2024-06-11 07:25:22 +08:00
|
|
|
"ember-cli-app-version": "^7.0.0",
|
2023-10-11 06:18:58 +08:00
|
|
|
"ember-cli-babel": "^8.2.0",
|
2024-08-27 00:18:20 +08:00
|
|
|
"ember-cli-deprecation-workflow": "^3.0.2",
|
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",
|
2024-01-11 03:57:56 +08:00
|
|
|
"ember-exam": "^9.0.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"ember-load-initializers": "^2.1.1",
|
2024-07-05 21:25:46 +08:00
|
|
|
"ember-modifier": "^4.2.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",
|
2024-06-12 06:46:08 +08:00
|
|
|
"ember-qunit": "^8.1.0",
|
2024-05-15 08:27:59 +08:00
|
|
|
"ember-template-imports": "^4.1.1",
|
2024-07-26 20:49:45 +08:00
|
|
|
"ember-test-selectors": "^7.0.0",
|
2023-10-02 18:36:06 +08:00
|
|
|
"float-kit": "1.0.0",
|
2024-03-06 05:56:43 +08:00
|
|
|
"html-entities": "^2.5.2",
|
2024-01-17 06:44:00 +08:00
|
|
|
"imports-loader": "^5.0.0",
|
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",
|
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-05-03 16:25:13 +08:00
|
|
|
"pretender": "^3.4.7",
|
2024-08-19 07:01:47 +08:00
|
|
|
"qunit": "^2.22.0",
|
2024-06-28 07:10:46 +08:00
|
|
|
"qunit-dom": "^3.2.0",
|
2024-07-12 19:07:13 +08:00
|
|
|
"sass": "^1.77.7",
|
2023-06-30 19:01:45 +08:00
|
|
|
"select-kit": "1.0.0",
|
2024-05-16 09:01:38 +08:00
|
|
|
"sinon": "^18.0.0",
|
2023-05-03 16:25:13 +08:00
|
|
|
"source-map": "^0.7.4",
|
2024-08-14 06:57:46 +08:00
|
|
|
"terser": "^5.31.6",
|
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",
|
2024-08-23 07:51:21 +08:00
|
|
|
"webpack": "^5.94.0",
|
2023-11-07 18:24:49 +08:00
|
|
|
"webpack-stats-plugin": "^1.1.3",
|
2024-03-04 09:04:07 +08:00
|
|
|
"xss": "^1.0.15"
|
2023-06-30 19:01:45 +08:00
|
|
|
},
|
|
|
|
"engines": {
|
2024-02-27 17:48:30 +08:00
|
|
|
"node": ">= 18",
|
2023-06-30 19:01:45 +08:00
|
|
|
"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
|
|
|
}
|
2024-06-18 00:21:04 +08:00
|
|
|
}
|