@salla.sa/twilight 1.6.15 → 2.0.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/README.md +4 -214
- package/components/README.md +55 -0
- package/components/dist/cjs/index-9441fd8e.js +1554 -0
- package/components/dist/cjs/index.cjs.js +2 -0
- package/components/dist/cjs/loader.cjs.js +21 -0
- package/components/dist/cjs/salla-login_2.cjs.entry.js +131 -0
- package/components/dist/cjs/twilight-components.cjs.js +19 -0
- package/components/dist/collection/collection-manifest.json +13 -0
- package/components/dist/collection/components/generate-summary.js +35 -0
- package/components/dist/collection/components/salla-login/salla-login.css +104 -0
- package/components/dist/collection/components/salla-login/salla-login.js +113 -0
- package/components/dist/collection/components/search-modal/search-modal.css +9 -0
- package/components/dist/collection/components/search-modal/search-modal.js +161 -0
- package/components/dist/collection/index.js +1 -0
- package/components/dist/collection/interfaces/colors.js +1 -0
- package/components/dist/collection/interfaces/index.js +2 -0
- package/components/dist/collection/interfaces/ratio.js +1 -0
- package/components/dist/collection/plugins/tailwind-theme/index.js +32 -0
- package/components/dist/collection/plugins/tailwind-theme/scripts/generator.js +51 -0
- package/components/dist/collection/utils/utils.js +16 -0
- package/components/dist/esm/index-63e5409f.js +1527 -0
- package/components/dist/esm/index.js +1 -0
- package/components/dist/esm/loader.js +17 -0
- package/components/dist/esm/polyfills/core-js.js +11 -0
- package/components/dist/esm/polyfills/css-shim.js +1 -0
- package/components/dist/esm/polyfills/dom.js +79 -0
- package/components/dist/esm/polyfills/es5-html-element.js +1 -0
- package/components/dist/esm/polyfills/index.js +34 -0
- package/components/dist/esm/polyfills/system.js +6 -0
- package/components/dist/esm/salla-login_2.entry.js +126 -0
- package/components/dist/esm/twilight-components.js +17 -0
- package/components/dist/index.cjs.js +1 -0
- package/components/dist/index.js +1 -0
- package/components/dist/twilight-components/index.esm.js +0 -0
- package/components/dist/twilight-components/p-3d53781c.js +1 -0
- package/components/dist/twilight-components/p-fccb89fa.entry.js +1 -0
- package/components/dist/twilight-components/twilight-components.esm.js +1 -0
- package/components/dist/types/components/salla-login/salla-login.d.ts +14 -0
- package/components/dist/types/components/search-modal/search-modal.d.ts +26 -0
- package/components/dist/types/components.d.ts +76 -0
- package/components/dist/types/index.d.ts +6 -0
- package/components/dist/types/interfaces/colors.d.ts +1 -0
- package/components/dist/types/interfaces/index.d.ts +2 -0
- package/components/dist/types/interfaces/ratio.d.ts +1 -0
- package/components/dist/types/stencil-public-runtime.d.ts +1563 -0
- package/components/dist/types/utils/utils.d.ts +6 -0
- package/components/loader/cdn.js +3 -0
- package/components/loader/index.cjs.js +3 -0
- package/components/loader/index.d.ts +13 -0
- package/components/loader/index.es2017.js +3 -0
- package/components/loader/index.js +4 -0
- package/components/loader/package.json +10 -0
- package/components/package.json +70 -0
- package/components/src/plugins/tailwind-theme/index.js +32 -0
- package/components/src/plugins/tailwind-theme/package.json +27 -0
- package/components/src/plugins/tailwind-theme/readme.md +47 -0
- package/components/src/plugins/tailwind-theme/safe-list-css.txt +19 -0
- package/components/src/plugins/tailwind-theme/utilities.json +1 -0
- package/components.js +1 -0
- package/dist/twilight.js +2 -0
- package/dist/twilight.js.LICENSE.txt +27 -0
- package/package.json +53 -63
- package/postInstall.js +2 -0
- package/tailwind.js +1 -0
- package/tailwind_css_list.js +1 -0
- package/watcher.js +20 -62
- package/LICENSE.md +0 -674
- package/dist/@salla.sa/twilight.min.js +0 -20
- package/dist/@salla.sa/twilight.min.js.map +0 -1
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/index.js.map +0 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +0 -1
- package/types/actions.d.ts +0 -47
- package/types/api/auth/index.d.ts +0 -17
- package/types/api/auth/request.d.ts +0 -42
- package/types/api/auth/response.d.ts +0 -22
- package/types/api/cart/index.d.ts +0 -24
- package/types/api/cart/request.d.ts +0 -8
- package/types/api/cart/response.d.ts +0 -66
- package/types/api/comment.d.ts +0 -18
- package/types/api/currency.d.ts +0 -17
- package/types/api/document.d.ts +0 -3
- package/types/api/index.d.ts +0 -110
- package/types/api/loyalty.d.ts +0 -226
- package/types/api/order.d.ts +0 -15
- package/types/api/product/index.d.ts +0 -17
- package/types/api/product/request.d.ts +0 -53
- package/types/api/product/response.d.ts +0 -103
- package/types/api/profile.d.ts +0 -60
- package/types/api/rating.d.ts +0 -49
- package/types/api/scope.d.ts +0 -42
- package/types/api/wishlist.d.ts +0 -7
- package/types/common.d.ts +0 -75
- package/types/event/auth.d.ts +0 -18
- package/types/event/cart.d.ts +0 -30
- package/types/event/comment.d.ts +0 -7
- package/types/event/currency.d.ts +0 -9
- package/types/event/document.d.ts +0 -29
- package/types/event/index.d.ts +0 -48
- package/types/event/infiniteScroll.d.ts +0 -12
- package/types/event/loyalty.d.ts +0 -14
- package/types/event/order.d.ts +0 -11
- package/types/event/product.d.ts +0 -30
- package/types/event/profile.d.ts +0 -19
- package/types/event/rating.d.ts +0 -13
- package/types/event/scope.d.ts +0 -15
- package/types/event/wishlist.d.ts +0 -8
- package/types/helpers/app-helpers.d.ts +0 -29
- package/types/index.d.ts +0 -37
- package/types/lib/config.ts +0 -14
- package/types/lib/form.d.ts +0 -8
- package/types/lib/lang.d.ts +0 -14
- package/types/lib/notify.d.ts +0 -14
- package/types/tiwlight-config.d.ts +0 -74
package/package.json
CHANGED
|
@@ -1,65 +1,55 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"rollup-plugin-version-injector": "^1.3.3",
|
|
56
|
-
"rollup-plugin-watch": "^1.0.1",
|
|
57
|
-
"webpack": "^5.74.0",
|
|
58
|
-
"webpack-build-notifier": "^2.3.0",
|
|
59
|
-
"webpack-cli": "^4.10.0"
|
|
60
|
-
},
|
|
61
|
-
"peerDependencies": {
|
|
62
|
-
"webpack": "^4 || ^5"
|
|
63
|
-
},
|
|
64
|
-
"gitHead": "4785838b20f24f09a8ce69951dd26fb159800d1b"
|
|
2
|
+
"name": "@salla.sa/twilight",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Salla Theme Toolkit, Webcomponents, Events, Requests, Utils",
|
|
5
|
+
"main": "dist/twilight.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"prod": "webpack --mode production",
|
|
8
|
+
"watch": "webpack --mode development --watch",
|
|
9
|
+
"postinstall": "node ./postInstall.js"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"salla",
|
|
13
|
+
"theme",
|
|
14
|
+
"utils",
|
|
15
|
+
"events",
|
|
16
|
+
"requests"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/SallaApp/twilight-js.git"
|
|
21
|
+
},
|
|
22
|
+
"author": "Salla.sa",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"watcher.js",
|
|
27
|
+
"tailwind.js",
|
|
28
|
+
"package.json",
|
|
29
|
+
"components.js",
|
|
30
|
+
"postInstall.js",
|
|
31
|
+
"components/dist",
|
|
32
|
+
"components/loader",
|
|
33
|
+
"tailwind_css_list.js"
|
|
34
|
+
],
|
|
35
|
+
"homepage": "https://salla.dev",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@salla.sa/applepay": "~1.0",
|
|
38
|
+
"axios": "^0.23.0",
|
|
39
|
+
"eventemitter2": "^6.4.5",
|
|
40
|
+
"infinite-scroll": "^4.0.1",
|
|
41
|
+
"lang.js": "^1.1.14",
|
|
42
|
+
"store": "^2.0.12"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@babel/core": "^7.16.0",
|
|
46
|
+
"babel-loader": "^8.2.3",
|
|
47
|
+
"glob": "^7.2.0",
|
|
48
|
+
"webpack": "^5.64.2",
|
|
49
|
+
"webpack-build-notifier": "^2.3.0",
|
|
50
|
+
"webpack-cli": "^4.9.1"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"webpack": "^4 || ^5"
|
|
54
|
+
}
|
|
65
55
|
}
|
package/postInstall.js
ADDED
package/tailwind.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./components/src/plugins/tailwind-theme/index.js');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('path').resolve(__dirname, 'components/src/plugins/tailwind-theme/safe-list-css.txt');
|
package/watcher.js
CHANGED
|
@@ -2,8 +2,6 @@ const path = require('path');
|
|
|
2
2
|
const glob = require("glob");
|
|
3
3
|
const color = {normal: "\x1b[0m", red: "\x1b[31m", green: "\x1b[32m", yellow: "\x1b[33m", cyan: "\x1b[36m",}
|
|
4
4
|
const {execSync} = require("child_process");
|
|
5
|
-
const fs = require("fs");
|
|
6
|
-
const WebSocketClient = require('websocket').client;
|
|
7
5
|
//const webpack = require("webpack");
|
|
8
6
|
/**
|
|
9
7
|
* @callback HookCallback
|
|
@@ -50,26 +48,10 @@ const WebSocketClient = require('websocket').client;
|
|
|
50
48
|
* @property {boolean} isWin
|
|
51
49
|
*/
|
|
52
50
|
class WatcherPlugin {
|
|
53
|
-
constructor(
|
|
54
|
-
|
|
55
|
-
if(!params.theme_id){
|
|
56
|
-
// this is another way to get params from cli
|
|
57
|
-
let cachePath = path.join(process.cwd(), "/node_modules/.salla-cli");
|
|
58
|
-
if(fs.existsSync(cachePath)) params = JSON.parse(fs.readFileSync(cachePath, 'utf8'));
|
|
59
|
-
}
|
|
60
|
-
}catch(err){}
|
|
61
|
-
|
|
62
|
-
let {wsport = 8001, sallaCli = "salla", theme_id, upload_url, store_id, draft_id} = params;
|
|
63
|
-
|
|
64
|
-
this.sallaCli = sallaCli;
|
|
65
|
-
this.theme_id = theme_id;
|
|
66
|
-
this.upload_url = upload_url;
|
|
67
|
-
this.store_id = store_id;
|
|
68
|
-
this.draft_id = draft_id;
|
|
69
|
-
this.wsport = wsport;
|
|
70
|
-
this.files = {};
|
|
51
|
+
constructor(sallaCli = 'salla') {
|
|
52
|
+
this.sallaCli = sallaCli;
|
|
71
53
|
}
|
|
72
|
-
|
|
54
|
+
|
|
73
55
|
/**
|
|
74
56
|
* @param {Compiler} compiler
|
|
75
57
|
*/
|
|
@@ -83,19 +65,9 @@ class WatcherPlugin {
|
|
|
83
65
|
|
|
84
66
|
console.log(color.green, '✓ Listening to webpack watch.', color.normal);
|
|
85
67
|
this.addFilesToWatcher(compiler);
|
|
86
|
-
this.connectToWsServer();
|
|
87
68
|
this.watchingChangedFiles(compiler);
|
|
88
|
-
this.afterCompile(compiler);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @param {Compiler} compiler
|
|
93
|
-
*/
|
|
94
|
-
afterCompile(compiler) {
|
|
95
|
-
compiler.hooks.afterCompile.tap('SallaAfterCompilePlugin', (compilation) => {
|
|
96
|
-
if(this.connection) this.connection.sendUTF(JSON.stringify({ msg: "reload" }));
|
|
97
|
-
});
|
|
98
69
|
}
|
|
70
|
+
|
|
99
71
|
/**
|
|
100
72
|
* @param {Compiler} compiler
|
|
101
73
|
*/
|
|
@@ -104,10 +76,8 @@ class WatcherPlugin {
|
|
|
104
76
|
let files = this.isWebpack5
|
|
105
77
|
? Array.from(compiler_.modifiedFiles || [])
|
|
106
78
|
: Object.keys(compiler_.watchFileSystem.watcher.mtimes);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (file.toLowerCase().endsWith(".twig")) this.addToQ(file);
|
|
110
|
-
});
|
|
79
|
+
files.filter(file => file.toLowerCase().endsWith('.twig'))
|
|
80
|
+
.forEach(file => execSync(`${this.sallaCli} theme sync -f "${file}" -t ${this.draftId}`, {stdio: 'inherit'}));
|
|
111
81
|
}
|
|
112
82
|
);
|
|
113
83
|
}
|
|
@@ -123,7 +93,7 @@ class WatcherPlugin {
|
|
|
123
93
|
}
|
|
124
94
|
|
|
125
95
|
getEntry() {
|
|
126
|
-
let viewsPath = path.join(process.cwd(), "
|
|
96
|
+
let viewsPath = path.join(process.cwd(), "views");
|
|
127
97
|
return this.isWin && this.isWebpack5
|
|
128
98
|
? viewsPath
|
|
129
99
|
: glob.sync(path.join(viewsPath, "**/*.twig"), {absolute: true});
|
|
@@ -134,31 +104,19 @@ class WatcherPlugin {
|
|
|
134
104
|
* @return {boolean}
|
|
135
105
|
*/
|
|
136
106
|
canWatch(options) {
|
|
137
|
-
if (!options.watch)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
});
|
|
151
|
-
client.connect(`ws://localhost:${this.wsport}`, 'echo-protocol');
|
|
152
|
-
}
|
|
153
|
-
addToQ(file) {
|
|
154
|
-
if (this.files[file]) clearTimeout(this.files[file]);
|
|
155
|
-
this.files[file] = setTimeout(() => {
|
|
156
|
-
execSync(
|
|
157
|
-
`${this.sallaCli} theme sync -f "${file}" -id ${this.theme_id} -store_id ${this.store_id} -draft_id ${this.draft_id} -upload_url ${this.upload_url}`,
|
|
158
|
-
{ stdio: "inherit" }
|
|
159
|
-
);
|
|
160
|
-
delete this.files[file];
|
|
161
|
-
}, 700);
|
|
107
|
+
if (options.mode !== 'development' || !options.watch) {
|
|
108
|
+
console.log(color.green, `✓ Skipping Watching Theme files in production.`, color.normal);
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
//if theme id not existed go out
|
|
112
|
+
try {
|
|
113
|
+
this.draftId = require(path.resolve(process.cwd(), 'theme.json')).draft_id
|
|
114
|
+
return !!this.draftId;
|
|
115
|
+
} catch (e) {
|
|
116
|
+
let command = color.cyan + this.sallaCli + ' theme watch' + color.red
|
|
117
|
+
console.log(color.red, `X Theme files won't sync! if you want to sync them, run: ${command}`, color.normal);
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
162
120
|
}
|
|
163
121
|
}
|
|
164
122
|
|