shortik-creator-mcp 0.4.0 → 0.4.1

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.
Files changed (170) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +5 -5
  3. package/bundled/MANIFEST.json +3 -3
  4. package/bundled/bridge/hwik-bridge.js +312 -6
  5. package/bundled/templates/_src/games/balance-game.css +1 -1
  6. package/bundled/templates/_src/games/balance-game.js +5 -1
  7. package/bundled/templates/_src/games/birthday-candles.js +2 -0
  8. package/bundled/templates/_src/games/brush-stroke.js +4 -0
  9. package/bundled/templates/_src/games/cheer-sign.css +1 -0
  10. package/bundled/templates/_src/games/cheer-sign.js +6 -1
  11. package/bundled/templates/_src/games/chosung-quiz.js +21 -2
  12. package/bundled/templates/_src/games/daily-ox.js +20 -2
  13. package/bundled/templates/_src/games/doodle-pad.js +2 -0
  14. package/bundled/templates/_src/games/draft-hunt.art.json +1 -0
  15. package/bundled/templates/_src/games/draft-hunt.css +13 -0
  16. package/bundled/templates/_src/games/draft-hunt.js +253 -0
  17. package/bundled/templates/_src/games/face-shape.art.json +1 -0
  18. package/bundled/templates/_src/games/face-shape.css +13 -0
  19. package/bundled/templates/_src/games/face-shape.js +163 -0
  20. package/bundled/templates/_src/games/nod-quiz.js +17 -2
  21. package/bundled/templates/_src/games/recycle-sort.js +18 -0
  22. package/bundled/templates/_src/games/riso-maker.js +2 -0
  23. package/bundled/templates/_src/games/say-it.js +4 -2
  24. package/bundled/templates/_src/games/season-food.js +17 -0
  25. package/bundled/templates/_src/games/smile-hold.js +5 -1
  26. package/bundled/templates/_src/games/spelling-quiz.js +19 -2
  27. package/bundled/templates/_src/games/syllable-typing.js +8 -2
  28. package/bundled/templates/_src/games/tips-cards.js +16 -2
  29. package/bundled/templates/_src/games/today-card.css +1 -1
  30. package/bundled/templates/_src/games/today-card.js +5 -1
  31. package/bundled/templates/_src/games/today-fate.js +3 -0
  32. package/bundled/templates/_src/games/tongue-twister.js +13 -3
  33. package/bundled/templates/_src/games/trivia-quiz.css +3 -3
  34. package/bundled/templates/_src/games/trivia-quiz.js +18 -0
  35. package/bundled/templates/_src/shell.js +93 -2
  36. package/bundled/templates/animal-ears/index.html +96 -5
  37. package/bundled/templates/balance-game/index.html +101 -6
  38. package/bundled/templates/birthday-candles/index.html +97 -4
  39. package/bundled/templates/blink-jump/index.html +95 -4
  40. package/bundled/templates/brain-numbers/index.html +95 -4
  41. package/bundled/templates/breathe/index.html +96 -5
  42. package/bundled/templates/brow-lift/index.html +96 -5
  43. package/bundled/templates/brush-stroke/index.html +99 -4
  44. package/bundled/templates/calorie-battle/index.html +95 -4
  45. package/bundled/templates/campfire/index.html +95 -4
  46. package/bundled/templates/catalog.json +1325 -14
  47. package/bundled/templates/checkout-rush/index.html +95 -4
  48. package/bundled/templates/cheer-shout/index.html +95 -4
  49. package/bundled/templates/cheer-sign/index.html +102 -5
  50. package/bundled/templates/chosung-quiz/index.html +116 -6
  51. package/bundled/templates/clap-rhythm/index.html +95 -4
  52. package/bundled/templates/cola-shake/index.html +95 -4
  53. package/bundled/templates/color-diff/index.html +96 -5
  54. package/bundled/templates/color-sort/index.html +96 -5
  55. package/bundled/templates/compass-hunt/index.html +95 -4
  56. package/bundled/templates/conductor/index.html +95 -4
  57. package/bundled/templates/cover-maker/index.html +95 -4
  58. package/bundled/templates/daily-ox/index.html +115 -6
  59. package/bundled/templates/dawn-birds/index.html +96 -5
  60. package/bundled/templates/day-receipt/index.html +95 -4
  61. package/bundled/templates/desktop-tidy/index.html +95 -4
  62. package/bundled/templates/dice-board/index.html +95 -4
  63. package/bundled/templates/doodle-pad/index.html +98 -5
  64. package/bundled/templates/draft-hunt/index.html +3162 -0
  65. package/bundled/templates/english-words/index.html +95 -4
  66. package/bundled/templates/f1-reaction/index.html +95 -4
  67. package/bundled/templates/face-copy/index.html +96 -5
  68. package/bundled/templates/face-filter/index.html +96 -5
  69. package/bundled/templates/face-shape/index.html +3363 -0
  70. package/bundled/templates/face-yoga/index.html +96 -5
  71. package/bundled/templates/flag-quiz/index.html +95 -4
  72. package/bundled/templates/fruit-merge/index.html +95 -4
  73. package/bundled/templates/glasses-fit/index.html +96 -5
  74. package/bundled/templates/hat-tryon/index.html +96 -5
  75. package/bundled/templates/head-dodge/index.html +95 -4
  76. package/bundled/templates/hidden-objects/index.html +96 -5
  77. package/bundled/templates/hole-wall/index.html +95 -4
  78. package/bundled/templates/hop-hop/index.html +95 -4
  79. package/bundled/templates/hurray-pose/index.html +95 -4
  80. package/bundled/templates/id-photo/index.html +96 -5
  81. package/bundled/templates/ink-bloom/index.html +95 -4
  82. package/bundled/templates/jumping-jacks/index.html +95 -4
  83. package/bundled/templates/latte-art/index.html +95 -4
  84. package/bundled/templates/level-tool/index.html +95 -4
  85. package/bundled/templates/library-quiet/index.html +95 -4
  86. package/bundled/templates/line-draw/index.html +95 -4
  87. package/bundled/templates/lip-color/index.html +96 -5
  88. package/bundled/templates/live-ox-quiz/index.html +1619 -0
  89. package/bundled/templates/live-penguin-run/index.html +1794 -0
  90. package/bundled/templates/live-snowman/index.html +1705 -0
  91. package/bundled/templates/live-stairs-race/index.html +1722 -0
  92. package/bundled/templates/lofi-maker/index.html +95 -4
  93. package/bundled/templates/lucky-direction/index.html +95 -4
  94. package/bundled/templates/market-memory/index.html +96 -5
  95. package/bundled/templates/match3-mini/index.html +95 -4
  96. package/bundled/templates/maze-roll/index.html +95 -4
  97. package/bundled/templates/memory-match/index.html +96 -5
  98. package/bundled/templates/menu-cards/index.html +95 -4
  99. package/bundled/templates/merge-numbers/index.html +96 -5
  100. package/bundled/templates/mine-sweep/index.html +95 -4
  101. package/bundled/templates/mini-golf/index.html +95 -4
  102. package/bundled/templates/mocktail-bar/index.html +95 -4
  103. package/bundled/templates/mole-tap/index.html +95 -4
  104. package/bundled/templates/mouth-munch/index.html +95 -4
  105. package/bundled/templates/mukbang-course/index.html +95 -4
  106. package/bundled/templates/music-box/index.html +96 -5
  107. package/bundled/templates/my-constellation/index.html +95 -4
  108. package/bundled/templates/neck-shoulder-stretch/index.html +95 -4
  109. package/bundled/templates/next-panel/index.html +96 -5
  110. package/bundled/templates/nod-quiz/index.html +112 -6
  111. package/bundled/templates/office-stretch/index.html +95 -4
  112. package/bundled/templates/omok/index.html +95 -4
  113. package/bundled/templates/one-leg/index.html +95 -4
  114. package/bundled/templates/one-minute-plant/index.html +96 -5
  115. package/bundled/templates/paper-crane/index.html +96 -5
  116. package/bundled/templates/pet-sticker/index.html +96 -5
  117. package/bundled/templates/photo-palette/index.html +96 -5
  118. package/bundled/templates/photo-puzzle/index.html +96 -5
  119. package/bundled/templates/photo-spot-diff/index.html +96 -5
  120. package/bundled/templates/pixel-snake/index.html +95 -4
  121. package/bundled/templates/plank-timer/index.html +95 -4
  122. package/bundled/templates/polaroid-shake/index.html +96 -5
  123. package/bundled/templates/pose-mirror/index.html +95 -4
  124. package/bundled/templates/posture-check/index.html +96 -5
  125. package/bundled/templates/rain-window/index.html +96 -5
  126. package/bundled/templates/reaction-test/index.html +95 -4
  127. package/bundled/templates/recycle-sort/index.html +114 -5
  128. package/bundled/templates/riso-maker/index.html +97 -4
  129. package/bundled/templates/say-it/index.html +99 -6
  130. package/bundled/templates/scratch-deck/index.html +95 -4
  131. package/bundled/templates/screw-sort/index.html +95 -4
  132. package/bundled/templates/season-food/index.html +113 -5
  133. package/bundled/templates/sfx-maker/index.html +96 -5
  134. package/bundled/templates/shake-shake/index.html +95 -4
  135. package/bundled/templates/simon-memory/index.html +96 -5
  136. package/bundled/templates/slide-puzzle/index.html +96 -5
  137. package/bundled/templates/smile-charge/index.html +96 -5
  138. package/bundled/templates/smile-hold/index.html +101 -6
  139. package/bundled/templates/spelling-quiz/index.html +114 -6
  140. package/bundled/templates/spot-diff/index.html +96 -5
  141. package/bundled/templates/squat-counter/index.html +95 -4
  142. package/bundled/templates/stack-tower/index.html +95 -4
  143. package/bundled/templates/star-finder/index.html +95 -4
  144. package/bundled/templates/stare-contest/index.html +96 -5
  145. package/bundled/templates/syllable-typing/index.html +103 -6
  146. package/bundled/templates/tilt-bowling/index.html +95 -4
  147. package/bundled/templates/tips-cards/index.html +112 -7
  148. package/bundled/templates/today-card/index.html +101 -6
  149. package/bundled/templates/today-dots/index.html +95 -4
  150. package/bundled/templates/today-fate/index.html +98 -4
  151. package/bundled/templates/tongue-twister/index.html +108 -7
  152. package/bundled/templates/transfer-puzzle/index.html +95 -4
  153. package/bundled/templates/travel-type/index.html +95 -4
  154. package/bundled/templates/trivia-banana/index.html +117 -8
  155. package/bundled/templates/trivia-giraffe/index.html +116 -7
  156. package/bundled/templates/trivia-hangul/index.html +116 -7
  157. package/bundled/templates/trivia-jupiter/index.html +116 -7
  158. package/bundled/templates/trivia-octopus/index.html +116 -7
  159. package/bundled/templates/trivia-thunder/index.html +116 -7
  160. package/bundled/templates/voice-balloon/index.html +95 -4
  161. package/bundled/templates/walk-math/index.html +96 -5
  162. package/bundled/templates/water-glass/index.html +95 -4
  163. package/bundled/templates/wave-breath/index.html +95 -4
  164. package/bundled/templates/wink-shoot/index.html +95 -4
  165. package/bundled/templates/word-chain/index.html +95 -4
  166. package/bundled/templates/word-recall/index.html +95 -4
  167. package/bundled/templates/wrist-eye-break/index.html +96 -5
  168. package/dist/index.js +595 -40
  169. package/dist/index.js.map +1 -1
  170. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # 변경 기록 — `shortik-creator-mcp` (옛 이름 `hwik-creator-mcp`)
