create-knapsack 4.89.1 → 4.89.2--canary.faf6549.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/.temp/packages/knapsack/data/db.yml +9 -0
- package/.temp/packages/knapsack/data/knapsack.asset-sets.json +4 -0
- package/.temp/packages/knapsack/data/knapsack.design-tokens.json +1 -0
- package/.temp/packages/knapsack/data/knapsack.files.json +3 -0
- package/.temp/packages/knapsack/data/knapsack.navs.yml +2 -0
- package/.temp/packages/knapsack/data/knapsack.patterns.json +35 -0
- package/.temp/packages/knapsack/dist/meta/ks-meta.json +1 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.android.xml +3 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.cjs +1 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.css +2 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.css.scss +2 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.d.cts +1 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.d.mts +1 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.d.ts +1 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.js +1 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.json +1 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.less +1 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.mjs +1 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.nested.json +1 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.scss +1 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.style-dictionary.json +1 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.swift +3 -0
- package/.temp/packages/knapsack/dist/tokens/design-tokens.w3c-spec.json +1 -0
- package/.temp/packages/knapsack/knapsack.config.cjs +26 -0
- package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/app-client-data.json +1 -0
- package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/build-meta.json +1 -0
- package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/discovery.json +1 -0
- package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/hydrate.renderer-react.json +1 -0
- package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/knapsack-renderer-react/apps_client_libs_renderer-react-components_dist_demo-wrapper_js.chunk.e12d15c77b840c0f2a57.js +22 -0
- package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/knapsack-renderer-react/ks-pattern-import-global-setup.js +17 -0
- package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/knapsack-renderer-react/main.bundle.e12d15c77b840c0f2a57.js +4846 -0
- package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/knapsack-renderer-react/manifest.json +4 -0
- package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/renderer-client/renderer-client.mjs +132 -0
- package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/renderer-discovery-react.json +1 -0
- package/.temp/packages/knapsack/package.json +17 -0
- package/package.json +16 -16
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
{
|
|
2
|
+
"main.js": "/knapsack-renderer-react/main.bundle.e12d15c77b840c0f2a57.js",
|
|
3
|
+
"apps_client_libs_renderer-react-components_dist_demo-wrapper_js.chunk.js": "/knapsack-renderer-react/apps_client_libs_renderer-react-components_dist_demo-wrapper_js.chunk.e12d15c77b840c0f2a57.js"
|
|
4
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
const metaTag = document.getElementById('ks-meta');
|
|
2
|
+
const metaString = metaTag?.innerText;
|
|
3
|
+
const meta = JSON.parse(metaString ?? '{}');
|
|
4
|
+
const {
|
|
5
|
+
websocketsPort
|
|
6
|
+
} = meta;
|
|
7
|
+
// an extra check in case the meta tag is wrong
|
|
8
|
+
const isReallyInIframe = window.parent !== window;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A type-safe wrapper for `window.parent.postMessage()`
|
|
12
|
+
*/
|
|
13
|
+
function postMessage(message) {
|
|
14
|
+
window.parent.postMessage(message, '*');
|
|
15
|
+
}
|
|
16
|
+
if (websocketsPort) {
|
|
17
|
+
if ('WebSocket' in window && window.location.hostname === 'localhost') {
|
|
18
|
+
const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
|
19
|
+
const socket = new window.WebSocket(`${protocol}://localhost:${websocketsPort}`);
|
|
20
|
+
socket.addEventListener('message', msg => {
|
|
21
|
+
const theMsg = JSON.parse(msg?.data ?? {});
|
|
22
|
+
if (!theMsg?.event) return;
|
|
23
|
+
const event = theMsg.event;
|
|
24
|
+
switch (event) {
|
|
25
|
+
case 'RENDERER_CLIENT_RELOAD':
|
|
26
|
+
window.location.reload();
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (isReallyInIframe) {
|
|
33
|
+
/**
|
|
34
|
+
* Prevents the natural click behavior of any links within the iframe.
|
|
35
|
+
* Otherwise the iframe reloads with the current page or follows the url provided.
|
|
36
|
+
*/
|
|
37
|
+
const links = document.querySelectorAll('a');
|
|
38
|
+
links.forEach(link => {
|
|
39
|
+
link.addEventListener('click', e => {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
let resizeTimeoutId;
|
|
44
|
+
let scrollDebounceTimer;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Sends a message to the parent window with the current height and width of the iframe's content.
|
|
48
|
+
* Search code base for the value in `event.type` to see how it's used.
|
|
49
|
+
*/
|
|
50
|
+
function sendResizeEvent({
|
|
51
|
+
height,
|
|
52
|
+
width
|
|
53
|
+
}) {
|
|
54
|
+
clearTimeout(resizeTimeoutId);
|
|
55
|
+
// slight delay to prevent spamming the parent window with resize events
|
|
56
|
+
resizeTimeoutId = setTimeout(() => {
|
|
57
|
+
postMessage({
|
|
58
|
+
type: 'ksRendererClient.contentResized',
|
|
59
|
+
// round up to the nearest pixel
|
|
60
|
+
height: Math.ceil(height),
|
|
61
|
+
width: Math.ceil(width)
|
|
62
|
+
});
|
|
63
|
+
}, 100);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Sends a message to the parent window with the current scroll position of the iframe's content.
|
|
68
|
+
*/
|
|
69
|
+
function sendScrollEvent() {
|
|
70
|
+
// Clear any existing timeout
|
|
71
|
+
window.clearTimeout(scrollDebounceTimer);
|
|
72
|
+
|
|
73
|
+
// Set new timeout - only send position after 150ms of no scrolling
|
|
74
|
+
scrollDebounceTimer = window.setTimeout(() => {
|
|
75
|
+
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
|
76
|
+
const scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
77
|
+
postMessage({
|
|
78
|
+
type: 'ksRendererClient.scrollPosition',
|
|
79
|
+
scrollTop,
|
|
80
|
+
scrollLeft
|
|
81
|
+
});
|
|
82
|
+
}, 150);
|
|
83
|
+
}
|
|
84
|
+
window.addEventListener('message', event => {
|
|
85
|
+
switch (event.data?.type) {
|
|
86
|
+
case 'ksRendererClient.updateScrollPosition':
|
|
87
|
+
{
|
|
88
|
+
if (document.documentElement) {
|
|
89
|
+
document.documentElement.scrollTop = event.data.scrollTop;
|
|
90
|
+
document.documentElement.scrollLeft = event.data.scrollLeft;
|
|
91
|
+
}
|
|
92
|
+
if (document.body) {
|
|
93
|
+
document.body.scrollTop = event.data.scrollTop;
|
|
94
|
+
document.body.scrollLeft = event.data.scrollLeft;
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
default:
|
|
99
|
+
{
|
|
100
|
+
const _exhaustiveCheck = event.data?.type;
|
|
101
|
+
console.log('Unhandled message type:', _exhaustiveCheck);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
window.addEventListener('scroll', sendScrollEvent, {
|
|
106
|
+
passive: true
|
|
107
|
+
});
|
|
108
|
+
// Send ready message when content is fully loaded
|
|
109
|
+
window.addEventListener('load', () => {
|
|
110
|
+
postMessage({
|
|
111
|
+
type: 'ksRendererClient.ready'
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
if (ResizeObserver) {
|
|
115
|
+
// watch for any changes to the content's width/height
|
|
116
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
117
|
+
const [entry] = entries;
|
|
118
|
+
if (!entry) return;
|
|
119
|
+
const {
|
|
120
|
+
height,
|
|
121
|
+
width
|
|
122
|
+
} = entry.contentRect;
|
|
123
|
+
sendResizeEvent({
|
|
124
|
+
height,
|
|
125
|
+
width
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// watch the <body> element
|
|
130
|
+
resizeObserver.observe(document.body);
|
|
131
|
+
}
|
|
132
|
+
}
|
package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/renderer-discovery-react.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"rendererId":"react","meta":{"id":"react","title":"React","aliasUse":"optional","aliasTitle":"Named Export","aliasIsJsNamedExport":true,"aliasDescription":"If `export X` was used instead of `export default`, then provide X.","enableDataDemos":true,"enableTemplateDemos":true,"hasSlotsSupport":true,"hasSlotOptionsSupport":true,"version":"4.89.1","hasInferSpecSupport":true,"syntaxHighlightingLanguage":"jsx","hasTemplateSuggestionsSupport":true,"prototypingTemplate":{"path":"@knapsack/renderer-react/prototype-template","spec":{"isInferred":false,"props":{"type":"object","properties":{}},"slots":{"children":{"title":"Children"}}}}},"codeSrcsByPath":{},"templates":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@my-org/knapsack",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "knapsack build",
|
|
7
|
+
"start": "knapsack start",
|
|
8
|
+
"serve": "NODE_ENV=production knapsack serve",
|
|
9
|
+
"test": "knapsack test"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@knapsack/app": "^4.89.1",
|
|
13
|
+
"@knapsack/renderer-react": "^4.89.1"
|
|
14
|
+
},
|
|
15
|
+
"author": "KnapsackBot 53622700+KnapsackBot@users.noreply.github.com",
|
|
16
|
+
"license": "ISC"
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-knapsack",
|
|
3
3
|
"description": "Create & Setup Knapsack Workspaces",
|
|
4
|
-
"version": "4.89.
|
|
4
|
+
"version": "4.89.2--canary.faf6549.0",
|
|
5
5
|
"bin": "bin.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -17,22 +17,22 @@
|
|
|
17
17
|
},
|
|
18
18
|
"author": "Knapsack (https://www.knapsack.cloud)",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@knapsack/core": "4.89.
|
|
21
|
-
"@knapsack/creator-utils": "4.89.
|
|
22
|
-
"@knapsack/file-utils": "4.89.
|
|
23
|
-
"@knapsack/utils": "4.89.
|
|
20
|
+
"@knapsack/core": "4.89.2--canary.faf6549.0",
|
|
21
|
+
"@knapsack/creator-utils": "4.89.2--canary.faf6549.0",
|
|
22
|
+
"@knapsack/file-utils": "4.89.2--canary.faf6549.0",
|
|
23
|
+
"@knapsack/utils": "4.89.2--canary.faf6549.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@knapsack/app": "4.89.
|
|
27
|
-
"@knapsack/eslint-config-starter": "4.89.
|
|
28
|
-
"@knapsack/renderer-angular": "4.89.
|
|
29
|
-
"@knapsack/renderer-hbs": "4.89.
|
|
30
|
-
"@knapsack/renderer-react": "4.89.
|
|
31
|
-
"@knapsack/renderer-twig": "4.89.
|
|
32
|
-
"@knapsack/renderer-vue": "4.89.
|
|
33
|
-
"@knapsack/test-ava": "4.89.
|
|
34
|
-
"@knapsack/types": "4.89.
|
|
35
|
-
"@knapsack/typescript-config-starter": "4.89.
|
|
26
|
+
"@knapsack/app": "4.89.2--canary.faf6549.0",
|
|
27
|
+
"@knapsack/eslint-config-starter": "4.89.2--canary.faf6549.0",
|
|
28
|
+
"@knapsack/renderer-angular": "4.89.2--canary.faf6549.0",
|
|
29
|
+
"@knapsack/renderer-hbs": "4.89.2--canary.faf6549.0",
|
|
30
|
+
"@knapsack/renderer-react": "4.89.2--canary.faf6549.0",
|
|
31
|
+
"@knapsack/renderer-twig": "4.89.2--canary.faf6549.0",
|
|
32
|
+
"@knapsack/renderer-vue": "4.89.2--canary.faf6549.0",
|
|
33
|
+
"@knapsack/test-ava": "4.89.2--canary.faf6549.0",
|
|
34
|
+
"@knapsack/types": "4.89.2--canary.faf6549.0",
|
|
35
|
+
"@knapsack/typescript-config-starter": "4.89.2--canary.faf6549.0",
|
|
36
36
|
"ava": "^6.4.1",
|
|
37
37
|
"eslint": "^8.57.0",
|
|
38
38
|
"typescript": "^5.9.3"
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"directory": "kits/create-knapsack",
|
|
48
48
|
"type": "git"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "faf6549d59a7fa2091a9892eeafef5ea52a8558b"
|
|
51
51
|
}
|