@merkur/integration-custom-element 0.47.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -22
- package/lib/index.umd.js +1 -1
- package/package.json +5 -8
package/README.md
CHANGED
|
@@ -38,8 +38,42 @@ To check out [live demo](https://merkur.js.org/demo) and [docs](https://merkur.j
|
|
|
38
38
|
|
|
39
39
|
Contribute to this project via [Pull-Requests](https://github.com/mjancarik/merkur/pulls).
|
|
40
40
|
|
|
41
|
-
We are
|
|
41
|
+
We are using [Changesets](https://github.com/changesets/changesets) for versioning and releasing. To add a changeset describing your changes, run `npm run changeset`.
|
|
42
42
|
|
|
43
|
+
> **Note:** The release process is documented **only** in this root README. Any per-package README sections that still describe a Lerna/Conventional Commits–based release flow are outdated and should be ignored in favour of the instructions below.
|
|
44
|
+
|
|
45
|
+
### Changeset format
|
|
46
|
+
|
|
47
|
+
Each changeset file (`.changeset/*.md`) must follow this structure:
|
|
48
|
+
|
|
49
|
+
**Frontmatter** — standard Changesets YAML listing affected package names and bump types (`patch`, `minor`, `major`).
|
|
50
|
+
|
|
51
|
+
**First line after frontmatter** — a single brief sentence summarising the change. No heading, no bold, no trailing bullet — just a plain declarative sentence. This section is not required but helps to quickly understand the change when browsing the changesets.
|
|
52
|
+
|
|
53
|
+
**Body** — three bullet points in this exact order, with no blank lines between them:
|
|
54
|
+
|
|
55
|
+
- **What** One or more sentences describing what changed: which APIs, files, or behaviours were added, removed, or fixed. Make sublists if needed to break down complex changes, but keep each bullet point as a single paragraph.
|
|
56
|
+
- **Why** One or more sentences explaining the motivation: why the change was necessary or beneficial.
|
|
57
|
+
- **How** Migration steps for consumers or contributors. If no action is required, write exactly: `Nothing.`
|
|
58
|
+
|
|
59
|
+
Additional rules:
|
|
60
|
+
- Each bullet is a single paragraph — no nested lists, no code blocks inside a bullet.
|
|
61
|
+
- Do not use headings (`##`, `###`) inside the body.
|
|
62
|
+
- Code symbols (function names, paths, package names) use backtick inline code.
|
|
63
|
+
|
|
64
|
+
Example:
|
|
65
|
+
|
|
66
|
+
```markdown
|
|
67
|
+
---
|
|
68
|
+
"@merkur/example": minor
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
Add `createFoo` helper for simplified widget initialisation.
|
|
72
|
+
|
|
73
|
+
- **What** New `createFoo(options)` export in `@merkur/example` wraps the low-level `initFoo` call and applies sensible defaults for `name` and `version`.
|
|
74
|
+
- **Why** Every project was duplicating the same boilerplate to call `initFoo`; centralising it reduces setup friction and ensures consistent defaults.
|
|
75
|
+
- **How** Replace direct `initFoo` calls with `createFoo({ name, version })`. The returned object is API-compatible, so no further changes are needed.
|
|
76
|
+
```
|
|
43
77
|
|
|
44
78
|
### Release
|
|
45
79
|
|
|
@@ -48,32 +82,43 @@ To release a version you must have the right permissions, please contact one of
|
|
|
48
82
|
|
|
49
83
|
#### Regular version release
|
|
50
84
|
|
|
51
|
-
To do a regular release,
|
|
85
|
+
To do a regular release, from the `master` branch with no uncommitted changes, run:
|
|
52
86
|
|
|
53
87
|
```
|
|
54
88
|
npm run release
|
|
55
89
|
```
|
|
56
90
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
91
|
+
This runs `release:prepare` (applies pending changesets, bumps versions, updates `package-lock.json`) followed by `release:push` (commits, tags, and pushes to the repository).
|
|
92
|
+
|
|
93
|
+
Packages are published from a GitHub Action triggered when a new version tag is pushed.
|
|
94
|
+
|
|
95
|
+
#### RC (pre-release) release
|
|
96
|
+
|
|
97
|
+
1. Enter pre-release mode (only needs to be done once per RC cycle):
|
|
98
|
+
```
|
|
99
|
+
npm run release:next:init
|
|
100
|
+
```
|
|
101
|
+
This sets pre-release mode to `rc`, so subsequent version bumps produce `rc` versions (e.g. `v0.44.0-rc.0`).
|
|
102
|
+
|
|
103
|
+
2. Add a changeset describing your changes:
|
|
104
|
+
```
|
|
105
|
+
npm run changeset
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
3. Bump versions and push the RC release:
|
|
109
|
+
```
|
|
110
|
+
npm run release
|
|
111
|
+
```
|
|
112
|
+
Repeat steps 2–3 for each subsequent RC iteration (e.g. `rc.0 → rc.1`).
|
|
113
|
+
|
|
114
|
+
4. When ready to graduate to a stable release, exit pre-release mode and prepare the final version:
|
|
115
|
+
```
|
|
116
|
+
npm run release:graduate
|
|
117
|
+
```
|
|
118
|
+
Then push with:
|
|
119
|
+
```
|
|
120
|
+
npm run release:push
|
|
121
|
+
```
|
|
77
122
|
|
|
78
123
|
---
|
|
79
124
|
|
package/lib/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}!function(t,e){if("function"==typeof define&&define.amd)define("@merkur/integration-custom-element",["exports","@merkur/core","@merkur/integration"],e);else if("undefined"!=typeof exports)e(exports,require("@merkur/core"),require("@merkur/integration"));else{var n={exports:{}};e(n.exports,t.Merkur.Core,t.Merkur.Integration),t.merkurIntegrationCustomElement=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,
|
|
1
|
+
function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}!function(t,e){if("function"==typeof define&&define.amd)define("@merkur/integration-custom-element",["exports","@merkur/core","@merkur/integration"],e);else if("undefined"!=typeof exports)e(exports,require("@merkur/core"),require("@merkur/integration"));else{var n={exports:{}};e(n.exports,t.Merkur.Core,t.Merkur.Integration),t.merkurIntegrationCustomElement=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e,n,r){function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach(function(e){u(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function u(t,e,n){return(e=d(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(){return l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=g(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},l.apply(null,arguments)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,d(r.key),r)}}function s(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function d(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==t(n)?n:n+""}function f(t,e,n){return e=g(e),p(t,v()?Reflect.construct(e,n||[],g(t).constructor):e.apply(t,n))}function p(e,n){if(n&&("object"==t(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(e)}function y(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b(t,e)}function h(t){var e="function"==typeof Map?new Map:void 0;return h=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(v())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&b(o,n.prototype),o}(t,arguments,g(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),b(n,t)},h(t)}function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(v=function(){return!!t})()}function b(t,e){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},b(t,e)}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}function _(t,e,n,r,o,i,u){try{var l=t[i](u),c=l.value}catch(t){return void n(t)}l.done?e(c):Promise.resolve(c).then(r,o)}function m(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(t){_(i,r,o,u,l,"next",t)}function l(t){_(i,r,o,u,l,"throw",t)}u(void 0)})}}function w(){return(w=m(function*(t,e){var o=i(i({},t),{},{createWidget:t.createWidget});return(0,n.getMerkur)().isRegistered(o.name+o.version)||(0,n.getMerkur)().register(o),yield O(),yield(0,r.loadAssets)(o.assets,e),yield(0,n.getMerkur)().create(o)})).apply(this,arguments)}function O(){return new Promise(function(t){"undefined"!=typeof document?"loading"!==document.readyState?t():window.addEventListener("DOMContentLoaded",function(){t()},{once:!0}):t()})}Object.defineProperty(e,"__esModule",{value:!0}),e.deepMerge=k,e.registerCustomElement=function(t){var e=k({},t),n=e.widgetDefinition,o=e.callbacks,u=e.observedAttributes,a=e.attributesParser,d=function(t){function e(){var t;c(this,e);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var i=t=f(this,e,[].concat(r));return t._pendingProps={},t._batchTimeout=null,t._isInitialized=!1,i._init(),p(t,i)}return y(e,t),s(e,[{key:"_init",value:function(){}}],[{key:"observedAttributes",get:function(){return null!=u?u:[]}}])}(h(HTMLElement)),v=function(t){function e(){return c(this,e),f(this,e,arguments)}return y(e,t),s(e,[{key:"_init",value:function(){var t,i,u,c,a,s=this;try{(t=e,i="_init",u=this,a=l(g(1&(c=3)?t.prototype:t),i,u),2&c&&"function"==typeof a?function(t){return a.apply(u,t)}:a)([]);var d=k({},n);this._widgetPromise=m(function*(){s._shadow=s.attachShadow({mode:"open"});try{var t,e=yield null==o||null===(t=o.getInstance)||void 0===t?void 0:t.call(o);if(e&&e.name&&e.version){var n,i;if(s._widget=e,yield O(),yield(0,r.loadAssets)(e.assets,s._shadow),s._setDefaultProps(),yield null==o||null===(n=o.reconstructor)||void 0===n?void 0:n.call(o,s._widget,s._getContext()),"function"==typeof(null==o?void 0:o.remount))yield null==o||null===(i=o.remount)||void 0===i?void 0:i.call(o,s._widget,s._getContext());else e.root=s._shadow,e.customElement=s,s._shadow.appendChild(e.container);return}}catch(t){return void console.error(t)}try{var u,l,c;d.root=s._shadow,d.customElement=s,d.container||(d.container=document.createElement("div"),d.container.setAttribute("id","merkur-container")),s._shadow.appendChild(d.container),s._widget=yield function(t,e){return w.apply(this,arguments)}(d,s._shadow),s._setDefaultProps(),yield null==o||null===(u=o.constructor)||void 0===u?void 0:u.call(o,s._widget,s._getContext()),null!==(l=yield null==o||null===(c=o.mount)||void 0===c?void 0:c.call(o,s._widget,s._getContext()))&&void 0!==l||(yield s._widget.mount())}catch(t){console.error(t)}})()}catch(t){console.error(t)}}},{key:"connectedCallback",value:(h=m(function*(){var t,e,n;this._isInitialized=!0,yield this._widgetPromise,null===(t=this._widget)||void 0===t||null===(e=t.connectedCallback)||void 0===e||e.call(t,this._getContext()),null==o||null===(n=o.connectedCallback)||void 0===n||n.call(o,this._widget,this._getContext())}),function(){return h.apply(this,arguments)})},{key:"disconnectedCallback",value:(p=m(function*(){var t,e,n;this._isInitialized=!1,yield this._widgetPromise,this._batchTimeout&&(clearTimeout(this._batchTimeout),this._batchTimeout=null,this._pendingProps={}),null===(t=this._widget)||void 0===t||null===(e=t.disconnectedCallback)||void 0===e||e.call(t,this._getContext()),null==o||null===(n=o.disconnectedCallback)||void 0===n||n.call(o,this._widget,this._getContext())}),function(){return p.apply(this,arguments)})},{key:"adoptedCallback",value:(d=m(function*(){var t,e,n;yield this._widgetPromise,null===(t=this._widget)||void 0===t||null===(e=t.adoptedCallback)||void 0===e||e.call(t,this._getContext()),null==o||null===(n=o.adoptedCallback)||void 0===n||n.call(o,this._widget,this._getContext())}),function(){return d.apply(this,arguments)})},{key:"attributeChangedCallback",value:(u=m(function*(t,e,n){var r=this;if(this._isInitialized){var i,u,l,c;yield this._widgetPromise;var s=t.replace(/-([a-z])/g,function(t){return t[1].toUpperCase()}),d=null!==(i=null==a?void 0:a[t])&&void 0!==i?i:function(t){return t};this._pendingProps[s]=d(n),this._batchTimeout&&clearTimeout(this._batchTimeout),this._batchTimeout=setTimeout(function(){var t,e,n=r._pendingProps;r._pendingProps={},r._batchTimeout=null,null===(t=r._widget)||void 0===t||null===(e=t.setProps)||void 0===e||e.call(t,n)},0),null===(u=this._widget)||void 0===u||null===(l=u.attributeChangedCallback)||void 0===l||l.call(u,this._widget,t,e,n,this._getContext()),null==o||null===(c=o.attributeChangedCallback)||void 0===c||c.call(o,this._widget,t,e,n,this._getContext())}}),function(t,e,n){return u.apply(this,arguments)})},{key:"_setDefaultProps",value:function(){var t=this,e=this.constructor.observedAttributes;Array.isArray(e)&&"function"==typeof this._widget.setProps&&(this._widget.props=i({},this._widget.props),e.forEach(function(e){if(t.hasAttribute(e)){var n,r,o=e.replace(/-([a-z])/g,function(t){return t[1].toUpperCase()}),i=null!==(n=null==a?void 0:a[e])&&void 0!==n?n:function(t){return t};t._widget.props[o]=i(null!==(r=t.getAttribute(e))&&void 0!==r?r:t._widget.props[e])}}))}},{key:"_getContext",value:function(){return{shadow:this._shadow,customElement:this}}}]);var u,d,p,h}(d);void 0===customElements.get(n.name)&&customElements.define(n.name,v);return v};var P=["__proto__","prototype","constructor"];function k(t,e){var n=function(t){return!!t&&t.constructor===Object};return n(t)&&n(e)?(Object.keys(e).forEach(function(r){if(!P.includes(r)){var o=t[r],i=e[r];Array.isArray(o)&&Array.isArray(i)?t[r]=o.concat(i):n(o)&&n(i)?t[r]=k(Object.assign({},o),i):t[r]=i}}),t):e}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkur/integration-custom-element",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Merkur module for easy integration with other apps with custom element.",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"module": "lib/index",
|
|
@@ -25,11 +25,9 @@
|
|
|
25
25
|
"./lib/index.es9.mjs": "./lib/index.es9.mjs"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
|
-
"preversion": "npm test",
|
|
29
28
|
"test": "jest --no-watchman -c ./jest.config.js",
|
|
30
29
|
"test:es:version": "es-check es11 ./lib/index.mjs --module && es-check es9 ./lib/index.es9.mjs --module && es-check es9 ./lib/index.es9.cjs --module",
|
|
31
|
-
"build": "rollup -c rollup.config.mjs"
|
|
32
|
-
"postpublish": "node ../../utils/restoreLatestTag.mjs"
|
|
30
|
+
"build": "rollup -c rollup.config.mjs"
|
|
33
31
|
},
|
|
34
32
|
"repository": {
|
|
35
33
|
"type": "git",
|
|
@@ -50,12 +48,11 @@
|
|
|
50
48
|
},
|
|
51
49
|
"homepage": "https://merkur.js.org/",
|
|
52
50
|
"devDependencies": {
|
|
53
|
-
"@merkur/core": "^0.
|
|
54
|
-
"@merkur/integration": "^0.
|
|
51
|
+
"@merkur/core": "^1.0.0",
|
|
52
|
+
"@merkur/integration": "^1.0.0"
|
|
55
53
|
},
|
|
56
54
|
"peerDependencies": {
|
|
57
55
|
"@merkur/core": "*",
|
|
58
56
|
"@merkur/integration": "*"
|
|
59
|
-
}
|
|
60
|
-
"gitHead": "1f8dd906f352a28828785d33791a8a4129836f35"
|
|
57
|
+
}
|
|
61
58
|
}
|