2
2
 
3
+ ## 0.4.1 (2026-11-19)
4
+ - **심사 정보 필수(ADR-0030)**: `hwik_publish_playable`·`hwik_upload_video`에 `description`(한 줄 소개 10자+)·`purpose`(기획 의도 20자+)·`sources`(소재·출처 5자+)·`how_to_play`(플레이 방법 10자+, 플레이어블)·`creator_confirmed`(제작자가 요약을 보고 확인)가 필요합니다. 빠지면 업로드 전에 무엇이 모자란지 알려 줍니다(서버도 같은 기준으로 거절).
5
+ - 프롬프트·가이드라인 7-1절: 로컬 미리보기로 결과를 보여 주고 → 심사 정보를 함께 정하고 → 요약을 보여 「이대로 심사 넣을까요?」를 확인받은 뒤 올리는 순서.
6
+ - ADR-0029 「라이브 콘텐츠」 항목(아래)도 이 버전에 포함됩니다.
7
+
8
+ ### ADR-0029 「라이브 콘텐츠」
9
+ - **브리지 1.10**: 동봉 브리지가 1.10.0 — `SHORTIK.live.join()`·`send(d)`·`add(k, n)`·`finish(s)`·`leave()`·`now()`, `SHORTIK.on('live', ev => …)`. 앱이 실시간 방을 중계하고(페이지는 여전히 네트워크 없음), 앱이 1.5초 안에 응답하지 않거나(연결 중이면 8초) 연결에 실패하면 브리지가 1인 방을 흉내 내 혼자서도 끝까지 됩니다.
10
+ - **가이드라인 6-4절 「라이브 콘텐츠」**: `<meta name="hwik-live" content="min=2,max=8,wait=12,duration=90">`(min 1~16, max 2~16·min 이상, wait 5~30, duration 15~600), API, seed로 같은 판, 다른 사람 그리기(send 초당 10회 이하), 협동 add, 레이스 finish, 카운트다운은 `SHORTIK.live.now()`, 자유 채팅 금지, 이겨도 보상 없음, 가명.
11
+ - **검사**: `SHORTIK.live`(또는 `HWIK.live`)를 쓰면 올바른 `hwik-live` 메타가 있어야 통과합니다(범위 밖 메타는 서버에서 반려). 메타만 있고 쓰지 않으면 권고. 결과 `optins.live`에 읽은 값.
12
+ - **`hwik_new_playable { kind: "live" }`**: 라이브 골격(계단 오르기 레이스 + 모두 함께 오른 계단 합계 — 대기실·연결 중·카운트다운·send/add/finish·결과까지 연결).
13
+ - **`hwik_idea_examples { live: true }`**: 라이브 아이디어 예시 5개. 프롬프트 「라이브 콘텐츠 만들기」 추가, 「새 미니게임 만들기」가 라이브를 원하면 그쪽으로 안내합니다.
14
+
3
15
  ## 0.4.0 (2026-10-15)
4
16
  - **새 이름 `shortik-creator-mcp`**: `npx -y shortik-creator-mcp`. 설치하면 `hwik-creator-mcp` 명령도 함께 생겨 기존 설정이 그대로 동작합니다. npm의 `hwik-creator-mcp`(0.3.0)도 당분간 그대로 받을 수 있지만 새 기능은 이 이름으로만 나갑니다.
5
17
  - **토큰 방식 수정**: 제작자 센터 「AI 도구 연결 › 토큰」에서 만든 토큰을 `SHORTIK_API_TOKEN`(옛 이름 `HWIK_API_TOKEN`) 환경변수로 넘기면 연결 코드 없이 바로 씁니다. 이전 버전은 이 변수를 읽지 않았습니다. 연결 코드로 저장한 토큰(`~/.hwik/credentials.json`)이 있으면 그쪽이 우선입니다. `hwik_whoami`가 `auth: "env_token"`으로 알려 줍니다.
package/README.md CHANGED
@@ -66,7 +66,7 @@ claude mcp add shortik -- npx -y shortik-creator-mcp
66
66
  > **Claude:** (hwik_publish_playable { dir, title, description, tags: ["게임","두더지","오렌지"] })
67
67
  > 업로드 완료 — 콘텐츠 `cnt_01J…`, 상태 **review**(운영자 심사 대기). 서버 검사도 통과했고 AI 생성 라벨이 붙었습니다. "심사 어떻게 됐어?"라고 물으면 `hwik_content_status`로 확인해 드릴게요.
68
68
 
69
- 프롬프트 메뉴에서 **"새 미니게임 만들기"** / **"영상 올리기"** / **"캠페인 콘텐츠 만들기"**를 고르면 위 순서를 자동으로 안내합니다.
69
+ 프롬프트 메뉴에서 **"새 미니게임 만들기"** / **"라이브 콘텐츠 만들기"** / **"영상 올리기"** / **"캠페인 콘텐츠 만들기"**를 고르면 위 순서를 자동으로 안내합니다.
70
70
 
