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",
|
2024-09-03 17:51:07 +08:00
|
|
|
"test": "ember test"
|
2021-01-19 05:12:45 +08:00
|
|
|
},
|
2021-08-27 05:19:44 +08:00
|
|
|
"dependencies": {
|
2024-09-16 15:39:22 +08:00
|
|
|
"@faker-js/faker": "^9.0.1",
|
2024-09-13 21:47:25 +08:00
|
|
|
"@glimmer/syntax": "^0.92.3",
|
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",
|
2024-09-03 17:51:07 +08:00
|
|
|
"discourse-hbr": "workspace:1.0.0",
|
|
|
|
"discourse-widget-hbs": "workspace:1.0.0",
|
2023-11-14 20:06:53 +08:00
|
|
|
"ember-route-template": "^1.0.3",
|
2024-09-03 17:51:07 +08:00
|
|
|
"ember-tracked-storage-polyfill": "^1.0.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-09-03 17:51:07 +08:00
|
|
|
"pretty-text": "workspace: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-09-05 16:46:28 +08:00
|
|
|
"@ember/test-helpers": "^4.0.4",
|
2024-09-03 17:51:07 +08:00
|
|
|
"@ember/test-waiters": "^3.1.0",
|
2024-09-02 16:06:40 +08:00
|
|
|
"@embroider/compat": "^3.6.1",
|
2024-09-30 08:02:51 +08:00
|
|
|
"@embroider/core": "^3.4.16",
|
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-09-16 15:40:30 +08:00
|
|
|
"@floating-ui/dom": "^1.6.11",
|
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-11 18:52:00 +08:00
|
|
|
"@swc/core": "^1.7.26",
|
2024-09-30 07:59:32 +08:00
|
|
|
"@types/jquery": "^3.5.31",
|
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-09-10 15:46:38 +08:00
|
|
|
"a11y-dialog": "8.1.1",
|
2024-09-03 17:51:07 +08:00
|
|
|
"admin": "workspace: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-09-10 15:45:56 +08:00
|
|
|
"babel-plugin-ember-template-compilation": "^2.3.0",
|
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-09-03 17:51:07 +08:00
|
|
|
"custom-proxy": "workspace:1.0.0",
|
2023-06-30 19:01:45 +08:00
|
|
|
"deepmerge": "^4.3.1",
|
2024-09-03 17:51:07 +08:00
|
|
|
"deprecation-silencer": "workspace:1.0.0",
|
|
|
|
"dialog-holder": "workspace:1.0.0",
|
|
|
|
"discourse-common": "workspace:1.0.0",
|
|
|
|
"discourse-i18n": "workspace:1.0.0",
|
|
|
|
"discourse-markdown-it": "workspace:1.0.0",
|
|
|
|
"discourse-plugins": "workspace:1.0.0",
|
2024-09-17 07:23:58 +08:00
|
|
|
"ember-auto-import": "^2.8.0",
|
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",
|
2024-09-03 17:51:07 +08:00
|
|
|
"ember-cli-progress-ci": "workspace:1.0.0",
|
2023-05-03 16:25:13 +08:00
|
|
|
"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",
|
2024-09-03 17:51:07 +08:00
|
|
|
"ember-production-deprecations": "workspace:1.0.0",
|
2024-06-12 06:46:08 +08:00
|
|
|
"ember-qunit": "^8.1.0",
|
2024-09-03 17:51:07 +08:00
|
|
|
"ember-source": "~5.5.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",
|
2024-09-03 17:51:07 +08:00
|
|
|
"float-kit": "workspace: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",
|
2024-09-30 08:04:00 +08:00
|
|
|
"jsuites": "^5.6.4",
|
2023-05-03 16:25:13 +08:00
|
|
|
"loader.js": "^4.7.0",
|
2024-09-03 17:51:07 +08:00
|
|
|
"make-plural": "^7.4.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-09-30 16:07:45 +08:00
|
|
|
"qunit-dom": "^3.2.1",
|
2024-07-12 19:07:13 +08:00
|
|
|
"sass": "^1.77.7",
|
2024-09-03 17:51:07 +08:00
|
|
|
"select-kit": "workspace:1.0.0",
|
2024-09-16 07:02:04 +08:00
|
|
|
"sinon": "^19.0.2",
|
2023-05-03 16:25:13 +08:00
|
|
|
"source-map": "^0.7.4",
|
2024-09-18 06:44:52 +08:00
|
|
|
"terser": "^5.33.0",
|
2024-09-11 18:54:01 +08:00
|
|
|
"testem": "^3.15.2",
|
2024-09-03 17:51:07 +08:00
|
|
|
"truth-helpers": "workspace: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",
|
2024-09-18 22:50:24 +08:00
|
|
|
"webpack-retry-chunk-load-plugin": "^3.1.1",
|
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",
|
2024-09-03 17:51:07 +08:00
|
|
|
"npm": "please-use-pnpm",
|
|
|
|
"yarn": "please-use-pnpm",
|
|
|
|
"pnpm": ">= 9"
|
2024-09-05 03:14:13 +08:00
|
|
|
},
|
2023-06-30 19:01:45 +08:00
|
|
|
"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
|
|
|
}
|