@ganpatiinfo/gids-core-web 0.0.2

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 ADDED
@@ -0,0 +1,3 @@
1
+ # GIDS Core components & styles for web
2
+
3
+ This package is dedicated to have core components and styles for web
@@ -0,0 +1,54 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/index.ts",
8
+ "declarations": [],
9
+ "exports": []
10
+ },
11
+ {
12
+ "kind": "javascript-module",
13
+ "path": "src/utils/constructedGidsStylesheet.ts",
14
+ "declarations": [
15
+ {
16
+ "kind": "function",
17
+ "name": "refreshConstructedGidsStylesheet",
18
+ "return": {
19
+ "type": {
20
+ "text": "boolean"
21
+ }
22
+ }
23
+ },
24
+ {
25
+ "kind": "function",
26
+ "name": "getConstructedGidsStylesheet",
27
+ "return": {
28
+ "type": {
29
+ "text": "CSSStyleSheet | undefined"
30
+ }
31
+ }
32
+ }
33
+ ],
34
+ "exports": [
35
+ {
36
+ "kind": "js",
37
+ "name": "refreshConstructedGidsStylesheet",
38
+ "declaration": {
39
+ "name": "refreshConstructedGidsStylesheet",
40
+ "module": "src/utils/constructedGidsStylesheet.ts"
41
+ }
42
+ },
43
+ {
44
+ "kind": "js",
45
+ "name": "getConstructedGidsStylesheet",
46
+ "declaration": {
47
+ "name": "getConstructedGidsStylesheet",
48
+ "module": "src/utils/constructedGidsStylesheet.ts"
49
+ }
50
+ }
51
+ ]
52
+ }
53
+ ]
54
+ }
package/dist/index.css ADDED
@@ -0,0 +1,9 @@
1
+ gids-global-styles-start {
2
+ --x: 0;
3
+ }
4
+
5
+ gids-global-styles-end {
6
+ --x: 0;
7
+ }
8
+
9
+ /*# sourceMappingURL=index.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sourceRoot":"","sources":["../src/styles/start.scss","../src/styles/end.scss"],"names":[],"mappings":"AAAA;EACC;;;ACDD;EACC","file":"index.css"}
@@ -0,0 +1,34 @@
1
+ export * from "./types/index.js"
2
+ /**
3
+ * Get the base path to where the assets can be found. Use "setAssetPath(path)"
4
+ * if the path needs to be customized.
5
+ */
6
+ export declare const getAssetPath: (path: string) => string;
7
+
8
+ /**
9
+ * Used to manually set the base path where assets can be found.
10
+ * If the script is used as "module", it's recommended to use "import.meta.url",
11
+ * such as "setAssetPath(import.meta.url)". Other options include
12
+ * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
13
+ * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
14
+ * But do note that this configuration depends on how your script is bundled, or lack of
15
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
16
+ * will have to ensure the static assets are copied to its build directory.
17
+ */
18
+ export declare const setAssetPath: (path: string) => void;
19
+
20
+ /**
21
+ * Used to specify a nonce value that corresponds with an application's CSP.
22
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
23
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
24
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
25
+ * will result in the same behavior.
26
+ */
27
+ export declare const setNonce: (nonce: string) => void
28
+
29
+ export interface SetPlatformOptions {
30
+ raf?: (c: FrameRequestCallback) => number;
31
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
32
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
33
+ }
34
+ export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
package/dist/index.js ADDED
@@ -0,0 +1,230 @@
1
+ /*
2
+ Stencil Client Platform v4.31.0 | MIT Licensed | https://stenciljs.com
3
+ */
4
+ var __defProp = Object.defineProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var win = typeof window !== "undefined" ? window : {};
10
+ var plt = {
11
+ $flags$: 0,
12
+ $resourcesUrl$: "",
13
+ jmp: (h2) => h2(),
14
+ raf: (h2) => requestAnimationFrame(h2),
15
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
16
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
17
+ ce: (eventName, opts) => new CustomEvent(eventName, opts)
18
+ };
19
+
20
+ // src/runtime/asset-path.ts
21
+ var getAssetPath = (path) => {
22
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
23
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
24
+ };
25
+ var setAssetPath = (path) => plt.$resourcesUrl$ = path;
26
+ var isComplexType = (o) => {
27
+ o = typeof o;
28
+ return o === "object" || o === "function";
29
+ };
30
+
31
+ // src/utils/regular-expression.ts
32
+ var escapeRegExpSpecialCharacters = (text) => {
33
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
34
+ };
35
+
36
+ // src/utils/result.ts
37
+ var result_exports = {};
38
+ __export(result_exports, {
39
+ err: () => err,
40
+ map: () => map,
41
+ ok: () => ok,
42
+ unwrap: () => unwrap,
43
+ unwrapErr: () => unwrapErr
44
+ });
45
+ var ok = (value) => ({
46
+ isOk: true,
47
+ isErr: false,
48
+ value
49
+ });
50
+ var err = (value) => ({
51
+ isOk: false,
52
+ isErr: true,
53
+ value
54
+ });
55
+ function map(result, fn) {
56
+ if (result.isOk) {
57
+ const val = fn(result.value);
58
+ if (val instanceof Promise) {
59
+ return val.then((newVal) => ok(newVal));
60
+ } else {
61
+ return ok(val);
62
+ }
63
+ }
64
+ if (result.isErr) {
65
+ const value = result.value;
66
+ return err(value);
67
+ }
68
+ throw "should never get here";
69
+ }
70
+ var unwrap = (result) => {
71
+ if (result.isOk) {
72
+ return result.value;
73
+ } else {
74
+ throw result.value;
75
+ }
76
+ };
77
+ var unwrapErr = (result) => {
78
+ if (result.isErr) {
79
+ return result.value;
80
+ } else {
81
+ throw result.value;
82
+ }
83
+ };
84
+ var h = (nodeName, vnodeData, ...children) => {
85
+ let child = null;
86
+ let simple = false;
87
+ let lastSimple = false;
88
+ const vNodeChildren = [];
89
+ const walk = (c) => {
90
+ for (let i2 = 0; i2 < c.length; i2++) {
91
+ child = c[i2];
92
+ if (Array.isArray(child)) {
93
+ walk(child);
94
+ } else if (child != null && typeof child !== "boolean") {
95
+ if (simple = !isComplexType(child)) {
96
+ child = String(child);
97
+ }
98
+ if (simple && lastSimple) {
99
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
100
+ } else {
101
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
102
+ }
103
+ lastSimple = simple;
104
+ }
105
+ }
106
+ };
107
+ walk(children);
108
+ const vnode = newVNode(nodeName, null);
109
+ vnode.$attrs$ = vnodeData;
110
+ if (vNodeChildren.length > 0) {
111
+ vnode.$children$ = vNodeChildren;
112
+ }
113
+ return vnode;
114
+ };
115
+ var newVNode = (tag, text) => {
116
+ const vnode = {
117
+ $flags$: 0,
118
+ $tag$: tag,
119
+ $text$: text,
120
+ $elm$: null,
121
+ $children$: null
122
+ };
123
+ return vnode;
124
+ };
125
+ var Host = {};
126
+ var isHost = (node) => node && node.$tag$ === Host;
127
+ var createSupportsRuleRe = (selector) => {
128
+ const safeSelector2 = escapeRegExpSpecialCharacters(selector);
129
+ return new RegExp(
130
+ // First capture group: match any context before the selector that's not inside @supports selector()
131
+ // Using negative lookahead to avoid matching inside @supports selector(...) condition
132
+ `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
133
+ "g"
134
+ );
135
+ };
136
+ createSupportsRuleRe("::slotted");
137
+ createSupportsRuleRe(":host");
138
+ createSupportsRuleRe(":host-context");
139
+ var hostTagName;
140
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
141
+ const newVNode2 = newParentVNode.$children$[childIndex];
142
+ let i2 = 0;
143
+ let elm;
144
+ let childNode;
145
+ {
146
+ if (!win.document) {
147
+ throw new Error(
148
+ "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
149
+ );
150
+ }
151
+ elm = newVNode2.$elm$ = win.document.createElement(
152
+ newVNode2.$tag$
153
+ );
154
+ if (newVNode2.$children$) {
155
+ for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
156
+ childNode = createElm(oldParentVNode, newVNode2, i2);
157
+ if (childNode) {
158
+ elm.appendChild(childNode);
159
+ }
160
+ }
161
+ }
162
+ }
163
+ elm["s-hn"] = hostTagName;
164
+ return elm;
165
+ };
166
+ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
167
+ let containerElm = parentElm;
168
+ let childNode;
169
+ for (; startIdx <= endIdx; ++startIdx) {
170
+ if (vnodes[startIdx]) {
171
+ childNode = createElm(null, parentVNode, startIdx);
172
+ if (childNode) {
173
+ vnodes[startIdx].$elm$ = childNode;
174
+ insertBefore(containerElm, childNode, before);
175
+ }
176
+ }
177
+ }
178
+ };
179
+ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
180
+ const elm = newVNode2.$elm$ = oldVNode.$elm$;
181
+ const newChildren = newVNode2.$children$;
182
+ {
183
+ if (newChildren !== null) {
184
+ addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
185
+ } else ;
186
+ }
187
+ };
188
+ var insertBefore = (parent, newNode, reference) => {
189
+ {
190
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
191
+ }
192
+ };
193
+ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
194
+ const hostElm = hostRef.$hostElement$;
195
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
196
+ const isHostElement = isHost(renderFnResults);
197
+ const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
198
+ hostTagName = hostElm.tagName;
199
+ if (isInitialLoad && rootVnode.$attrs$) {
200
+ for (const key of Object.keys(rootVnode.$attrs$)) {
201
+ if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
202
+ rootVnode.$attrs$[key] = hostElm[key];
203
+ }
204
+ }
205
+ }
206
+ rootVnode.$tag$ = null;
207
+ rootVnode.$flags$ |= 4 /* isHost */;
208
+ hostRef.$vnode$ = rootVnode;
209
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm;
210
+ patch(oldVNode, rootVnode, isInitialLoad);
211
+ };
212
+
213
+ // src/runtime/nonce.ts
214
+ var setNonce = (nonce) => plt.$nonce$ = nonce;
215
+
216
+ // src/runtime/platform-options.ts
217
+ var setPlatformOptions = (opts) => Object.assign(plt, opts);
218
+
219
+ // src/runtime/render.ts
220
+ function render(vnode, container) {
221
+ const ref = {
222
+ $hostElement$: container
223
+ };
224
+ renderVdom(ref, vnode);
225
+ }
226
+
227
+ export { getAssetPath, render, setAssetPath, setNonce, setPlatformOptions };
228
+ //# sourceMappingURL=index.js.map
229
+
230
+ //# sourceMappingURL=index.js.map