71
71
  ## 4. 도구 목록
72
72
 
@@ -75,10 +75,10 @@ claude mcp add shortik -- npx -y shortik-creator-mcp
75
75
  | `hwik_connect { code }` | 연결 코드 → 토큰 교환·저장 |
76
76
  | `hwik_whoami` / `hwik_logout` | 연결 상태 / 토큰 파일 삭제 |
77
77
  | `hwik_list_templates` | 내장 템플릿 전체 + 옵션(색·문구·길이·문제 …) + 켜진 선택 기능(소리·주간 순위·정답률·결과 그림·타임랩스·기기 기능) |
78
- | `hwik_get_guidelines` | 제작 규칙 전문(금지 문구, 기술 제약, 브리지 1.9 전체 메서드, 선택 기능 메타·플레이 녹화, 조정값, 영상 안전 영역, 캠페인, 리믹스, 한도) |
79
- | `hwik_idea_examples { capability?, category? }` | 서버 아이디어 예시(연결돼 있으면 `/portal/drafts/idea-examples`, 아니면 `/v1/public/idea-examples`) |
78
+ | `hwik_get_guidelines` | 제작 규칙 전문(금지 문구, 기술 제약, 브리지 1.10 전체 메서드, 선택 기능 메타·플레이 녹화, 조정값, 라이브 콘텐츠(6-4절), 영상 안전 영역, 캠페인, 리믹스, 한도) |
79
+ | `hwik_idea_examples { capability?, category?, live? }` | 서버 아이디어 예시(연결돼 있으면 `/portal/drafts/idea-examples`, 아니면 `/v1/public/idea-examples`). `live: true`면 라이브 콘텐츠 예시(계단 오르기 레이스·다 같이 눈사람·라이브 OX 퀴즈·펭귄 점프 레이스·공동 목표 달리기) |
80
80
  | `hwik_scaffold_playable { template, title, out_dir, options? }` | 템플릿 복사 + 옵션 적용 |
81
- | `hwik_new_playable { title, out_dir }` | 오리지널 게임용 최소 골격 |
81
+ | `hwik_new_playable { title, out_dir, kind? }` | 오리지널 게임용 최소 골격. `kind: "live"`면 라이브 콘텐츠 골격(`hwik-live` 메타 + `SHORTIK.live` 계단 오르기 레이스, 혼자서도 끝까지) |
82
82
  | `hwik_validate { dir, external_links?, post_play_landing? }` | 서버 동일 정적 검사 + 금지 문구 + 브리지/CSP/AI 라벨 + 매니페스트 + 심사 사전 점검(코드 속 외부 주소 vs 신고) |
83
83
  | `hwik_preview { dir, screenshot? }` / `hwik_preview_stop` | 루프백 미리보기 서버(폰 프레임·앱 UI 오버레이·브리지 이벤트 로그) |
84
84
  | `hwik_get_tweaks { project_dir }` / `hwik_set_tweaks { project_dir, values }` | `index.html`의 `hwik-tweaks` 조정값 보기 / `value`만 바꿔 저장 → 검사 + 미리보기(다시 생성하지 않음) |
@@ -99,7 +99,7 @@ claude mcp add shortik -- npx -y shortik-creator-mcp
99
99
  ## 5. 심사 규칙 요약 (자세한 내용은 `hwik_get_guidelines`)
100
100
  1. **보상과 게임 결과를 연결하지 않기.** 점수·승패·순위·정답에 포인트·현금·상금·경품·당첨·환전을 연결하는 문구 금지. 사행성 연출(슬롯·룰렛·도박·복권) 금지. 결과 화면은 "완료!"처럼 중립적으로. 2026-10-07부터 일반 콘텐츠에는 시청 보상이 없고, 시청자 리워드는 광고주 캠페인 콘텐츠에만 서버가 지급합니다(미션도 꺼짐).
101
101
  2. **격리 실행.** 네트워크(fetch/XHR/WebSocket…)·저장소(localStorage/cookie/indexedDB)·eval·iframe·외부 스크립트/URL 금지. 루트 `index.html`, ZIP ≤ 5MB(권장 150KB), 파일 ≤ 200개, 허용 확장자만.
102
- 3. **브리지 1.8 규약.** 로드 후 `SHORTIK.ready()` 1회 → `SHORTIK.progress({stage})` → 한 판 끝나면 `SHORTIK.complete()`(점수 없이). `pause/resume/mute` 처리. 링크는 `SHORTIK.cta({id})`로만. 기존 HWIK.*도 그대로 동작합니다(`SHORTIK === HWIK`, 같은 객체). 결과를 내보내는 호출은 표시 전용 두 가지뿐 — `SHORTIK.record(value)`(주간 순위, `<meta name="hwik-leaderboard">`)·`SHORTIK.quiz([...])`(정답률, `<meta name="hwik-quiz">`) — 순위·정답에 보상은 없습니다(「순위에 따른 보상은 없어요」). 결과 그림 저장(`hwik-result` + `SHORTIK.result`), 소리(`hwik-audio` + `SHORTIK.on('mute')`), 얼굴 타임랩스(`hwik-timelapse`), 카메라 위치 안내(`hwik-placement`)는 `hwik_get_guidelines` 6-2절.
102
+ 3. **브리지 1.10 규약.** 로드 후 `SHORTIK.ready()` 1회 → `SHORTIK.progress({stage})` → 한 판 끝나면 `SHORTIK.complete()`(점수 없이). `pause/resume/mute` 처리. 링크는 `SHORTIK.cta({id})`로만. 기존 HWIK.*도 그대로 동작합니다(`SHORTIK === HWIK`, 같은 객체). 결과를 내보내는 호출은 표시 전용 두 가지뿐 — `SHORTIK.record(value)`(주간 순위, `<meta name="hwik-leaderboard">`)·`SHORTIK.quiz([...])`(정답률, `<meta name="hwik-quiz">`) — 순위·정답에 보상은 없습니다(「순위에 따른 보상은 없어요」). 결과 그림 저장(`hwik-result` + `SHORTIK.result`), 소리(`hwik-audio` + `SHORTIK.on('mute')`), 얼굴 타임랩스(`hwik-timelapse`), 카메라 위치 안내(`hwik-placement`)는 `hwik_get_guidelines` 6-2절. **라이브 콘텐츠**(여럿이 동시에, `<meta name="hwik-live" content="min=2,max=8,wait=12,duration=90">` + `SHORTIK.live.join/send/add/finish/leave/now`)는 6-4절 — 앱이 방을 중계하고, 응답이 없으면 브리지가 1인 방으로 대체하므로 혼자서도 끝까지 되어야 합니다. 도착 순서·순위에 보상은 없고 자유 채팅도 없습니다.
103
103
  4. **화면.** 플레이어블은 화면 전체(숏폼 크기)에서 돌고 앱 UI는 위(`--hwik-inset-top`)·아래(`--hwik-inset-bottom`, 첫 터치 전 `--hwik-inset-bottom-max`)에 떠 있습니다. 배경은 끝까지, 버튼·문구는 inset 안쪽에. 터치 우선(44px 이상), 60fps.
104
104
  5. **라벨.** AI 생성 라벨 항상 켜짐(`is_ai_generated=true`, `<meta name="hwik-ai-generated">`). 광고주 의뢰는 `is_ad=true` → `광고` 라벨.
105
105
  6. **영상.** 본인이 권리를 가진 원본만(다른 사람의 SNS 영상을 내려받거나 퍼 오기 금지). mp4/h264, 세로 720×1280 권장, ≤200MB, ≤180초(권장 8~60초). 화면에 굽는 문구는 프레임의 x 14~72%, y 22~62% 안에.
