ember-primitives 0.37.0 → 0.38.0
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/declarations/store.d.ts +39 -0
- package/declarations/type-utils.d.ts +3 -0
- package/declarations/utils.d.ts +1 -0
- package/dist/proper-links.js.map +1 -1
- package/dist/store.js +63 -0
- package/dist/store.js.map +1 -0
- package/dist/type-utils.js +2 -0
- package/dist/type-utils.js.map +1 -0
- package/dist/utils.js +5 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Newable } from './type-utils.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a singleton for the given context and links the lifetime of the created class to the passed context
|
|
4
|
+
*
|
|
5
|
+
* Note that this function is _not_ lazy. Calling `createStore` will create an instance of the passed class.
|
|
6
|
+
* When combined with a getter though, creation becomes lazy.
|
|
7
|
+
*
|
|
8
|
+
* In this example, `MyState` is created once per instance of the component.
|
|
9
|
+
* repeat accesses to `this.foo` return a stable reference _as if_ `@cached` were used.
|
|
10
|
+
* ```js
|
|
11
|
+
* class MyState {}
|
|
12
|
+
*
|
|
13
|
+
* class Demo extends Component {
|
|
14
|
+
* // this is a stable reference
|
|
15
|
+
* get foo() {
|
|
16
|
+
* return createStore(this, MyState);
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* // or
|
|
20
|
+
* bar = createStore(this, MyState);
|
|
21
|
+
*
|
|
22
|
+
* // or
|
|
23
|
+
* three = createStore(this, () => new MyState(1, 2));
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* If arguments need to be configured during construction, the second argument may also be a function
|
|
28
|
+
* ```js
|
|
29
|
+
* class MyState {}
|
|
30
|
+
*
|
|
31
|
+
* class Demo extends Component {
|
|
32
|
+
* // this is a stable reference
|
|
33
|
+
* get foo() {
|
|
34
|
+
* return createStore(this, MyState);
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function createStore<Instance extends object>(context: object, theClass: Newable<Instance> | (() => Instance)): Instance;
|
package/declarations/utils.d.ts
CHANGED
package/dist/proper-links.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proper-links.js","sources":["../src/proper-links.ts"],"sourcesContent":["import { assert } from '@ember/debug';\nimport { registerDestructor } from '@ember/destroyable';\nimport { getOwner } from '@ember/owner';\n\nimport { getAnchor, shouldHandle } from 'should-handle-link';\n\nimport type EmberRouter from '@ember/routing/router';\nimport type RouterService from '@ember/routing/router-service';\n\nexport { shouldHandle } from 'should-handle-link';\n\
|
|
1
|
+
{"version":3,"file":"proper-links.js","sources":["../src/proper-links.ts"],"sourcesContent":["import { assert } from '@ember/debug';\nimport { registerDestructor } from '@ember/destroyable';\nimport { getOwner } from '@ember/owner';\n\nimport { getAnchor, shouldHandle } from 'should-handle-link';\n\nimport type { Newable } from './type-utils.ts';\nimport type EmberRouter from '@ember/routing/router';\nimport type RouterService from '@ember/routing/router-service';\n\nexport { shouldHandle } from 'should-handle-link';\n\nexport interface Options {\n ignore?: string[];\n}\n\nexport function properLinks(\n options: Options\n): <Instance extends object, Klass = { new (...args: any[]): Instance }>(klass: Klass) => Klass;\n\nexport function properLinks<Instance extends object, Klass = { new (...args: any[]): Instance }>(\n klass: Klass\n): Klass;\n/**\n * @internal\n */\nexport function properLinks<Instance extends object, Klass = { new (...args: any[]): Instance }>(\n options: Options,\n klass: Klass\n): Klass;\n\nexport function properLinks<Instance extends object, Klass = { new (...args: any[]): Instance }>(\n ...args: [Options] | [Klass] | [Options, Klass]\n): Klass | ((klass: Klass) => Klass) {\n let options: Options = {};\n\n let klass: undefined | Klass = undefined;\n\n if (args.length === 2) {\n options = args[0];\n klass = args[1];\n } else if (args.length === 1) {\n if (typeof args[0] === 'object') {\n // TODO: how to get first arg type correct?\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return (klass: Klass) => properLinks(args[0] as any, klass);\n } else {\n klass = args[0];\n }\n }\n\n const ignore = options.ignore || [];\n\n assert(`klass was not defined. possibile incorrect arity given to properLinks`, klass);\n\n return class RouterWithProperLinks extends (klass as unknown as Newable<EmberRouter>) {\n // SAFETY: we literally do not care about the args' type here,\n // because we just call super\n constructor(...args: any[]) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n super(...args);\n\n setup(this, ignore);\n }\n } as unknown as Klass;\n}\n\n/**\n * Setup proper links without a decorator.\n * This function only requires that a framework object with an owner is passed.\n */\nexport function setup(parent: object, ignore?: string[]) {\n const handler = (event: MouseEvent) => {\n /**\n * event.target may not be an anchor,\n * it may be a span, svg, img, or any number of elements nested in <a>...</a>\n */\n const interactive = getAnchor(event);\n\n if (!interactive) return;\n\n const owner = getOwner(parent);\n\n assert('owner is not present', owner);\n\n const routerService = owner.lookup('service:router');\n\n handle(routerService, interactive, ignore ?? [], event);\n };\n\n document.body.addEventListener('click', handler, false);\n\n registerDestructor(parent, () => document.body.removeEventListener('click', handler));\n}\n\nexport function handle(\n router: RouterService,\n element: HTMLAnchorElement,\n ignore: string[],\n event: MouseEvent\n) {\n if (!shouldHandle(location.href, element, event, ignore)) {\n return;\n }\n\n const url = new URL(element.href);\n\n const fullHref = `${url.pathname}${url.search}${url.hash}`;\n\n const rootURL = router.rootURL;\n\n let withoutRootURL = fullHref.slice(rootURL.length);\n\n // re-add the \"root\" sigil\n // we removed it when we chopped off the rootURL,\n // because the rootURL often has this attached to it as well\n if (!withoutRootURL.startsWith('/')) {\n withoutRootURL = `/${withoutRootURL}`;\n }\n\n try {\n const routeInfo = router.recognize(fullHref);\n\n if (routeInfo) {\n event.preventDefault();\n event.stopImmediatePropagation();\n event.stopPropagation();\n\n router.transitionTo(withoutRootURL);\n\n return false;\n }\n } catch (e) {\n if (e instanceof Error && e.name === 'UnrecognizedURLError') {\n return;\n }\n\n throw e;\n }\n}\n"],"names":["properLinks","args","options","klass","undefined","length","ignore","assert","RouterWithProperLinks","constructor","setup","parent","handler","event","interactive","getAnchor","owner","getOwner","routerService","lookup","handle","document","body","addEventListener","registerDestructor","removeEventListener","router","element","shouldHandle","location","href","url","URL","fullHref","pathname","search","hash","rootURL","withoutRootURL","slice","startsWith","routeInfo","recognize","preventDefault","stopImmediatePropagation","stopPropagation","transitionTo","e","Error","name"],"mappings":"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"}
|
package/dist/store.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { link } from 'reactiveweb/link';
|
|
2
|
+
import { isNewable } from './utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* context => { class => instance }
|
|
6
|
+
*/
|
|
7
|
+
const contextCache = new WeakMap();
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates a singleton for the given context and links the lifetime of the created class to the passed context
|
|
11
|
+
*
|
|
12
|
+
* Note that this function is _not_ lazy. Calling `createStore` will create an instance of the passed class.
|
|
13
|
+
* When combined with a getter though, creation becomes lazy.
|
|
14
|
+
*
|
|
15
|
+
* In this example, `MyState` is created once per instance of the component.
|
|
16
|
+
* repeat accesses to `this.foo` return a stable reference _as if_ `@cached` were used.
|
|
17
|
+
* ```js
|
|
18
|
+
* class MyState {}
|
|
19
|
+
*
|
|
20
|
+
* class Demo extends Component {
|
|
21
|
+
* // this is a stable reference
|
|
22
|
+
* get foo() {
|
|
23
|
+
* return createStore(this, MyState);
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* // or
|
|
27
|
+
* bar = createStore(this, MyState);
|
|
28
|
+
*
|
|
29
|
+
* // or
|
|
30
|
+
* three = createStore(this, () => new MyState(1, 2));
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* If arguments need to be configured during construction, the second argument may also be a function
|
|
35
|
+
* ```js
|
|
36
|
+
* class MyState {}
|
|
37
|
+
*
|
|
38
|
+
* class Demo extends Component {
|
|
39
|
+
* // this is a stable reference
|
|
40
|
+
* get foo() {
|
|
41
|
+
* return createStore(this, MyState);
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
function createStore(context, theClass) {
|
|
47
|
+
let cache = contextCache.get(context);
|
|
48
|
+
if (!cache) {
|
|
49
|
+
cache = new Map();
|
|
50
|
+
contextCache.set(context, cache);
|
|
51
|
+
}
|
|
52
|
+
let existing = cache.get(theClass);
|
|
53
|
+
if (!existing) {
|
|
54
|
+
const instance = isNewable(theClass) ? new theClass() : theClass();
|
|
55
|
+
link(instance, context);
|
|
56
|
+
cache.set(theClass, instance);
|
|
57
|
+
existing = instance;
|
|
58
|
+
}
|
|
59
|
+
return existing;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { createStore };
|
|
63
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sources":["../src/store.ts"],"sourcesContent":["import { link } from 'reactiveweb/link';\n\nimport { isNewable } from './utils.ts';\n\nimport type { Newable } from './type-utils.ts';\n\n/**\n * context => { class => instance }\n */\nconst contextCache = new WeakMap<object, Map<object, object>>();\n\n/**\n * Creates a singleton for the given context and links the lifetime of the created class to the passed context\n *\n * Note that this function is _not_ lazy. Calling `createStore` will create an instance of the passed class.\n * When combined with a getter though, creation becomes lazy.\n *\n * In this example, `MyState` is created once per instance of the component.\n * repeat accesses to `this.foo` return a stable reference _as if_ `@cached` were used.\n * ```js\n * class MyState {}\n *\n * class Demo extends Component {\n * // this is a stable reference\n * get foo() {\n * return createStore(this, MyState);\n * }\n *\n * // or\n * bar = createStore(this, MyState);\n *\n * // or\n * three = createStore(this, () => new MyState(1, 2));\n * }\n * ```\n *\n * If arguments need to be configured during construction, the second argument may also be a function\n * ```js\n * class MyState {}\n *\n * class Demo extends Component {\n * // this is a stable reference\n * get foo() {\n * return createStore(this, MyState);\n * }\n * }\n * ```\n */\nexport function createStore<Instance extends object>(\n context: object,\n theClass: Newable<Instance> | (() => Instance)\n): Instance {\n let cache = contextCache.get(context);\n\n if (!cache) {\n cache = new Map();\n contextCache.set(context, cache);\n }\n\n let existing = cache.get(theClass);\n\n if (!existing) {\n const instance = isNewable(theClass) ? new theClass() : theClass();\n\n link(instance, context);\n\n cache.set(theClass, instance);\n existing = instance;\n }\n\n return existing as Instance;\n}\n"],"names":["contextCache","WeakMap","createStore","context","theClass","cache","get","Map","set","existing","instance","isNewable","link"],"mappings":";;;AAMA;AACA;AACA;AACA,MAAMA,YAAY,GAAG,IAAIC,OAAO,EAA+B;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CACzBC,OAAe,EACfC,QAA8C,EACpC;AACV,EAAA,IAAIC,KAAK,GAAGL,YAAY,CAACM,GAAG,CAACH,OAAO,CAAC;EAErC,IAAI,CAACE,KAAK,EAAE;AACVA,IAAAA,KAAK,GAAG,IAAIE,GAAG,EAAE;AACjBP,IAAAA,YAAY,CAACQ,GAAG,CAACL,OAAO,EAAEE,KAAK,CAAC;AAClC,EAAA;AAEA,EAAA,IAAII,QAAQ,GAAGJ,KAAK,CAACC,GAAG,CAACF,QAAQ,CAAC;EAElC,IAAI,CAACK,QAAQ,EAAE;AACb,IAAA,MAAMC,QAAQ,GAAGC,SAAS,CAACP,QAAQ,CAAC,GAAG,IAAIA,QAAQ,EAAE,GAAGA,QAAQ,EAAE;AAElEQ,IAAAA,IAAI,CAACF,QAAQ,EAAEP,OAAO,CAAC;AAEvBE,IAAAA,KAAK,CAACG,GAAG,CAACJ,QAAQ,EAAEM,QAAQ,CAAC;AAC7BD,IAAAA,QAAQ,GAAGC,QAAQ;AACrB,EAAA;AAEA,EAAA,OAAOD,QAAQ;AACjB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/utils.js
CHANGED
|
@@ -7,6 +7,10 @@ function uniqueId() {
|
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/restrict-plus-operands, @typescript-eslint/no-unsafe-member-access
|
|
8
8
|
return ([3e7] + -1e3 + -4e3 + -2e3 + -1e11).replace(/[0-3]/g, a => (a * 4 ^ Math.random() * 16 >> (a & 2)).toString(16));
|
|
9
9
|
}
|
|
10
|
+
function isNewable(x) {
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
12
|
+
return x.prototype?.constructor === x;
|
|
13
|
+
}
|
|
10
14
|
|
|
11
|
-
export { uniqueId };
|
|
15
|
+
export { isNewable, uniqueId };
|
|
12
16
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["// this is copy pasted from https://github.com/emberjs/ember.js/blob/60d2e0cddb353aea0d6e36a72fda971010d92355/packages/%40ember/-internals/glimmer/lib/helpers/unique-id.ts\n// Unfortunately due to https://github.com/emberjs/ember.js/issues/20165 we cannot use the built-in version in template tags\nexport function uniqueId(): string {\n // @ts-expect-error this one-liner abuses weird JavaScript semantics that\n // TypeScript (legitimately) doesn't like, but they're nonetheless valid and\n // specced.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/restrict-plus-operands, @typescript-eslint/no-unsafe-member-access\n return ([3e7] + -1e3 + -4e3 + -2e3 + -1e11).replace(/[0-3]/g, (a) =>\n ((a * 4) ^ ((Math.random() * 16) >> (a & 2))).toString(16)\n );\n}\n"],"names":["uniqueId","replace","a","Math","random","toString"],"mappings":"AAAA;AACA;AACO,SAASA,QAAQA,GAAW;AACjC;AACA;AACA;AACA;EACA,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,EAAEC,OAAO,CAAC,QAAQ,EAAGC,CAAC,IAC9D,CAAEA,CAAC,GAAG,CAAC,GAAMC,IAAI,CAACC,MAAM,EAAE,GAAG,EAAE,KAAMF,CAAC,GAAG,CAAC,CAAE,EAAEG,QAAQ,CAAC,EAAE,CAC3D,CAAC;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["// this is copy pasted from https://github.com/emberjs/ember.js/blob/60d2e0cddb353aea0d6e36a72fda971010d92355/packages/%40ember/-internals/glimmer/lib/helpers/unique-id.ts\n// Unfortunately due to https://github.com/emberjs/ember.js/issues/20165 we cannot use the built-in version in template tags\nexport function uniqueId(): string {\n // @ts-expect-error this one-liner abuses weird JavaScript semantics that\n // TypeScript (legitimately) doesn't like, but they're nonetheless valid and\n // specced.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/restrict-plus-operands, @typescript-eslint/no-unsafe-member-access\n return ([3e7] + -1e3 + -4e3 + -2e3 + -1e11).replace(/[0-3]/g, (a) =>\n ((a * 4) ^ ((Math.random() * 16) >> (a & 2))).toString(16)\n );\n}\n\nexport function isNewable(x: any): x is new (...args: unknown[]) => NonNullable<object> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return x.prototype?.constructor === x;\n}\n"],"names":["uniqueId","replace","a","Math","random","toString","isNewable","x","prototype","constructor"],"mappings":"AAAA;AACA;AACO,SAASA,QAAQA,GAAW;AACjC;AACA;AACA;AACA;EACA,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,EAAEC,OAAO,CAAC,QAAQ,EAAGC,CAAC,IAC9D,CAAEA,CAAC,GAAG,CAAC,GAAMC,IAAI,CAACC,MAAM,EAAE,GAAG,EAAE,KAAMF,CAAC,GAAG,CAAC,CAAE,EAAEG,QAAQ,CAAC,EAAE,CAC3D,CAAC;AACH;AAEO,SAASC,SAASA,CAACC,CAAM,EAAwD;AACtF;AACA,EAAA,OAAOA,CAAC,CAACC,SAAS,EAAEC,WAAW,KAAKF,CAAC;AACvC;;;;"}
|