@base-framework/base 3.9.24 → 3.9.26
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/dist/base.js +1 -1
- package/dist/chunks/chunk-6N533MOU.js +2 -0
- package/dist/chunks/chunk-BTEZZMTE.js +2 -0
- package/dist/chunks/chunk-CKS4W2H6.js +2 -0
- package/dist/chunks/chunk-DNPDLUU4.js +2 -0
- package/dist/chunks/chunk-HL52UJBX.js +2 -0
- package/dist/chunks/chunk-KB5AL3PM.js +2 -0
- package/dist/chunks/chunk-KMMYW6DR.js +2 -0
- package/dist/chunks/chunk-R7IRTCS2.js +2 -0
- package/dist/chunks/chunk-UBJO7NXL.js +2 -0
- package/dist/chunks/chunk-ZUB7I6Z4.js +2 -0
- package/dist/modules/ajax.js +1 -1
- package/dist/modules/component.js +1 -1
- package/dist/modules/data.js +1 -1
- package/dist/modules/html.js +1 -1
- package/dist/modules/router.js +1 -1
- package/dist/modules/state.js +1 -1
- package/dist/types/main/data-tracker/data-tracker.d.ts +9 -14
- package/dist/types/modules/data/types/basic-data.d.ts +30 -0
- package/dist/types/modules/data/types/deep-data/deep-data.d.ts +20 -0
- package/dist/types/modules/data-binder/data-binder.d.ts +15 -0
- package/dist/types/modules/data-binder/data-pub-sub.d.ts +39 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var d=class{static getType(e){let t=typeof e;return t!=="object"?t:Array.isArray(e)?"array":"object"}static isUndefined(e){return typeof e>"u"}static isObject(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}static isFunction(e){return typeof e=="function"}static isString(e){return typeof e=="string"}static isArray(e){return Array.isArray(e)}};var f={types:{},add(r,e){this.types[r]=e},get(r){return this.types[r]||!1},remove(r){delete this.types[r]}};var l=class{constructor(){this.types=new Map}add(e,t){let s=this.types.get(e);s||(s=[],this.types.set(e,s)),s.push(t)}get(e){return this.types.get(e)||!1}has(e){return this.types.has(e)}removeType(e){let t=this.types.get(e);if(!t)return;if(!t.length){this.types.delete(e);return}let s,i=f.get(e);if(i){for(let n=0,c=t.length;n<c;n++)s=t[n],s&&(t[n]=null,typeof i=="function"&&i(s));this.types.delete(e)}}remove(e){if(e){this.removeType(e);return}let t=this.types.keys();for(let s of t)s&&this.removeType(s);this.types.clear()}};var o=new WeakMap,g=new WeakMap,u=r=>!!r&&(typeof r=="object"||typeof r=="function"),a=class{static trackingCount=0;static addType(e,t){f.add(e,t)}static removeType(e){f.remove(e)}static getTrackingId(e){if(!e||typeof e!="object")return"";let t=g.get(e);return t||(t="dt"+this.trackingCount++,g.set(e,t)),t}static add(e,t,s){u(e)&&this.find(e).add(t,s)}static get(e,t){let s=u(e)?o.get(e):void 0;return s?t?s.get(t):s:!1}static has(e,t){let s=u(e)?o.get(e):void 0;return s&&t?s.has(t):!1}static find(e){let t=o.get(e);return t||(t=new l,o.set(e,t)),t}static isEmpty(e){return!e||typeof e!="object"?!0:e.size===0}static remove(e,t){let s=u(e)?o.get(e):void 0;if(s){if(!t){s.remove(),o.delete(e);return}s.remove(t),this.isEmpty(s.types)&&o.delete(e)}}};var v={getEvents(r){return typeof r!="object"||r===null?[]:a.get(r,"events")},create(r,e,t,s=!1,i=!1,n=null){return{event:r,obj:e,fn:t,capture:s,swapped:i,originalFn:n}},on(r,e,t,s){if(Array.isArray(r))for(let i=0,n=r.length;i<n;i++)this.add(r[i],e,t,s);else this.add(r,e,t,s);return this},off(r,e,t,s){if(Array.isArray(r))for(let i=0,n=r.length;i<n;i++)this.remove(r[i],e,t,s);else this.remove(r,e,t,s);return this},add(r,e,t,s=!1,i=!1,n=null){if(typeof e!="object"||e===null)return this;let c=this.create(r,e,t,s,i,n);return a.add(e,"events",c),e.addEventListener(r,t,s),this},remove(r,e,t,s=!1){let i=this.getEvent(r,e,t,s);if(i===!1)return this;if(typeof i=="object"){this.removeEvent(i);let n=this.getEvents(e);if(n){let c=n.indexOf(i);c>-1&&n.splice(c,1),n.length===0&&a.remove(e,"events")}}return this},removeEvent(r){return typeof r=="object"&&r.obj.removeEventListener(r.event,r.fn,r.capture),this},getEvent(r,e,t,s){if(typeof e!="object")return!1;let i=this.getEvents(e);if(!i||i.length<1)return!1;let n=this.create(r,e,t,s);return this.search(n,i)},search(r,e){let t,s=this.isSwappable(r.event);for(let i=0,n=e.length;i<n;i++)if(t=e[i],!(t.event!==r.event||t.obj!==r.obj)&&(t.fn===r.fn||s===!0&&t.originalFn===r.fn))return t;return!1},removeEvents(r){return typeof r!="object"||r===null?this:(a.remove(r,"events"),this)},swap:new Set(["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"]),addSwapped(r){this.swap.add(r)},isSwappable(r){return this.swap.has(r)}};a.addType("events",r=>{v.removeEvent(r)});var m=class{static limit(e,t=1e6){return typeof e!="string"?"":e.substring(0,t)}static parseQueryString(e,t,s=!0){typeof e!="string"&&(e=window.location.search),e=this.limit(e);let i={},n=/([^?=&]+)(=([^&]*))?/g;return e.replace(n,function(c,p,w,y){let h=y===void 0?"":y;if(t!==!1)try{i[p]=decodeURIComponent(h)}catch{i[p]=h}else i[p]=h}),i}static camelCase(e){e=this.limit(e);let t=/(-|\s|_)+\w{1}/g;return e.replace(t,s=>s[1].toUpperCase())}static uncamelCase(e,t="-"){e=this.limit(e);let s=/([A-Z]{1,})/g;return e.replace(s,i=>t+i.toLowerCase()).toLowerCase()}static titleCase(e){if(!e)return"";e=this.limit(e);let t=/\w\S*/;return e.replace(t,s=>s.charAt(0).toUpperCase()+s.substring(1).toLowerCase())}};export{d as a,a as b,v as c,m as d};
|
|
2
|
+
//# sourceMappingURL=chunk-ZUB7I6Z4.js.map
|
package/dist/modules/ajax.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as e,d as r,e as o,f as c}from"../chunks/chunk-
|
|
1
|
+
import{c as e,d as r,e as o,f as c}from"../chunks/chunk-6N533MOU.js";import"../chunks/chunk-ZUB7I6Z4.js";export{r as Ajax,c as ResourceCache,o as ResourceCacheStore,e as XhrRequest};
|
|
2
2
|
//# sourceMappingURL=ajax.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b as A,c,d as f,e as m,f as P,g as C,h as S}from"../chunks/chunk-
|
|
1
|
+
import{a,b as A,c,d as f,e as m,f as P,g as C,h as S}from"../chunks/chunk-BTEZZMTE.js";import"../chunks/chunk-CKS4W2H6.js";import{f as s}from"../chunks/chunk-R7IRTCS2.js";import"../chunks/chunk-6N533MOU.js";import"../chunks/chunk-UBJO7NXL.js";import"../chunks/chunk-ZUB7I6Z4.js";var b=r=>{let t=typeof r;return t!=="string"&&t!=="number"?r:d(r)},d=r=>[{tag:"text",textContent:r}],l=()=>({props:{},children:[]}),h=r=>({props:{},children:d(r)}),u=r=>({props:{},children:r}),y=r=>({props:r[0]||{},children:b(r[1])});var D=r=>({props:{watch:r},children:[]}),O=r=>{if(r.length===0)return l();let t=r[0],e=typeof t;if(e==="string"||e==="number")return h(t);if(Array.isArray(t))return s.isWatching(t)?D(t):u(t);let o=r[1]??r[0]??[];if(o&&Array.isArray(o)&&s.isWatching(o)){let n=r[0]&&!Array.isArray(r[0])?r[0]:{};r[0]={...n,watch:o},r[1]=[]}return y(r)},H=r=>(...t)=>{let{props:e,children:o}=O(t);return r(e,o)};var T=(r,t)=>{let e=Object.keys(r);for(let o=0,n=e.length;o<n;o++){let p=e[o],x=r[p],i=f[p]||p;t.prototype[i]=m(x,i)}return t},W=0,j=r=>{let t=class extends r{};return t.prototype._classId="pod"+W++,t},I=(r,t=c)=>{if(!r)return null;let e=j(t),o={},n=r(o);return T(o,e),e.prototype.render=n,e};export{H as Atom,C as Builder,c as Component,a as Directives,S as Import,P as Jot,I as Pod,A as Unit};
|
|
2
2
|
//# sourceMappingURL=component.js.map
|
package/dist/modules/data.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as a,g as e,h as o}from"../chunks/chunk-R7IRTCS2.js";import"../chunks/chunk-6N533MOU.js";import"../chunks/chunk-UBJO7NXL.js";import"../chunks/chunk-ZUB7I6Z4.js";export{a as Data,e as Model,o as SimpleData};
|
|
2
2
|
//# sourceMappingURL=data.js.map
|
package/dist/modules/html.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{i as m}from"../chunks/chunk-UBJO7NXL.js";import"../chunks/chunk-ZUB7I6Z4.js";export{m as Html};
|
|
2
2
|
//# sourceMappingURL=html.js.map
|
package/dist/modules/router.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as r,j as o,k as t}from"../chunks/chunk-
|
|
1
|
+
import{i as r,j as o,k as t}from"../chunks/chunk-BTEZZMTE.js";import"../chunks/chunk-CKS4W2H6.js";import"../chunks/chunk-R7IRTCS2.js";import"../chunks/chunk-6N533MOU.js";import"../chunks/chunk-UBJO7NXL.js";import"../chunks/chunk-ZUB7I6Z4.js";export{r as NavLink,o as Router,t as router};
|
|
2
2
|
//# sourceMappingURL=router.js.map
|
package/dist/modules/state.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as r,b as t}from"../chunks/chunk-
|
|
1
|
+
import{a as r,b as t}from"../chunks/chunk-CKS4W2H6.js";import"../chunks/chunk-R7IRTCS2.js";import"../chunks/chunk-6N533MOU.js";import"../chunks/chunk-UBJO7NXL.js";import"../chunks/chunk-ZUB7I6Z4.js";export{r as State,t as Store};
|
|
2
2
|
//# sourceMappingURL=state.js.map
|
|
@@ -10,13 +10,6 @@
|
|
|
10
10
|
* @class
|
|
11
11
|
*/
|
|
12
12
|
export class DataTracker {
|
|
13
|
-
/**
|
|
14
|
-
* @private
|
|
15
|
-
* @static
|
|
16
|
-
* @type {Map} trackers This is an object that stores all tracker
|
|
17
|
-
* objects by tracking id.
|
|
18
|
-
*/
|
|
19
|
-
private static trackers;
|
|
20
13
|
/**
|
|
21
14
|
* @private
|
|
22
15
|
* @static
|
|
@@ -42,7 +35,8 @@ export class DataTracker {
|
|
|
42
35
|
static removeType(type: string): void;
|
|
43
36
|
/**
|
|
44
37
|
* This will get the object tracking id or set it if
|
|
45
|
-
* not set.
|
|
38
|
+
* not set. Trackers no longer need it; it is kept for code that
|
|
39
|
+
* uses the id as a key of its own.
|
|
46
40
|
*
|
|
47
41
|
* @param {object} obj
|
|
48
42
|
* @returns {string}
|
|
@@ -67,7 +61,8 @@ export class DataTracker {
|
|
|
67
61
|
*/
|
|
68
62
|
static get(obj: object, type?: string): any;
|
|
69
63
|
/**
|
|
70
|
-
* This will check if an object has a specific type.
|
|
64
|
+
* This will check if an object has a specific type. It only
|
|
65
|
+
* reads: nothing is created for an object that is not tracked.
|
|
71
66
|
*
|
|
72
67
|
* @param {object} obj
|
|
73
68
|
* @param {string} type
|
|
@@ -75,13 +70,12 @@ export class DataTracker {
|
|
|
75
70
|
*/
|
|
76
71
|
static has(obj: object, type: string): boolean;
|
|
77
72
|
/**
|
|
78
|
-
* This will get the tracker or create
|
|
79
|
-
* if no tracker is set.
|
|
73
|
+
* This will get the tracker of an object or create one.
|
|
80
74
|
*
|
|
81
|
-
* @param {
|
|
82
|
-
* @returns {
|
|
75
|
+
* @param {object} obj
|
|
76
|
+
* @returns {Tracker} The tracker.
|
|
83
77
|
*/
|
|
84
|
-
static find(
|
|
78
|
+
static find(obj: object): Tracker;
|
|
85
79
|
/**
|
|
86
80
|
* This will check if an object is empty.
|
|
87
81
|
*
|
|
@@ -99,3 +93,4 @@ export class DataTracker {
|
|
|
99
93
|
*/
|
|
100
94
|
static remove(obj: object, type?: string): void;
|
|
101
95
|
}
|
|
96
|
+
import { Tracker } from './tracker.js';
|
|
@@ -114,6 +114,36 @@ export class BasicData {
|
|
|
114
114
|
* @type {object} stage
|
|
115
115
|
*/
|
|
116
116
|
stage: object;
|
|
117
|
+
/**
|
|
118
|
+
* This will create the local event sub.
|
|
119
|
+
*
|
|
120
|
+
* @protected
|
|
121
|
+
* @returns {DataPubSub}
|
|
122
|
+
*/
|
|
123
|
+
protected createEventSub(): DataPubSub;
|
|
124
|
+
/**
|
|
125
|
+
* This will check if the constructor values can be written
|
|
126
|
+
* without publishing: true unless a subclass changed how values
|
|
127
|
+
* are set or published.
|
|
128
|
+
*
|
|
129
|
+
* @protected
|
|
130
|
+
* @returns {boolean}
|
|
131
|
+
*/
|
|
132
|
+
protected _canSilentInit(): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* This will write the constructor values.
|
|
135
|
+
*
|
|
136
|
+
* A new data object has a new id, so nothing can be subscribed to
|
|
137
|
+
* it yet, locally or in the data binder. Publishing every value
|
|
138
|
+
* was pure overhead (most of the cost of creating a scoped row).
|
|
139
|
+
* The values are written the way set() would write them: a value
|
|
140
|
+
* equal to the current one (undefined) is skipped.
|
|
141
|
+
*
|
|
142
|
+
* @protected
|
|
143
|
+
* @param {object} attributes
|
|
144
|
+
* @returns {void}
|
|
145
|
+
*/
|
|
146
|
+
protected _initAttributes(attributes: object): void;
|
|
117
147
|
/**
|
|
118
148
|
* This will setup the number and unique id of the data object.
|
|
119
149
|
*
|
|
@@ -38,6 +38,26 @@ export class Data extends BasicData {
|
|
|
38
38
|
* @returns {object}
|
|
39
39
|
*/
|
|
40
40
|
scope(attr: string, constructor?: object): object;
|
|
41
|
+
/**
|
|
42
|
+
* This will link a scoped data source to a parent attr.
|
|
43
|
+
*
|
|
44
|
+
* linkAttr makes two subscriptions per key: the parent path to
|
|
45
|
+
* the child key, and the child key back to the parent path. A
|
|
46
|
+
* scoped for-each row only needs the first. The child sends its
|
|
47
|
+
* writes to those keys back to the parent directly (see
|
|
48
|
+
* _setAttr), which also lands them on the parent in the same
|
|
49
|
+
* tick instead of after the next flush.
|
|
50
|
+
*
|
|
51
|
+
* @param {object} data The parent data.
|
|
52
|
+
* @param {string} attr The parent attr ('items[3]').
|
|
53
|
+
* @returns {void}
|
|
54
|
+
*/
|
|
55
|
+
linkScope(data: object, attr: string): void;
|
|
56
|
+
_upstream: {
|
|
57
|
+
data: any;
|
|
58
|
+
prefix: string;
|
|
59
|
+
keys: Set<string>;
|
|
60
|
+
};
|
|
41
61
|
/**
|
|
42
62
|
* This will splice a value from an array and set
|
|
43
63
|
* the result.
|
|
@@ -97,6 +97,21 @@ export class DataBinder {
|
|
|
97
97
|
* @returns {this} an instance of the data binder.
|
|
98
98
|
*/
|
|
99
99
|
unbind(element: object): this;
|
|
100
|
+
/**
|
|
101
|
+
* This will check if a node has one-way watchers.
|
|
102
|
+
*
|
|
103
|
+
* @param {object} node
|
|
104
|
+
* @returns {boolean}
|
|
105
|
+
*/
|
|
106
|
+
hasWatchers(node: object): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* This will check if a node has anything to unbind: watchers or a
|
|
109
|
+
* two-way bind.
|
|
110
|
+
*
|
|
111
|
+
* @param {object} node
|
|
112
|
+
* @returns {boolean}
|
|
113
|
+
*/
|
|
114
|
+
isBound(node: object): boolean;
|
|
100
115
|
/**
|
|
101
116
|
* This will setup a watcher for an element.
|
|
102
117
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export function getRootKey(msg: string): string;
|
|
1
2
|
/**
|
|
2
3
|
* DataPubSub
|
|
3
4
|
*
|
|
@@ -15,8 +16,13 @@ export class DataPubSub {
|
|
|
15
16
|
* subscribed messages grouped by their `prefix:` segment. Used by
|
|
16
17
|
* the data binder so deep data can publish only to subscribed
|
|
17
18
|
* paths instead of walking every node of a value.
|
|
19
|
+
* @param {boolean} [indexRoots=false] Maintain an index of
|
|
20
|
+
* subscribed messages grouped by their root key ('items' for
|
|
21
|
+
* 'items[0].name:change'). Used by deep data so setting an object
|
|
22
|
+
* only looks at the paths under that key instead of every
|
|
23
|
+
* subscription on the data.
|
|
18
24
|
*/
|
|
19
|
-
constructor(indexPrefixes?: boolean);
|
|
25
|
+
constructor(indexPrefixes?: boolean, indexRoots?: boolean);
|
|
20
26
|
/**
|
|
21
27
|
* @type {Map} callBacks
|
|
22
28
|
* @protected
|
|
@@ -30,6 +36,14 @@ export class DataPubSub {
|
|
|
30
36
|
* @protected
|
|
31
37
|
*/
|
|
32
38
|
protected prefixIndex: Map<string, Set<string>> | null;
|
|
39
|
+
/**
|
|
40
|
+
* Index of subscribed messages keyed by root key. Null when
|
|
41
|
+
* disabled.
|
|
42
|
+
*
|
|
43
|
+
* @type {Map<string, Set<string>>|null}
|
|
44
|
+
* @protected
|
|
45
|
+
*/
|
|
46
|
+
protected rootIndex: Map<string, Set<string>> | null;
|
|
33
47
|
/**
|
|
34
48
|
* Queue for batching publish calls
|
|
35
49
|
* @type {Map<string, Array>}
|
|
@@ -149,6 +163,30 @@ export class DataPubSub {
|
|
|
149
163
|
* @returns {void}
|
|
150
164
|
*/
|
|
151
165
|
protected _unindexMessage(msg: string): void;
|
|
166
|
+
/**
|
|
167
|
+
* This will add a message to the root index.
|
|
168
|
+
*
|
|
169
|
+
* @protected
|
|
170
|
+
* @param {string} msg
|
|
171
|
+
* @returns {void}
|
|
172
|
+
*/
|
|
173
|
+
protected _indexRoot(msg: string): void;
|
|
174
|
+
/**
|
|
175
|
+
* This will remove a message from the root index.
|
|
176
|
+
*
|
|
177
|
+
* @protected
|
|
178
|
+
* @param {string} msg
|
|
179
|
+
* @returns {void}
|
|
180
|
+
*/
|
|
181
|
+
protected _unindexRoot(msg: string): void;
|
|
182
|
+
/**
|
|
183
|
+
* This will get the subscribed messages under a root key. When
|
|
184
|
+
* root indexing is disabled every message is returned.
|
|
185
|
+
*
|
|
186
|
+
* @param {string} root
|
|
187
|
+
* @returns {Iterable<string>|null}
|
|
188
|
+
*/
|
|
189
|
+
getRootMessages(root: string): Iterable<string> | null;
|
|
152
190
|
/**
|
|
153
191
|
* This will get the subscribed messages for a prefix
|
|
154
192
|
* (e.g. 'dt-3:'). Returns null when prefix indexing is
|