@@ -1,5 +1,5 @@
1
1
  {
2
- "synced_at": "2026-10-15T14:01:32.292Z",
3
- "templates": 128,
4
- "files": 130
2
+ "synced_at": "2026-11-19T12:05:04.707Z",
3
+ "templates": 134,
4
+ "files": 136
5
5
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * HWIK Playable Bridge SDK v1.9.0 (SHORTIK)
2
+ * HWIK Playable Bridge SDK v1.10.0 (SHORTIK)
3
3
  * ---------------------------------------------------------------
4
4
  * Tiny, dependency-free bridge between a playable (HTML5 mini-game /
5
5
  * interactive card) and the SHORTIK host (Flutter WebView or web iframe).
@@ -30,7 +30,7 @@
30
30
  * 3. Standalone (dev / preview): no-op + console.debug
31
31
  *
32
32
  * Wire format (playable → host):
33
- * {"type":"ready"|"progress"|"complete"|"record"|"snapshot"|"cta"|"haptic"|"request"|"release","payload":{...},"v":1}
33
+ * {"type":"ready"|"progress"|"complete"|"record"|"snapshot"|"cta"|"haptic"|"request"|"release"|"live_*"|…,"payload":{...},"v":1}
34
34
  *
35
35
  * Device capabilities (v1.1, docs/05 §3-2): the playable never touches sensors or
36
36
  * the camera. It declares them in index.html with a meta tag (name "hwik-capabilities", content "motion"),
@@ -57,7 +57,33 @@
57
57
  * 'clip_chunk' {id, seq, total, data} (base64 slices) + 'clip_done' {id, mime, duration_ms, width, height, bytes},
58
58
  * or 'clip_error' {id?, reason}. The clip never leaves the page except through these bridge messages.
59
59
  *
60
- * Host → playable: call HWIK._dispatch('pause'|'resume'|'mute'|'capabilities'|'capability'|'clip_start'|'clip_stop'|<stream>, data)
60
+ * Live rooms (v1.10, ADR-0029 §10–§11, 「라이브 콘텐츠」): a page that declares the meta tag named "hwik-live"
61
+ * (content "min=2,max=8,wait=12,duration=90": min 1–16, max 2–16 and ≥ min, wait 5–30 s, duration 15–600 s) plays in a
62
+ * real-time room the HOST relays — the page itself still has no network (rule 6).
63
+ * SHORTIK.live.join() → 'live_join' {} ask the host for a room (once per round)
64
+ * SHORTIK.live.send(d) → 'live_send' {d} JSON ≤ 512 bytes serialized, relayed to the OTHER players
65
+ * SHORTIK.live.add(k, n) → 'live_add' {k, n} shared counter (co-op goal): k /^[A-Za-z0-9_]{1,16}$/, n integer −1000..1000
66
+ * SHORTIK.live.finish(s?) → 'live_finish' {s} "I am done"; s optional integer 0..10,000,000; place = server arrival order
67
+ * SHORTIK.live.leave() → 'live_leave' {}
68
+ * SHORTIK.live.now() server clock estimate (epoch ms) from the frames' `now`; use it for start_at / end_at countdowns
69
+ * send + add share a page-side budget of 15 per second (the service's limit); anything invalid or over budget is dropped
70
+ * with a console.warn and the call returns false. Frames arrive as SHORTIK.on('live', ev => …), the server frame as is:
71
+ * ev.t = 'connecting' (bridge-made, see below) | 'welcome' {you:{id,name}, room:{id, phase, players, wait_until, max, cfg}} | 'players' {players:[{id,name}]}
72
+ * | 'start' {seed (uint32), start_at, end_at, players} | 'msg' {from, d} | 'counter' {k, v}
73
+ * | 'finish' {id, s, place} | 'end' {reason: time|all_finished|alone, results:[{id,name,place,s}], counters}
74
+ * | 'error' {code}; every frame carries `now` (server epoch ms). Ids are room-local (p1…), names are pseudonyms.
75
+ * Host relay: HWIK._dispatch('live', frame). Before welcome the host may also send two relay-status frames that are not
76
+ * passed on as is: {t:'connecting'} (it is fetching a ticket / waking the service → the bridge waits for welcome up to 8 s
77
+ * after join() instead of 1.5 s, and gives the page its own {t:'connecting', now} for a 「연결 중…」 UI) and
78
+ * {t:'unavailable'} (ticket or connection failed → solo at once, the page never sees it).
79
+ * SOLO FALLBACK: when no 'live' frame arrives within 1.5 s of join() (old app, web, preview, policy off), no welcome
80
+ * within 8 s after 'connecting', 'unavailable', or an error before any welcome — the bridge simulates a one-player room
81
+ * locally: welcome → start at once (random seed, start_at = now + 3000, end_at = start_at + the meta's duration, default
82
+ * 60 s) → counters summed locally → finish gives place 1 → end ('all_finished' after finish, 'time' at end_at). Simulated
83
+ * frames carry `solo: true`; host frames that show up during a solo round are ignored for that round. So a live page
84
+ * always plays to the end alone. Nothing about a room (order, place, counters) is ever a reward input (rule 4).
85
+ *
86
+ * Host → playable: call HWIK._dispatch('pause'|'resume'|'mute'|'capabilities'|'capability'|'clip_start'|'clip_stop'|'live'|<stream>, data)
61
87
  * (Flutter: controller.runJavaScript("HWIK._dispatch('pause')");
62
88
  * iframe: iframe.contentWindow.postMessage({source:"hwik-host",event:"pause"}, origin))
63
89
  *
@@ -69,7 +95,7 @@
69
95
  // Idempotent, and self-upgrading: a page loads the CDN copy first and then its own inline copy. A stale CDN copy
70
96
  // (cached, or deployed late) must not win over a newer inline one — v1.1 silently dropped request options.
71
97
  // Both run before any game script, so nothing has subscribed to the old object yet.
72
- var SDK_VERSION = '1.9.0';
98
+ var SDK_VERSION = '1.10.0';
73
99
  function olderThanThis(v) {
74
100
  var a = String(v || '1.0.0').split('.'), b = SDK_VERSION.split('.');
75
101
  for (var i = 0; i < 3; i++) { var x = +a[i] || 0, y = +b[i] || 0; if (x !== y) return x < y; }
@@ -90,7 +116,8 @@
90
116
  // v1.4 (ADR-0010): 'shake' {strength, count}, 'compass' {heading, reliable}, 'photo' {url, w, h} | {cancelled}.
91
117
  // v1.6 (ADR-0012): 'snapshot' {state: 'saved'|'shared'|'closed'|'unavailable', reason?} after HWIK.snapshot().
92
118
  // v1.9 (ADR-0022): 'clip_start' {max_sec, watermark:{lines}} and 'clip_stop' — handled by the SDK itself (pages may listen).
93
- var EVENTS = ['pause', 'resume', 'mute', 'capabilities', 'capability', 'motion', 'face', 'blink', 'pose', 'camera', 'sound', 'clap', 'speech', 'mic', 'shake', 'compass', 'photo', 'snapshot', 'result', 'clip_start', 'clip_stop'];
119
+ // v1.10 (ADR-0029 §11): 'live' — live room frames relayed by the host (or simulated by the solo fallback).
120
+ var EVENTS = ['pause', 'resume', 'mute', 'capabilities', 'capability', 'motion', 'face', 'blink', 'pose', 'camera', 'sound', 'clap', 'speech', 'mic', 'shake', 'compass', 'photo', 'snapshot', 'result', 'clip_start', 'clip_stop', 'live'];
94
121
  var listeners = {};
95
122
  for (var ei = 0; ei < EVENTS.length; ei++) listeners[EVENTS[ei]] = [];
96
123
  var readySent = false;
@@ -446,6 +473,277 @@
446
473
  if (typeof global.setTimeout === 'function') st.timer = global.setTimeout(clipStop, maxSec * 1000);
447
474
  }
448
475
 
476
+ // ---- live rooms (v1.10, ADR-0029 §11) ----------------------------------------------------------------------------
477
+ // The page never talks to the network: the host relays room frames. Limits mirror the hwik-live service (§11-3) so a
478
+ // page never earns the service's error / disconnect; the host and the service check everything again.
479
+ var LIVE_SOLO_AFTER_MS = 1500;
480
+ var LIVE_CONNECTING_MAX_MS = 8000; // after the host's 'connecting': total wait for welcome, counted from join()
481
+ var LIVE_COUNTDOWN_MS = 3000;
482
+ var LIVE_MSG_MAX_BYTES = 512;
483
+ var LIVE_PER_SEC = 15;
484
+ var LIVE_MAX_SCORE = 10000000;
485
+ var LIVE_KEY_RE = /^[A-Za-z0-9_]{1,16}$/;
486
+ var LIVE_LIMITS = { min: [1, 16, 1], max: [2, 16, 8], wait: [5, 30, 10], duration: [15, 600, 60] }; // [lo, hi, default]
487
+ var LIVE_CLOCK_SAMPLES = 16;
488
+ // mode: null (not in a room) | 'pending' (join sent, waiting for the host) | 'host' (relayed room) | 'solo' (fallback)
489
+ var live = { mode: null, timer: null, solo: null, welcomed: false, connecting: false, joinAt: 0, clock: [], bucketAt: 0, bucket: 0 };
490
+
491
+ function liveWarn(msg) {
492
+ var c = global.console;
493
+ if (c && typeof c.warn === 'function') c.warn('[SHORTIK live] ' + msg);
494
+ }
495
+
496
+ /** Room settings from the page's own hwik-live meta (out-of-range values clamped, missing ones defaulted). */
497
+ function liveConfig() {
498
+ var cfg = {}, raw = '';
499
+ try {
500
+ var doc = global.document, m = doc && typeof doc.querySelector === 'function' ? doc.querySelector('meta[name="hwik-live"]') : null;
501
+ raw = m ? String(m.getAttribute('content') || '') : '';
502
+ } catch (e) { raw = ''; }
503
+ var parts = raw.split(','), kv = {};
504
+ for (var i = 0; i < parts.length; i++) {
505
+ var p = parts[i].split('='), k = String(p[0] || '').trim().toLowerCase(), v = String(p[1] == null ? '' : p[1]).trim();
506
+ if (/^\d{1,4}$/.test(v)) kv[k] = +v;
507
+ }
508
+ for (var key in LIVE_LIMITS) {
509
+ if (!Object.prototype.hasOwnProperty.call(LIVE_LIMITS, key)) continue;
510
+ var lim = LIVE_LIMITS[key], val = Object.prototype.hasOwnProperty.call(kv, key) ? kv[key] : lim[2];
511
+ cfg[key] = Math.min(lim[1], Math.max(lim[0], val));
512
+ }
513
+ if (cfg.max < cfg.min) cfg.max = cfg.min < 2 ? 2 : cfg.min;
514
+ return cfg;
515
+ }
516
+
517
+ /** UTF-8 byte length of a string (no TextEncoder needed). */
518
+ function utf8Bytes(s) {
519
+ var n = 0;
520
+ for (var i = 0; i < s.length; i++) {
521
+ var c = s.charCodeAt(i);
522
+ if (c < 0x80) n += 1;
523
+ else if (c < 0x800) n += 2;
524
+ else if (c >= 0xd800 && c <= 0xdbff && i + 1 < s.length) { n += 4; i++; }
525
+ else n += 3;
526
+ }
527
+ return n;
528
+ }
529
+
530
+ function isInt(n, lo, hi) {
531
+ return typeof n === 'number' && isFinite(n) && Math.floor(n) === n && n >= lo && n <= hi;
532
+ }
533
+
534
+ /** The service's 15/s budget for send + add together; over budget is dropped here instead of costing an error. */
535
+ function liveAllow() {
536
+ var now = Date.now();
537
+ if (now - live.bucketAt >= 1000) { live.bucketAt = now; live.bucket = 0; }
538
+ if (live.bucket >= LIVE_PER_SEC) return false;
539
+ live.bucket++;
540
+ return true;
541
+ }
542
+
543
+ function liveClearTimers() {
544
+ if (live.timer != null && typeof global.clearTimeout === 'function') global.clearTimeout(live.timer);
545
+ live.timer = null;
546
+ if (live.solo && live.solo.endTimer != null && typeof global.clearTimeout === 'function') global.clearTimeout(live.solo.endTimer);
547
+ }
548
+
549
+ function liveReset() {
550
+ liveClearTimers();
551
+ live.mode = null;
552
+ live.solo = null;
553
+ }
554
+
555
+ function liveDeliver(frame) {
556
+ var list = listeners.live.slice();
557
+ for (var i = 0; i < list.length; i++) {
558
+ try { list[i](frame); } catch (e) {
559
+ if (global.console && console.error) console.error('[HWIK bridge] listener error', e);
560
+ }
561
+ }
562
+ }
563
+
564
+ /** Clock samples: server `now` minus local receive time; the largest (least delayed) recent one is the best offset. */
565
+ function liveClockSample(now) {
566
+ if (typeof now !== 'number' || !isFinite(now)) return;
567
+ live.clock.push(now - Date.now());
568
+ if (live.clock.length > LIVE_CLOCK_SAMPLES) live.clock.shift();
569
+ }
570
+
571
+ function liveNow() {
572
+ if (!live.clock.length) return Date.now();
573
+ var best = live.clock[0];
574
+ for (var i = 1; i < live.clock.length; i++) if (live.clock[i] > best) best = live.clock[i];
575
+ return Date.now() + best;
576
+ }
577
+
578
+ function liveRandomSeed() {
579
+ try {
580
+ var c = global.crypto;
581
+ if (c && typeof c.getRandomValues === 'function') { var a = new Uint32Array(1); c.getRandomValues(a); return a[0] >>> 0; }
582
+ } catch (e) { /* fall through */ }
583
+ return Math.floor(Math.random() * 4294967296) >>> 0;
584
+ }
585
+
586
+ function soloFrame(t, fields) {
587
+ var f = { t: t, now: Date.now(), solo: true };
588
+ for (var k in fields) if (Object.prototype.hasOwnProperty.call(fields, k)) f[k] = fields[k];
589
+ return f;
590
+ }
591
+
592
+ function soloEnd(reason) {
593
+ var r = live.solo;
594
+ if (!r || r.phase === 'ended') return;
595
+ r.phase = 'ended';
596
+ liveClearTimers();
597
+ var counters = {};
598
+ for (var k in r.counters) if (Object.prototype.hasOwnProperty.call(r.counters, k)) counters[k] = r.counters[k];
599
+ var results = [{ id: r.me.id, name: r.me.name, place: r.finished ? 1 : null, s: r.finished ? r.s : null }];
600
+ live.mode = null;
601
+ live.solo = null;
602
+ liveDeliver(soloFrame('end', { reason: reason, results: results, counters: counters }));
603
+ }
604
+
605
+ /** §11-4 solo fallback: a one-player room, simulated locally with the service's frame shapes. */
606
+ function soloStart() {
607
+ liveClearTimers();
608
+ var cfg = liveConfig(), now = Date.now();
609
+ var me = { id: 'p1', name: '나' };
610
+ live.mode = 'solo';
611
+ live.clock = [];
612
+ live.solo = { me: me, cfg: cfg, phase: 'waiting', counters: {}, finished: false, s: null, endTimer: null };
613
+ // A slow host that answers later keeps no seat in a real room while this page plays alone.
614
+ send('live_leave', {});
615
+ liveDeliver(soloFrame('welcome', { you: { id: me.id, name: me.name }, room: { id: 'solo', phase: 'waiting', players: [{ id: me.id, name: me.name }], wait_until: now, max: cfg.max, cfg: cfg } }));
616
+ var r = live.solo;
617
+ if (live.mode !== 'solo' || !r || r.phase !== 'waiting') return; // the page left from inside its welcome handler
618
+ r.phase = 'playing';
619
+ var startAt = Date.now() + LIVE_COUNTDOWN_MS, endAt = startAt + cfg.duration * 1000;
620
+ if (typeof global.setTimeout === 'function') r.endTimer = global.setTimeout(function () { if (live.solo === r) soloEnd('time'); }, endAt - Date.now());
621
+ liveDeliver(soloFrame('start', { seed: liveRandomSeed(), start_at: startAt, end_at: endAt, players: [{ id: me.id, name: me.name }] }));
622
+ }
623
+
624
+ /** Host → page frame (HWIK._dispatch('live', frame)). */
625
+ function liveFromHost(frame) {
626
+ if (!frame || typeof frame !== 'object' || typeof frame.t !== 'string') return false;
627
+ if (live.mode === 'solo' || live.mode === null) return false; // a solo round ignores the host; no room → nothing to say
628
+ var t = frame.t;
629
+ // Relay status (not service frames): only meaningful before welcome.
630
+ if (t === 'connecting' || t === 'unavailable') {
631
+ if (live.welcomed) return false;
632
+ liveClockSample(frame.now);
633
+ if (t === 'unavailable') { soloStart(); return true; } // ticket / connection failed: play alone at once
634
+ if (!live.connecting) {
635
+ // The live service may be cold-starting: wait for welcome up to 8 s after join() instead of 1.5 s.
636
+ live.connecting = true;
637
+ liveClearTimers();
638
+ if (typeof global.setTimeout === 'function') {
639
+ live.timer = global.setTimeout(function () {
640
+ live.timer = null;
641
+ if ((live.mode === 'pending' || live.mode === 'host') && !live.welcomed) soloStart();
642
+ }, Math.max(0, live.joinAt + LIVE_CONNECTING_MAX_MS - Date.now()));
643
+ }
644
+ }
645
+ liveDeliver({ t: 'connecting', now: liveNow() }); // a bridge-made frame for a 「연결 중…」 UI
646
+ return true;
647
+ }
648
+ if (t === 'welcome') live.welcomed = true;
649
+ if (live.mode === 'pending') live.mode = 'host';
650
+ // Any first frame ends the 1.5 s wait; after 'connecting' only welcome ends the 8 s wait.
651
+ if (live.welcomed || !live.connecting) liveClearTimers();
652
+ liveClockSample(frame.now);
653
+ var preWelcomeError = t === 'error' && !live.welcomed;
654
+ if (t === 'end') liveReset();
655
+ liveDeliver(frame);
656
+ // No room behind this host (ticket refused, room closed before welcome): the page still plays — alone.
657
+ if (preWelcomeError && live.mode === 'host') soloStart();
658
+ return true;
659
+ }
660
+
661
+ var liveApi = {
662
+ /** Ask for a room. Returns false while already in one (or waiting for one). */
663
+ join: function () {
664
+ if (live.mode !== null) return false;
665
+ live.mode = 'pending';
666
+ live.welcomed = false;
667
+ live.connecting = false;
668
+ live.joinAt = Date.now();
669
+ live.clock = [];
670
+ send('live_join', {});
671
+ if (typeof global.setTimeout === 'function') {
672
+ live.timer = global.setTimeout(function () {
673
+ live.timer = null;
674
+ if (live.mode === 'pending') soloStart();
675
+ }, LIVE_SOLO_AFTER_MS);
676
+ }
677
+ return true;
678
+ },
679
+
680
+ /** Relay a small JSON value (position, state) to the other players: ≤ 512 bytes serialized, ≤ ~10/s recommended. */
681
+ send: function (d) {
682
+ if (live.mode === null) { liveWarn('send() before join() — dropped'); return false; }
683
+ var raw;
684
+ try { raw = JSON.stringify(d); } catch (e) { raw = undefined; }
685
+ if (typeof raw !== 'string' || d === null) { liveWarn('send(d): d must be a JSON value (not null / undefined / a function) — dropped'); return false; }
686
+ if (utf8Bytes(raw) > LIVE_MSG_MAX_BYTES) { liveWarn('send(d): ' + utf8Bytes(raw) + ' bytes > ' + LIVE_MSG_MAX_BYTES + ' — dropped'); return false; }
687
+ if (!liveAllow()) { liveWarn('send/add over 15 per second — dropped'); return false; }
688
+ if (live.mode === 'solo') return true; // nobody else in a solo room; the service never echoes your own msg either
689
+ send('live_send', { d: JSON.parse(raw) });
690
+ return true;
691
+ },
692
+
693
+ /** Add n (integer −1000..1000) to the room's shared counter k (/^[A-Za-z0-9_]{1,16}$/) — co-op goals. */
694
+ add: function (k, n) {
695
+ if (live.mode === null) { liveWarn('add() before join() — dropped'); return false; }
696
+ if (typeof k !== 'string' || !LIVE_KEY_RE.test(k)) { liveWarn('add(k, n): k must match /^[A-Za-z0-9_]{1,16}$/ — dropped'); return false; }
697
+ if (!isInt(n, -1000, 1000)) { liveWarn('add(k, n): n must be an integer −1000..1000 — dropped'); return false; }
698
+ if (!liveAllow()) { liveWarn('send/add over 15 per second — dropped'); return false; }
699
+ if (live.mode === 'solo') {
700
+ var r = live.solo;
701
+ if (!r || r.phase !== 'playing') return false; // like the service: counters only count while playing
702
+ r.counters[k] = (r.counters[k] || 0) + n;
703
+ var v = r.counters[k];
704
+ later(function () { if (live.solo === r && r.phase === 'playing') liveDeliver(soloFrame('counter', { k: k, v: v })); });
705
+ return true;
706
+ }
707
+ send('live_add', { k: k, n: n });
708
+ return true;
709
+ },
710
+
711
+ /** "I am done" (once). s: optional integer 0..10,000,000 shown in results. Place = server arrival order, never a reward. */
712
+ finish: function (s) {
713
+ if (live.mode === null) { liveWarn('finish() before join() — dropped'); return false; }
714
+ var score = s === undefined || s === null ? null : s;
715
+ if (score !== null && !isInt(score, 0, LIVE_MAX_SCORE)) { liveWarn('finish(s): s must be an integer 0..10,000,000 — dropped'); return false; }
716
+ if (live.mode === 'solo') {
717
+ var r = live.solo;
718
+ if (!r || r.phase !== 'playing' || r.finished) return false;
719
+ r.finished = true;
720
+ r.s = score;
721
+ later(function () {
722
+ if (live.solo !== r || r.phase !== 'playing') return;
723
+ liveDeliver(soloFrame('finish', { id: r.me.id, s: score, place: 1 }));
724
+ soloEnd('all_finished');
725
+ });
726
+ return true;
727
+ }
728
+ send('live_finish', { s: score });
729
+ return true;
730
+ },
731
+
732
+ /** Leave the room (also ends a solo round silently, like a closed connection). */
733
+ leave: function () {
734
+ var was = live.mode;
735
+ if (was === null) return false;
736
+ liveReset();
737
+ if (was !== 'solo') send('live_leave', {});
738
+ return true;
739
+ },
740
+
741
+ /** Server clock estimate in epoch ms (local clock in a solo round / before the first frame). */
742
+ now: function () {
743
+ return liveNow();
744
+ }
745
+ };
746
+
449
747
  var HWIK = {
450
748
  __isHwikBridge: true,
451
749
  version: VERSION,
@@ -556,6 +854,12 @@
556
854
  }
557
855
  },
558
856
 
857
+ /**
858
+ * Live rooms (v1.10, ADR-0029 §11; declare the "hwik-live" meta). join → frames on SHORTIK.on('live', ev => …);
859
+ * with no host answer within 1.5 s the bridge plays a one-player room locally (frames carry solo: true).
860
+ */
861
+ live: liveApi,
862
+
559
863
  /** Campaign CTA. The host resolves the id to a tracking link; never navigate yourself. */
560
864
  cta: function (opts) {
561
865
  var id = sanitizeId(opts && opts.id);
@@ -601,7 +905,7 @@
601
905
  return out;
602
906
  },
603
907
 
604
- /** Subscribe to host events: 'pause' | 'resume' | 'mute' | 'capabilities' | 'capability' | <stream>. Returns an unsubscribe fn. */
908
+ /** Subscribe to host events: 'pause' | 'resume' | 'mute' | 'capabilities' | 'capability' | 'live' | <stream>. Returns an unsubscribe fn. */
605
909
  on: function (event, fn) {
606
910
  if (EVENTS.indexOf(event) < 0 || typeof fn !== 'function') return function () {};
607
911
  listeners[event].push(fn);
@@ -620,6 +924,8 @@
620
924
  /** Host → playable entry point. data for 'mute' is { muted: boolean }. */
621
925
  _dispatch: function (event, data) {
622
926
  if (EVENTS.indexOf(event) < 0) return false;
927
+ // v1.10 live frames: delivered by the live module (ignored during a solo round or when no room was joined).
928
+ if (event === 'live') return liveFromHost(data);
623
929
  if (event === 'capabilities' && data && typeof data === 'object') {
624
930
  capabilityMap = {};
625
931
  for (var k in data) if (Object.prototype.hasOwnProperty.call(data, k)) capabilityMap[k] = !!data[k];
@@ -3,7 +3,7 @@
3
3
  fades back to a screen. */
4
4
  .bg-wrap { position:absolute; inset:0; display:flex; flex-direction:column; gap:14px; padding:4px 20px 6px; }
5
5
  .bg-step { align-self:flex-start; font-family:var(--font-display); font-weight:800; font-size:14px; color:var(--ink); letter-spacing:.02em; background:var(--bg); padding:2px 8px; }
6
- .bg-opt { position:relative; flex:1; border:0; border-radius:2px; display:flex; align-items:center; justify-content:center; padding:22px 26px; font-family:var(--font-display); font-weight:800; font-size:28px; line-height:1.3; letter-spacing:-.02em; word-break:keep-all; cursor:pointer; touch-action:manipulation; background-size:7px 7px; transition:transform .22s var(--ease), opacity .22s var(--ease), box-shadow .22s var(--ease); }
6
+ .bg-opt { position:relative; flex:1; border:0; border-radius:2px; display:flex; align-items:center; justify-content:center; padding:22px 26px; font-family:var(--font-display); font-weight:800; font-size:28px; line-height:1.3; letter-spacing:-.02em; word-break:keep-all; overflow-wrap:anywhere; cursor:pointer; touch-action:manipulation; background-size:7px 7px; transition:transform .22s var(--ease), opacity .22s var(--ease), box-shadow .22s var(--ease); }
7
7
  .bg-a { background-color:var(--accent); color:var(--on-accent); background-image:radial-gradient(color-mix(in srgb, var(--ink) 22%, transparent) 1.3px, transparent 1.7px); box-shadow:5px 5px 0 var(--accent-2); }
8
8
  .bg-b { background-color:var(--accent-2); color:var(--ink); background-image:radial-gradient(color-mix(in srgb, var(--accent-3) 40%, transparent) 1.3px, transparent 1.7px); box-shadow:5px 5px 0 var(--accent); }
9
9
  .bg-vs { align-self:center; margin:-34px 0; z-index:2; width:58px; height:58px; border-radius:50%; background:var(--accent-3); color:var(--ink); box-shadow:3px -2px 0 color-mix(in srgb, var(--accent-2) 70%, transparent); display:flex; align-items:center; justify-content:center; font-family:var(--font-display); font-weight:800; font-size:18px; letter-spacing:-.02em; }
@@ -3,13 +3,17 @@
3
3
  // Art: a riso balance scale (art.json kits: zine); in play, the two choices are two inks meeting at a yellow VS.
4
4
  (function () {
5
5
  'use strict';
6
- var TOTAL = 8, QS = [
6
+ var OFFICIAL = [
7
7
  ['평생 여름만', '평생 겨울만'], ['짜장면', '짬뽕'], ['아침형 인간', '저녁형 인간'], ['산으로 여행', '바다로 여행'],
8
8
  ['탕수육 찍먹', '탕수육 부먹'], ['민트초코 좋아', '민트초코 글쎄'], ['물냉면', '비빔냉면'], ['10분 일찍 도착', '딱 맞춰 도착'],
9
9
  ['계획대로 여행', '발길 닿는 대로 여행'], ['강아지', '고양이'], ['영화관에서 보기', '집에서 보기'], ['순간이동 능력', '시간 멈추기 능력'],
10
10
  ['후라이드', '양념'], ['전화로 말하기', '문자로 말하기'], ['비 오는 날', '눈 오는 날'], ['종이책', '전자책'],
11
11
  ['혼자 여행', '같이 여행'], ['과거 구경하기', '미래 구경하기'], ['커피', '차'], ['여름 방학 한 달', '겨울 방학 한 달']
12
12
  ];
13
+ // Fill-in content (ADR-0026): the maker's pairs replace the official ones; a pair needs two texts.
14
+ var QS = HwikShell.content({ pairs: OFFICIAL }).pairs.filter(function (p) { return p.length >= 2; });
15
+ if (!QS.length) QS = OFFICIAL;
16
+ var TOTAL = Math.min(8, QS.length);
13
17
  var Z, step, a, b, order, n, picks, locked, A;
14
18
 
15
19
  function show() {
@@ -6,6 +6,8 @@
6
6
  'use strict';
7
7
  var N = 7;
8
8
  var WISHES = ['올해도 건강하고 행복하길!', '하고 싶은 일 모두 이루길!', '웃을 일만 가득하길!', '맛있는 거 많이 먹는 한 해!', '좋은 사람들과 함께하는 한 해!'];
9
+ // Fill-in content (ADR-0026): a maker's own wishes (1..10) replace the official ones.
10
+ WISHES = HwikShell.content({ wishes: WISHES }).wishes;
9
11
  var G = HwikArt.gig, T;
10
12
  var c, ctx, t, lit, level, blowFor, smoke, wish, lastSound, confetti, snd;
11
13
 
@@ -4,6 +4,10 @@
4
4
  (function () {
5
5
  'use strict';
6
6
  var CHARS = ['별', '꿈', '봄', '쉼', '숨', '빛', '길', '꽃'];
7
+ // Fill-in content (ADR-0026): a maker's own characters (3..12, one Hangul or Hanja each). The ghost is plain
8
+ // fillText, so a character missing from the page's subset brush font falls back to the stack's next face (system
9
+ // gothic) and still draws; tracing is free-hand and never compared with the glyph.
10
+ CHARS = HwikShell.content({ chars: CHARS }).chars;
7
11
  var BAR = 64;
8
12
  var S = HwikArt.sumi, F = HwikArt.worldfoley;
9
13
  var T, c, ctx, ink, inkCtx, bg, dpr, box, brush, ch, charIdx, drawing, pid, bounds, stamped, stampAnim, art, artBox, stats, t, lastChar;
@@ -4,6 +4,7 @@
4
4
  .cs-tab { flex:1; min-height:44px; border:2px solid var(--ink); border-radius:0; background:var(--surface); color:var(--ink); font-family:var(--font-body); font-size:14px; line-height:1; touch-action:manipulation; cursor:pointer; }
5
5
  .cs-tab.on { background:var(--ink); color:var(--bg); }
6
6
  .cs-opts { display:grid; grid-template-columns:repeat(3, 1fr); gap:6px; }
7
+ .cs-opts.cs-many { max-height:124px; overflow-y:auto; overscroll-behavior:contain; }
7
8
  .cs-opt { min-height:48px; display:flex; align-items:center; justify-content:center; gap:6px; padding:4px 6px; border:2px solid var(--ink); border-radius:0; background:var(--surface); color:var(--ink); font-family:var(--font-body); font-size:13.5px; line-height:1.2; word-break:keep-all; text-align:center; touch-action:manipulation; cursor:pointer; }
8
9
  .cs-opt.on { background:var(--accent); color:var(--on-accent); }
9
10
  .cs-opt canvas { flex:none; }
@@ -3,7 +3,10 @@
3
3
  // counts only) or drag side to side, and a halftone crowd answers: arms up, jumps, a printed 와아. A creative toy.
4
4
  (function () {
5
5
  'use strict';
6
- var PHRASES = [['오늘도', '수고했어'], ['직진만', '해!'], ['너 진짜', '최고야'], ['할 수', '있다!'], ['퇴근까지', '화이팅'], ['밥은', '먹었니']];
6
+ var OFFICIAL = [['오늘도', '수고했어'], ['직진만', '해!'], ['너 진짜', '최고야'], ['할 수', '있다!'], ['퇴근까지', '화이팅'], ['밥은', '먹었니']];
7
+ // Fill-in content (ADR-0026): the maker's two-line phrases replace the official ones; a phrase needs two lines.
8
+ var PHRASES = HwikShell.content({ phrases: OFFICIAL }).phrases.filter(function (p) { return p.length >= 2; });
9
+ if (!PHRASES.length) PHRASES = OFFICIAL;
7
10
  var ICONS = [['heart', '하트'], ['star', '별'], ['bolt', '번개'], ['crown', '왕관'], ['flame', '불꽃'], ['note', '음표']];
8
11
  var INKS = [['주황 · 먹', '#C24409', '#1A1613'], ['파랑 · 크림', '#2D59C8', '#F7EEDD'], ['분홍 · 남색', '#E2729A', '#1F2A5A'], ['노랑 · 먹', '#F2C230', '#1A1613'], ['민트 · 빨강', '#62C2A8', '#A8240A']];
9
12
  var PAPER = '#F7EEDD', F = HwikArt.worldfoley, hall = null, ending = false;
@@ -147,6 +150,8 @@
147
150
  tabs.forEach(function (b, i) { b.classList.toggle('on', i === tab); b.setAttribute('aria-pressed', i === tab ? 'true' : 'false'); });
148
151
  opts.textContent = '';
149
152
  var list = tab === 0 ? PHRASES : tab === 1 ? ICONS : INKS;
153
+ // A maker's longer phrase list (ADR-0026) scrolls inside two rows instead of pushing the panel over the sign.
154
+ opts.classList.toggle('cs-many', list.length > 6);
150
155
  list.forEach(function (item, i) {
151
156
  var b = api.el('button', 'cs-opt' + ((tab === 0 ? sel.phrase : tab === 1 ? sel.icon : sel.ink) === i ? ' on' : ''), opts); b.type = 'button';
152
157
  if (tab === 0) api.el('span', '', b, item.join(' '));
@@ -4,16 +4,35 @@
4
4
  (function () {
5
5
  'use strict';
6
6
  var CHO = 'ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ', TOTAL = 8, LIMIT = 8;
7
- var POOL = [
7
+ var OFFICIAL = [
8
8
  ['과일', '사과 바나나 포도 수박 딸기 복숭아 참외 자두 파인애플'],
9
9
  ['동물', '고양이 강아지 토끼 기린 코끼리 다람쥐 펭귄 거북이 호랑이'],
10
10
  ['음식', '김치찌개 떡볶이 비빔밥 라면 김밥 불고기 잡채 만두 칼국수'],
11
11
  ['물건', '우산 냉장고 자전거 연필 가방 시계 안경 베개 선풍기'],
12
12
  ['장소', '도서관 놀이터 편의점 지하철 바닷가 운동장 영화관 공원']
13
13
  ];
14
+ // Fill-in content (ADR-0026): a maker gives one category and its words. Every question needs three distractors
15
+ // whose initials differ from the answer's, so words that cannot get them are left out (repeatedly, since leaving
16
+ // one out can starve another); when fewer than a round's worth remain, the official pool plays instead.
17
+ var POOL = OFFICIAL, MAKER = false;
18
+ (function () {
19
+ var DEF = OFFICIAL[0][1].split(' ');
20
+ var fill = HwikShell.content({ words: DEF }).words;
21
+ if (fill === DEF) return;
22
+ var seen = {}, list = [];
23
+ fill.forEach(function (w) { w = w.replace(/\s+/g, ''); if (w && !seen[w]) { seen[w] = true; list.push(w); } });
24
+ for (var changed = true; changed;) {
25
+ var keep = list.filter(function (w) { var k = cho(w), m = 0; list.forEach(function (x) { if (cho(x) !== k) m++; }); return m >= 3; });
26
+ changed = keep.length !== list.length; list = keep;
27
+ }
28
+ if (list.length < TOTAL) return;
29
+ POOL = [[HwikShell.content({ category: '' }).category.trim() || '낱말', list.join(' ')]]; MAKER = true;
30
+ })();
14
31
  var Z, words = [], bar, cat, q, note, btns = [], order, n, right, answer, tLeft, locked;
15
32
  POOL.forEach(function (p) { p[1].split(' ').forEach(function (w) { words.push({ w: w, c: p[0] }); }); });
16
- var QZ_SET = []; for (var qi = 0; qi < TOTAL; qi++) QZ_SET.push(Math.floor((qi + 0.5) * words.length / TOTAL));
33
+ // The first round of a visit is fixed (quiz statistics): spread over every official category, or a maker's first
34
+ // TOTAL words in their order.
35
+ var QZ_SET = []; for (var qi = 0; qi < TOTAL; qi++) QZ_SET.push(MAKER ? qi : Math.floor((qi + 0.5) * words.length / TOTAL));
17
36
  var qzFirst = true, qzRound = false, qzMarks = [], qzAt = -1, A, lastSec = 0;
18
37
 
19
38
  function cho(w) {
@@ -3,7 +3,7 @@
3
3
  // Art: a riso tear-off desk calendar (art.json kits: zine). Each fact is today's sheet; the answer is stamped on it.
4
4
  (function () {
5
5
  'use strict';
6
- var POOL = [
6
+ var OFFICIAL = [
7
7
  ['달은 스스로 빛을 낸다', false, '햇빛을 반사해서 빛나 보여요.'], ['지구에서 가장 넓은 바다는 태평양이다', true, '지구 표면의 약 3분의 1을 차지해요.'],
8
8
  ['상어는 포유류다', false, '상어는 연골어류, 고래와 돌고래가 포유류예요.'], ['소리는 진공에서 전달되지 않는다', true, '소리는 공기 같은 매질이 있어야 전달돼요.'],
9
9
  ['한국의 국화는 무궁화다', true, '법률로 정하지는 않았지만 관례상 국화예요.'], ['물은 4℃에서 밀도가 가장 높다', true, '그래서 겨울 호수 바닥 물이 덜 얼어요.'],
@@ -16,6 +16,11 @@
16
16
  ['바나나는 익을수록 녹말이 당으로 바뀐다', true, '그래서 익을수록 단맛이 강해져요.'], ['우리 몸의 피는 원래 파란색이다', false, '산소가 적어도 피는 어두운 붉은색이에요.'],
17
17
  ];
18
18
  var N = 5;
19
+ // Fill-in content (ADR-0026): a maker's {s, o, why} facts replace the pool; the date still picks today's five, so a
20
+ // pool shorter than one day's set (the server asks for 5 or more) keeps the official one.
21
+ var POOL = HwikShell.content({ items: OFFICIAL.map(function (q) { return { s: q[0], o: q[1], why: q[2] }; }) }).items
22
+ .map(function (q) { return [q.s, q.o, q.why]; });
23
+ if (POOL.length < N) POOL = OFFICIAL;
19
24
  var Z, T, c, ctx, today, idx, right, reveal, btnO, btnX, t, revealAt, tearAt, marks = [], snd, ended;
20
25
 
21
26
  /**
@@ -60,7 +65,20 @@
60
65
  var l = out[out.length - 1], n = l ? l + ' ' + wd : wd;
61
66
  if (g.measureText(n).width > maxW && l) out.push(wd); else out[out.length - 1] = n;
62
67
  });
63
- return out;
68
+ return fit(g, out, maxW);
69
+ }
70
+ /** A maker's line with no spaces (ADR-0026) is cut letter by letter instead of running off the sheet. */
71
+ function fit(g, rows, maxW) {
72
+ var res = [];
73
+ rows.forEach(function (ln) {
74
+ while (ln.length > 1 && g.measureText(ln).width > maxW) {
75
+ var k = ln.length - 1;
76
+ while (k > 1 && g.measureText(ln.slice(0, k)).width > maxW) k--;
77
+ res.push(ln.slice(0, k)); ln = ln.slice(k);
78
+ }
79
+ res.push(ln);
80
+ });
81
+ return res;
64
82
  }
65
83
 
66
84
  /** A tear-off sheet: paper stock, the binding strip with two rings, a pink print offset. */
@@ -6,6 +6,8 @@
6
6
  var P = HwikArt.papercraft;
7
7
  var COLORS, SIZES = [4, 9, 18], PAPER;
8
8
  var TOPICS = ['고양이', '우리 집', '좋아하는 음식', '오늘의 날씨', '우주선', '나무 한 그루', '웃는 얼굴', '바닷속', '꿈에 나온 것', '자유롭게'];
9
+ // Fill-in content (ADR-0026): a maker's own topics (3..15) replace the official ones.
10
+ TOPICS = HwikShell.content({ topics: TOPICS }).topics;
9
11
  var c, ctx, strokes, cur, color, size, erasing, topicEl, colorEls = [], sizeEls = [], eraseEl, shot = null, A, scratch, lastMove = 0;
10
12
  /** Crayon on paper: a soft band of noise that follows the finger's speed (stopped when the finger lifts). */
11
13
  function scratchOn(api) { if (!scratch) scratch = A.bed({ type: 'white', filter: 'bandpass', freq: 2600, q: 0.9, gain: 0 }); }
@@ -0,0 +1 @@
1
+ {"world": "paper", "kits": ["papercraft", "foleybox"]}